void gs_plugin_initialize (GsPlugin *plugin) { GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData)); g_autoptr(SnapdClient) client = NULL; g_autoptr (GError) error = NULL; g_mutex_init (&priv->store_snaps_lock); client = get_client (plugin, &error); if (client == NULL) { gs_plugin_set_enabled (plugin, FALSE); return; } priv->store_snaps = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_object_unref); priv->auth = gs_auth_new ("snapd", "ubuntusso", &error); if (priv->auth) { gs_auth_set_provider_name (priv->auth, "Snap Store"); gs_auth_set_header (priv->auth, _("To continue, you need to use an Ubuntu One account."), _("To continue, you need to use your Ubuntu One account."), _("To continue, you need to use an Ubuntu One account.")); gs_plugin_add_auth (plugin, priv->auth); g_signal_connect_object (priv->auth, "changed", G_CALLBACK (load_auth), plugin, G_CONNECT_SWAPPED); } else { g_warning ("Failed to instantiate the snapd authentication object: %s", error->message); } gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "desktop-categories"); gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit"); gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_BEFORE, "icons"); /* Override hardcoded popular apps */ gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_BEFORE, "hardcoded-popular"); /* set name of MetaInfo file */ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Snap"); }
void gs_plugin_initialize (GsPlugin *plugin) { GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData)); if (!gs_snapd_exists ()) { g_debug ("disabling '%s' as snapd not running", gs_plugin_get_name (plugin)); gs_plugin_set_enabled (plugin, FALSE); } priv->auth = gs_auth_new ("snapd"); gs_auth_set_provider_name (priv->auth, "Snap Store"); gs_auth_set_provider_schema (priv->auth, "com.ubuntu.UbuntuOne.GnomeSoftware"); gs_plugin_add_auth (plugin, priv->auth); gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "desktop-categories"); gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "ubuntu-reviews"); gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit"); }