Merge lp:~ken-vandine/indicator-me/gsettings into lp:indicator-me

Proposed by Ken VanDine
Status: Merged
Approved by: Ted Gould
Approved revision: 150
Merged at revision: 148
Proposed branch: lp:~ken-vandine/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/com.canonical.indicator.me.gschema.xml.in (+10/-0)
data/indicator-me.convert (+2/-0)
po/POTFILES.in (+1/-0)
src/me-service.c (+12/-32)
To merge this branch: bzr merge lp:~ken-vandine/indicator-me/gsettings
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+58065@code.launchpad.net

This proposal supersedes a proposal from 2010-10-08.

Description of the change

Resubmit of mterry's branch, but renamed gsettings schema name to com.canonical.indicator.me, following the what we did for indicator-datetime

This fixes (LP: #656322)

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 :)

Revision history for this message
Ted Gould (ted) wrote : Posted in a previous version of this proposal

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

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

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2011-04-18 03:50:21 +0000
+++ configure.ac 2011-04-18 04:14:23 +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 @@
33DBUSMENUGLIB_REQUIRED_VERSION=0.3.9535DBUSMENUGLIB_REQUIRED_VERSION=0.3.95
34DBUSMENUGTK_REQUIRED_VERSION=0.3.9536DBUSMENUGTK_REQUIRED_VERSION=0.3.95
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
38GIO_UNIX_REQUIRED_VERSION=2.2240GIO_UNIX_REQUIRED_VERSION=2.22
3941
@@ -44,7 +46,7 @@
44 dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION46 dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
45 dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)47 dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
46PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION48PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
47 gconf-2.0 >= $GCONF_REQUIRED_VERSION49 glib-2.0 >= $GLIB_REQUIRED_VERSION
48 indicator >= $INDICATOR_REQUIRED_VERSION50 indicator >= $INDICATOR_REQUIRED_VERSION
49 gwibber-0.1 >= $GWIBBER_REQUIRED_VERSION51 gwibber-0.1 >= $GWIBBER_REQUIRED_VERSION
50 gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION52 gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
5153
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2009-11-20 23:26:22 +0000
+++ data/Makefile.am 2011-04-18 04:14:23 +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 = com.canonical.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/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:14:23 +0000
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<schemalist gettext-domain="indicator-me">
3 <schema id="com.canonical.indicator.me" path="/com/canonical/indicator/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
=== 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:14:23 +0000
@@ -0,0 +1,2 @@
1[com.canonical.indicator.me]
2display = /system/indicator/me/display
03
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2010-09-21 16:54:53 +0000
+++ po/POTFILES.in 2011-04-18 04:14:23 +0000
@@ -1,4 +1,5 @@
1[encoding: UTF-8]1[encoding: UTF-8]
2data/com.canonical.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 2011-03-23 23:21:07 +0000
+++ src/me-service.c 2011-04-18 04:14:23 +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>
@@ -93,6 +91,7 @@
93static GFileMonitor *avatar_monitor = NULL;91static GFileMonitor *avatar_monitor = NULL;
94static DbusmenuMenuitem *broadcast_field = NULL;92static DbusmenuMenuitem *broadcast_field = NULL;
95static DbusmenuMenuitem * useritem = NULL;93static DbusmenuMenuitem * useritem = NULL;
94static GSettings *gsettings = NULL;
9695
97static void96static void
98status_update (void) {97status_update (void) {
@@ -317,24 +316,13 @@
317 return FALSE;316 return FALSE;
318}317}
319318
320#define GCONF_NAMESPACE "/system/indicator/me"
321#define GCONF_DISPLAY "/system/indicator/me/display"
322
323static void319static void
324display_mode_changed ()320display_mode_changed (GSettings *settings, gchar *key)
325{321{
326 GConfClient *context = gconf_client_get_default ();322 gint value = g_settings_get_int (settings, key);
327 g_return_if_fail (context != NULL);
328
329 GConfValue *option = gconf_client_get (context, GCONF_DISPLAY, NULL);
330 gint value = 1; /* username, by default */
331323
332 g_debug ("display_mode_changed");324 g_debug ("display_mode_changed");
333325
334 if (option != NULL &&
335 option->type == GCONF_VALUE_INT)
336 value = gconf_value_get_int (option);
337
338 switch (value) {326 switch (value) {
339 case 0: /* anonymous */327 case 0: /* anonymous */
340 status_service_dbus_set_username (dbus_interface, "");328 status_service_dbus_set_username (dbus_interface, "");
@@ -351,10 +339,6 @@
351 dbusmenu_menuitem_property_set_bool (useritem,339 dbusmenu_menuitem_property_set_bool (useritem,
352 DBUSMENU_MENUITEM_PROP_VISIBLE,340 DBUSMENU_MENUITEM_PROP_VISIBLE,
353 (value == 0) ? FALSE : TRUE);341 (value == 0) ? FALSE : TRUE);
354
355 g_object_unref (context);
356
357 return;
358}342}
359343
360344
@@ -399,22 +383,15 @@
399}383}
400#endif384#endif
401385
386#define GSETTINGS_SCHEMA "com.canonical.indicator.me"
387#define GSETTINGS_DISPLAY "display"
388
402static gboolean389static gboolean
403build_menu (gpointer data)390build_menu (gpointer data)
404{391{
405 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);392 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
406 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);393 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);
407394
408 /* and receive display mode notifications to update it later */
409 GConfClient *context = gconf_client_get_default ();
410 if (context != NULL) {
411 gconf_client_add_dir (context, GCONF_NAMESPACE,
412 GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
413 gconf_client_notify_add (context, GCONF_DISPLAY,
414 display_mode_changed, NULL, NULL, NULL);
415 g_object_unref (context);
416 }
417
418 /* disabled for this release */395 /* disabled for this release */
419#if 0396#if 0
420 build_avatar_item(root);397 build_avatar_item(root);
@@ -478,9 +455,12 @@
478 }455 }
479456
480 /* finally set the menu name and update items visibility according457 /* finally set the menu name and update items visibility according
481 to a gconf key458 to a gsettings key and receive display mode notifications to update it
482 */459 later */
483 display_mode_changed ();460 gsettings = g_settings_new (GSETTINGS_SCHEMA);
461 g_signal_connect (gsettings, "changed::" GSETTINGS_DISPLAY,
462 G_CALLBACK (display_mode_changed), NULL);
463 display_mode_changed (gsettings, GSETTINGS_DISPLAY);
484464
485 return FALSE;465 return FALSE;
486}466}

Subscribers

People subscribed via source and target branches