Merge lp:~kklimonda/indicator-application/lp-547072 into lp:indicator-application/0.4

Proposed by Krzysztof Klimonda
Status: Merged
Merged at revision: not available
Proposed branch: lp:~kklimonda/indicator-application/lp-547072
Merge into: lp:indicator-application/0.4
Prerequisite: lp:~kklimonda/indicator-application/lp-532858
Diff against target: 100 lines (+31/-3)
1 file modified
src/libappindicator/app-indicator.c (+31/-3)
To merge this branch: bzr merge lp:~kklimonda/indicator-application/lp-547072
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+22163@code.launchpad.net

Description of the change

Fixes bug 547072 by making a GtkStatusIcon use the same mechanism to choose the right icon as indicator-application uses.

To post a comment you must log in.
111. By Krzysztof Klimonda

Make app_indicator_set_property also set the suffixed icon_name.

112. By Krzysztof Klimonda

use gchar instead of for the clarity

Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/libappindicator/app-indicator.c'
2--- src/libappindicator/app-indicator.c 2010-03-19 21:46:41 +0000
3+++ src/libappindicator/app-indicator.c 2010-03-25 18:58:25 +0000
4@@ -43,6 +43,8 @@
5
6 #include "dbus-shared.h"
7
8+#define PANEL_ICON_SUFFIX "panel"
9+
10 /**
11 AppIndicatorPrivate:
12 @id: The ID of the indicator. Maps to AppIndicator::id.
13@@ -140,6 +142,7 @@
14 static void status_icon_changes (AppIndicator * self, gpointer data);
15 static void status_icon_activate (GtkStatusIcon * icon, gpointer data);
16 static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
17+static gchar * append_panel_icon_suffix (const gchar * icon_name);
18 static void watcher_proxy_destroyed (GObject * object, gpointer data);
19 static void client_menu_changed (GtkWidget *widget, GtkWidget *child, AppIndicator *indicator);
20 static void submenu_changed (GtkWidget *widget, GtkWidget *child, gpointer data);
21@@ -450,6 +453,7 @@
22 {
23 AppIndicator *self = APP_INDICATOR (object);
24 AppIndicatorPrivate *priv = self->priv;
25+ gchar *long_name;
26 const gchar *instr;
27 GEnumValue *enum_val;
28
29@@ -500,7 +504,8 @@
30 if (priv->icon_name)
31 g_free (priv->icon_name);
32
33- priv->icon_name = g_strdup (instr);
34+ long_name = append_panel_icon_suffix (instr);
35+ priv->icon_name = long_name;
36
37 g_signal_emit (self, signals[NEW_ICON], 0, TRUE);
38 }
39@@ -900,6 +905,23 @@
40 return;
41 }
42
43+/* A helper function that appends PANEL_ICON_SUFFIX to the given icon name
44+ if it's missing. */
45+static gchar *
46+append_panel_icon_suffix (const gchar *icon_name)
47+{
48+ gchar * long_name = NULL;
49+
50+ if (!g_str_has_suffix (icon_name, PANEL_ICON_SUFFIX)) {
51+ long_name =
52+ g_strdup_printf("%s-%s", icon_name, PANEL_ICON_SUFFIX);
53+ } else {
54+ long_name = g_strdup (icon_name);
55+ }
56+
57+ return long_name;
58+}
59+
60
61 /* ************************* */
62 /* Public Functions */
63@@ -1001,6 +1023,8 @@
64 void
65 app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name)
66 {
67+ gchar *long_name;
68+
69 g_return_if_fail (IS_APP_INDICATOR (self));
70 g_return_if_fail (icon_name != NULL);
71
72@@ -1009,7 +1033,8 @@
73 if (self->priv->attention_icon_name)
74 g_free (self->priv->attention_icon_name);
75
76- self->priv->attention_icon_name = g_strdup (icon_name);
77+ long_name = append_panel_icon_suffix (icon_name);
78+ self->priv->attention_icon_name = long_name;
79
80 g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE);
81 }
82@@ -1027,6 +1052,8 @@
83 void
84 app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
85 {
86+ gchar *long_name;
87+
88 g_return_if_fail (IS_APP_INDICATOR (self));
89 g_return_if_fail (icon_name != NULL);
90
91@@ -1035,7 +1062,8 @@
92 if (self->priv->icon_name)
93 g_free (self->priv->icon_name);
94
95- self->priv->icon_name = g_strdup (icon_name);
96+ long_name = append_panel_icon_suffix (icon_name);
97+ self->priv->icon_name = long_name;
98
99 g_signal_emit (self, signals[NEW_ICON], 0, TRUE);
100 }

Subscribers

People subscribed via source and target branches