Merge lp:~charlesk/indicator-power/icon-policy into lp:indicator-power/1.0

Proposed by Ted Gould
Status: Merged
Merged at revision: 125
Proposed branch: lp:~charlesk/indicator-power/icon-policy
Merge into: lp:indicator-power/1.0
Diff against target: 679 lines (+236/-161)
2 files modified
data/com.canonical.indicator.power.gschema.xml.in (+11/-1)
src/indicator-power.c (+225/-160)
To merge this branch: bzr merge lp:~charlesk/indicator-power/icon-policy
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Review via email: mp+92575@code.launchpad.net
To post a comment you must log in.
137. By Charles Kerr

make prototypes for update_visibility() and should_be_visible() align with the neighboring forward declarations

138. By Charles Kerr

remove unnecessary G_OBJECT() cast

139. By Charles Kerr

consistent use of ICON_POLICY_KEY

140. By Charles Kerr

remove unncessary private field 'visible'

141. By Charles Kerr

move POWER_INDICATOR_ICON_POLICY_* enum to the top of the file

142. By Charles Kerr

ensure that we don't have a reference to the proxy or proxy_cancel fields in indicator_power_dispose().

Revision history for this message
Lars Karlitski (larsu) wrote :

I've reviewed this exact code in another merge:

  https://code.launchpad.net/~charlesk/indicator-power/icon-policy/+merge/91483

