[gnome-main-menu] application-browser: migrate to gsettings



commit fc14680c7c17f8fe8c22baed1bc2d10f1e0e2f46
Author: Stefano Karapetsas <stefano karapetsas com>
Date:   Wed Dec 12 15:51:03 2012 +0100

    application-browser: migrate to gsettings

 application-browser/etc/Makefile.am                |   20 ++----
 .../etc/application-browser.schemas.in             |   70 --------------------
 ...main-menu.application-browser.gschema.xml.in.in |   35 ++++++++++
 application-browser/src/application-browser.c      |   18 +++--
 4 files changed, 53 insertions(+), 90 deletions(-)
---
diff --git a/application-browser/etc/Makefile.am b/application-browser/etc/Makefile.am
index 428c3ef..92436fd 100644
--- a/application-browser/etc/Makefile.am
+++ b/application-browser/etc/Makefile.am
@@ -2,20 +2,16 @@ desktopdir       = $(datadir)/applications
 desktop_DATA     = application-browser.desktop
 @INTLTOOL_DESKTOP_RULE@
 
-schemasdir   = @GCONF_SCHEMA_FILE_DIR@
-schemas_DATA = application-browser.schemas
- INTLTOOL_SCHEMAS_RULE@
+ INTLTOOL_XML_NOMERGE_RULE@
+gsettings_SCHEMAS = org.mate.gnome-main-menu.application-browser.gschema.xml
+ GSETTINGS_RULES@
+
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
+	$(AM_V_GEN) $(SED) -e 's^\ GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
 
 $(desktop_DATA).in: $(desktop_DATA).in.in
 	sed -e "s|\ BINDIR\@|$(bindir)|" $< > $@
 
-install-data-local:
-	if test -z "$(DESTDIR)" ; then \
-		for p in $(schemas_DATA) ; do \
-			GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
-		done \
-	fi
-
-EXTRA_DIST = $(desktop_DATA).in.in $(schemas_DATA).in
+EXTRA_DIST = $(desktop_DATA).in.in $(gsettings_SCHEMAS).in.in
 
-CLEANFILES = $(desktop_DATA) $(schemas_DATA) $(desktop_DATA).in
+CLEANFILES = $(desktop_DATA) $(gsettings_SCHEMAS) $(desktop_DATA).in $(gsettings_SCHEMAS).in
diff --git a/application-browser/etc/org.mate.gnome-main-menu.application-browser.gschema.xml.in.in b/application-browser/etc/org.mate.gnome-main-menu.application-browser.gschema.xml.in.in
new file mode 100644
index 0000000..903f69a
--- /dev/null
+++ b/application-browser/etc/org.mate.gnome-main-menu.application-browser.gschema.xml.in.in
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+  <schema id="org.mate.gnome-main-menu.application-browser" path="/org/mate/gnome-main-menu/application-browser/">
+    <key name="new-apps-file-key" type="s">
+      <default>'.config/ab-newapps.txt'</default>
+      <_summary>Filename of existing .desktop files</_summary>
+      <_description>Filename of existing .desktop files</_description>
+    </key>
+    <key name="new-apps-max-items" type="i">
+      <default>9</default>
+      <_summary>Max number of New Applications</_summary>
+      <_description>The maximum number of applications that will be displayed in the New Applications category</_description>
+    </key>
+    <key name="exit-shell-on-action-start" type="b">
+      <default>true</default>
+      <_summary>Exit shell on start action performed</_summary>
+      <_description>Indicates whether to close the shell when a start action is performed</_description>
+    </key>
+    <key name="exit-shell-on-action-help" type="b">
+      <default>false</default>
+      <_summary>Exit shell on help action performed</_summary>
+      <_description>Indicates whether to close the shell when a help action is performed</_description>
+    </key>
+    <key name="exit-shell-on-action-add-remove" type="b">
+      <default>false</default>
+      <_summary>Exit shell on add or remove action performed</_summary>
+      <_description>Indicates whether to close the shell when an add or remove action is performed</_description>
+    </key>
+    <key name="exit-shell-on-action-upgrade-uninstall" type="b">
+      <default>true</default>
+      <_summary>Exit shell on upgrade or uninstall action performed</_summary>
+      <_description>Indicates whether to close the shell when an upgrade or uninstall action is performed</_description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/application-browser/src/application-browser.c b/application-browser/src/application-browser.c
index f986b7a..e5c6566 100644
--- a/application-browser/src/application-browser.c
+++ b/application-browser/src/application-browser.c
@@ -23,14 +23,14 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
 #include <unique/unique.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 #include <libslab/slab.h>
 
-#define APPLICATION_BROWSER_PREFIX  "/desktop/gnome/applications/main-menu/ab_"
-#define NEW_APPS_MAX_ITEMS  (APPLICATION_BROWSER_PREFIX "new_apps_max_items")
+#define APPLICATION_BROWSER_SCHEMA  "org.mate.gnome-main-menu.application-browser"
+#define NEW_APPS_MAX_ITEMS          "new-apps-max-items"
 
 static UniqueResponse
 unique_app_message_cb (UniqueApp *app, gint command, UniqueMessageData *data,
@@ -88,11 +88,13 @@ main (int argc, char *argv[])
 		return 0;
 	}
 
-	NewAppConfig *config = g_new0 (NewAppConfig, 1);
-	config->max_items = get_slab_gconf_int (NEW_APPS_MAX_ITEMS);
-	config->name = _("New Applications");
-	AppShellData *app_data = appshelldata_new ("applications.menu", config,
-		APPLICATION_BROWSER_PREFIX, GTK_ICON_SIZE_DND, TRUE, FALSE);
+	//NewAppConfig *config = g_new0 (NewAppConfig, 1);
+	GSettings *settings = g_settings_new (APPLICATION_BROWSER_SCHEMA);
+	gint max_items = g_settings_get_int (settings, NEW_APPS_MAX_ITEMS);
+	g_object_unref (settings);
+	//config->name = _("New Applications");
+	AppShellData *app_data = appshelldata_new ("applications.menu",
+		GTK_ICON_SIZE_DND, TRUE, FALSE, max_items);
 	generate_categories (app_data);
 
 	layout_shell (app_data, _("Filter"), _("Groups"), _("Application Actions"), NULL, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]