From 636b9f97d012198242832a74ac70a471098a66c8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 11:45:53 -0600 Subject: Adding in an image helper library. --- .bzrignore | 1 + libindicator/Makefile.am | 2 ++ libindicator/indicator-image-helper.c | 12 ++++++++++++ libindicator/indicator-image-helper.h | 31 +++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 libindicator/indicator-image-helper.c create mode 100644 libindicator/indicator-image-helper.h diff --git a/.bzrignore b/.bzrignore index 5d1c40e..38d60ed 100644 --- a/.bzrignore +++ b/.bzrignore @@ -151,3 +151,4 @@ libindicator/libindicator_la-indicator-desktop-shortcuts.lo tests/test-desktop-shortcuts tests/test-desktop-shortcuts-tester tests/test-desktop-shortcuts-touch-test +libindicator/libindicator_la-indicator-image-helper.lo diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am index 467e09a..890160c 100644 --- a/libindicator/Makefile.am +++ b/libindicator/Makefile.am @@ -11,6 +11,7 @@ libindicatorincludedir=$(includedir)/libindicator-0.3/libindicator indicator_headers = \ indicator.h \ indicator-desktop-shortcuts.h \ + indicator-image-helper.h \ indicator-object.h \ indicator-service.h \ indicator-service-manager.h @@ -26,6 +27,7 @@ libindicator_la_SOURCES = \ dbus-shared.h \ indicator-object.c \ indicator-desktop-shortcuts.c \ + indicator-image-helper.c \ indicator-object-marshal.h \ indicator-object-marshal.c \ indicator-service.c \ diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c new file mode 100644 index 0000000..9d487fd --- /dev/null +++ b/libindicator/indicator-image-helper.c @@ -0,0 +1,12 @@ + +#include "indicator-image-helper.h" + +GtkImage * +indicator_image_helper (const gchar * name) +{ + g_return_val_if_fail(name != NULL, NULL); + g_return_val_if_fail(name[0] != '\0', NULL); + + + return NULL; +} diff --git a/libindicator/indicator-image-helper.h b/libindicator/indicator-image-helper.h new file mode 100644 index 0000000..fed02dc --- /dev/null +++ b/libindicator/indicator-image-helper.h @@ -0,0 +1,31 @@ +/* +A little helper to make a themed image with fallbacks that +is only constrained in the vertical dimention. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +. +*/ + +#ifndef __INDICATOR_IMAGE_HELPER_H__ +#define __INDICATOR_IMAGE_HELPER_H__ + +#include + +GtkImage * indicator_image_helper (const gchar * name); + +#endif /* __INDICATOR_IMAGE_HELPER_H__ */ -- cgit v1.2.3 From 48e8a34c8d54500bfa7b303d36d9cca9c8348ccf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 12:29:30 -0600 Subject: Fleshing out the image loading function. --- libindicator/indicator-image-helper.c | 51 ++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 9d487fd..3bc25a2 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -1,12 +1,61 @@ #include "indicator-image-helper.h" +const gchar * INDICATOR_NAMES_DATA = "indicator-names-data"; + GtkImage * indicator_image_helper (const gchar * name) { g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name[0] != '\0', NULL); + /* Get the default theme */ + GtkIconTheme * default_theme = gtk_icon_theme_get_default(); + g_return_val_if_fail(default_theme != NULL, NULL); + + /* Build us a GIcon */ + GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); + g_return_val_if_fail(icon_names != NULL, NULL); + + /* Look through the themes for that icon */ + GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, 22, 0); + if (icon_info == NULL) { + g_warning("Unable to find icon '%s' in theme.", name); + g_object_unref(icon_names); + return NULL; + } + + /* Grab the filename */ + const gchar * icon_filename = gtk_icon_info_get_filename(icon_info); + g_return_val_if_fail(icon_filename != NULL, NULL); /* An error because we shouldn't get info without a filename */ + + /* Build a pixbuf */ + GError * error = NULL; + GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(icon_filename, &error); + gtk_icon_info_free(icon_info); + + if (pixbuf == NULL) { + g_error("Unable to load icon from name '%s' file '%s' because: %s", name, icon_filename, error == NULL ? "I don't know" : error->message); + g_object_unref(icon_names); + return NULL; + } + + /* Build us an image */ + GtkImage * image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf)); + g_object_unref(pixbuf); + + if (image == NULL) { + g_error("Unable to create image from pixbuf on icon name '%s'", name); + g_object_unref(icon_names); + return NULL; + } + + /* Attach our names to the image */ + g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); + + /* Connect to all changes */ + /* TODO */ - return NULL; + /* Return our built image */ + return image; } -- cgit v1.2.3 From 805edb88641378614175ad9f4f205bbdc1d707a1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 13:10:36 -0600 Subject: Pulled out a bunch of the code into a refresh function for signals. --- libindicator/indicator-image-helper.c | 51 ++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 3bc25a2..5897711 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -3,31 +3,28 @@ const gchar * INDICATOR_NAMES_DATA = "indicator-names-data"; -GtkImage * -indicator_image_helper (const gchar * name) +void +refresh_image (GtkImage * image) { - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(name[0] != '\0', NULL); + g_return_if_fail(GTK_IS_IMAGE(image)); + + GIcon * icon_names = (GIcon *)g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA); + g_return_if_fail(icon_names != NULL); /* Get the default theme */ GtkIconTheme * default_theme = gtk_icon_theme_get_default(); - g_return_val_if_fail(default_theme != NULL, NULL); - - /* Build us a GIcon */ - GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); - g_return_val_if_fail(icon_names != NULL, NULL); + g_return_if_fail(default_theme != NULL); /* Look through the themes for that icon */ GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, 22, 0); if (icon_info == NULL) { - g_warning("Unable to find icon '%s' in theme.", name); - g_object_unref(icon_names); - return NULL; + g_warning("Unable to find icon in theme."); + return; } /* Grab the filename */ const gchar * icon_filename = gtk_icon_info_get_filename(icon_info); - g_return_val_if_fail(icon_filename != NULL, NULL); /* An error because we shouldn't get info without a filename */ + g_return_if_fail(icon_filename != NULL); /* An error because we shouldn't get info without a filename */ /* Build a pixbuf */ GError * error = NULL; @@ -35,14 +32,29 @@ indicator_image_helper (const gchar * name) gtk_icon_info_free(icon_info); if (pixbuf == NULL) { - g_error("Unable to load icon from name '%s' file '%s' because: %s", name, icon_filename, error == NULL ? "I don't know" : error->message); - g_object_unref(icon_names); - return NULL; + g_error("Unable to load icon from file '%s' because: %s", icon_filename, error == NULL ? "I don't know" : error->message); + return; } + /* Put the pixbuf on the image */ + gtk_image_set_from_pixbuf(image, pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + + return; +} + +GtkImage * +indicator_image_helper (const gchar * name) +{ + g_return_val_if_fail(name != NULL, NULL); + g_return_val_if_fail(name[0] != '\0', NULL); + + /* Build us a GIcon */ + GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); + g_return_val_if_fail(icon_names != NULL, NULL); + /* Build us an image */ - GtkImage * image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf)); - g_object_unref(pixbuf); + GtkImage * image = GTK_IMAGE(gtk_image_new()); if (image == NULL) { g_error("Unable to create image from pixbuf on icon name '%s'", name); @@ -53,6 +65,9 @@ indicator_image_helper (const gchar * name) /* Attach our names to the image */ g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); + /* Put the pixbuf in */ + refresh_image(image); + /* Connect to all changes */ /* TODO */ -- cgit v1.2.3 From 64df2c666c7411b43f82ae299fca86c48719354a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 13:25:26 -0600 Subject: Setting up the callback for themes changing. --- libindicator/indicator-image-helper.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 5897711..08a4875 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -3,7 +3,7 @@ const gchar * INDICATOR_NAMES_DATA = "indicator-names-data"; -void +static void refresh_image (GtkImage * image) { g_return_if_fail(GTK_IS_IMAGE(image)); @@ -43,6 +43,16 @@ refresh_image (GtkImage * image) return; } +/* Handles the theme changed signal to refresh the icon to make + sure that it changes appropriately */ +static void +theme_changed_cb (GtkIconTheme * theme, gpointer user_data) +{ + GtkImage * image = GTK_IMAGE(user_data); + refresh_image(image); + return; +} + GtkImage * indicator_image_helper (const gchar * name) { @@ -69,7 +79,7 @@ indicator_image_helper (const gchar * name) refresh_image(image); /* Connect to all changes */ - /* TODO */ + g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); /* Return our built image */ return image; -- cgit v1.2.3 From ba4a73a9ea33a1996ff7965dd7996b54901b385a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 14:26:20 -0600 Subject: Disconnect from theme update when the image goes away. --- libindicator/indicator-image-helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 08a4875..3e8c627 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -53,6 +53,15 @@ theme_changed_cb (GtkIconTheme * theme, gpointer user_data) return; } +/* Removes the signal on the theme that was calling update on this + image. */ +static void +image_destroyed_cb (GtkImage * image, gpointer user_data) +{ + g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), theme_changed_cb, image); + return; +} + GtkImage * indicator_image_helper (const gchar * name) { @@ -80,6 +89,7 @@ indicator_image_helper (const gchar * name) /* Connect to all changes */ g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); + g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); /* Return our built image */ return image; -- cgit v1.2.3 From 37f0f3400bce36b98e89595bdbb694bec7139ee2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 15:30:37 -0600 Subject: Doing dynamic size calculation based on the font if we have a prop set telling us to do so. --- libindicator/indicator-image-helper.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 3e8c627..76ac3c2 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -15,8 +15,22 @@ refresh_image (GtkImage * image) GtkIconTheme * default_theme = gtk_icon_theme_get_default(); g_return_if_fail(default_theme != NULL); + gint icon_size = 22; + + GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(image)); + GValue styleprop = {0}; + gtk_style_get_style_property(style, GTK_TYPE_IMAGE, "x-ayatana-indicator-dynamic", &styleprop); + + if (G_VALUE_HOLDS_BOOLEAN(&styleprop) && g_value_get_boolean(&styleprop)) { + PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(image)); + PangoFontMetrics * metrics = pango_context_get_metrics(context, style->font_desc, pango_context_get_language(context)); + icon_size = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)) + PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); + g_debug("Looking for icon size %d", icon_size); + pango_font_metrics_unref(metrics); + } + /* Look through the themes for that icon */ - GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, 22, 0); + GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); if (icon_info == NULL) { g_warning("Unable to find icon in theme."); return; -- cgit v1.2.3 From 12ab8f4476b500c21747514cfbec272d0cbd5ada Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 16:14:46 -0600 Subject: If we get an icon that is too big, we have to scale it. --- libindicator/indicator-image-helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 76ac3c2..53776c4 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -1,4 +1,5 @@ +#include #include "indicator-image-helper.h" const gchar * INDICATOR_NAMES_DATA = "indicator-names-data"; @@ -50,6 +51,16 @@ refresh_image (GtkImage * image) return; } + /* Scale icon if all we get is something too big. */ + if (gdk_pixbuf_get_height(pixbuf) > icon_size) { + gfloat scale = (gfloat)icon_size / (gfloat)gdk_pixbuf_get_height(pixbuf); + gint width = round(gdk_pixbuf_get_width(pixbuf) * scale); + + GdkPixbuf * scaled = gdk_pixbuf_scale_simple(pixbuf, width, icon_size, GDK_INTERP_BILINEAR); + g_object_unref(G_OBJECT(pixbuf)); + pixbuf = scaled; + } + /* Put the pixbuf on the image */ gtk_image_set_from_pixbuf(image, pixbuf); g_object_unref(G_OBJECT(pixbuf)); -- cgit v1.2.3 From 0660884bfea160a9870f814bfd85265d264a34eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 16:30:19 -0600 Subject: A little loader to test to see if we load an icon and what size it is. --- helper/test-loader-build | 3 +++ helper/test-loader.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 helper/test-loader-build create mode 100644 helper/test-loader.c diff --git a/helper/test-loader-build b/helper/test-loader-build new file mode 100755 index 0000000..fa1e006 --- /dev/null +++ b/helper/test-loader-build @@ -0,0 +1,3 @@ +#!/bin/bash + +gcc `pkg-config --cflags --libs gtk+-2.0` -I../libindicator/ test-loader.c ../libindicator/indicator-image-helper.c -o test-loader diff --git a/helper/test-loader.c b/helper/test-loader.c new file mode 100644 index 0000000..6a06248 --- /dev/null +++ b/helper/test-loader.c @@ -0,0 +1,18 @@ + +#include +#include "indicator-image-helper.h" + +int +main (int argv, char * argc[]) +{ + gtk_init(&argv, &argc); + + GtkImage * image = indicator_image_helper(argc[1]); + + GdkPixbuf * pixbuf = gtk_image_get_pixbuf(image); + + g_debug("Pixbuf width: %d", gdk_pixbuf_get_width(pixbuf)); + g_debug("Pixbuf height: %d", gdk_pixbuf_get_height(pixbuf)); + + return; +} -- cgit v1.2.3 From 5867fa760a390d48f30e8794f6292601c61cefad Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 16:40:19 -0600 Subject: Adding in a copyright header. --- libindicator/indicator-image-helper.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 53776c4..cbbad3d 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -1,3 +1,25 @@ +/* +A little helper to make a themed image with fallbacks that +is only constrained in the vertical dimention. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +. +*/ #include #include "indicator-image-helper.h" -- cgit v1.2.3 From 9bc7677cb39433b30768bd0a1f878b6f5277704b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 16:58:15 -0600 Subject: releasing version 0.3.4-0ubuntu1~ppa2~imagehelper1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5b9c025..2300cbb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -libindicator (0.3.4-0ubuntu1~ppa2~imagehelper1) UNRELEASED; urgency=low +libindicator (0.3.4-0ubuntu1~ppa2~imagehelper1) lucid; urgency=low * Upstream merge * Adding in a image loader helper for indicators. - -- Ted Gould Wed, 10 Mar 2010 16:55:17 -0600 + -- Ted Gould Wed, 10 Mar 2010 16:58:13 -0600 libindicator (0.3.4-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3 From d4246925f5f7e855eb153b7b825456c1f6653e93 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 22:12:35 -0600 Subject: releasing version 0.3.4-0ubuntu1~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0752c40..8f521ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -libindicator (0.3.4-0ubuntu1~ppa2) UNRELEASED; urgency=low +libindicator (0.3.4-0ubuntu1~ppa2) lucid; urgency=low * Upstream merge * Adding in a image loader helper for indicators. - -- Ted Gould Wed, 10 Mar 2010 22:09:43 -0600 + -- Ted Gould Wed, 10 Mar 2010 22:12:32 -0600 libindicator (0.3.4-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3 From b4ca4f6ff3d2176b42cad8ec5e5970452d83edb9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 10:22:17 -0600 Subject: Splitting things out into an update function and a buid function. --- libindicator/indicator-image-helper.c | 30 ++++++++++++++++-------------- libindicator/indicator-image-helper.h | 4 +++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index cbbad3d..2703208 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -112,21 +112,24 @@ image_destroyed_cb (GtkImage * image, gpointer user_data) GtkImage * indicator_image_helper (const gchar * name) { - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(name[0] != '\0', NULL); - - /* Build us a GIcon */ - GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); - g_return_val_if_fail(icon_names != NULL, NULL); - /* Build us an image */ GtkImage * image = GTK_IMAGE(gtk_image_new()); - if (image == NULL) { - g_error("Unable to create image from pixbuf on icon name '%s'", name); - g_object_unref(icon_names); - return NULL; - } + indicator_image_helper_update(image, name); + + return image; +} + +void +indicator_image_helper_update (GtkImage * image, const gchar * name) +{ + g_return_if_fail(name != NULL); + g_return_if_fail(name[0] != '\0'); + g_return_if_fail(image != NULL); + + /* Build us a GIcon */ + GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); + g_return_if_fail(icon_names != NULL); /* Attach our names to the image */ g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); @@ -138,6 +141,5 @@ indicator_image_helper (const gchar * name) g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); - /* Return our built image */ - return image; + return; } diff --git a/libindicator/indicator-image-helper.h b/libindicator/indicator-image-helper.h index fed02dc..77e2f0a 100644 --- a/libindicator/indicator-image-helper.h +++ b/libindicator/indicator-image-helper.h @@ -26,6 +26,8 @@ License along with this library. If not, see #include -GtkImage * indicator_image_helper (const gchar * name); +GtkImage * indicator_image_helper (const gchar * name); +void indicator_image_helper_update (GtkImage * image, + const gchar * name); #endif /* __INDICATOR_IMAGE_HELPER_H__ */ -- cgit v1.2.3 From e31a7de28b3a030186e49a4b0d88730604196539 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 10:35:14 -0600 Subject: Check to see if we've seen the image previously before adding signals in. --- libindicator/indicator-image-helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 2703208..ae417c7 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -109,6 +109,8 @@ image_destroyed_cb (GtkImage * image, gpointer user_data) return; } +/* Builds an image with the name and fallbacks and all kinds of fun + stuff . */ GtkImage * indicator_image_helper (const gchar * name) { @@ -120,6 +122,7 @@ indicator_image_helper (const gchar * name) return image; } +/* Updates and image with all the fun stuff */ void indicator_image_helper_update (GtkImage * image, const gchar * name) { @@ -131,6 +134,8 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); g_return_if_fail(icon_names != NULL); + gboolean seen_previously = (g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA) != NULL); + /* Attach our names to the image */ g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); @@ -138,8 +143,10 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) refresh_image(image); /* Connect to all changes */ - g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); - g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); + if (!seen_previously) { + g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); + g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); + } return; } -- cgit v1.2.3 From a6ecf4a5b44ae4179d17d1f78da80ced04209b32 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 10:51:17 -0600 Subject: Watching for style changes on the image. --- libindicator/indicator-image-helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index ae417c7..86d6c25 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -109,6 +109,15 @@ image_destroyed_cb (GtkImage * image, gpointer user_data) return; } +/* Catch the style changing on the image to make sure + we've got the latest. */ +static void +image_style_change_cb (GtkImage * image, GtkStyle * previous_style, gpointer user_data) +{ + refresh_image(image); + return; +} + /* Builds an image with the name and fallbacks and all kinds of fun stuff . */ GtkImage * @@ -146,6 +155,7 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) if (!seen_previously) { g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); + g_signal_connect(G_OBJECT(image), "style-set", G_CALLBACK(image_style_change_cb), NULL); } return; -- cgit v1.2.3 From bb8b7032dfd93cd0cdad55967b973dd4de7ca044 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 14:20:02 -0600 Subject: 0.3.5 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2601ea5..b3f3d78 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.4, ted@canonical.com) +AC_INIT(libindicator, 0.3.5, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.4) +AM_INIT_AUTOMAKE(libindicator, 0.3.5) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 0de990f43c73324b2e321747fa666614f95ac111 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 14:26:15 -0600 Subject: releasing version 0.3.5-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index bbb6996..4d9c0a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -libindicator (0.3.5-0ubuntu1~ppa1) UNRELEASED; urgency=low +libindicator (0.3.5-0ubuntu1~ppa1) lucid; urgency=low * Upstream release 0.3.5 * Adding in a image loader helper for indicators. - -- Ted Gould Thu, 11 Mar 2010 14:22:09 -0600 + -- Ted Gould Thu, 11 Mar 2010 14:26:11 -0600 libindicator (0.3.4-0ubuntu1) lucid; urgency=low -- cgit v1.2.3 From 259bcc9933de10b893dd9feeca3d18cde6bc5f1f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 14:26:58 -0600 Subject: debian/rules: Updating shlibs number --- debian/changelog | 6 ++++++ debian/rules | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4d9c0a5..83a7e5b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libindicator (0.3.5-0ubuntu1~ppa2) UNRELEASED; urgency=low + + * debian/rules: Updating shlibs number + + -- Ted Gould Thu, 11 Mar 2010 14:26:32 -0600 + libindicator (0.3.5-0ubuntu1~ppa1) lucid; urgency=low * Upstream release 0.3.5 diff --git a/debian/rules b/debian/rules index 5ee8f88..5e14c74 100755 --- a/debian/rules +++ b/debian/rules @@ -5,4 +5,4 @@ include /usr/share/cdbs/1/class/gnome.mk LDFLAGS += -Wl,-z,defs -Wl,--as-needed -DEB_DH_MAKESHLIBS_ARGS_libindicator0 += -V 'libindicator0 (>= 0.3.3)' +DEB_DH_MAKESHLIBS_ARGS_libindicator0 += -V 'libindicator0 (>= 0.3.5)' -- cgit v1.2.3 From a815f8420172fd403de2669ecce4b6a2c19dc5f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Mar 2010 14:27:17 -0600 Subject: releasing version 0.3.5-0ubuntu1~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 83a7e5b..ff7f91a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libindicator (0.3.5-0ubuntu1~ppa2) UNRELEASED; urgency=low +libindicator (0.3.5-0ubuntu1~ppa2) lucid; urgency=low * debian/rules: Updating shlibs number - -- Ted Gould Thu, 11 Mar 2010 14:26:32 -0600 + -- Ted Gould Thu, 11 Mar 2010 14:27:04 -0600 libindicator (0.3.5-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3