Approving it here, too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.indicator.power.gschema.xml.in'
2--- data/com.canonical.indicator.power.gschema.xml.in 2011-08-25 17:46:15 +0000
3+++ data/com.canonical.indicator.power.gschema.xml.in 2012-02-13 20:29:18 +0000
4@@ -1,9 +1,19 @@
5 <schemalist>
6+ <enum id="icon-policy-enum">
7+ <value nick="present" value="0" />
8+ <value nick="charge" value="1" />
9+ <value nick="never" value="2" />
10+ </enum>
11 <schema gettext-domain="@GETTEXT_PACKAGE@" id="com.canonical.indicator.power" path="/com/canonical/indicator/power/">
12 <key name="show-time" type="b">
13 <default>false</default>
14 <_summary>Show time in Menu Bar</_summary>
15- <_description>Whether show the time in the menu bar.</_description>
16+ <_description>Whether or not to show the time in the menu bar.</_description>
17+ </key>
18+ <key enum="icon-policy-enum" name="icon-policy">
19+ <default>"present"</default>
20+ <_summary>When to show the battery status in the menu bar.</_summary>
21+ <_description>Options for when to show battery status. Valid options are "present", "charge", and "never".</_description>
22 </key>
23 </schema>
24 </schemalist>
25
26=== modified file 'src/indicator-power.c'
27--- src/indicator-power.c 2011-11-08 21:38:58 +0000
28+++ src/indicator-power.c 2012-02-13 20:29:18 +0000
29@@ -24,7 +24,6 @@
30 #endif
31
32 /* GStuff */
33-#include <glib.h>
34 #include <glib-object.h>
35 #include <glib/gi18n-lib.h>
36 #include <gio/gio.h>
37@@ -36,6 +35,8 @@
38 #include <libindicator/indicator.h>
39 #include <libindicator/indicator-object.h>
40
41+#define ICON_POLICY_KEY "icon-policy"
42+
43 #define DEFAULT_ICON "gpm-battery-missing"
44
45 #define DBUS_SERVICE "org.gnome.SettingsDaemon"
46@@ -50,27 +51,25 @@
47 #define IS_INDICATOR_POWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_POWER_TYPE))
48 #define INDICATOR_POWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_POWER_TYPE, IndicatorPowerClass))
49
50-typedef struct _IndicatorPower IndicatorPower;
51-typedef struct _IndicatorPowerClass IndicatorPowerClass;
52-typedef struct _IndicatorPowerPrivate IndicatorPowerPrivate;
53-
54-struct _IndicatorPower
55-{
56+enum {
57+ POWER_INDICATOR_ICON_POLICY_PRESENT,
58+ POWER_INDICATOR_ICON_POLICY_CHARGE,
59+ POWER_INDICATOR_ICON_POLICY_NEVER
60+};
61+
62+GType indicator_power_get_type (void);
63+
64+INDICATOR_SET_VERSION
65+INDICATOR_SET_TYPE (INDICATOR_POWER_TYPE)
66+
67+typedef struct {
68+ IndicatorObjectClass parent_class;
69+}
70+IndicatorPowerClass;
71+
72+typedef struct {
73 IndicatorObject parent_instance;
74
75- IndicatorPowerPrivate *priv;
76-};
77-
78-struct _IndicatorPowerClass
79-{
80- IndicatorObjectClass parent_class;
81-};
82-
83-GType indicator_power_get_type (void) G_GNUC_CONST;
84-
85-
86-struct _IndicatorPowerPrivate
87-{
88 GtkMenu *menu;
89
90 GtkLabel *label;
91@@ -85,11 +84,10 @@
92 GVariant *device;
93
94 GSettings *settings;
95-};
96+}
97+IndicatorPower;
98
99 /* Prototypes */
100-static void indicator_power_class_init (IndicatorPowerClass *klass);
101-static void indicator_power_init (IndicatorPower *self);
102 static void indicator_power_dispose (GObject *object);
103 static void indicator_power_finalize (GObject *object);
104
105@@ -99,15 +97,13 @@
106 static const gchar* get_accessible_desc (IndicatorObject * io);
107 static const gchar* get_name_hint (IndicatorObject * io);
108
109+static void update_visibility (IndicatorPower * self);
110+static gboolean should_be_visible (IndicatorPower * self);
111+
112+static void gsd_appeared_callback (GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data);
113
114 G_DEFINE_TYPE (IndicatorPower, indicator_power, INDICATOR_OBJECT_TYPE);
115
116-
117-/* Indicator stuff */
118-INDICATOR_SET_VERSION
119-INDICATOR_SET_TYPE (INDICATOR_POWER_TYPE)
120-
121-
122 static void
123 indicator_power_class_init (IndicatorPowerClass *klass)
124 {
125@@ -122,8 +118,75 @@
126 io_class->get_menu = get_menu;
127 io_class->get_accessible_desc = get_accessible_desc;
128 io_class->get_name_hint = get_name_hint;
129-
130- g_type_class_add_private (klass, sizeof (IndicatorPowerPrivate));
131+}
132+
133+static void
134+indicator_power_init (IndicatorPower *self)
135+{
136+ self->menu = GTK_MENU(gtk_menu_new());
137+
138+ self->accessible_desc = NULL;
139+
140+ self->watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
141+ DBUS_SERVICE,
142+ G_BUS_NAME_WATCHER_FLAGS_NONE,
143+ gsd_appeared_callback,
144+ NULL,
145+ self,
146+ NULL);
147+
148+ self->settings = g_settings_new ("com.canonical.indicator.power");
149+ g_signal_connect_swapped (self->settings, "changed::" ICON_POLICY_KEY,
150+ G_CALLBACK(update_visibility), self);
151+ g_object_set (G_OBJECT(self),
152+ INDICATOR_OBJECT_DEFAULT_VISIBILITY, FALSE,
153+ NULL);
154+}
155+
156+static void
157+indicator_power_dispose (GObject *object)
158+{
159+ IndicatorPower *self = INDICATOR_POWER(object);
160+
161+ if (self->devices != NULL) {
162+ g_variant_unref (self->devices);
163+ self->devices = NULL;
164+ }
165+
166+ if (self->device != NULL) {
167+ g_variant_unref (self->device);
168+ self->device = NULL;
169+ }
170+
171+ g_clear_object (&self->proxy);
172+ g_clear_object (&self->proxy_cancel);
173+
174+ g_clear_object (&self->settings);
175+
176+ G_OBJECT_CLASS (indicator_power_parent_class)->dispose (object);
177+}
178+
179+static void
180+indicator_power_finalize (GObject *object)
181+{
182+ IndicatorPower *self = INDICATOR_POWER(object);
183+
184+ g_free (self->accessible_desc);
185+
186+ G_OBJECT_CLASS (indicator_power_parent_class)->finalize (object);
187+}
188+
189+/***
190+****
191+***/
192+
193+static void
194+spawn_command_line_async (const char * command)
195+{
196+ GError * err = NULL;
197+ if (!g_spawn_command_line_async (command, &err))
198+ g_warning ("Couldn't execute command \"%s\": %s", command, err->message);
199+ g_clear_error (&err);
200 }
201
202 static void
203@@ -131,37 +194,21 @@
204 gpointer data)
205 {
206 /*TODO: show the statistics of the specific device*/
207- const gchar *command = "gnome-power-statistics";
208-
209- if (g_spawn_command_line_async (command, NULL) == FALSE)
210- g_warning ("Couldn't execute command: %s", command);
211+ spawn_command_line_async ("gnome-power-statistics");
212 }
213
214 static void
215-option_toggled_cb (GtkCheckMenuItem *item,
216- gpointer user_data)
217+option_toggled_cb (GtkCheckMenuItem *item, IndicatorPower * self)
218 {
219- IndicatorPower *self = INDICATOR_POWER (user_data);
220- IndicatorPowerPrivate *priv = self->priv;
221- gboolean visible;
222-
223- visible = gtk_check_menu_item_get_active (item);
224-
225- gtk_widget_set_visible (GTK_WIDGET (priv->label),
226- visible);
227-
228- g_settings_set_boolean (priv->settings, "show-time",
229- visible);
230+ gtk_widget_set_visible (GTK_WIDGET (self->label),
231+ gtk_check_menu_item_get_active(item));
232 }
233
234 static void
235 show_preferences_cb (GtkMenuItem *item,
236 gpointer data)
237 {
238- const gchar *command = "gnome-control-center power";
239-
240- if (g_spawn_command_line_async (command, NULL) == FALSE)
241- g_warning ("Couldn't execute command: %s", command);
242+ spawn_command_line_async ("gnome-control-center power");
243 }
244
245 static void
246@@ -352,14 +399,12 @@
247 set_accessible_desc (IndicatorPower *self,
248 const gchar *desc)
249 {
250- IndicatorPowerPrivate *priv = self->priv;
251-
252- if (desc == NULL || strlen(desc) == 0)
253+ if (desc == NULL || desc[0] == '\0')
254 return;
255
256- g_free (priv->accessible_desc);
257+ g_free (self->accessible_desc);
258
259- priv->accessible_desc = g_strdup (desc);
260+ self->accessible_desc = g_strdup (desc);
261 }
262
263 static const gchar *
264@@ -559,38 +604,32 @@
265 static void
266 build_menu (IndicatorPower *self)
267 {
268- IndicatorPowerPrivate *priv = self->priv;
269 GtkWidget *item;
270 GtkWidget *image;
271 GList *children;
272 gsize n_devices = 0;
273- gboolean visible;
274-
275- if (priv->menu == NULL)
276- priv->menu = GTK_MENU (gtk_menu_new ());
277-
278- children = gtk_container_get_children (GTK_CONTAINER (priv->menu));
279+
280+ /* remove the existing menuitems */
281+ children = gtk_container_get_children (GTK_CONTAINER (self->menu));
282 g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL);
283 g_list_free (children);
284
285 /* devices */
286- n_devices = menu_add_devices (priv->menu, priv->devices);
287+ n_devices = menu_add_devices (self->menu, self->devices);
288
289 if (!get_greeter_mode ()) {
290 /* only do the separator if we have at least one device */
291 if (n_devices != 0)
292 {
293 item = gtk_separator_menu_item_new ();
294- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
295+ gtk_menu_shell_append (GTK_MENU_SHELL (self->menu), item);
296 }
297
298 /* options */
299 item = gtk_check_menu_item_new_with_label (_("Show Time in Menu Bar"));
300- g_signal_connect (G_OBJECT (item), "toggled",
301- G_CALLBACK (option_toggled_cb), self);
302- visible = g_settings_get_boolean (priv->settings, "show-time");
303- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), visible);
304- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
305+ g_signal_connect (item, "toggled", G_CALLBACK(option_toggled_cb), self);
306+ g_settings_bind (self->settings, "show-time", item, "active", G_SETTINGS_BIND_DEFAULT);
307+ gtk_menu_shell_append (GTK_MENU_SHELL (self->menu), item);
308
309 /* preferences */
310 item = gtk_image_menu_item_new_with_label (_("Power Settings..."));
311@@ -598,11 +637,11 @@
312 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
313 g_signal_connect (G_OBJECT (item), "activate",
314 G_CALLBACK (show_preferences_cb), NULL);
315- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
316+ gtk_menu_shell_append (GTK_MENU_SHELL (self->menu), item);
317 }
318
319 /* show the menu */
320- gtk_widget_show_all (GTK_WIDGET (priv->menu));
321+ gtk_widget_show_all (GTK_WIDGET (self->menu));
322 }
323
324 static GVariant *
325@@ -625,7 +664,7 @@
326 gsize n_devices;
327 guint i;
328
329- n_devices = g_variant_n_children (devices);
330+ n_devices = devices ? g_variant_n_children (devices) : 0;
331 g_debug ("Num devices: '%" G_GSIZE_FORMAT "'\n", n_devices);
332
333 for (i = 0; i < n_devices; i++)
334@@ -699,7 +738,6 @@
335 put_primary_device (IndicatorPower *self,
336 GVariant *device)
337 {
338- IndicatorPowerPrivate *priv = self->priv;
339 UpDeviceKind kind;
340 UpDeviceState state;
341 GIcon *device_gicons;
342@@ -726,10 +764,10 @@
343
344 /* set icon */
345 device_gicons = get_device_icon (kind, state, time, device_icon);
346- gtk_image_set_from_gicon (priv->status_image,
347+ gtk_image_set_from_gicon (self->status_image,
348 device_gicons,
349 GTK_ICON_SIZE_LARGE_TOOLBAR);
350- gtk_widget_show (GTK_WIDGET (priv->status_image));
351+ gtk_widget_show (GTK_WIDGET (self->status_image));
352
353
354 /* get the device name */
355@@ -738,7 +776,7 @@
356 /* get the description */
357 build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name);
358
359- gtk_label_set_label (GTK_LABEL (priv->label),
360+ gtk_label_set_label (GTK_LABEL (self->label),
361 short_details);
362 set_accessible_desc (self, accesible_name);
363
364@@ -755,32 +793,47 @@
365 gpointer user_data)
366 {
367 IndicatorPower *self = INDICATOR_POWER (user_data);
368- IndicatorPowerPrivate *priv = self->priv;
369 GVariant *devices_container;
370 GError *error = NULL;
371
372 devices_container = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
373 if (devices_container == NULL)
374 {
375- g_printerr ("Error getting devices: %s\n", error->message);
376+ g_message ("Couldn't get devices: %s\n", error->message);
377 g_error_free (error);
378-
379- return;
380 }
381- priv->devices = g_variant_get_child_value (devices_container, 0);
382- g_variant_unref (devices_container);
383-
384- priv->device = get_primary_device (priv->devices);
385- if (priv->device == NULL)
386+ else /* update 'devices' */
387 {
388- g_printerr ("Error getting primary device");
389-
390- return;
391+ if (self->devices != NULL)
392+ g_variant_unref (self->devices);
393+ self->devices = g_variant_get_child_value (devices_container, 0);
394+
395+ g_variant_unref (devices_container);
396+
397+ if (self->device != NULL)
398+ g_variant_unref (self->device);
399+ self->device = get_primary_device (self->devices);
400+
401+ if (self->device == NULL)
402+ {
403+ g_message ("Couldn't find primary device");
404+ }
405+ else
406+ {
407+ put_primary_device (self, self->device);
408+ }
409 }
410
411- put_primary_device (self, priv->device);
412-
413 build_menu (self);
414+
415+ update_visibility (self);
416+}
417+
418+static void
419+update_visibility (IndicatorPower * self)
420+{
421+ indicator_object_set_visible (INDICATOR_OBJECT (self),
422+ should_be_visible (self));
423 }
424
425 static void
426@@ -791,17 +844,16 @@
427 gpointer user_data)
428 {
429 IndicatorPower *self = INDICATOR_POWER (user_data);
430- IndicatorPowerPrivate *priv = self->priv;
431
432 if (g_strcmp0 (signal_name, "Changed") == 0)
433 {
434 /* get the new state */
435- g_dbus_proxy_call (priv->proxy,
436+ g_dbus_proxy_call (self->proxy,
437 "GetDevices",
438 NULL,
439 G_DBUS_CALL_FLAGS_NONE,
440 -1,
441- priv->proxy_cancel,
442+ self->proxy_cancel,
443 get_devices_cb,
444 user_data);
445 }
446@@ -813,16 +865,11 @@
447 gpointer user_data)
448 {
449 IndicatorPower *self = INDICATOR_POWER (user_data);
450- IndicatorPowerPrivate *priv = self->priv;
451 GError *error = NULL;
452
453- priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
454+ self->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
455
456- if (priv->proxy_cancel != NULL)
457- {
458- g_object_unref (priv->proxy_cancel);
459- priv->proxy_cancel = NULL;
460- }
461+ g_clear_object (&self->proxy_cancel);
462
463 if (error != NULL)
464 {
465@@ -833,18 +880,18 @@
466 }
467
468 /* we want to change the primary device changes */
469- g_signal_connect (priv->proxy,
470+ g_signal_connect (self->proxy,
471 "g-signal",
472 G_CALLBACK (receive_signal),
473 user_data);
474
475 /* get the initial state */
476- g_dbus_proxy_call (priv->proxy,
477+ g_dbus_proxy_call (self->proxy,
478 "GetDevices",
479 NULL,
480 G_DBUS_CALL_FLAGS_NONE,
481 -1,
482- priv->proxy_cancel,
483+ self->proxy_cancel,
484 get_devices_cb,
485 user_data);
486 }
487@@ -856,9 +903,8 @@
488 gpointer user_data)
489 {
490 IndicatorPower *self = INDICATOR_POWER (user_data);
491- IndicatorPowerPrivate *priv = self->priv;
492
493- priv->proxy_cancel = g_cancellable_new ();
494+ self->proxy_cancel = g_cancellable_new ();
495
496 g_dbus_proxy_new (connection,
497 G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
498@@ -866,50 +912,11 @@
499 name,
500 POWER_DBUS_PATH,
501 POWER_DBUS_INTERFACE,
502- priv->proxy_cancel,
503+ self->proxy_cancel,
504 service_proxy_cb,
505 self);
506 }
507
508-static void
509-indicator_power_init (IndicatorPower *self)
510-{
511- IndicatorPowerPrivate *priv;
512-
513- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
514- INDICATOR_POWER_TYPE,
515- IndicatorPowerPrivate);
516- priv = self->priv;
517-
518- /* Init variables */
519- priv->menu = NULL;
520- priv->accessible_desc = NULL;
521-
522-
523- priv->watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
524- DBUS_SERVICE,
525- G_BUS_NAME_WATCHER_FLAGS_NONE,
526- gsd_appeared_callback,
527- NULL,
528- self,
529- NULL);
530-
531- /* GSettings */
532- priv->settings = g_settings_new ("com.canonical.indicator.power");
533-}
534-
535-static void
536-indicator_power_dispose (GObject *object)
537-{
538- G_OBJECT_CLASS (indicator_power_parent_class)->dispose (object);
539-}
540-
541-static void
542-indicator_power_finalize (GObject *object)
543-{
544- G_OBJECT_CLASS (indicator_power_parent_class)->finalize (object);
545-}
546-
547
548
549
550@@ -919,54 +926,50 @@
551 get_label (IndicatorObject *io)
552 {
553 IndicatorPower *self = INDICATOR_POWER (io);
554- IndicatorPowerPrivate *priv = self->priv;
555
556- if (priv->label == NULL)
557+ if (self->label == NULL)
558 {
559 /* Create the label if it doesn't exist already */
560- priv->label = GTK_LABEL (gtk_label_new (""));
561- gtk_widget_set_visible (GTK_WIDGET (priv->label), FALSE);
562+ self->label = GTK_LABEL (gtk_label_new (""));
563+ gtk_widget_set_visible (GTK_WIDGET (self->label), FALSE);
564 }
565
566- return priv->label;
567+ return self->label;
568 }
569
570 static GtkImage *
571 get_image (IndicatorObject *io)
572 {
573 IndicatorPower *self = INDICATOR_POWER (io);
574- IndicatorPowerPrivate *priv = self->priv;
575 GIcon *gicon;
576
577- if (priv->status_image == NULL)
578+ if (self->status_image == NULL)
579 {
580 /* Will create the status icon if it doesn't exist already */
581 gicon = g_themed_icon_new (DEFAULT_ICON);
582- priv->status_image = GTK_IMAGE (gtk_image_new_from_gicon (gicon,
583+ self->status_image = GTK_IMAGE (gtk_image_new_from_gicon (gicon,
584 GTK_ICON_SIZE_LARGE_TOOLBAR));
585 }
586
587- return priv->status_image;
588+ return self->status_image;
589 }
590
591 static GtkMenu *
592 get_menu (IndicatorObject *io)
593 {
594 IndicatorPower *self = INDICATOR_POWER (io);
595- IndicatorPowerPrivate *priv = self->priv;
596
597 build_menu (self);
598
599- return GTK_MENU (priv->menu);
600+ return GTK_MENU (self->menu);
601 }
602
603 static const gchar *
604 get_accessible_desc (IndicatorObject *io)
605 {
606 IndicatorPower *self = INDICATOR_POWER (io);
607- IndicatorPowerPrivate *priv = self->priv;
608
609- return priv->accessible_desc;
610+ return self->accessible_desc;
611 }
612
613 static const gchar *
614@@ -974,3 +977,65 @@
615 {
616 return PACKAGE_NAME;
617 }
618+
619+/***
620+****
621+***/
622+
623+static void
624+count_batteries(GVariant *devices, int *total, int *inuse)
625+{
626+ const int n_devices = devices ? g_variant_n_children (devices) : 0;
627+
628+ int i;
629+ for (i=0; i<n_devices; i++)
630+ {
631+ GVariant * device = g_variant_get_child_value (devices, i);
632+
633+ UpDeviceKind kind;
634+ g_variant_get_child (device, 1, "u", &kind);
635+ if (kind == UP_DEVICE_KIND_BATTERY)
636+ {
637+ ++*total;
638+
639+ UpDeviceState state;
640+ g_variant_get_child (device, 4, "u", &state);
641+ if ((state == UP_DEVICE_STATE_CHARGING) || (state == UP_DEVICE_STATE_DISCHARGING))
642+ ++*inuse;
643+ }
644+ }
645+
646+ g_debug("count_batteries found %d batteries (%d are charging/discharging)", *total, *inuse);
647+}
648+
649+static gboolean
650+should_be_visible (IndicatorPower * self)
651+{
652+ gboolean visible = TRUE;
653+
654+ const int icon_policy = g_settings_get_enum (self->settings, ICON_POLICY_KEY);
655+
656+ g_debug ("icon_policy is: %d (present==0, charge==1, never==2)", icon_policy);
657+
658+ if (icon_policy == POWER_INDICATOR_ICON_POLICY_NEVER)
659+ {
660+ visible = FALSE;
661+ }
662+ else
663+ {
664+ int batteries=0, inuse=0;
665+ count_batteries (self->devices, &batteries, &inuse);
666+
667+ if (icon_policy == POWER_INDICATOR_ICON_POLICY_PRESENT)
668+ {
669+ visible = batteries > 0;
670+ }
671+ else if (icon_policy == POWER_INDICATOR_ICON_POLICY_CHARGE)
672+ {
673+ visible = inuse > 0;
674+ }
675+ }
676+
677+ g_debug ("should_be_visible: %s", visible?"yes":"no");
678+ return visible;
679+}

Subscribers

People subscribed via source and target branches