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
=== modified file 'configure.ac'
--- configure.ac 2010-09-22 12:07:52 +0000
+++ configure.ac 2010-10-12 12:41:35 +0000
@@ -10,6 +10,8 @@
1010
11AM_MAINTAINER_MODE11AM_MAINTAINER_MODE
1212
13GLIB_GSETTINGS
14
13IT_PROG_INTLTOOL([0.35.0])15IT_PROG_INTLTOOL([0.35.0])
1416
15AC_ISC_POSIX17AC_ISC_POSIX
@@ -33,7 +35,7 @@
33DBUSMENUGTK_REQUIRED_VERSION=0.2.235DBUSMENUGTK_REQUIRED_VERSION=0.2.2
34DBUSMENUGLIB_REQUIRED_VERSION=0.2.236DBUSMENUGLIB_REQUIRED_VERSION=0.2.2
35TELEPATHYGLIB_REQUIRED_VERSION=0.9.037TELEPATHYGLIB_REQUIRED_VERSION=0.9.0
36GCONF_REQUIRED_VERSION=2.0.038GLIB_REQUIRED_VERSION=2.26
37INDICATOR_DISPLAY_OBJECTS=0.139INDICATOR_DISPLAY_OBJECTS=0.1
3840
39PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION41PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
@@ -41,7 +43,7 @@
41 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS43 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
42 dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)44 dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)
43PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION45PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
44 gconf-2.0 >= $GCONF_REQUIRED_VERSION46 glib-2.0 >= $GLIB_REQUIRED_VERSION
45 indicator >= $INDICATOR_REQUIRED_VERSION47 indicator >= $INDICATOR_REQUIRED_VERSION
46 gwibber >= $GWIBBER_REQUIRED_VERSION48 gwibber >= $GWIBBER_REQUIRED_VERSION
47 telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION)49 telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION)
4850
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2009-11-20 23:26:22 +0000
+++ data/Makefile.am 2010-10-12 12:41:35 +0000
@@ -7,10 +7,19 @@
7%.service: %.service.in7%.service: %.service.in
8 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@8 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
99
10@INTLTOOL_XML_NOMERGE_RULE@
11
12@GSETTINGS_RULES@
13gsettings_SCHEMAS = org.ayatana.indicator.me.gschema.xml
14
15convertdir = $(datadir)/GConf/gsettings
16dist_convert_DATA = indicator-me.convert
1017
11EXTRA_DIST = \18EXTRA_DIST = \
12 $(service_in_files)19 $(service_in_files) \
20 $(gsettings_SCHEMAS:.xml=.xml.in)
1321
14CLEANFILES = \22CLEANFILES = \
15 $(dbus_services_DATA)23 $(dbus_services_DATA) \
24 $(gsettings_SCHEMAS)
1625
1726
=== added file 'data/indicator-me.convert'
--- data/indicator-me.convert 1970-01-01 00:00:00 +0000
+++ data/indicator-me.convert 2010-10-12 12:41:35 +0000
@@ -0,0 +1,2 @@
1[org.ayatana.indicator.me]
2display = /system/indicator/me/display
03
=== added file 'data/org.ayatana.indicator.me.gschema.xml.in'
--- data/org.ayatana.indicator.me.gschema.xml.in 1970-01-01 00:00:00 +0000
+++ data/org.ayatana.indicator.me.gschema.xml.in 2010-10-12 12:41:35 +0000
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<schemalist gettext-domain="indicator-me">
3 <schema id="org.ayatana.indicator.me" path="/apps/indicators/me/">
4 <key name="display" type="i">
5 <default>1</default>
6 <_summary>How to display your name</_summary>
7 <_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>
8 </key>
9 </schema>
10</schemalist>
011
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2010-09-21 16:54:53 +0000
+++ po/POTFILES.in 2010-10-12 12:41:35 +0000
@@ -1,4 +1,5 @@
1[encoding: UTF-8]1[encoding: UTF-8]
2data/org.ayatana.indicator.me.gschema.xml.in
2src/indicator-me.c3src/indicator-me.c
3src/status-provider.c4src/status-provider.c
4src/status-provider-pidgin.c5src/status-provider-pidgin.c
56
=== modified file 'src/me-service.c'
--- src/me-service.c 2010-09-16 16:02:49 +0000
+++ src/me-service.c 2010-10-12 12:41:35 +0000
@@ -34,8 +34,6 @@
3434
35#include <gio/gio.h>35#include <gio/gio.h>
3636
37#include <gconf/gconf-client.h>
38
39#include <libdbusmenu-glib/client.h>37#include <libdbusmenu-glib/client.h>
40#include <libdbusmenu-glib/server.h>38#include <libdbusmenu-glib/server.h>
41#include <libdbusmenu-glib/menuitem.h>39#include <libdbusmenu-glib/menuitem.h>
@@ -91,6 +89,7 @@
91static GFileMonitor *avatar_monitor = NULL;89static GFileMonitor *avatar_monitor = NULL;
92static DbusmenuMenuitem *broadcast_field = NULL;90static DbusmenuMenuitem *broadcast_field = NULL;
93static DbusmenuMenuitem * useritem = NULL;91static DbusmenuMenuitem * useritem = NULL;
92static GSettings *gsettings = NULL;
9493
95static void94static void
96status_update (void) {95status_update (void) {
@@ -312,24 +311,13 @@
312 return FALSE;311 return FALSE;
313}312}
314313
315#define GCONF_NAMESPACE "/system/indicator/me"
316#define GCONF_DISPLAY "/system/indicator/me/display"
317
318static void314static void
319display_mode_changed ()315display_mode_changed (GSettings *settings, gchar *key)
320{316{
321 GConfClient *context = gconf_client_get_default ();317 gint value = g_settings_get_int (settings, key);
322 g_return_if_fail (context != NULL);
323
324 GConfValue *option = gconf_client_get (context, GCONF_DISPLAY, NULL);
325 gint value = 1; /* username, by default */
326318
327 g_debug ("display_mode_changed");319 g_debug ("display_mode_changed");
328320
329 if (option != NULL &&
330 option->type == GCONF_VALUE_INT)
331 value = gconf_value_get_int (option);
332
333 switch (value) {321 switch (value) {
334 case 0: /* anonymous */322 case 0: /* anonymous */
335 status_service_dbus_set_username (dbus_interface, "");323 status_service_dbus_set_username (dbus_interface, "");
@@ -346,10 +334,6 @@
346 dbusmenu_menuitem_property_set_bool (useritem,334 dbusmenu_menuitem_property_set_bool (useritem,
347 DBUSMENU_MENUITEM_PROP_VISIBLE,335 DBUSMENU_MENUITEM_PROP_VISIBLE,
348 (value == 0) ? FALSE : TRUE);336 (value == 0) ? FALSE : TRUE);
349
350 g_object_unref (context);
351
352 return;
353}337}
354338
355339
@@ -394,22 +378,15 @@
394}378}
395#endif379#endif
396380
381#define GSETTINGS_SCHEMA "org.ayatana.indicator.me"
382#define GSETTINGS_DISPLAY "display"
383
397static gboolean384static gboolean
398build_menu (gpointer data)385build_menu (gpointer data)
399{386{
400 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);387 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
401 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);388 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);
402389
403 /* and receive display mode notifications to update it later */
404 GConfClient *context = gconf_client_get_default ();
405 if (context != NULL) {
406 gconf_client_add_dir (context, GCONF_NAMESPACE,
407 GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
408 gconf_client_notify_add (context, GCONF_DISPLAY,
409 display_mode_changed, NULL, NULL, NULL);
410 g_object_unref (context);
411 }
412
413 /* disabled for this release */390 /* disabled for this release */
414#if 0391#if 0
415 build_avatar_item(root);392 build_avatar_item(root);
@@ -473,9 +450,12 @@
473 }450 }
474451
475 /* finally set the menu name and update items visibility according452 /* finally set the menu name and update items visibility according
476 to a gconf key453 to a gsettings key and receive display mode notifications to update it
477 */454 later */
478 display_mode_changed ();455 gsettings = g_settings_new (GSETTINGS_SCHEMA);
456 g_signal_connect (gsettings, "changed::" GSETTINGS_DISPLAY,
457 G_CALLBACK (display_mode_changed), NULL);
458 display_mode_changed (gsettings, GSETTINGS_DISPLAY);
479459
480 return FALSE;460 return FALSE;
481}461}

Subscribers

People subscribed via source and target branches