Merge lp:~larsu/indicator-session/lp1048348 into lp:indicator-session/12.10

Proposed by Lars Karlitski on 2012-09-13
Status: Merged
Approved by: Charles Kerr on 2012-09-13
Approved revision: 358
Merged at revision: 358
Proposed branch: lp:~larsu/indicator-session/lp1048348
Merge into: lp:indicator-session/12.10
Diff against target: 56 lines (+18/-0)
1 file modified
src/indicator-session.c (+18/-0)
To merge this branch: bzr merge lp:~larsu/indicator-session/lp1048348
Reviewer Review Type Date Requested Status
Charles Kerr (community) 2012-09-13 Approve on 2012-09-13
jenkins (community) continuous-integration Approve on 2012-09-13
Review via email: mp+124112@code.launchpad.net

Commit message

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.

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Charles Kerr (charlesk) wrote :

"gtk-missing-image" makes more sense as a fallback than "system-shutdown", but otherwise looks good.

review: Needs Fixing
358. By Lars Karlitski on 2012-09-13

Change fallback icon to "gtk-missing-image"

Lars Karlitski (larsu) wrote :

Thought about it some more and agree with you. Changed it with r358.

jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Charles Kerr (charlesk) :
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-08-31 16:36:06 +0000
3+++ src/indicator-session.c 2012-09-13 13:37:39 +0000
4@@ -64,6 +64,7 @@
5 GDBusProxy * service_proxy;
6 GSettings * settings;
7 DbusmenuClient * menu_client;
8+ GtkIconTheme * icon_theme;
9 };
10
11 static gboolean greeter_mode;
12@@ -84,6 +85,7 @@
13 DbusmenuClient * client,
14 gpointer user_data);
15 static void on_menu_layout_updated (DbusmenuClient * client, IndicatorSession * session);
16+static void indicator_session_update_icon_callback (GtkWidget * widget, gpointer callback_data);
17 static void indicator_session_update_icon_and_a11y (IndicatorSession * self);
18 static void indicator_session_update_users_label (IndicatorSession* self,
19 const gchar* name);
20@@ -135,6 +137,13 @@
21 self->entry.image = GTK_IMAGE (gtk_image_new());
22 self->entry.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME,
23 INDICATOR_SESSION_DBUS_OBJECT));
24+ /* We need to check if the current icon theme has the hard coded icons.
25+ * If not, we'll fall back to a standard icon */
26+ self->icon_theme = gtk_icon_theme_get_default();
27+ g_signal_connect(G_OBJECT(self->icon_theme),
28+ "changed",
29+ G_CALLBACK(indicator_session_update_icon_callback), self);
30+
31 indicator_session_update_icon_and_a11y (self);
32 g_settings_bind (self->settings, "show-real-name-on-panel",
33 self->entry.label, "visible",
34@@ -478,6 +487,9 @@
35 icon = ICON_ALERT;
36 }
37
38+ if (gtk_icon_theme_has_icon (indicator->icon_theme, icon) == FALSE)
39+ icon = "gtk-missing-image";
40+
41 g_debug (G_STRLOC" setting icon to \"%s\"", icon);
42 gtk_image_set_from_icon_name (GTK_IMAGE(indicator->entry.image),
43 icon,
44@@ -515,6 +527,12 @@
45 }
46
47 static void
48+indicator_session_update_icon_callback (GtkWidget * widget, gpointer callback_data)
49+{
50+ indicator_session_update_icon_and_a11y ((IndicatorSession *)callback_data);
51+}
52+
53+static void
54 indicator_session_update_icon_and_a11y (IndicatorSession * indicator)
55 {
56 const int disposition = calculate_disposition (indicator);

Subscribers

People subscribed via source and target branches