From 21ec8b711eaf32e125760af2dbe5b3030e509441 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Wed, 12 Sep 2012 10:49:45 -0700 Subject: Revert en_GB localization to 'Switch Off'; this needs to be done in the translation, with the UI kept in en_US. --- src/dialog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dialog.c b/src/dialog.c index 7c562d5..eb91f57 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -34,7 +34,7 @@ with this program. If not, see . static const gchar * title_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("title", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("title", "Restart"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Switch Off") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Shut Down") }; static const gchar * body_strings[LOGOUT_DIALOG_TYPE_CNT] = { @@ -46,7 +46,7 @@ static const gchar * body_strings[LOGOUT_DIALOG_TYPE_CNT] = { static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("button", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("button", "Restart"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Switch Off") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Shut Down") }; /* TRANSLATORS: These strings have an ellipsis so that the user knows @@ -54,7 +54,7 @@ static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = { static const gchar * button_auth_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("button auth", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("button auth", "Restart…"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button auth", "Switch Off…") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button auth", "Shut Down…") }; /* TRANSLATORS: This button appears on the logout dialog when -- cgit v1.2.3 From c7398986a6a83033bcb2f90ab37fb30622160d6c Mon Sep 17 00:00:00 2001 From: Xiao-Long Chen Date: Thu, 13 Sep 2012 09:27:06 +0200 Subject: Add fallback to "system-shutdown" icon Thanks Xiao-Long! --- src/indicator-session.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index aa328dd..de58a20 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -64,6 +64,7 @@ struct _IndicatorSession GDBusProxy * service_proxy; GSettings * settings; DbusmenuClient * menu_client; + GtkIconTheme * icon_theme; }; static gboolean greeter_mode; @@ -84,6 +85,7 @@ static gboolean build_restart_item (DbusmenuMenuitem * newitem, 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); static void indicator_session_update_users_label (IndicatorSession* self, const gchar* name); @@ -135,6 +137,13 @@ indicator_session_init (IndicatorSession *self) self->entry.image = GTK_IMAGE (gtk_image_new()); self->entry.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + /* We need to check if the current icon theme has the hard coded icons. + * If not, we'll fall back to a standard icon */ + self->icon_theme = gtk_icon_theme_get_default(); + g_signal_connect(G_OBJECT(self->icon_theme), + "changed", + G_CALLBACK(indicator_session_update_icon_callback), self); + indicator_session_update_icon_and_a11y (self); g_settings_bind (self->settings, "show-real-name-on-panel", self->entry.label, "visible", @@ -478,6 +487,9 @@ indicator_session_update_icon_from_disposition (IndicatorSession * indicator, icon = ICON_ALERT; } + if (gtk_icon_theme_has_icon (indicator->icon_theme, icon) == FALSE) + icon = "system-shutdown"; // or some other fallback icon + g_debug (G_STRLOC" setting icon to \"%s\"", icon); gtk_image_set_from_icon_name (GTK_IMAGE(indicator->entry.image), icon, @@ -514,6 +526,12 @@ calculate_disposition (IndicatorSession * indicator) return ret; } +static void +indicator_session_update_icon_callback (GtkWidget * widget, gpointer callback_data) +{ + indicator_session_update_icon_and_a11y ((IndicatorSession *)callback_data); +} + static void indicator_session_update_icon_and_a11y (IndicatorSession * indicator) { -- cgit v1.2.3 From 52597f6fd10bc5a6674218a2ab620a3f64584a01 Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Thu, 13 Sep 2012 12:45:34 +0200 Subject: make Suspend translatable --- src/session-menu-mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index 643abd1..cfb907b 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -506,7 +506,7 @@ build_session_menuitems (SessionMenuMgr* mgr) g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(action_func_spawn_async), CMD_LOGOUT); - mi = mgr->suspend_mi = mi_new ("Suspend"); + mi = mgr->suspend_mi = mi_new (_("Suspend")); dbusmenu_menuitem_child_append (mgr->top_mi, mi); g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(action_func_suspend), mgr); -- cgit v1.2.3 From c6d485032398a1d29889d996ef793f0aeca5d3c3 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 13 Sep 2012 15:27:35 +0200 Subject: Change fallback icon to "gtk-missing-image" --- src/indicator-session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index de58a20..71b05a3 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -488,7 +488,7 @@ indicator_session_update_icon_from_disposition (IndicatorSession * indicator, } if (gtk_icon_theme_has_icon (indicator->icon_theme, icon) == FALSE) - icon = "system-shutdown"; // or some other fallback icon + icon = "gtk-missing-image"; g_debug (G_STRLOC" setting icon to \"%s\"", icon); gtk_image_set_from_icon_name (GTK_IMAGE(indicator->entry.image), -- cgit v1.2.3 From cf87a398189c2f64a5b60e910da382a613fed9f0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 18 Sep 2012 11:09:15 -0500 Subject: Still using 'switch off' instead of 'shut down' in the default text in session-menu-mgr.c --- src/session-menu-mgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index cfb907b..f6cd038 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -488,8 +488,8 @@ update_confirmation_labels (SessionMenuMgr * mgr) mi_set_label (mgr->logout_mi, confirm_needed ? _("Log Out\342\200\246") : _("Log Out")); - mi_set_label (mgr->shutdown_mi, confirm_needed ? _("Switch Off\342\200\246") - : _("Switch Off")); + 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") @@ -523,7 +523,7 @@ build_session_menuitems (SessionMenuMgr* mgr) g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(action_func_spawn_async), CMD_RESTART); - mi = mgr->shutdown_mi = mi_new (_("Switch Off\342\200\246")); + mi = mgr->shutdown_mi = mi_new (_("Shut Down\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_SHUTDOWN); -- cgit v1.2.3 From e2f76a71222f95d422de46dfce8aa61c7a9e9943 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 18 Sep 2012 11:10:10 -0500 Subject: add AM_V_GEN to the gdbus-codegen invocation for prettier silent-rules invocation --- src/Makefile.am | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index cd82812..bcc8652 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,7 @@ dbus_display_manager_sources = \ dbus-display-manager.h $(dbus_display_manager_sources): display-manager.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-display-manager \ $^ @@ -48,7 +48,7 @@ dbus_consolekit_manager_sources = \ dbus-consolekit-manager.h $(dbus_consolekit_manager_sources): org.freedesktop.ConsoleKit.Manager.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-consolekit-manager \ $^ @@ -58,7 +58,7 @@ dbus_consolekit_seat_sources = \ dbus-consolekit-seat.h $(dbus_consolekit_seat_sources): org.freedesktop.ConsoleKit.Seat.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-consolekit-seat \ $^ @@ -68,7 +68,7 @@ dbus_consolekit_session_sources = \ dbus-consolekit-session.h $(dbus_consolekit_session_sources): org.freedesktop.ConsoleKit.Session.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-consolekit-session \ $^ @@ -78,7 +78,7 @@ dbus_accounts_sources = \ dbus-accounts.h $(dbus_accounts_sources): org.freedesktop.Accounts.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-accounts \ $^ @@ -88,7 +88,7 @@ dbus_user_sources = \ dbus-user.h $(dbus_user_sources): org.freedesktop.Accounts.User.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-user \ $^ @@ -98,7 +98,7 @@ dbus_upower_sources = \ dbus-upower.h $(dbus_upower_sources): upower.xml - gdbus-codegen \ + $(AM_V_GEN) gdbus-codegen \ --interface-prefix org.freedesktop \ --generate-c-code dbus-upower \ --c-namespace DBus \ -- cgit v1.2.3 From 83b681bc23b7f8d571b0b57a077b56859041b63f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 18 Sep 2012 19:10:35 -0500 Subject: don't unconditionally show the user menuitems ... let dbusmenu's code process the menuitem's VISIBLE property --- src/indicator-session.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 71b05a3..06a5a7b 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -313,8 +313,6 @@ new_user_item (DbusmenuMenuitem * newitem, g_debug ("%s (\"%s\")", __func__, dbusmenu_menuitem_property_get (newitem, USER_ITEM_PROP_NAME)); - gtk_widget_show_all (user_item); - return TRUE; } -- cgit v1.2.3 From 6db75f9ca01326ea608c59f2fa664f57742ec035 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Sep 2012 15:34:05 -0500 Subject: Removing handling for the restart item type --- src/indicator-session.c | 66 ------------------------------------------------- 1 file changed, 66 deletions(-) (limited to 'src') 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) -- cgit v1.2.3 From 1c274a4a72b9823be37828daf23c19fb16eedebb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Sep 2012 15:37:20 -0500 Subject: Make the restart item a normal one --- src/session-menu-mgr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index f6cd038..c6ae5b5 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -491,8 +491,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")); } @@ -516,9 +515,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); -- cgit v1.2.3 From 79a2f85857aface06962f660b7aa975fe3bf58e3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Sep 2012 15:37:44 -0500 Subject: Drop the defines --- src/shared-names.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') 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 . #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" -- cgit v1.2.3 From de629aa168803833613881b954cb033089a2dd45 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 28 Sep 2012 16:22:25 -0500 Subject: Move the upower init to after the items are created --- src/session-menu-mgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index f6cd038..2800126 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -318,7 +318,6 @@ init_upower_proxy (SessionMenuMgr * mgr) g_clear_error (&error); } - on_upower_properties_changed (mgr); g_signal_connect_swapped (mgr->upower_proxy, "changed", G_CALLBACK(on_upower_properties_changed), mgr); } @@ -1193,6 +1192,11 @@ session_menu_mgr_new (SessionDbus * session_dbus, mgr->user_menuitem_index = n; update_user_menuitems (mgr); build_session_menuitems (mgr); + + /* After we have the session menu items built we can look to + align them with UPower */ + on_upower_properties_changed (mgr); + return mgr; } -- cgit v1.2.3