← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 148: Merged gsettings port

 

Merge authors:
  Ken VanDine (ken-vandine)
  Michael Terry (mterry)
Related merge proposals:
  https://code.launchpad.net/~ken-vandine/indicator-me/gsettings/+merge/58065
  proposed by: Ken VanDine (ken-vandine)
  review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 148 [merge]
fixes bug(s): https://launchpad.net/bugs/656322
committer: Ken VanDine <ken.vandine@xxxxxxxxxxxxx>
branch nick: indicator-me-trunk
timestamp: Wed 2011-06-22 13:30:55 -0400
message:
  Merged gsettings port
added:
  data/com.canonical.indicator.me.gschema.xml.in
  data/indicator-me.convert
modified:
  configure.ac
  data/Makefile.am
  po/POTFILES.in
  src/me-service.c


--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk

Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file 'configure.ac'
--- configure.ac	2011-04-18 03:50:21 +0000
+++ configure.ac	2011-04-18 03:55:42 +0000
@@ -10,6 +10,8 @@
 
 AM_MAINTAINER_MODE
 
+GLIB_GSETTINGS
+
 IT_PROG_INTLTOOL([0.35.0])
 
 AC_ISC_POSIX
@@ -33,7 +35,7 @@
 DBUSMENUGLIB_REQUIRED_VERSION=0.3.95
 DBUSMENUGTK_REQUIRED_VERSION=0.3.95
 TELEPATHYGLIB_REQUIRED_VERSION=0.9.0
-GCONF_REQUIRED_VERSION=2.0.0
+GLIB_REQUIRED_VERSION=2.26
 INDICATOR_DISPLAY_OBJECTS=0.1
 GIO_UNIX_REQUIRED_VERSION=2.22
 
