gint main (gint argc, gchar *argv[]) { IrisTask *task = NULL; gchar *dir = g_get_current_dir (); if (argc > 1) dir = g_strdup (argv [1]); iris_init (); mutex = g_mutex_new (); cond = g_cond_new (); g_mutex_lock (mutex); task = iris_task_new (worker, dir, NULL); iris_task_add_callback (task, callback, NULL, NULL); iris_task_run (task); g_cond_wait (cond, mutex); g_mutex_unlock (mutex); g_free (dir); return 0; }
static gboolean has_stream (MarinaSource *source) { MarinaGoogleReaderSourcePrivate *priv; IrisTask *task; g_return_val_if_fail (MARINA_IS_GOOGLE_READER_SOURCE (source), FALSE); priv = MARINA_GOOGLE_READER_SOURCE (source)->priv; /* if they are asking if we have a stream, we can at this point * go ahead and lookup our opml from google if necessary */ if (priv->username && !priv->children) { /* go ahead and start fetching the OPML from google */ if (!priv->session) { g_mutex_lock (priv->session_lock); if (!priv->session) priv->session = soup_session_async_new (); g_mutex_unlock (priv->session_lock); } /* use gtask to get our remote items */ /* get the credentials from gnome-keyring if we can */ task = iris_task_new_full (fetch_keyring_pass, g_object_ref (source), g_object_unref, TRUE, NULL, g_main_context_default ()); /* if that fails, ask the user. do this in an errback so we are in main thread */ iris_task_add_errback (task, ask_user_pass, g_object_ref (source), g_object_unref); /* get our google cookie */ iris_task_add_callback (task, get_cookie, g_object_ref (source), g_object_unref); /* fetch the OMPL from the google */ iris_task_add_callback (task, fetch_opml, g_object_ref (source), g_object_unref); /* parse the OPML */ iris_task_add_callback (task, parse_opml, g_object_ref (source), g_object_unref); iris_task_run (task); } return FALSE; }