[gnome-software] Add a simple GSettings file with the compatible desktops listed
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a simple GSettings file with the compatible desktops listed
- Date: Mon, 4 Nov 2013 10:20:38 +0000 (UTC)
commit c6847fc8a8b624d80e72e41dbed4d0665213a6dd
Author: Richard Hughes <richard hughsie com>
Date: Mon Nov 4 10:19:18 2013 +0000
Add a simple GSettings file with the compatible desktops listed
Setting this is easier than setting an environment variable, and also allows
us to have a different upstream / distributor default.
contrib/gnome-software.spec.in | 1 +
data/Makefile.am | 4 ++++
data/org.gnome.software.gschema.xml | 9 +++++++++
src/gs-plugin-loader.c | 18 +++++++++++++++---
4 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 760f2a3..ab49a7e 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -100,6 +100,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_libexecdir}/gnome-software-service
%{_datadir}/dbus-1/services/org.gnome.Software.service
%{_datadir}/gnome-shell/search-providers/gnome-software-search-provider.ini
+%{_datadir}/glib-2.0/schemas/org.gnome.software.gschema.xml
%changelog
* #LONGDATE# Richard Hughes <richard hughsie com> #VERSION#-0.#BUILD##ALPHATAG#
diff --git a/data/Makefile.am b/data/Makefile.am
index b9de349..8bd10b7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -16,6 +16,9 @@ dist_resources_DATA = \
gs-star-dim.png \
gs-star.png
+ GSETTINGS_RULES@
+gsettings_SCHEMAS = org.gnome.software.gschema.xml
+
install-sample-data:
wget -O fedora-20.xml.gz http://people.freedesktop.org/~hughsient/temp/fedora-20.xml.gz; \
mkdir -p $(DESTDIR)$(datadir)/app-info/xmls; \
@@ -29,6 +32,7 @@ install-sample-data:
cd -
EXTRA_DIST = \
+ $(gsettings_SCHEMAS) \
featured.ini.in
MAINTAINERCLEANFILES = \
diff --git a/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
new file mode 100644
index 0000000..c4f7c20
--- /dev/null
+++ b/data/org.gnome.software.gschema.xml
@@ -0,0 +1,9 @@
+<schemalist>
+ <schema id="org.gnome.software" path="/org/gnome/software/" gettext-domain="gnome-software">
+ <key name="compatible-projects" type="as">
+ <default>['GNOME', 'KDE']</default>
+ <summary>A list of compatible projects</summary>
+ <description>This is a list of compatible projects we should show such as GNOME, KDE and
XFCE.</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 6e0c0b6..3b980d4 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -44,6 +44,8 @@ struct GsPluginLoaderPrivate
GMutex app_cache_mutex;
GHashTable *app_cache;
GHashTable *icon_cache;
+ GSettings *settings;
+
gchar **compatible_projects;
GList *queued_installs;
@@ -2636,12 +2638,15 @@ static void
gs_plugin_loader_init (GsPluginLoader *plugin_loader)
{
const gchar *tmp;
+ gchar **projects;
+ guint i;
plugin_loader->priv = GS_PLUGIN_LOADER_GET_PRIVATE (plugin_loader);
plugin_loader->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify)
gs_plugin_loader_plugin_free);
plugin_loader->priv->status_last = GS_PLUGIN_STATUS_LAST;
plugin_loader->priv->pending_apps = g_ptr_array_new_with_free_func ((GFreeFunc) g_object_unref);
plugin_loader->priv->profile = gs_profile_new ();
+ plugin_loader->priv->settings = g_settings_new ("org.gnome.software");
plugin_loader->priv->app_cache = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -2659,9 +2664,15 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
/* by default we only show project-less apps or compatible projects */
tmp = g_getenv ("GNOME_SOFTWARE_COMPATIBLE_PROJECTS");
- if (tmp == NULL)
- tmp = "GNOME";
- plugin_loader->priv->compatible_projects = g_strsplit (tmp, ",", -1);
+ if (tmp == NULL) {
+ projects = g_settings_get_strv (plugin_loader->priv->settings,
+ "compatible-projects");
+ } else {
+ projects = g_strsplit (tmp, ",", -1);
+ }
+ for (i = 0; projects[i] != NULL; i++)
+ g_debug ("compatible-project: %s", projects[i]);
+ plugin_loader->priv->compatible_projects = projects;
}
/**
@@ -2686,6 +2697,7 @@ gs_plugin_loader_finalize (GObject *object)
/* run the plugins */
gs_plugin_loader_run (plugin_loader, "gs_plugin_destroy");
+ g_object_unref (plugin_loader->priv->settings);
g_object_unref (plugin_loader->priv->profile);
g_strfreev (plugin_loader->priv->compatible_projects);
g_hash_table_unref (plugin_loader->priv->app_cache);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]