Merge lp:~charlesk/gnome-bluetooth/indicators into lp:~ubuntu-desktop/gnome-bluetooth/ubuntu

Proposed by Charles Kerr
Status: Merged
Merged at revision: 61
Proposed branch: lp:~charlesk/gnome-bluetooth/indicators
Merge into: lp:~ubuntu-desktop/gnome-bluetooth/ubuntu
Diff against target: 310 lines (+182/-31)
3 files modified
debian/patches/01_use_app_indicator.patch (+153/-31)
debian/patches/03_text_changes.patch (+28/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~charlesk/gnome-bluetooth/indicators
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Charles Kerr (community) Needs Resubmitting
Review via email: mp+90956@code.launchpad.net

Description of the change

Adds a menubar visibility toggle to 01_use_app_indicator.patch (LP: #829690)

 - Modify the properties panel to add a visibility toggle as spec'ed in
   https://wiki.ubuntu.com/Bluetooth#specification
 - Add a GSettings schema for storing that visibility toggle
 - Modify bluetooth-applet to support the visibility toggle

To post a comment you must log in.
62. By Charles Kerr

Capitalization fixes to text in the popup menu (LP: #906042)

63. By Charles Kerr

replace the three single dots '...' by the unicode symbol U+2026 (…).

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for the work, some comment from a first review:

304 ++ const gchar * const * schemas = g_settings_list_schemas ();
305 ++ for (i=0; !schema_exists && schemas && schemas[i]; i++)
306 ++ if (!g_strcmp0 (schema, schemas[i]))
307 ++ schema_exists = TRUE;

what's the point of checking if the schemas exists when it's part of the same source and we know it's being installed? if the schemas is not there the installation is corrupted and we better let the code error out...

286 ++on_settings_visible_changed (GSettings *settings, gchar *key, CcBluetoothPanel * panel)
287 ++{
288 ++ g_return_if_fail (!g_strcmp0 (key, VISIBLE_KEY));

why do you check the key? is the signal connected on another key than visible_key? that seems not required

289 ++
290 ++ GtkToggleButton *toggle = GTK_TOGGLE_BUTTON(panel->priv->indicator_check);
291 ++ gboolean oldval = gtk_toggle_button_get_active (toggle);
292 ++ gboolean newval = g_settings_get_boolean (settings, key);
293 ++ if (oldval != newval)
294 ++ gtk_toggle_button_set_active (toggle, newval);

do we need those checks? what do you try to avoid? if the visibility changed then it's likely that the checkbox state will change, it's also not obvious that all those checks spare any work over calling set_active in any case.

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

note that instead of connecting the callback to the gsettings value you can probably simplify the code using g_settings_bind() to bind the widget state to the key value

64. By Charles Kerr

Improve the schema handling from seb's review feedback.

1. Since the schema is part of this package, don't test to see if it exists before we use it. If the installation is corrupt, better to error out.

2. Simplify tying the togglebutton to the GSettings boolean by using g_settings_bind().

Revision history for this message
Charles Kerr (charlesk) wrote :

Seb, thanks for the useful feedback. Using g_settings_bind() did in fact remove all that extra code.

Likewise, I've removed the test-for-schema code before calling g_settings_new().

Fixed r64

Revision history for this message
Charles Kerr (charlesk) :
review: Needs Resubmitting
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, that looks better, small minor comments,questions though:

> ++ else if ((gsettings != NULL) && !g_settings_get_boolean (gsettings, GSETTINGS_VISIBLE_KEY))

the NULL checking is not needed there, g_settings_new() can't return null, it works or the install is broken it exits

> g_clear_object (&self->priv->indicator_settings);

shouldn't g_object_unref() be used rather there?

> ++++ b/applet/com.canonical.indicator.bluetooth.gschema.xml

you should use a .xml.in with _summary and _description keys and list it in POTFILES.in to make the summary and description translatable and the .xml should be generated at build time

Otherwise the changes look good and seem to work fine, the checkbox seems a bit too close from the ui frame in the capplet though and maybe it would be better with some margin but I will let design comment on that

review: Needs Fixing
Revision history for this message
Charles Kerr (charlesk) wrote :

Seb, thanks for the additional feedback; it's all been helpful.

>> ++ else if ((gsettings != NULL) && !g_settings_get_boolean (gsettings, GSETTINGS_VISIBLE_KEY))
> the NULL checking is not needed there, g_settings_new() can't return null, it works or the install is broken it exits

Fixed in r65

>> g_clear_object (&self->priv->indicator_settings);
> shouldn't g_object_unref() be used rather there?

g_clear_object calls g_object_unref() and NULLs the pointer. I suppose NULLing is unnecessary in _finalize() but IMO it's harmless.

>> ++++ b/applet/com.canonical.indicator.bluetooth.gschema.xml
> you should use a .xml.in with _summary and _description keys and list it in POTFILES.in

Great point; fixed in r65

> the checkbox seems a bit too close from the ui frame in the capplet though and maybe it would be better with some margin

Yeah, I think that's true. Adding a 6-pixel margin between them in r66 looks better.

65. By Charles Kerr

More improvements generated by code review:

 - remove an unnecessary (gsettings==NULL) safeguard -- g_settings_new() can't return NULL

 - insead of bundling a schema.xml directly, use an .xml.in file marked for translation

66. By Charles Kerr

Add a 6 pixel margin between the ui frame and the visibility checkbox.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, that looks great, I will merge it tomorrow. Bonus point if you open a bug on bugzilla.gnome.org about the string changes in case they want to take it.

Small note also, shouldn't gsettingsschema_in_files be added to EXTRA_DIST?

67. By Charles Kerr

Add $(gsettingsschema_in_files) to EXTRA_DIST

Revision history for this message
Charles Kerr (charlesk) wrote :

> Bonus point if you open a bug on bugzilla.gnome.org about the string changes in case they want to take it.

https://bugzilla.gnome.org/show_bug.cgi?id=669284

> also, shouldn't gsettingsschema_in_files be added to EXTRA_DIST?

Yep. r67.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, I'm merging that

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/patches/01_use_app_indicator.patch'
2--- debian/patches/01_use_app_indicator.patch 2012-01-29 22:11:20 +0000
3+++ debian/patches/01_use_app_indicator.patch 2012-02-02 22:03:19 +0000
4@@ -1,8 +1,6 @@
5
6-Index: gnome-bluetooth-3.2.1/applet/main.c
7-===================================================================
8---- gnome-bluetooth-3.2.1.orig/applet/main.c 2012-01-29 17:06:45.334805472 -0500
9-+++ gnome-bluetooth-3.2.1/applet/main.c 2012-01-29 17:06:51.358835339 -0500
10+--- a/applet/main.c
11++++ b/applet/main.c
12 @@ -29,6 +29,9 @@
13 #include <glib/gi18n.h>
14 #include <gtk/gtk.h>
15@@ -13,7 +11,39 @@
16 #include <bluetooth-chooser.h>
17 #include <bluetooth-client.h>
18 #include <bluetooth-utils.h>
19-@@ -417,7 +420,11 @@
20+@@ -37,6 +40,12 @@
21+ #include "notify.h"
22+ #include "agent.h"
23+
24++#ifdef HAVE_APP_INDICATOR
25++ #define BLUETOOTH_INDICATOR_GSETTINGS_SCHEMA_ID "com.canonical.indicator.bluetooth"
26++ #define GSETTINGS_VISIBLE_KEY "visible"
27++ static GSettings *gsettings = NULL;
28++#endif /* HAVE_APP_INDICATOR */
29++
30+ static gboolean option_debug = FALSE;
31+ static BluetoothApplet *applet = NULL;
32+ static gboolean discover_lock = FALSE;
33+@@ -391,11 +400,14 @@
34+ else
35+ set_icon (TRUE);
36+
37+- if (state != BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER) {
38++ if (state == BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER)
39++ hide_icon ();
40++#ifdef HAVE_APP_INDICATOR
41++ else if (!g_settings_get_boolean (gsettings, GSETTINGS_VISIBLE_KEY))
42++ hide_icon ();
43++#endif
44++ else
45+ show_icon ();
46+- return;
47+- }
48+- hide_icon ();
49+ }
50+
51+ static void
52+@@ -417,7 +429,11 @@
53
54 discoverable = bluetooth_applet_get_discoverable (applet);
55
56@@ -25,7 +55,7 @@
57 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (object), discoverable);
58
59 discover_lock = FALSE;
60-@@ -854,7 +861,11 @@
61+@@ -854,7 +870,11 @@
62 int main(int argc, char *argv[])
63 {
64 GApplication *app;
65@@ -37,13 +67,16 @@
66 GtkWidget *menu;
67 GOptionContext *context;
68 GError *error = NULL;
69-@@ -919,14 +930,21 @@
70+@@ -919,14 +939,24 @@
71 update_discoverability ((GObject*) applet, NULL, NULL);
72 update_device_list (applet, NULL);
73
74 +#ifdef HAVE_APP_INDICATOR
75 + indicator = init_notification();
76 + app_indicator_set_menu(indicator, GTK_MENU(menu));
77++ gsettings = g_settings_new (BLUETOOTH_INDICATOR_GSETTINGS_SCHEMA_ID);
78++ g_signal_connect (gsettings, "changed::" GSETTINGS_VISIBLE_KEY,
79++ G_CALLBACK(update_icon_visibility), NULL);
80 +#else
81 statusicon = init_notification();
82 +#endif /* HAVE_APP_INDICATOR */
83@@ -59,10 +92,8 @@
84
85 setup_agents(applet);
86
87-Index: gnome-bluetooth-3.2.1/applet/Makefile.am
88-===================================================================
89---- gnome-bluetooth-3.2.1.orig/applet/Makefile.am 2012-01-29 17:06:45.322805412 -0500
90-+++ gnome-bluetooth-3.2.1/applet/Makefile.am 2012-01-29 17:06:51.358835339 -0500
91+--- a/applet/Makefile.am
92++++ b/applet/Makefile.am
93 @@ -18,6 +18,13 @@
94
95 INCLUDES = -I$(top_srcdir)/lib
96@@ -77,10 +108,21 @@
97 man_MANS = bluetooth-applet.1
98
99 ui_DATA = popup-menu.ui authorisation-dialogue.ui confirm-dialogue.ui passkey-dialogue.ui
100-Index: gnome-bluetooth-3.2.1/applet/notify.c
101-===================================================================
102---- gnome-bluetooth-3.2.1.orig/applet/notify.c 2012-01-29 17:06:45.346805532 -0500
103-+++ gnome-bluetooth-3.2.1/applet/notify.c 2012-01-29 17:06:51.358835339 -0500
104+@@ -37,3 +44,12 @@
105+ EXTRA_DIST += $(man_MANS) $(autostart_in_in_files) $(ui_DATA)
106+
107+ MAINTAINERCLEANFILES = Makefile.in
108++
109++if HAVE_APP_INDICATOR
110++gsettingsschema_in_files = com.canonical.indicator.bluetooth.gschema.xml.in
111++gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
112++@INTLTOOL_XML_NOMERGE_RULE@
113++@GSETTINGS_RULES@
114++EXTRA_DIST += $(gsettingsschema_in_files)
115++CLEANFILES += $(gsettings_SCHEMAS)
116++endif
117+--- a/applet/notify.c
118++++ b/applet/notify.c
119 @@ -29,12 +29,19 @@
120 #include <glib/gi18n.h>
121 #include <gtk/gtk.h>
122@@ -220,10 +262,8 @@
123 +#endif /* HAVE_APP_INDICATOR */
124 }
125 }
126-Index: gnome-bluetooth-3.2.1/applet/notify.h
127-===================================================================
128---- gnome-bluetooth-3.2.1.orig/applet/notify.h 2012-01-29 17:06:45.358805587 -0500
129-+++ gnome-bluetooth-3.2.1/applet/notify.h 2012-01-29 17:06:51.358835339 -0500
130+--- a/applet/notify.h
131++++ b/applet/notify.h
132 @@ -22,7 +22,13 @@
133 *
134 */
135@@ -238,10 +278,8 @@
136 void cleanup_notification(void);
137
138 gboolean notification_supports_actions(void);
139-Index: gnome-bluetooth-3.2.1/applet/popup-menu.ui
140-===================================================================
141---- gnome-bluetooth-3.2.1.orig/applet/popup-menu.ui 2011-10-17 07:26:48.000000000 -0400
142-+++ gnome-bluetooth-3.2.1/applet/popup-menu.ui 2012-01-29 17:07:16.042957738 -0500
143+--- a/applet/popup-menu.ui
144++++ b/applet/popup-menu.ui
145 @@ -63,7 +63,7 @@
146 <object class="GtkActionGroup" id="preferences-action-group">
147 <child>
148@@ -251,10 +289,8 @@
149 <property name="stock-id">gtk-preferences</property>
150 <signal name="activate" handler="settings_callback"/>
151 </object>
152-Index: gnome-bluetooth-3.2.1/applet/test-agentdialog.c
153-===================================================================
154---- gnome-bluetooth-3.2.1.orig/applet/test-agentdialog.c 2012-01-29 17:06:45.314805367 -0500
155-+++ gnome-bluetooth-3.2.1/applet/test-agentdialog.c 2012-01-29 17:06:51.358835339 -0500
156+--- a/applet/test-agentdialog.c
157++++ b/applet/test-agentdialog.c
158 @@ -32,7 +32,11 @@
159
160 int main(int argc, char *argv[])
161@@ -282,10 +318,8 @@
162
163 setup_agents(applet);
164
165-Index: gnome-bluetooth-3.2.1/configure.ac
166-===================================================================
167---- gnome-bluetooth-3.2.1.orig/configure.ac 2012-01-29 17:06:45.374805671 -0500
168-+++ gnome-bluetooth-3.2.1/configure.ac 2012-01-29 17:06:51.358835339 -0500
169+--- a/configure.ac
170++++ b/configure.ac
171 @@ -98,6 +98,31 @@
172 gtk+-3.0 >= $GTK_REQUIRED
173 libnotify >= $NOTIFY_REQUIRED)
174@@ -325,3 +359,91 @@
175 + Application Indicators......: ${enable_appindicator}
176 "
177
178+--- a/properties/bluetooth.ui
179++++ b/properties/bluetooth.ui
180+@@ -667,6 +667,26 @@
181+ <property name="height">1</property>
182+ </packing>
183+ </child>
184++ <child>
185++ <object class="GtkCheckButton" id="menubar_visibility_toggle">
186++ <property name="label" translatable="yes">_Show Bluetooth status in the menu bar</property>
187++ <property name="use_action_appearance">False</property>
188++ <property name="visible">True</property>
189++ <property name="can_focus">True</property>
190++ <property name="receives_default">False</property>
191++ <property name="margin_top">6</property>
192++ <property name="use_action_appearance">False</property>
193++ <property name="use_underline">True</property>
194++ <property name="xalign">0</property>
195++ <property name="draw_indicator">True</property>
196++ </object>
197++ <packing>
198++ <property name="left_attach">0</property>
199++ <property name="top_attach">2</property>
200++ <property name="width">2</property>
201++ <property name="height">1</property>
202++ </packing>
203++ </child>
204+ </object>
205+ </child>
206+ </object>
207+--- a/properties/cc-bluetooth-panel.c
208++++ b/properties/cc-bluetooth-panel.c
209+@@ -55,6 +55,7 @@
210+ BluetoothClient *client;
211+ BluetoothKillswitch *killswitch;
212+ gboolean debug;
213++ GSettings *indicator_settings;
214+ };
215+
216+ static void cc_bluetooth_panel_finalize (GObject *object);
217+@@ -106,6 +107,8 @@
218+ self->priv->client = NULL;
219+ }
220+
221++ g_clear_object (&self->priv->indicator_settings);
222++
223+ G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->finalize (object);
224+ }
225+
226+@@ -731,6 +734,12 @@
227+ G_CALLBACK (killswitch_changed), self);
228+ cc_bluetooth_panel_update_power (self);
229+
230++ /* Set up the menubar visibility toggle */
231++ self->priv->indicator_settings = g_settings_new ("com.canonical.indicator.bluetooth");
232++ g_settings_bind (self->priv->indicator_settings, "visible",
233++ WID("menubar_visibility_toggle"), "active",
234++ G_SETTINGS_BIND_DEFAULT);
235++
236+ gtk_widget_show_all (GTK_WIDGET (self));
237+ }
238+
239+@@ -758,4 +767,3 @@
240+ g_io_module_unload (GIOModule *module)
241+ {
242+ }
243+-
244+--- /dev/null
245++++ b/applet/com.canonical.indicator.bluetooth.gschema.xml.in
246+@@ -0,0 +1,9 @@
247++<schemalist>
248++ <schema id="com.canonical.indicator.bluetooth" path="/com/canonical/indicator/bluetooth/">
249++ <key name="visible" type="b">
250++ <default>true</default>
251++ <_summary>Whether or not to show the bluetooth indicator in the menu bar.</_summary>
252++ <_description>Whether or not to show the bluetooth indicator in the menu bar.</_description>
253++ </key>
254++ </schema>
255++</schemalist>
256+--- a/po/POTFILES.in
257++++ b/po/POTFILES.in
258+@@ -10,6 +10,7 @@
259+ applet/notify.c
260+ applet/agent.c
261+ applet/bluetooth-applet.desktop.in.in
262++applet/com.canonical.indicator.bluetooth.gschema.xml.in
263+ [type: gettext/glade] applet/popup-menu.ui
264+ [type: gettext/glade] applet/authorisation-dialogue.ui
265+ [type: gettext/glade] applet/confirm-dialogue.ui
266
267=== added file 'debian/patches/03_text_changes.patch'
268--- debian/patches/03_text_changes.patch 1970-01-01 00:00:00 +0000
269+++ debian/patches/03_text_changes.patch 2012-02-02 22:03:19 +0000
270@@ -0,0 +1,28 @@
271+--- a/applet/popup-menu.ui
272++++ b/applet/popup-menu.ui
273+@@ -33,14 +33,14 @@
274+ </child>
275+ <child>
276+ <object class="GtkAction" id="send-file">
277+- <property name="label" translatable="yes">Send files to device...</property>
278++ <property name="label" translatable="yes">Send Files to Device…</property>
279+ <property name="icon-name">document-send</property>
280+ <signal name="activate" handler="sendto_callback"/>
281+ </object>
282+ </child>
283+ <child>
284+ <object class="GtkAction" id="browse-device">
285+- <property name="label" translatable="yes">Browse files on device...</property>
286++ <property name="label" translatable="yes">Browse Files on Device…</property>
287+ <signal name="activate" handler="browse_callback"/>
288+ </object>
289+ </child>
290+@@ -53,7 +53,7 @@
291+ </child>
292+ <child>
293+ <object class="GtkAction" id="setup-new">
294+- <property name="label" translatable="yes">Set up new device...</property>
295++ <property name="label" translatable="yes">Set Up New Device…</property>
296+ <signal name="activate" handler="wizard_callback"/>
297+ </object>
298+ </child>
299
300=== modified file 'debian/patches/series'
301--- debian/patches/series 2012-01-23 20:09:53 +0000
302+++ debian/patches/series 2012-02-02 22:03:19 +0000
303@@ -4,6 +4,7 @@
304 git_update_indicator_list.patch
305 01_use_app_indicator.patch
306 02_gettext_macros.patch
307+03_text_changes.patch
308 nodisplay_autostart.patch
309 onlyshowin_unity.patch
310 fix_browse_devices_selector.patch

Subscribers

People subscribed via source and target branches

to all changes: