Merge lp:~mterry/indicator-me/gsettings into lp:indicator-me

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/indicator-me/gsettings
Merge into: lp:indicator-me
Diff against target: 189 lines (+40/-36)
6 files modified
configure.ac (+4/-2)
data/Makefile.am (+11/-2)
data/indicator-me.convert (+2/-0)
data/org.ayatana.indicator.me.gschema.xml.in (+10/-0)
po/POTFILES.in (+1/-0)
src/me-service.c (+12/-32)
To merge this branch: bzr merge lp:~mterry/indicator-me/gsettings
Reviewer Review Type Date Requested Status
Ted Gould (community) Needs Fixing
Review via email: mp+38005@code.launchpad.net

This proposal has been superseded by a proposal from 2011-04-18.

Description of the change

One big concern I had with this conversion was that indicator-datetime is apparently using /apps/indicators/XXX for their gsettings paths. But indicator-me was using /system/indicator/XXX in gconf.

I conservatively kept using /system/indicator/XXX, but if the Brand New Thing is /apps/indicators, just modify data/org.ayatana.indicator.me.gschema.xml.in to match (the path attribute near the top).

To post a comment you must log in.
lp:~mterry/indicator-me/gsettings updated
114. By Michael Terry

use gsettings, not gconf

Revision history for this message
Ted Gould (ted) wrote :

On Fri, 2010-10-08 at 19:01 +0000, Michael Terry wrote:
> One big concern I had with this conversion was that indicator-datetime is
> apparently using /apps/indicators/XXX for their gsettings paths. But
> indicator-me was using /system/indicator/XXX in gconf.

I like /apps because it seems like that's where people are putting
things that aren't part of GNOME Core. But, we should probably get a
definitive answer here.

Also, it seems to me this key should be an enum in gsettings (as it
supports that) instead of an int. Thoughts?

Revision history for this message
Michael Terry (mterry) wrote :

I agree that this key would be an enum if we designed it from scratch. However, the gsettings documentation leads me to believe that enums are stored as strings. And gsettings-data-convert does not handle any sort of data transformation.

So you'd have to use some new key like 'display_enum', keep 'display' around, and then convert values yourself after both are in dconf. Doesn't seem worth it.

Revision history for this message
Ted Gould (ted) wrote :

On Fri, 2010-10-08 at 23:52 +0000, Michael Terry wrote:
> I agree that this key would be an enum if we designed it from scratch. However, the gsettings documentation leads me to believe that enums are stored as strings. And gsettings-data-convert does not handle any sort of data transformation.
>
> So you'd have to use some new key like 'display_enum', keep 'display' around, and then convert values yourself after both are in dconf. Doesn't seem worth it.

Ah, sucks. Probably worth sticking with the int then. No cool new
feature use :)

lp:~mterry/indicator-me/gsettings updated
115. By Michael Terry

move gsettings path to /apps/indicators

Revision history for this message
Ted Gould (ted) wrote :

