summaryrefslogtreecommitdiff
path: root/geyes
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-24 18:20:32 +0100
committerStefano Karapetsas <[email protected]>2012-11-24 18:20:32 +0100
commit75d606567d8e4923e83a58ec8fce410bee89d473 (patch)
treedd6e3299b0e357bf9024ade99c5f8f83d6592af8 /geyes
parent23536328cce34467f2a106662e2bb2c0d8507467 (diff)
downloadmate-applets-75d606567d8e4923e83a58ec8fce410bee89d473.tar.bz2
mate-applets-75d606567d8e4923e83a58ec8fce410bee89d473.tar.xz
geyes: migrate to gsettings
Diffstat (limited to 'geyes')
-rw-r--r--geyes/Makefile.am22
-rw-r--r--geyes/geyes.c15
-rw-r--r--geyes/geyes.h4
-rw-r--r--geyes/geyes.schemas.in17
-rw-r--r--geyes/org.mate.panel.applet.geyes.gschema.xml.in.in9
-rw-r--r--geyes/themes.c28
6 files changed, 36 insertions, 59 deletions
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 <math.h>
#include <stdlib.h>
#include <mate-panel-applet.h>
-#include <mate-panel-applet-mateconf.h>
+#include <mate-panel-applet-gsettings.h>
#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 <glib/gi18n.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <mate-panel-applet.h>
#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 @@
-<mateconfschemafile>
- <schemalist>
-
- <schema>
- <key>/schemas/apps/geyes/prefs/theme_path</key>
- <owner>geyes_applet2</owner>
- <type>string</type>
- <locale name="C">
- <short>Directory in which the theme is located</short>
- <long></long>
- </locale>
- </schema>
-
-
- </schemalist>
-
-</mateconfschemafile> \ 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 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.mate.panel.applet.geyes">
+ <key name="theme-path" type="s">
+ <default>''</default>
+ <_summary>Directory in which the theme is located</_summary>
+ <_description>Directory in which the theme is located</_description>
+ </key>
+ </schema>
+</schemalist>
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 <limits.h>
#include <ctype.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
-#include <mate-panel-applet-mateconf.h>
+#include <gio/gio.h>
#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);
}