diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-session.c | 66 | ||||
-rw-r--r-- | src/session-menu-mgr.c | 7 | ||||
-rw-r--r-- | src/shared-names.h | 4 |
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" |