summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman
diff options
context:
space:
mode:
authorJussi Kukkonen <jussi.kukkonen@intel.com>2016-06-22 11:52:29 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-01 15:22:42 (GMT)
commita3869bfe910ae051426d45a904473a87a4ed45a4 (patch)
tree98bfee36699fe31d541c0f0b4214cd7ee1fac874 /meta/recipes-connectivity/connman
parent0cef80f7b1f36d338697418298c999d90492abce (diff)
downloadpoky-a3869bfe910ae051426d45a904473a87a4ed45a4.tar.gz
connman-gnome: StatusIcon adapts to size changes
Update the Gtk3 patch to make the StatusIcon load pixbufs at (more) correct sizes -- Gtk3 does not seem to reliably position the icon otherwise. (From OE-Core rev: 708cd88608d2407db3d679cb6489dcdad58af5b7) Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/connman')
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch136
1 files changed, 121 insertions, 15 deletions
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch b/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
index c93e9b4..279ca05 100644
--- a/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
+++ b/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
@@ -1,10 +1,11 @@
1From a59b0fac02e74a971ac3f08bf28c17ce361a9526 Mon Sep 17 00:00:00 2001 1From 092fe0793b39c6feb6464bfbd568b050960d62c0 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com> 2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Wed, 2 Mar 2016 15:47:49 +0200 3Date: Wed, 2 Mar 2016 15:47:49 +0200
4Subject: [PATCH] Port to Gtk3 4Subject: [PATCH] Port to Gtk3
5 5
6Some unused (or not useful) code was removed, functionality should stay 6Some unused (or not useful) code was removed, functionality should stay
7the same. 7the same, although applet now loads icons based on actual size available
8to it.
8 9
9Code still contains quite a few uses of deprecated API. 10Code still contains quite a few uses of deprecated API.
10 11
@@ -12,13 +13,13 @@ Upstream-Status: Submitted
12Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> 13Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
13--- 14---
14 applet/agent.c | 3 +-- 15 applet/agent.c | 3 +--
15 applet/main.c | 43 ------------------------------------------- 16 applet/main.c | 43 ------------------------------
16 applet/status.c | 8 -------- 17 applet/status.c | 74 +++++++++++++++++++++++++++++++++------------------
17 configure.ac | 3 +-- 18 configure.ac | 3 +--
18 properties/ethernet.c | 14 +++++++------- 19 properties/ethernet.c | 14 +++++-----
19 properties/main.c | 2 +- 20 properties/main.c | 2 +-
20 properties/wifi.c | 12 ++++++------ 21 properties/wifi.c | 12 ++++-----
21 7 files changed, 16 insertions(+), 69 deletions(-) 22 7 files changed, 64 insertions(+), 87 deletions(-)
22 23
23diff --git a/applet/agent.c b/applet/agent.c 24diff --git a/applet/agent.c b/applet/agent.c
24index 65bed08..04fe86a 100644 25index 65bed08..04fe86a 100644
@@ -42,7 +43,7 @@ index 65bed08..04fe86a 100644
42 label = gtk_label_new(_("Please provide some network information:")); 43 label = gtk_label_new(_("Please provide some network information:"));
43 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); 44 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
44diff --git a/applet/main.c b/applet/main.c 45diff --git a/applet/main.c b/applet/main.c
45index f12d371..cd16285 100644 46index c7b3c7f..f2ce46b 100644
46--- a/applet/main.c 47--- a/applet/main.c
47+++ b/applet/main.c 48+++ b/applet/main.c
48@@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name, 49@@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name,
@@ -103,10 +104,26 @@ index f12d371..cd16285 100644
103 "copyright", "Copyright \xc2\xa9 2008 Intel Corporation", 104 "copyright", "Copyright \xc2\xa9 2008 Intel Corporation",
104 "comments", _("A connection manager for the GNOME desktop"), 105 "comments", _("A connection manager for the GNOME desktop"),
105diff --git a/applet/status.c b/applet/status.c 106diff --git a/applet/status.c b/applet/status.c
106index aed6f1e..015ff29 100644 107index aed6f1e..6ecbf3a 100644
107--- a/applet/status.c 108--- a/applet/status.c
108+++ b/applet/status.c 109+++ b/applet/status.c
109@@ -102,8 +102,6 @@ static void icon_animation_start(IconAnimation *animation, 110@@ -30,13 +30,14 @@
111 static gboolean available = FALSE;
112
113 static GtkStatusIcon *statusicon = NULL;
114+static gint icon_size = 0;
115
116 static GdkPixbuf *pixbuf_load(GtkIconTheme *icontheme, const gchar *name)
117 {
118 GdkPixbuf *pixbuf;
119 GError *error = NULL;
120
121- pixbuf = gtk_icon_theme_load_icon(icontheme, name, 22, 0, &error);
122+ pixbuf = gtk_icon_theme_load_icon(icontheme, name, icon_size, 0, &error);
123
124 if (pixbuf == NULL) {
125 g_warning("Missing icon %s: %s", name, error->message);
126@@ -102,8 +103,6 @@ static void icon_animation_start(IconAnimation *animation,
110 { 127 {
111 available = TRUE; 128 available = TRUE;
112 129
@@ -115,7 +132,7 @@ index aed6f1e..015ff29 100644
115 animation->start = start; 132 animation->start = start;
116 animation->end = (end == 0) ? animation->count - 1 : end; 133 animation->end = (end == 0) ? animation->count - 1 : end;
117 134
118@@ -120,8 +118,6 @@ static void icon_animation_stop(IconAnimation *animation) 135@@ -120,8 +119,6 @@ static void icon_animation_stop(IconAnimation *animation)
119 { 136 {
120 available = TRUE; 137 available = TRUE;
121 138
@@ -124,7 +141,96 @@ index aed6f1e..015ff29 100644
124 if (animation->id > 0) 141 if (animation->id > 0)
125 g_source_remove(animation->id); 142 g_source_remove(animation->id);
126 143
127@@ -251,8 +247,6 @@ void status_unavailable(void) 144@@ -190,6 +187,42 @@ static GdkPixbuf *pixbuf_none;
145 static GdkPixbuf *pixbuf_wired;
146 static GdkPixbuf *pixbuf_signal[5];
147
148+static void
149+load_icons (gint size)
150+{
151+ // educated guess to preload correct size
152+ if (size == 0)
153+ size = 34;
154+
155+ if (icon_size == size)
156+ return;
157+
158+ icon_size = size;
159+
160+ if(pixbuf_none)
161+ status_cleanup();
162+
163+ g_debug ("Loading icons at size %d", icon_size);
164+ animation = icon_animation_load(icontheme, "connman-connecting", 33);
165+ pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
166+ pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
167+ pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
168+ pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
169+ pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
170+
171+ pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
172+ pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
173+ pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
174+}
175+
176+static gboolean
177+size_changed_cb (GtkStatusIcon *statusicon,
178+ gint size,
179+ gpointer user_data)
180+{
181+ load_icons (size);
182+}
183+
184 int status_init(StatusCallback activate, GtkWidget *popup)
185 {
186 GdkScreen *screen;
187@@ -204,17 +237,9 @@ int status_init(StatusCallback activate, GtkWidget *popup)
188
189 gtk_icon_theme_append_search_path(icontheme, ICONDIR);
190
191- animation = icon_animation_load(icontheme, "connman-connecting", 33);
192-
193- pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
194- pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
195- pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
196- pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
197- pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
198-
199- pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
200- pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
201- pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
202+ g_signal_connect (statusicon, "size-changed",
203+ G_CALLBACK(size_changed_cb), NULL);
204+ load_icons (gtk_status_icon_get_size (statusicon));
205
206 if (activate != NULL)
207 g_signal_connect(statusicon, "activate",
208@@ -231,17 +256,18 @@ void status_cleanup(void)
209 int i;
210
211 icon_animation_free(animation);
212+ animation = NULL;
213
214 for (i = 0; i < 5; i++)
215- g_object_unref(pixbuf_signal[i]);
216+ g_clear_object(&pixbuf_signal[i]);
217
218- g_object_unref(pixbuf_none);
219- g_object_unref(pixbuf_wired);
220- g_object_unref(pixbuf_notifier);
221+ g_clear_object(&pixbuf_none);
222+ g_clear_object(&pixbuf_wired);
223+ g_clear_object(&pixbuf_notifier);
224
225- g_object_unref(icontheme);
226+ g_clear_object(&icontheme);
227
228- g_object_unref(statusicon);
229+ g_clear_object(&statusicon);
230 }
231
232 void status_unavailable(void)
233@@ -251,8 +277,6 @@ void status_unavailable(void)
128 available = FALSE; 234 available = FALSE;
129 235
130 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier); 236 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier);
@@ -133,7 +239,7 @@ index aed6f1e..015ff29 100644
133 239
134 gtk_status_icon_set_visible(statusicon, TRUE); 240 gtk_status_icon_set_visible(statusicon, TRUE);
135 } 241 }
136@@ -299,7 +293,6 @@ static void set_ready(gint signal) 242@@ -299,7 +323,6 @@ static void set_ready(gint signal)
137 243
138 if (signal < 0) { 244 if (signal < 0) {
139 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired); 245 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired);
@@ -141,7 +247,7 @@ index aed6f1e..015ff29 100644
141 return; 247 return;
142 } 248 }
143 249
144@@ -311,7 +304,6 @@ static void set_ready(gint signal) 250@@ -311,7 +334,6 @@ static void set_ready(gint signal)
145 index = 4; 251 index = 4;
146 252
147 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]); 253 gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]);
@@ -273,5 +379,5 @@ index bd325ef..a5827e0 100644
273 } 379 }
274 break; 380 break;
275-- 381--
2762.8.1 3822.1.4
277 383