aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-10-01 17:39:38 +0000
committerTarmac <Unknown>2012-10-01 17:39:38 +0000
commit8aec4a8be0e8d05d6c58b7657d68de8f039f1d34 (patch)
tree883581dd0c1ee7b7e831553927906429ee64b1d0 /src
parentf5a2bb4a0f3262196be351ac1c0b13a269f52b12 (diff)
parent79a2f85857aface06962f660b7aa975fe3bf58e3 (diff)
downloadayatana-indicator-session-8aec4a8be0e8d05d6c58b7657d68de8f039f1d34.tar.gz
ayatana-indicator-session-8aec4a8be0e8d05d6c58b7657d68de8f039f1d34.tar.bz2
ayatana-indicator-session-8aec4a8be0e8d05d6c58b7657d68de8f039f1d34.zip
Remove the custom menu type for the restart entry. Fixes: https://bugs.launchpad.net/bugs/1058148. Approved by Charles Kerr, Lars Uebernickel.
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c66
-rw-r--r--src/session-menu-mgr.c7
-rw-r--r--src/shared-names.h4
3 files changed, 2 insertions, 75 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 06a5a7b..c100d78 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -80,10 +80,6 @@ static gboolean new_user_item (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
DbusmenuClient * client,
gpointer user_data);
-static gboolean build_restart_item (DbusmenuMenuitem * newitem,
- DbusmenuMenuitem * parent,
- DbusmenuClient * client,
- gpointer user_data);
static void on_menu_layout_updated (DbusmenuClient * client, IndicatorSession * session);
static void indicator_session_update_icon_callback (GtkWidget * widget, gpointer callback_data);
static void indicator_session_update_icon_and_a11y (IndicatorSession * self);
@@ -168,9 +164,6 @@ indicator_session_init (IndicatorSession *self)
dbusmenu_client_add_type_handler (self->menu_client,
USER_ITEM_TYPE,
new_user_item);
- dbusmenu_client_add_type_handler (self->menu_client,
- RESTART_ITEM_TYPE,
- build_restart_item);
dbusmenu_gtkclient_set_accel_group (DBUSMENU_GTKCLIENT(self->menu_client),
gtk_accel_group_new());
}
@@ -316,7 +309,6 @@ new_user_item (DbusmenuMenuitem * newitem,
return TRUE;
}
-
static void
user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data)
{
@@ -357,64 +349,6 @@ receive_signal (GDBusProxy * proxy,
}
}
-
-
-
-static void
-restart_property_change (DbusmenuMenuitem * item,
- const gchar * property,
- GVariant * variant,
- gpointer user_data)
-{
- DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT(user_data);
- GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(client, item);
-
- if (g_strcmp0(property, RESTART_ITEM_LABEL) == 0) {
- gtk_menu_item_set_label(gmi, g_variant_get_string(variant, NULL));
- } else if (g_strcmp0(property, RESTART_ITEM_ICON) == 0) {
- GtkWidget * image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(gmi));
-
- GIcon * gicon = g_themed_icon_new_with_default_fallbacks(g_variant_get_string(variant, NULL));
- if (image == NULL) {
- image = gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(gmi), image);
- } else {
- gtk_image_set_from_gicon(GTK_IMAGE(image), gicon, GTK_ICON_SIZE_MENU);
- }
- g_object_unref(G_OBJECT(gicon));
- }
- return;
-}
-
-static gboolean
-build_restart_item (DbusmenuMenuitem * newitem,
- DbusmenuMenuitem * parent,
- DbusmenuClient * client,
- gpointer user_data)
-{
- GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_image_menu_item_new());
- if (gmi == NULL) {
- return FALSE;
- }
-
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
-
- g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(restart_property_change), client);
-
- GVariant * variant;
- variant = dbusmenu_menuitem_property_get_variant(newitem, RESTART_ITEM_LABEL);
- if (variant != NULL) {
- restart_property_change(newitem, RESTART_ITEM_LABEL, variant, client);
- }
-
- variant = dbusmenu_menuitem_property_get_variant(newitem, RESTART_ITEM_ICON);
- if (variant != NULL) {
- restart_property_change(newitem, RESTART_ITEM_ICON, variant, client);
- }
-
- return TRUE;
-}
-
static void
indicator_session_update_users_label (IndicatorSession * self,
const gchar * name)
diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c
index 2800126..f5b5bcf 100644
--- a/src/session-menu-mgr.c
+++ b/src/session-menu-mgr.c
@@ -490,8 +490,7 @@ update_confirmation_labels (SessionMenuMgr * mgr)
mi_set_label (mgr->shutdown_mi, confirm_needed ? _("Shut Down\342\200\246")
: _("Shut Down"));
- dbusmenu_menuitem_property_set (mgr->restart_mi, RESTART_ITEM_LABEL,
- confirm_needed ? _("Restart\342\200\246")
+ mi_set_label (mgr->restart_mi, confirm_needed ? _("Restart\342\200\246")
: _("Restart"));
}
@@ -515,9 +514,7 @@ build_session_menuitems (SessionMenuMgr* mgr)
g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK(action_func_hibernate), mgr);
- mi = mgr->restart_mi = dbusmenu_menuitem_new ();
- mi_set_type (mi, RESTART_ITEM_TYPE);
- dbusmenu_menuitem_property_set (mi, RESTART_ITEM_LABEL, _("Restart\342\200\246"));
+ mi = mgr->restart_mi = mi_new (_("Restart\342\200\246"));
dbusmenu_menuitem_child_append (mgr->top_mi, mi);
g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK(action_func_spawn_async), CMD_RESTART);
diff --git a/src/shared-names.h b/src/shared-names.h
index e82aef8..900fbbe 100644
--- a/src/shared-names.h
+++ b/src/shared-names.h
@@ -36,10 +36,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define USER_ITEM_PROP_ICON "user-item-icon-path"
#define USER_ITEM_ICON_DEFAULT "avatar-default"
-#define RESTART_ITEM_TYPE "x-canonical-restart-item"
-#define RESTART_ITEM_LABEL "restart-label"
-#define RESTART_ITEM_ICON "restart-icon"
-
#define ICON_DEFAULT "system-devices-panel"
#define ICON_INFO "system-devices-panel-information"
#define ICON_ALERT "system-devices-panel-alert"