Exemple #1
0
void
gs_plugin_initialize (GsPlugin *plugin)
{
	/* need metadata */
	gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");

	/* set name of MetaInfo file */
	gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Steam");
}
Exemple #2
0
void
gs_plugin_initialize (GsPlugin *plugin)
{
	GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData));
	g_autoptr(GError) error = NULL;
	g_autoptr(GsOsRelease) os_release = NULL;

	priv->settings = g_settings_new ("org.gnome.software");
	priv->review_server = g_settings_get_string (priv->settings,
						     "review-server");
	priv->ratings = g_hash_table_new_full (g_str_hash, g_str_equal,
					       g_free, (GDestroyNotify) g_array_unref);

	/* get the machine+user ID hash value */
	priv->user_hash = gs_utils_get_user_hash (&error);
	if (priv->user_hash == NULL) {
		g_warning ("Failed to get machine+user hash: %s", error->message);
		return;
	}

	/* get the distro name (e.g. 'Fedora') but allow a fallback */
	os_release = gs_os_release_new (&error);
	if (os_release != NULL) {
		priv->distro = g_strdup (gs_os_release_get_name (os_release));
		if (priv->distro == NULL) {
			g_warning ("no distro name specified");
			priv->distro = g_strdup ("Unknown");
		}
	} else {
		g_warning ("failed to get distro name: %s", error->message);
		priv->distro = g_strdup ("Unknown");
	}

	/* add source */
	priv->cached_origin = gs_app_new (gs_plugin_get_name (plugin));
	gs_app_set_kind (priv->cached_origin, AS_APP_KIND_SOURCE);
	gs_app_set_origin_hostname (priv->cached_origin, priv->review_server);
	gs_app_set_origin_ui (priv->cached_origin, "Open Desktop Review Server");

	/* add the source to the plugin cache which allows us to match the
	 * unique ID to a GsApp when creating an event */
	gs_plugin_cache_add (plugin,
			     gs_app_get_unique_id (priv->cached_origin),
			     priv->cached_origin);

	/* need application IDs and version */
	gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
	gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "flatpak-system");
	gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "flatpak-user");

	/* set name of MetaInfo file */
	gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Odrs");
}
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));
	g_autofree gchar *user_agent = NULL;
	g_autoptr(SoupSession) soup_session = NULL;

	priv->client = fwupd_client_new ();

	/* use a custom user agent to provide the fwupd version */
	user_agent = fwupd_build_user_agent (PACKAGE_NAME, PACKAGE_VERSION);
	soup_session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, user_agent,
						      SOUP_SESSION_TIMEOUT, 10,
						      NULL);
	soup_session_remove_feature_by_type (soup_session,
					     SOUP_TYPE_CONTENT_DECODER);
	gs_plugin_set_soup_session (plugin, soup_session);

	/* set name of MetaInfo file */
	gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Fwupd");
}