summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Kukkonen <jussi.kukkonen@intel.com>2016-06-22 14:52:29 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-01 16:08:44 +0100
commit708cd88608d2407db3d679cb6489dcdad58af5b7 (patch)
treebcf776fe920a2ae0352683a2a6d30dadd36932b3
parent23045bf89d9859d756310899052e9dd1aad302ce (diff)
downloadopenembedded-core-708cd88608d2407db3d679cb6489dcdad58af5b7.tar.gz
openembedded-core-708cd88608d2407db3d679cb6489dcdad58af5b7.tar.bz2
openembedded-core-708cd88608d2407db3d679cb6489dcdad58af5b7.zip
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. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-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 c93e9b4654..279ca05d6f 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 @@
-From a59b0fac02e74a971ac3f08bf28c17ce361a9526 Mon Sep 17 00:00:00 2001
+From 092fe0793b39c6feb6464bfbd568b050960d62c0 Mon Sep 17 00:00:00 2001
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date: Wed, 2 Mar 2016 15:47:49 +0200
Subject: [PATCH] Port to Gtk3
Some unused (or not useful) code was removed, functionality should stay
-the same.
+the same, although applet now loads icons based on actual size available
+to it.
Code still contains quite a few uses of deprecated API.
@@ -12,13 +13,13 @@ Upstream-Status: Submitted
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
applet/agent.c | 3 +--
- applet/main.c | 43 -------------------------------------------
- applet/status.c | 8 --------
+ applet/main.c | 43 ------------------------------
+ applet/status.c | 74 +++++++++++++++++++++++++++++++++------------------
configure.ac | 3 +--
- properties/ethernet.c | 14 +++++++-------
+ properties/ethernet.c | 14 +++++-----
properties/main.c | 2 +-
- properties/wifi.c | 12 ++++++------
- 7 files changed, 16 insertions(+), 69 deletions(-)
+ properties/wifi.c | 12 ++++-----
+ 7 files changed, 64 insertions(+), 87 deletions(-)
diff --git a/applet/agent.c b/applet/agent.c
index 65bed08..04fe86a 100644
@@ -42,7 +43,7 @@ index 65bed08..04fe86a 100644
label = gtk_label_new(_("Please provide some network information:"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
diff --git a/applet/main.c b/applet/main.c
-index f12d371..cd16285 100644
+index c7b3c7f..f2ce46b 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name,
@@ -103,10 +104,26 @@ index f12d371..cd16285 100644
"copyright", "Copyright \xc2\xa9 2008 Intel Corporation",
"comments", _("A connection manager for the GNOME desktop"),
diff --git a/applet/status.c b/applet/status.c
-index aed6f1e..015ff29 100644
+index aed6f1e..6ecbf3a 100644
--- a/applet/status.c
+++ b/applet/status.c
-@@ -102,8 +102,6 @@ static void icon_animation_start(IconAnimation *animation,
+@@ -30,13 +30,14 @@
+ static gboolean available = FALSE;
+
+ static GtkStatusIcon *statusicon = NULL;
++static gint icon_size = 0;
+
+ static GdkPixbuf *pixbuf_load(GtkIconTheme *icontheme, const gchar *name)
+ {
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+
+- pixbuf = gtk_icon_theme_load_icon(icontheme, name, 22, 0, &error);
++ pixbuf = gtk_icon_theme_load_icon(icontheme, name, icon_size, 0, &error);
+
+ if (pixbuf == NULL) {
+ g_warning("Missing icon %s: %s", name, error->message);
+@@ -102,8 +103,6 @@ static void icon_animation_start(IconAnimation *animation,
{
available = TRUE;
@@ -115,7 +132,7 @@ index aed6f1e..015ff29 100644
animation->start = start;
animation->end = (end == 0) ? animation->count - 1 : end;
-@@ -120,8 +118,6 @@ static void icon_animation_stop(IconAnimation *animation)
+@@ -120,8 +119,6 @@ static void icon_animation_stop(IconAnimation *animation)
{
available = TRUE;
@@ -124,7 +141,96 @@ index aed6f1e..015ff29 100644
if (animation->id > 0)
g_source_remove(animation->id);
-@@ -251,8 +247,6 @@ void status_unavailable(void)
+@@ -190,6 +187,42 @@ static GdkPixbuf *pixbuf_none;
+ static GdkPixbuf *pixbuf_wired;
+ static GdkPixbuf *pixbuf_signal[5];
+
++static void
++load_icons (gint size)
++{
++ // educated guess to preload correct size
++ if (size == 0)
++ size = 34;
++
++ if (icon_size == size)
++ return;
++
++ icon_size = size;
++
++ if(pixbuf_none)
++ status_cleanup();
++
++ g_debug ("Loading icons at size %d", icon_size);
++ animation = icon_animation_load(icontheme, "connman-connecting", 33);
++ pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
++ pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
++ pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
++ pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
++ pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
++
++ pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
++ pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
++ pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
++}
++
++static gboolean
++size_changed_cb (GtkStatusIcon *statusicon,
++ gint size,
++ gpointer user_data)
++{
++ load_icons (size);
++}
++
+ int status_init(StatusCallback activate, GtkWidget *popup)
+ {
+ GdkScreen *screen;
+@@ -204,17 +237,9 @@ int status_init(StatusCallback activate, GtkWidget *popup)
+
+ gtk_icon_theme_append_search_path(icontheme, ICONDIR);
+
+- animation = icon_animation_load(icontheme, "connman-connecting", 33);
+-
+- pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
+- pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
+- pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
+- pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
+- pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
+-
+- pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
+- pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
+- pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
++ g_signal_connect (statusicon, "size-changed",
++ G_CALLBACK(size_changed_cb), NULL);
++ load_icons (gtk_status_icon_get_size (statusicon));
+
+ if (activate != NULL)
+ g_signal_connect(statusicon, "activate",
+@@ -231,17 +256,18 @@ void status_cleanup(void)
+ int i;
+
+ icon_animation_free(animation);
++ animation = NULL;
+
+ for (i = 0; i < 5; i++)
+- g_object_unref(pixbuf_signal[i]);
++ g_clear_object(&pixbuf_signal[i]);
+
+- g_object_unref(pixbuf_none);
+- g_object_unref(pixbuf_wired);
+- g_object_unref(pixbuf_notifier);
++ g_clear_object(&pixbuf_none);
++ g_clear_object(&pixbuf_wired);
++ g_clear_object(&pixbuf_notifier);
+
+- g_object_unref(icontheme);
++ g_clear_object(&icontheme);
+
+- g_object_unref(statusicon);
++ g_clear_object(&statusicon);
+ }
+
+ void status_unavailable(void)
+@@ -251,8 +277,6 @@ void status_unavailable(void)
available = FALSE;
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier);
@@ -133,7 +239,7 @@ index aed6f1e..015ff29 100644
gtk_status_icon_set_visible(statusicon, TRUE);
}
-@@ -299,7 +293,6 @@ static void set_ready(gint signal)
+@@ -299,7 +323,6 @@ static void set_ready(gint signal)
if (signal < 0) {
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired);
@@ -141,7 +247,7 @@ index aed6f1e..015ff29 100644
return;
}
-@@ -311,7 +304,6 @@ static void set_ready(gint signal)
+@@ -311,7 +334,6 @@ static void set_ready(gint signal)
index = 4;
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]);
@@ -273,5 +379,5 @@ index bd325ef..a5827e0 100644
}
break;
--
-2.8.1
+2.1.4