static void item_loader_finalize (GObject *object) { ItemLoader *il = ITEM_LOADER (object); if (il->priv->idleId) g_source_remove (il->priv->idleId); G_OBJECT_CLASS (parent_class)->finalize (object); }
ItemLoader * item_loader_new (fetchCallbackPtr fetchCallback, nodePtr node, gpointer fetchCallbackData) { ItemLoader *il; il = ITEM_LOADER (g_object_new (ITEM_LOADER_TYPE, NULL)); il->priv->node = node; il->priv->fetchCallback = fetchCallback; il->priv->fetchCallbackData = fetchCallbackData; return il; }
static gboolean item_loader_fetch (gpointer user_data) { ItemLoader *il = ITEM_LOADER (user_data); GSList *resultItems = NULL; gboolean result; result = (*il->priv->fetchCallback)(il->priv->fetchCallbackData, &resultItems); if (result) g_signal_emit_by_name (il, "item-batch-fetched", resultItems); else g_signal_emit_by_name (il, "finished"); return result; }