Merge lp:~ted/indicator-session/kill-restart-item into lp:indicator-session/12.10

Proposed by Ted Gould on 2012-09-28
Status: Merged
Approved by: Charles Kerr on 2012-10-01
Approved revision: 365
Merged at revision: 364
Proposed branch: lp:~ted/indicator-session/kill-restart-item
Merge into: lp:indicator-session/12.10
Diff against target: 137 lines (+2/-75)
3 files modified
src/indicator-session.c (+0/-66)
src/session-menu-mgr.c (+2/-5)
src/shared-names.h (+0/-4)
To merge this branch: bzr merge lp:~ted/indicator-session/kill-restart-item
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve on 2012-10-01
Lars Karlitski (community) 2012-09-28 Approve on 2012-10-01
jenkins (community) continuous-integration Needs Fixing on 2012-09-28
Review via email: mp+127065@code.launchpad.net

Commit message

Remove the custom menu type for the restart entry

Description of the change

Removes the custom menu type that was being used for the restart item as it's no longer required, and made it so the entry didn't show properly in the HUD.

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Lars Karlitski (larsu) wrote :

Looks good.

review: Approve
Charles Kerr (charlesk) wrote :

I love patches like this one.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-session.c'
2--- src/indicator-session.c 2012-09-19 00:10:35 +0000
3+++ src/indicator-session.c 2012-09-28 20:54:27 +0000
4@@ -80,10 +80,6 @@
5 DbusmenuMenuitem * parent,
6 DbusmenuClient * client,
7 gpointer user_data);
8-static gboolean build_restart_item (DbusmenuMenuitem * newitem,
9- DbusmenuMenuitem * parent,
10- DbusmenuClient * client,
11- gpointer user_data);
12 static void on_menu_layout_updated (DbusmenuClient * client, IndicatorSession * session);
13 static void indicator_session_update_icon_callback (GtkWidget * widget, gpointer callback_data);
14 static void indicator_session_update_icon_and_a11y (IndicatorSession * self);
15@@ -168,9 +164,6 @@
16 dbusmenu_client_add_type_handler (self->menu_client,
17 USER_ITEM_TYPE,
18 new_user_item);
19- dbusmenu_client_add_type_handler (self->menu_client,
20- RESTART_ITEM_TYPE,
21- build_restart_item);
22 dbusmenu_gtkclient_set_accel_group (DBUSMENU_GTKCLIENT(self->menu_client),
23 gtk_accel_group_new());
24 }
25@@ -316,7 +309,6 @@
26 return TRUE;
27 }
28
29-
30 static void
31 user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data)
32 {
33@@ -357,64 +349,6 @@
34 }
35 }
36
37-
38-
39-
40-static void
41-restart_property_change (DbusmenuMenuitem * item,
42- const gchar * property,
43- GVariant * variant,
44- gpointer user_data)
45-{
46- DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT(user_data);
47- GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(client, item);
48-
49- if (g_strcmp0(property, RESTART_ITEM_LABEL) == 0) {
50- gtk_menu_item_set_label(gmi, g_variant_get_string(variant, NULL));
51- } else if (g_strcmp0(property, RESTART_ITEM_ICON) == 0) {
52- GtkWidget * image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(gmi));
53-
54- GIcon * gicon = g_themed_icon_new_with_default_fallbacks(g_variant_get_string(variant, NULL));
55- if (image == NULL) {
56- image = gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_MENU);
57- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(gmi), image);
58- } else {
59- gtk_image_set_from_gicon(GTK_IMAGE(image), gicon, GTK_ICON_SIZE_MENU);
60- }
61- g_object_unref(G_OBJECT(gicon));
62- }
63- return;
64-}
65-
66-static gboolean
67-build_restart_item (DbusmenuMenuitem * newitem,
68- DbusmenuMenuitem * parent,
69- DbusmenuClient * client,
70- gpointer user_data)
71-{
72- GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_image_menu_item_new());
73- if (gmi == NULL) {
74- return FALSE;
75- }
76-
77- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
78-
79- g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(restart_property_change), client);
80-
81- GVariant * variant;
82- variant = dbusmenu_menuitem_property_get_variant(newitem, RESTART_ITEM_LABEL);
83- if (variant != NULL) {
84- restart_property_change(newitem, RESTART_ITEM_LABEL, variant, client);
85- }
86-
87- variant = dbusmenu_menuitem_property_get_variant(newitem, RESTART_ITEM_ICON);
88- if (variant != NULL) {
89- restart_property_change(newitem, RESTART_ITEM_ICON, variant, client);
90- }
91-
92- return TRUE;
93-}
94-
95 static void
96 indicator_session_update_users_label (IndicatorSession * self,
97 const gchar * name)
98
99=== modified file 'src/session-menu-mgr.c'
100--- src/session-menu-mgr.c 2012-09-18 16:09:15 +0000
101+++ src/session-menu-mgr.c 2012-09-28 20:54:27 +0000
102@@ -491,8 +491,7 @@
103 mi_set_label (mgr->shutdown_mi, confirm_needed ? _("Shut Down\342\200\246")
104 : _("Shut Down"));
105
106- dbusmenu_menuitem_property_set (mgr->restart_mi, RESTART_ITEM_LABEL,
107- confirm_needed ? _("Restart\342\200\246")
108+ mi_set_label (mgr->restart_mi, confirm_needed ? _("Restart\342\200\246")
109 : _("Restart"));
110 }
111
112@@ -516,9 +515,7 @@
113 g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
114 G_CALLBACK(action_func_hibernate), mgr);
115
116- mi = mgr->restart_mi = dbusmenu_menuitem_new ();
117- mi_set_type (mi, RESTART_ITEM_TYPE);
118- dbusmenu_menuitem_property_set (mi, RESTART_ITEM_LABEL, _("Restart\342\200\246"));
119+ mi = mgr->restart_mi = mi_new (_("Restart\342\200\246"));
120 dbusmenu_menuitem_child_append (mgr->top_mi, mi);
121 g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
122 G_CALLBACK(action_func_spawn_async), CMD_RESTART);
123
124=== modified file 'src/shared-names.h'
125--- src/shared-names.h 2012-08-31 01:33:11 +0000
126+++ src/shared-names.h 2012-09-28 20:54:27 +0000
127@@ -36,10 +36,6 @@
128 #define USER_ITEM_PROP_ICON "user-item-icon-path"
129 #define USER_ITEM_ICON_DEFAULT "avatar-default"
130
131-#define RESTART_ITEM_TYPE "x-canonical-restart-item"
132-#define RESTART_ITEM_LABEL "restart-label"
133-#define RESTART_ITEM_ICON "restart-icon"
134-
135 #define ICON_DEFAULT "system-devices-panel"
136 #define ICON_INFO "system-devices-panel-information"
137 #define ICON_ALERT "system-devices-panel-alert"

Subscribers

People subscribed via source and target branches