@@ -44,7 +46,7 @@
                                  dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
                                  dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
 PKG_CHECK_MODULES(MESERVICE,     dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
-				 gconf-2.0 >= $GCONF_REQUIRED_VERSION
+                                 glib-2.0 >= $GLIB_REQUIRED_VERSION
                                  indicator >= $INDICATOR_REQUIRED_VERSION
                                  gwibber-0.1 >= $GWIBBER_REQUIRED_VERSION
                                  gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION

=== modified file 'data/Makefile.am'
--- data/Makefile.am	2009-11-20 23:26:22 +0000
+++ data/Makefile.am	2011-04-18 04:00:53 +0000
@@ -7,10 +7,19 @@
 %.service: %.service.in
 	sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
 
+@INTLTOOL_XML_NOMERGE_RULE@
+
+@GSETTINGS_RULES@
+gsettings_SCHEMAS = com.canonical.indicator.me.gschema.xml
+
+convertdir = $(datadir)/GConf/gsettings
+dist_convert_DATA = indicator-me.convert
 
 EXTRA_DIST =					\
-	$(service_in_files)
+	$(service_in_files)			\
+	$(gsettings_SCHEMAS:.xml=.xml.in)
 
 CLEANFILES =					\
-	$(dbus_services_DATA)
+	$(dbus_services_DATA)			\
+	$(gsettings_SCHEMAS)
 

=== added file 'data/com.canonical.indicator.me.gschema.xml.in'
--- data/com.canonical.indicator.me.gschema.xml.in	1970-01-01 00:00:00 +0000
+++ data/com.canonical.indicator.me.gschema.xml.in	2011-04-18 04:08:30 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist gettext-domain="indicator-me">
+  <schema id="com.canonical.indicator.me" path="/com/canonical/indicator/me/">
+    <key name="display" type="i">
+      <default>1</default>
+      <_summary>How to display your name</_summary>
+      <_description>Set this key to 0 to not show any name, set it to 1 to display your user name, or set it to 2 to display your full name.</_description>
+    </key>
+  </schema>
+</schemalist>

=== added file 'data/indicator-me.convert'
--- data/indicator-me.convert	1970-01-01 00:00:00 +0000
+++ data/indicator-me.convert	2011-04-18 04:00:53 +0000
@@ -0,0 +1,2 @@
+[com.canonical.indicator.me]
+display = /system/indicator/me/display

=== modified file 'po/POTFILES.in'
--- po/POTFILES.in	2010-09-21 16:54:53 +0000
+++ po/POTFILES.in	2011-04-18 04:00:53 +0000
@@ -1,4 +1,5 @@
 [encoding: UTF-8]
+data/com.canonical.indicator.me.gschema.xml.in
 src/indicator-me.c
 src/status-provider.c
 src/status-provider-pidgin.c

=== modified file 'src/me-service.c'
--- src/me-service.c	2011-03-23 23:21:07 +0000
+++ src/me-service.c	2011-04-18 04:00:53 +0000
@@ -34,8 +34,6 @@
 
 #include <gio/gio.h>
 
-#include <gconf/gconf-client.h>
-
 #include <libdbusmenu-glib/client.h>
 #include <libdbusmenu-glib/server.h>
 #include <libdbusmenu-glib/menuitem.h>
@@ -93,6 +91,7 @@
 static GFileMonitor *avatar_monitor = NULL;
 static DbusmenuMenuitem *broadcast_field = NULL;
 static DbusmenuMenuitem * useritem = NULL;
+static GSettings *gsettings = NULL;
 
 static void
 status_update (void) {
@@ -317,24 +316,13 @@
   return FALSE;
 }
 
-#define GCONF_NAMESPACE "/system/indicator/me"
-#define GCONF_DISPLAY   "/system/indicator/me/display"
-
 static void
-display_mode_changed ()
+display_mode_changed (GSettings *settings, gchar *key)
 {
-  GConfClient *context = gconf_client_get_default ();
-  g_return_if_fail (context != NULL);
-
-  GConfValue *option = gconf_client_get (context, GCONF_DISPLAY, NULL);
-  gint value = 1; /* username, by default */
+  gint value = g_settings_get_int (settings, key);
 
   g_debug ("display_mode_changed");
 
-  if (option != NULL &&
-      option->type == GCONF_VALUE_INT)
-    value = gconf_value_get_int (option);
-
   switch (value) {
   case 0: /* anonymous */
     status_service_dbus_set_username (dbus_interface, "");
@@ -351,10 +339,6 @@
   dbusmenu_menuitem_property_set_bool (useritem,
                                        DBUSMENU_MENUITEM_PROP_VISIBLE,
                                        (value == 0) ? FALSE : TRUE);
-
-  g_object_unref (context);
-
-  return;
 }
 
 
@@ -399,22 +383,15 @@
 }
 #endif
 
+#define GSETTINGS_SCHEMA  "com.canonical.indicator.me"
+#define GSETTINGS_DISPLAY "display"
+
 static gboolean
 build_menu (gpointer data)
 {
 	DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
 	g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);
 
-  /* and receive display mode notifications to update it later */
-  GConfClient *context = gconf_client_get_default ();
-  if (context != NULL) {
-    gconf_client_add_dir (context, GCONF_NAMESPACE,
-                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-    gconf_client_notify_add (context, GCONF_DISPLAY,
-                             display_mode_changed, NULL, NULL, NULL);
-    g_object_unref (context);
-  }
-
   /* disabled for this release */
 #if 0
   build_avatar_item(root);
@@ -478,9 +455,12 @@
   }
 
   /* finally set the menu name and update items visibility according
-     to a gconf key
-  */
-  display_mode_changed ();
+     to a gsettings key and receive display mode notifications to update it
+     later */
+  gsettings = g_settings_new (GSETTINGS_SCHEMA);
+  g_signal_connect (gsettings, "changed::" GSETTINGS_DISPLAY,
+                    G_CALLBACK (display_mode_changed), NULL);
+  display_mode_changed (gsettings, GSETTINGS_DISPLAY);
 
 	return FALSE;
 }