From 75d606567d8e4923e83a58ec8fce410bee89d473 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Sat, 24 Nov 2012 18:20:32 +0100 Subject: geyes: migrate to gsettings --- geyes/Makefile.am | 22 ++++++++--------- geyes/geyes.c | 15 +++++++----- geyes/geyes.h | 4 ++++ geyes/geyes.schemas.in | 17 ------------- .../org.mate.panel.applet.geyes.gschema.xml.in.in | 9 +++++++ geyes/themes.c | 28 ++++------------------ 6 files changed, 36 insertions(+), 59 deletions(-) delete mode 100644 geyes/geyes.schemas.in create mode 100644 geyes/org.mate.panel.applet.geyes.gschema.xml.in.in diff --git a/geyes/Makefile.am b/geyes/Makefile.am index 509110a3..46f191e5 100644 --- a/geyes/Makefile.am +++ b/geyes/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = themes docs INCLUDES = \ -I. \ -I$(srcdir) \ - $(MATE_APPLETS3_CFLAGS) \ + $(MATE_APPLETS4_CFLAGS) \ -I$(includedir) \ -DGEYES_THEMES_DIR=\""$(pkgdatadir)/geyes/"\" \ -DGEYES_MENU_UI_DIR=\""$(uidir)"\" @@ -16,7 +16,7 @@ geyes_applet2_SOURCES = \ geyes.h geyes_applet2_LDADD = \ - $(MATE_APPLETS3_LIBS) \ + $(MATE_APPLETS4_LIBS) \ -lm appletdir = $(datadir)/mate-panel/applets @@ -40,16 +40,15 @@ org.mate.panel.applet.GeyesAppletFactory.service: $(service_in_files) -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ $< > $@ -CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA) - uidir = $(datadir)/mate-2.0/ui ui_DATA = geyes-applet-menu.xml -schemasdir = @MATECONF_SCHEMA_FILE_DIR@ -schemas_in_files = geyes.schemas.in -schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) +@INTLTOOL_XML_NOMERGE_RULE@ +gsettings_SCHEMAS = org.mate.panel.applet.geyes.gschema.xml +@GSETTINGS_RULES@ -@INTLTOOL_SCHEMAS_RULE@ +%.gschema.xml.in: %.gschema.xml.in.in Makefile + $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@ themesdir = $(pkgdatadir)/geyes @@ -60,11 +59,13 @@ icons = \ mate-eyes-applet.22.png \ mate-eyes-applet.16.png +CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS) *.gschema.valid + EXTRA_DIST = \ README.themes \ org.mate.applets.GeyesApplet.mate-panel-applet.in.in \ $(service_in_files) \ - $(schemas_in_files) \ + $(gsettings_SCHEMAS_in_in) \ $(ui_DATA) \ $(icons) @@ -110,8 +111,5 @@ install-data-local: echo "*** Icon cache not updated. After install, run this:"; \ echo "*** $(gtk_update_icon_cache)"; \ fi -if MATECONF_SCHEMAS_INSTALL - MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(schemas_DATA) ; -endif -include $(top_srcdir)/git.mk diff --git a/geyes/geyes.c b/geyes/geyes.c index 7e204d1a..57147c67 100644 --- a/geyes/geyes.c +++ b/geyes/geyes.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "geyes.h" #define UPDATE_TIMEOUT 100 @@ -203,8 +203,7 @@ properties_load (EyesApplet *eyes_applet) { gchar *theme_path = NULL; - theme_path = mate_panel_applet_mateconf_get_string ( - eyes_applet->applet, "theme_path", NULL); + theme_path = g_settings_get_string (eyes_applet->settings, "theme-path"); if (theme_path == NULL) theme_path = g_strdup (GEYES_THEMES_DIR "Default-tiny"); @@ -290,6 +289,8 @@ create_eyes (MatePanelApplet *applet) eyes_applet->applet = applet; eyes_applet->vbox = gtk_vbox_new (FALSE, 0); + eyes_applet->settings = + mate_panel_applet_settings_new (applet, "org.mate.panel.applet.geyes"); gtk_container_add (GTK_CONTAINER (applet), eyes_applet->vbox); @@ -325,7 +326,11 @@ destroy_cb (GtkObject *object, EyesApplet *eyes_applet) eyes_applet->pupil_filename = NULL; if (eyes_applet->prop_box.pbox) - gtk_widget_destroy (eyes_applet->prop_box.pbox); + gtk_widget_destroy (eyes_applet->prop_box.pbox); + + if (eyes_applet->settings) + g_object_unref (eyes_applet->settings); + eyes_applet->settings = NULL; g_free (eyes_applet); } @@ -395,8 +400,6 @@ geyes_applet_fill (MatePanelApplet *applet) eyes_applet = create_eyes (applet); - mate_panel_applet_add_preferences (applet, "/schemas/apps/geyes/prefs", NULL); - eyes_applet->timeout_id = g_timeout_add ( UPDATE_TIMEOUT, (GtkFunction) timer_cb, eyes_applet); diff --git a/geyes/geyes.h b/geyes/geyes.h index cc820abb..3fb24457 100644 --- a/geyes/geyes.h +++ b/geyes/geyes.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #define MAX_EYES 1000 @@ -61,6 +62,9 @@ typedef struct /* Properties */ EyesPropertyBox prop_box; + + /* Settings */ + GSettings *settings; } EyesApplet; /* eyes.c */ diff --git a/geyes/geyes.schemas.in b/geyes/geyes.schemas.in deleted file mode 100644 index 539bda55..00000000 --- a/geyes/geyes.schemas.in +++ /dev/null @@ -1,17 +0,0 @@ - - - - - /schemas/apps/geyes/prefs/theme_path - geyes_applet2 - string - - Directory in which the theme is located - - - - - - - - \ No newline at end of file diff --git a/geyes/org.mate.panel.applet.geyes.gschema.xml.in.in b/geyes/org.mate.panel.applet.geyes.gschema.xml.in.in new file mode 100644 index 00000000..c551fb6a --- /dev/null +++ b/geyes/org.mate.panel.applet.geyes.gschema.xml.in.in @@ -0,0 +1,9 @@ + + + + '' + <_summary>Directory in which the theme is located + <_description>Directory in which the theme is located + + + diff --git a/geyes/themes.c b/geyes/themes.c index 7d08f1d1..6777cac4 100644 --- a/geyes/themes.c +++ b/geyes/themes.c @@ -23,8 +23,7 @@ #include #include #include -#include -#include +#include #include "geyes.h" #define NUM_THEME_DIRECTORIES 2 @@ -180,25 +179,6 @@ destroy_theme (EyesApplet *eyes_applet) g_free (eyes_applet->theme_name); } -static gboolean -key_writable (MatePanelApplet *applet, const char *key) -{ - gboolean writable; - char *fullkey; - static MateConfClient *client = NULL; - - if (client == NULL) - client = mateconf_client_get_default (); - - fullkey = mate_panel_applet_mateconf_get_full_key (applet, key); - - writable = mateconf_client_key_is_writable (client, fullkey, NULL); - - g_free (fullkey); - - return writable; -} - static void theme_selected_cb (GtkTreeSelection *selection, gpointer data) { @@ -227,8 +207,8 @@ theme_selected_cb (GtkTreeSelection *selection, gpointer data) load_theme (eyes_applet, theme); setup_eyes (eyes_applet); - mate_panel_applet_mateconf_set_string ( - eyes_applet->applet, "theme_path", theme, NULL); + g_settings_set_string ( + eyes_applet->settings, "theme-path", theme); g_free (theme); } @@ -387,7 +367,7 @@ properties_cb (GtkAction *action, G_CALLBACK (theme_selected_cb), eyes_applet); - if ( ! key_writable (eyes_applet->applet, "theme_path")) { + if ( ! g_settings_is_writable (eyes_applet->settings, "theme-path")) { gtk_widget_set_sensitive (tree, FALSE); gtk_widget_set_sensitive (label, FALSE); } -- cgit v1.2.1