3
3
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=609654
4
4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/497870
6
Index: gnome-power-manager-2.30.1/configure.ac
6
Index: gnome-power-manager-2.31.1/configure.ac
7
7
===================================================================
8
--- gnome-power-manager-2.30.1.orig/configure.ac 2010-07-14 15:07:42.148486811 +0200
9
+++ gnome-power-manager-2.30.1/configure.ac 2010-07-14 15:07:42.288486376 +0200
8
--- gnome-power-manager-2.31.1.orig/configure.ac 2010-06-02 18:22:48.000000000 +0200
9
+++ gnome-power-manager-2.31.1/configure.ac 2010-08-05 23:50:36.591312002 +0200
10
10
@@ -122,6 +122,7 @@
11
11
XRANDR_REQUIRED=1.2.0
12
12
CANBERRA_REQUIRED=0.10
51
51
documentation dir: $DOCDIR
52
52
dbus-1 services dir: $DBUS_SERVICES_DIR
53
53
gconf-schema dir: $GCONF_SCHEMA_FILE_DIR
54
Index: gnome-power-manager-2.30.1/src/Makefile.am
54
Index: gnome-power-manager-2.31.1/src/Makefile.am
55
55
===================================================================
56
--- gnome-power-manager-2.30.1.orig/src/Makefile.am 2010-07-14 15:07:42.228488737 +0200
57
+++ gnome-power-manager-2.30.1/src/Makefile.am 2010-07-14 15:08:00.082889995 +0200
56
--- gnome-power-manager-2.31.1.orig/src/Makefile.am 2010-08-05 23:50:36.551312002 +0200
57
+++ gnome-power-manager-2.31.1/src/Makefile.am 2010-08-05 23:50:36.591312002 +0200
59
59
$(GSTREAMER_CFLAGS) \
60
60
-DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE \
62
62
+ $(APP_INDICATOR_CFLAGS) \
63
63
-DBINDIR=\"$(bindir)\" \
64
-DSBINDIR=\"$(sbindir)\" \
64
65
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
65
-DDATADIR=\"$(datadir)\" \
68
68
$(GSTREAMER_LIBS) \
74
Index: gnome-power-manager-2.30.1/src/gpm-engine.c
75
===================================================================
76
--- gnome-power-manager-2.30.1.orig/src/gpm-engine.c 2010-07-14 15:07:42.158484660 +0200
77
+++ gnome-power-manager-2.30.1/src/gpm-engine.c 2010-07-14 15:07:42.288486376 +0200
88
gpm_engine_recalculate_state_icon (engine);
89
gpm_engine_recalculate_state_summary (engine);
91
+ g_signal_emit (engine, signals [DEVICES_CHANGED], 0);
95
@@ -1210,6 +1213,13 @@
96
G_STRUCT_OFFSET (GpmEngineClass, charge_critical),
97
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
98
G_TYPE_NONE, 1, G_TYPE_POINTER);
99
+ signals [DEVICES_CHANGED] =
100
+ g_signal_new ("devices-changed",
101
+ G_TYPE_FROM_CLASS (object_class),
103
+ G_STRUCT_OFFSET (GpmEngineClass, devices_changed),
104
+ NULL, NULL, g_cclosure_marshal_VOID__VOID,
109
Index: gnome-power-manager-2.30.1/src/gpm-engine.h
110
===================================================================
111
--- gnome-power-manager-2.30.1.orig/src/gpm-engine.h 2010-07-14 15:07:42.158484660 +0200
112
+++ gnome-power-manager-2.30.1/src/gpm-engine.h 2010-07-14 15:07:42.288486376 +0200
115
void (* discharging) (GpmEngine *engine,
117
+ void (* devices_changed) (GpmEngine *engine);
120
GType gpm_engine_get_type (void);
121
Index: gnome-power-manager-2.30.1/src/gpm-manager.c
122
===================================================================
123
--- gnome-power-manager-2.30.1.orig/src/gpm-manager.c 2010-07-14 15:07:42.168489283 +0200
124
+++ gnome-power-manager-2.30.1/src/gpm-manager.c 2010-07-14 15:07:42.288486376 +0200
74
Index: gnome-power-manager-2.31.1/src/gpm-manager.c
75
===================================================================
76
--- gnome-power-manager-2.31.1.orig/src/gpm-manager.c 2010-06-02 18:22:48.000000000 +0200
77
+++ gnome-power-manager-2.31.1/src/gpm-manager.c 2010-08-05 23:50:36.591312002 +0200
126
79
gpm_manager_notify_close (manager, *notification_class);
128
81
/* if the status icon is hidden, don't point at it */
129
82
- if (gtk_status_icon_is_embedded (manager->priv->status_icon))
130
83
+ if (manager->priv->status_icon && gtk_status_icon_is_embedded (manager->priv->status_icon))
131
notification = notify_notification_new_with_status_icon (title, message, icon, manager->priv->status_icon);
84
notification = notify_notification_new_with_status_icon (title, message, icon_name, manager->priv->status_icon);
133
notification = notify_notification_new (title, message, icon, NULL);
134
@@ -2031,7 +2031,8 @@
86
notification = notify_notification_new (title, message, icon_name, NULL);
135
88
g_object_unref (manager->priv->backlight);
136
89
g_object_unref (manager->priv->console);
137
90
g_object_unref (manager->priv->client);
142
95
G_OBJECT_CLASS (gpm_manager_parent_class)->finalize (object);
144
Index: gnome-power-manager-2.30.1/src/gpm-tray-icon.c
97
Index: gnome-power-manager-2.31.1/src/gpm-tray-icon.c
145
98
===================================================================
146
--- gnome-power-manager-2.30.1.orig/src/gpm-tray-icon.c 2010-07-14 15:07:42.168489283 +0200
147
+++ gnome-power-manager-2.30.1/src/gpm-tray-icon.c 2010-07-14 15:07:42.298485621 +0200
99
--- gnome-power-manager-2.31.1.orig/src/gpm-tray-icon.c 2010-06-02 18:22:48.000000000 +0200
100
+++ gnome-power-manager-2.31.1/src/gpm-tray-icon.c 2010-08-05 23:51:01.000000000 +0200
148
101
@@ -41,6 +41,10 @@
149
102
#include <gconf/gconf-client.h>
150
103
#include <libupower-glib/upower.h>
200
142
g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), FALSE);
201
143
g_return_val_if_fail (tooltip != NULL, FALSE);
203
145
+#ifndef HAVE_APP_INDICATOR
204
#if GTK_CHECK_VERSION(2,15,0)
205
146
gtk_status_icon_set_tooltip_text (icon->priv->status_icon, tooltip);
207
gtk_status_icon_set_tooltip (icon->priv->status_icon, tooltip);
214
152
gpm_tray_icon_get_status_icon (GpmTrayIcon *icon)
216
154
g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), NULL);
227
if (filename != NULL) {
165
filename = g_icon_to_string (gicon);
228
166
egg_debug ("Setting icon to %s", filename);
229
167
+#ifdef HAVE_APP_INDICATOR
230
168
+ app_indicator_set_icon (icon->priv->app_indicator, filename);
232
gtk_status_icon_set_from_icon_name (icon->priv->status_icon, filename);
170
gtk_status_icon_set_from_gicon (icon->priv->status_icon, gicon);
235
173
/* make sure that we are visible */
236
174
gpm_tray_icon_show (icon, TRUE);
241
- * gpm_tray_icon_popup_cleared_cd:
242
- * @widget: The popup Gtkwidget
244
- * We have to re-enable the tooltip when the popup is removed
247
-gpm_tray_icon_popup_cleared_cd (GtkWidget *widget, GpmTrayIcon *icon)
249
- g_return_if_fail (GPM_IS_TRAY_ICON (icon));
250
- egg_debug ("clear tray");
251
- g_object_ref_sink (widget);
252
- g_object_unref (widget);
256
* gpm_tray_icon_class_init:
175
@@ -191,11 +218,13 @@
177
gchar *percentage_str;
179
+#ifndef HAVE_APP_INDICATOR
181
GtkWidget *label_title;
182
GtkWidget *label_percentage;
263
183
- GtkWidget *image;
185
GtkWidget *hbox_align;
264
187
const gchar *object_path;
265
+#ifndef HAVE_APP_INDICATOR
267
188
const gchar *desc;
269
189
UpDevice *device;
270
UpDeviceKind kind_tmp;
275
/* generate the label */
193
/* generate the labels */
276
194
+#ifdef HAVE_APP_INDICATOR
277
+ label = gpm_upower_get_device_summary (device);
278
+ item = gtk_menu_item_new_with_label (label);
195
+ desc = gpm_upower_get_device_summary (device);
196
+ item = gtk_menu_item_new_with_label (desc);
280
desc = gpm_device_kind_to_localised_text (kind, 1);
281
label = g_strdup_printf ("%s (%.1f%%)", desc, percentage);
282
item = gtk_image_menu_item_new_with_label (label);
284
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
198
desc = gpm_device_kind_to_localised_string (kind, 1);
199
percentage_str = g_strdup_printf ("%.0f%%", percentage);
202
image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_MENU);
285
203
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
286
204
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
289
207
/* callback and add the the menu */
290
208
g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (gpm_tray_icon_show_info_cb), icon);
291
@@ -257,14 +276,16 @@
293
* gpm_tray_icon_create_menu:
295
- * Display the popup menu.
296
+ * Create the popup menu.
299
-gpm_tray_icon_create_menu (GpmTrayIcon *icon, guint32 timestamp)
301
+gpm_tray_icon_create_menu (GpmTrayIcon *icon)
303
GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
305
+#ifndef HAVE_APP_INDICATOR
311
@@ -289,14 +310,63 @@
314
212
/* preferences */
342
239
+ app_indicator_set_menu (icon->priv->app_indicator, menu);
346
+ * gpm_tray_icon_popup_cleared_cd:
347
+ * @widget: The popup Gtkwidget
349
+ * We have to re-enable the tooltip when the popup is removed
352
+gpm_tray_icon_popup_cleared_cd (GtkWidget *widget, GpmTrayIcon *icon)
354
+ g_return_if_fail (GPM_IS_TRAY_ICON (icon));
355
+ egg_debug ("clear tray");
356
+ g_object_ref_sink (widget);
357
+ g_object_unref (widget);
361
+ * gpm_tray_icon_popup_menu:
363
+ * Display the popup menu.
366
+gpm_tray_icon_popup_menu (GpmTrayIcon *icon, guint32 timestamp)
370
+ menu = gpm_tray_icon_create_menu (icon);
373
gtk_widget_show_all (GTK_WIDGET (menu));
374
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
376
gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 timestamp, GpmTrayIcon *icon)
378
egg_debug ("icon right clicked");
379
- gpm_tray_icon_create_menu (icon, timestamp);
380
+ gpm_tray_icon_popup_menu (icon, timestamp);
385
gpm_tray_icon_activate_cb (GtkStatusIcon *status_icon, GpmTrayIcon *icon)
387
egg_debug ("icon left clicked");
388
- gpm_tray_icon_create_menu (icon, gtk_get_current_event_time());
389
+ gpm_tray_icon_popup_menu (icon, gtk_get_current_event_time());
243
* gpm_tray_icon_popup_cleared_cd:
244
* @widget: The popup Gtkwidget
246
g_signal_connect (GTK_WIDGET (menu), "hide",
247
G_CALLBACK (gpm_tray_icon_popup_cleared_cd), icon);
394
* gpm_conf_gconf_key_changed_cb:
252
* gpm_tray_icon_popup_menu_cb:
396
254
gpm_tray_icon_init (GpmTrayIcon *icon)
398
256
gboolean allowed_in_menu;