GNOME has decided the paths should be Java style. So it should really be /com/canonical/indicator/me/*

review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2010-09-22 12:07:52 +0000
3+++ configure.ac 2010-10-12 12:41:35 +0000
4@@ -10,6 +10,8 @@
5
6 AM_MAINTAINER_MODE
7
8+GLIB_GSETTINGS
9+
10 IT_PROG_INTLTOOL([0.35.0])
11
12 AC_ISC_POSIX
13@@ -33,7 +35,7 @@
14 DBUSMENUGTK_REQUIRED_VERSION=0.2.2
15 DBUSMENUGLIB_REQUIRED_VERSION=0.2.2
16 TELEPATHYGLIB_REQUIRED_VERSION=0.9.0
17-GCONF_REQUIRED_VERSION=2.0.0
18+GLIB_REQUIRED_VERSION=2.26
19 INDICATOR_DISPLAY_OBJECTS=0.1
20
21 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
22@@ -41,7 +43,7 @@
23 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
24 dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)
25 PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
26- gconf-2.0 >= $GCONF_REQUIRED_VERSION
27+ glib-2.0 >= $GLIB_REQUIRED_VERSION
28 indicator >= $INDICATOR_REQUIRED_VERSION
29 gwibber >= $GWIBBER_REQUIRED_VERSION
30 telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION)
31
32=== modified file 'data/Makefile.am'
33--- data/Makefile.am 2009-11-20 23:26:22 +0000
34+++ data/Makefile.am 2010-10-12 12:41:35 +0000
35@@ -7,10 +7,19 @@
36 %.service: %.service.in
37 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
38
39+@INTLTOOL_XML_NOMERGE_RULE@
40+
41+@GSETTINGS_RULES@
42+gsettings_SCHEMAS = org.ayatana.indicator.me.gschema.xml
43+
44+convertdir = $(datadir)/GConf/gsettings
45+dist_convert_DATA = indicator-me.convert
46
47 EXTRA_DIST = \
48- $(service_in_files)
49+ $(service_in_files) \
50+ $(gsettings_SCHEMAS:.xml=.xml.in)
51
52 CLEANFILES = \
53- $(dbus_services_DATA)
54+ $(dbus_services_DATA) \
55+ $(gsettings_SCHEMAS)
56
57
58=== added file 'data/indicator-me.convert'
59--- data/indicator-me.convert 1970-01-01 00:00:00 +0000
60+++ data/indicator-me.convert 2010-10-12 12:41:35 +0000
61@@ -0,0 +1,2 @@
62+[org.ayatana.indicator.me]
63+display = /system/indicator/me/display
64
65=== added file 'data/org.ayatana.indicator.me.gschema.xml.in'
66--- data/org.ayatana.indicator.me.gschema.xml.in 1970-01-01 00:00:00 +0000
67+++ data/org.ayatana.indicator.me.gschema.xml.in 2010-10-12 12:41:35 +0000
68@@ -0,0 +1,10 @@
69+<?xml version="1.0" encoding="UTF-8"?>
70+<schemalist gettext-domain="indicator-me">
71+ <schema id="org.ayatana.indicator.me" path="/apps/indicators/me/">
72+ <key name="display" type="i">
73+ <default>1</default>
74+ <_summary>How to display your name</_summary>
75+ <_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>
76+ </key>
77+ </schema>
78+</schemalist>
79
80=== modified file 'po/POTFILES.in'
81--- po/POTFILES.in 2010-09-21 16:54:53 +0000
82+++ po/POTFILES.in 2010-10-12 12:41:35 +0000
83@@ -1,4 +1,5 @@
84 [encoding: UTF-8]
85+data/org.ayatana.indicator.me.gschema.xml.in
86 src/indicator-me.c
87 src/status-provider.c
88 src/status-provider-pidgin.c
89
90=== modified file 'src/me-service.c'
91--- src/me-service.c 2010-09-16 16:02:49 +0000
92+++ src/me-service.c 2010-10-12 12:41:35 +0000
93@@ -34,8 +34,6 @@
94
95 #include <gio/gio.h>
96
97-#include <gconf/gconf-client.h>
98-
99 #include <libdbusmenu-glib/client.h>
100 #include <libdbusmenu-glib/server.h>
101 #include <libdbusmenu-glib/menuitem.h>
102@@ -91,6 +89,7 @@
103 static GFileMonitor *avatar_monitor = NULL;
104 static DbusmenuMenuitem *broadcast_field = NULL;
105 static DbusmenuMenuitem * useritem = NULL;
106+static GSettings *gsettings = NULL;
107
108 static void
109 status_update (void) {
110@@ -312,24 +311,13 @@
111 return FALSE;
112 }
113
114-#define GCONF_NAMESPACE "/system/indicator/me"
115-#define GCONF_DISPLAY "/system/indicator/me/display"
116-
117 static void
118-display_mode_changed ()
119+display_mode_changed (GSettings *settings, gchar *key)
120 {
121- GConfClient *context = gconf_client_get_default ();
122- g_return_if_fail (context != NULL);
123-
124- GConfValue *option = gconf_client_get (context, GCONF_DISPLAY, NULL);
125- gint value = 1; /* username, by default */
126+ gint value = g_settings_get_int (settings, key);
127
128 g_debug ("display_mode_changed");
129
130- if (option != NULL &&
131- option->type == GCONF_VALUE_INT)
132- value = gconf_value_get_int (option);
133-
134 switch (value) {
135 case 0: /* anonymous */
136 status_service_dbus_set_username (dbus_interface, "");
137@@ -346,10 +334,6 @@
138 dbusmenu_menuitem_property_set_bool (useritem,
139 DBUSMENU_MENUITEM_PROP_VISIBLE,
140 (value == 0) ? FALSE : TRUE);
141-
142- g_object_unref (context);
143-
144- return;
145 }
146
147
148@@ -394,22 +378,15 @@
149 }
150 #endif
151
152+#define GSETTINGS_SCHEMA "org.ayatana.indicator.me"
153+#define GSETTINGS_DISPLAY "display"
154+
155 static gboolean
156 build_menu (gpointer data)
157 {
158 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
159 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);
160
161- /* and receive display mode notifications to update it later */
162- GConfClient *context = gconf_client_get_default ();
163- if (context != NULL) {
164- gconf_client_add_dir (context, GCONF_NAMESPACE,
165- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
166- gconf_client_notify_add (context, GCONF_DISPLAY,
167- display_mode_changed, NULL, NULL, NULL);
168- g_object_unref (context);
169- }
170-
171 /* disabled for this release */
172 #if 0
173 build_avatar_item(root);
174@@ -473,9 +450,12 @@
175 }
176
177 /* finally set the menu name and update items visibility according
178- to a gconf key
179- */
180- display_mode_changed ();
181+ to a gsettings key and receive display mode notifications to update it
182+ later */
183+ gsettings = g_settings_new (GSETTINGS_SCHEMA);
184+ g_signal_connect (gsettings, "changed::" GSETTINGS_DISPLAY,
185+ G_CALLBACK (display_mode_changed), NULL);
186+ display_mode_changed (gsettings, GSETTINGS_DISPLAY);
187
188 return FALSE;
189 }

Subscribers

People subscribed via source and target branches