aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-09-13 15:29:42 +0000
committerTarmac <Unknown>2012-09-13 15:29:42 +0000
commit2496d6700ceb0dc5397ec802853846e95c44373d (patch)
tree63f2b0f8d94a22fda96fb4e46c513956293a7384
parentc4d09268983fca43e7577a38cba7785266809a5d (diff)
parentc6d485032398a1d29889d996ef793f0aeca5d3c3 (diff)
downloadayatana-indicator-session-2496d6700ceb0dc5397ec802853846e95c44373d.tar.gz
ayatana-indicator-session-2496d6700ceb0dc5397ec802853846e95c44373d.tar.bz2
ayatana-indicator-session-2496d6700ceb0dc5397ec802853846e95c44373d.zip
If the system menu's icon is missing in the current theme, fall back to gtk-missing-icon instead of showing no icon at all.. Fixes: https://bugs.launchpad.net/bugs/1048348. Approved by Charles Kerr, jenkins.
-rw-r--r--src/indicator-session.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index aa328dd..71b05a3 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 = "gtk-missing-image";
+
g_debug (G_STRLOC" setting icon to \"%s\"", icon);
gtk_image_set_from_icon_name (GTK_IMAGE(indicator->entry.image),
icon,
@@ -515,6 +527,12 @@ calculate_disposition (IndicatorSession * indicator)
}
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)
{
const int disposition = calculate_disposition (indicator);