diff options
-rw-r--r-- | meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch | 136 |
1 files changed, 15 insertions, 121 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 279ca05d6f..c93e9b4654 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,11 +1,10 @@ | |||
1 | From 092fe0793b39c6feb6464bfbd568b050960d62c0 Mon Sep 17 00:00:00 2001 | 1 | From a59b0fac02e74a971ac3f08bf28c17ce361a9526 Mon Sep 17 00:00:00 2001 |
2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> | 2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> |
3 | Date: Wed, 2 Mar 2016 15:47:49 +0200 | 3 | Date: Wed, 2 Mar 2016 15:47:49 +0200 |
4 | Subject: [PATCH] Port to Gtk3 | 4 | Subject: [PATCH] Port to Gtk3 |
5 | 5 | ||
6 | Some unused (or not useful) code was removed, functionality should stay | 6 | Some unused (or not useful) code was removed, functionality should stay |
7 | the same, although applet now loads icons based on actual size available | 7 | the same. |
8 | to it. | ||
9 | 8 | ||
10 | Code still contains quite a few uses of deprecated API. | 9 | Code still contains quite a few uses of deprecated API. |
11 | 10 | ||
@@ -13,13 +12,13 @@ Upstream-Status: Submitted | |||
13 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | 12 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> |
14 | --- | 13 | --- |
15 | applet/agent.c | 3 +-- | 14 | applet/agent.c | 3 +-- |
16 | applet/main.c | 43 ------------------------------ | 15 | applet/main.c | 43 ------------------------------------------- |
17 | applet/status.c | 74 +++++++++++++++++++++++++++++++++------------------ | 16 | applet/status.c | 8 -------- |
18 | configure.ac | 3 +-- | 17 | configure.ac | 3 +-- |
19 | properties/ethernet.c | 14 +++++----- | 18 | properties/ethernet.c | 14 +++++++------- |
20 | properties/main.c | 2 +- | 19 | properties/main.c | 2 +- |
21 | properties/wifi.c | 12 ++++----- | 20 | properties/wifi.c | 12 ++++++------ |
22 | 7 files changed, 64 insertions(+), 87 deletions(-) | 21 | 7 files changed, 16 insertions(+), 69 deletions(-) |
23 | 22 | ||
24 | diff --git a/applet/agent.c b/applet/agent.c | 23 | diff --git a/applet/agent.c b/applet/agent.c |
25 | index 65bed08..04fe86a 100644 | 24 | index 65bed08..04fe86a 100644 |
@@ -43,7 +42,7 @@ index 65bed08..04fe86a 100644 | |||
43 | label = gtk_label_new(_("Please provide some network information:")); | 42 | label = gtk_label_new(_("Please provide some network information:")); |
44 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); | 43 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); |
45 | diff --git a/applet/main.c b/applet/main.c | 44 | diff --git a/applet/main.c b/applet/main.c |
46 | index c7b3c7f..f2ce46b 100644 | 45 | index f12d371..cd16285 100644 |
47 | --- a/applet/main.c | 46 | --- a/applet/main.c |
48 | +++ b/applet/main.c | 47 | +++ b/applet/main.c |
49 | @@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name, | 48 | @@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name, |
@@ -104,26 +103,10 @@ index c7b3c7f..f2ce46b 100644 | |||
104 | "copyright", "Copyright \xc2\xa9 2008 Intel Corporation", | 103 | "copyright", "Copyright \xc2\xa9 2008 Intel Corporation", |
105 | "comments", _("A connection manager for the GNOME desktop"), | 104 | "comments", _("A connection manager for the GNOME desktop"), |
106 | diff --git a/applet/status.c b/applet/status.c | 105 | diff --git a/applet/status.c b/applet/status.c |
107 | index aed6f1e..6ecbf3a 100644 | 106 | index aed6f1e..015ff29 100644 |
108 | --- a/applet/status.c | 107 | --- a/applet/status.c |
109 | +++ b/applet/status.c | 108 | +++ b/applet/status.c |
110 | @@ -30,13 +30,14 @@ | 109 | @@ -102,8 +102,6 @@ static void icon_animation_start(IconAnimation *animation, |
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, | ||
127 | { | 110 | { |
128 | available = TRUE; | 111 | available = TRUE; |
129 | 112 | ||
@@ -132,7 +115,7 @@ index aed6f1e..6ecbf3a 100644 | |||
132 | animation->start = start; | 115 | animation->start = start; |
133 | animation->end = (end == 0) ? animation->count - 1 : end; | 116 | animation->end = (end == 0) ? animation->count - 1 : end; |
134 | 117 | ||
135 | @@ -120,8 +119,6 @@ static void icon_animation_stop(IconAnimation *animation) | 118 | @@ -120,8 +118,6 @@ static void icon_animation_stop(IconAnimation *animation) |
136 | { | 119 | { |
137 | available = TRUE; | 120 | available = TRUE; |
138 | 121 | ||
@@ -141,96 +124,7 @@ index aed6f1e..6ecbf3a 100644 | |||
141 | if (animation->id > 0) | 124 | if (animation->id > 0) |
142 | g_source_remove(animation->id); | 125 | g_source_remove(animation->id); |
143 | 126 | ||
144 | @@ -190,6 +187,42 @@ static GdkPixbuf *pixbuf_none; | 127 | @@ -251,8 +247,6 @@ void status_unavailable(void) |
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) | ||
234 | available = FALSE; | 128 | available = FALSE; |
235 | 129 | ||
236 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier); | 130 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier); |
@@ -239,7 +133,7 @@ index aed6f1e..6ecbf3a 100644 | |||
239 | 133 | ||
240 | gtk_status_icon_set_visible(statusicon, TRUE); | 134 | gtk_status_icon_set_visible(statusicon, TRUE); |
241 | } | 135 | } |
242 | @@ -299,7 +323,6 @@ static void set_ready(gint signal) | 136 | @@ -299,7 +293,6 @@ static void set_ready(gint signal) |
243 | 137 | ||
244 | if (signal < 0) { | 138 | if (signal < 0) { |
245 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired); | 139 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired); |
@@ -247,7 +141,7 @@ index aed6f1e..6ecbf3a 100644 | |||
247 | return; | 141 | return; |
248 | } | 142 | } |
249 | 143 | ||
250 | @@ -311,7 +334,6 @@ static void set_ready(gint signal) | 144 | @@ -311,7 +304,6 @@ static void set_ready(gint signal) |
251 | index = 4; | 145 | index = 4; |
252 | 146 | ||
253 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]); | 147 | gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]); |
@@ -379,5 +273,5 @@ index bd325ef..a5827e0 100644 | |||
379 | } | 273 | } |
380 | break; | 274 | break; |
381 | -- | 275 | -- |
382 | 2.1.4 | 276 | 2.8.1 |
383 | 277 | ||