aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-23 13:22:47 -0500
committerTed Gould <ted@canonical.com>2009-09-23 13:22:47 -0500
commitf040dff2782aeb0896d7b39b46221f60beca8909 (patch)
tree1934cdd9b1096d7f62769e07449fda355ce753a7
parent27b1c17d9f8702a4e87f083819246956148e329a (diff)
parentfcda1c20e3ebfa62d3696a493af3ef3ef4716402 (diff)
downloadayatana-indicator-messages-f040dff2782aeb0896d7b39b46221f60beca8909.tar.gz
ayatana-indicator-messages-f040dff2782aeb0896d7b39b46221f60beca8909.tar.bz2
ayatana-indicator-messages-f040dff2782aeb0896d7b39b46221f60beca8909.zip
On changing values as well...
-rw-r--r--debian/changelog6
-rw-r--r--src/indicator-messages.c26
2 files changed, 31 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index f92bc73..1e29c80 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-messages (0.2.3-0ubuntu1~ppa2~icon2) UNRELEASED; urgency=low
+
+ * On changing values as well...
+
+ -- Ted Gould <ted@ubuntu.com> Wed, 23 Sep 2009 13:22:30 -0500
+
indicator-messages (0.2.3-0ubuntu1~ppa2~icon1) karmic; urgency=low
* Merging in icon scaling code.
diff --git a/src/indicator-messages.c b/src/indicator-messages.c
index 070b2be..01f2579 100644
--- a/src/indicator-messages.c
+++ b/src/indicator-messages.c
@@ -164,7 +164,29 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, gchar * value, in
is already cached, shouldn't be a big deal really. */
GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(mi, INDICATOR_MENUITEM_PROP_ICON);
if (pixbuf != NULL) {
- gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), pixbuf);
+ /* If we've got a pixbuf we need to make sure it's of a reasonable
+ size to fit in the menu. If not, rescale it. */
+ GdkPixbuf * resized_pixbuf;
+ gint width, height;
+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
+ if (gdk_pixbuf_get_width(pixbuf) > width ||
+ gdk_pixbuf_get_height(pixbuf) > height) {
+ g_debug("Resizing icon from %dx%d to %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), width, height);
+ resized_pixbuf = gdk_pixbuf_scale_simple(pixbuf,
+ width,
+ height,
+ GDK_INTERP_BILINEAR);
+ } else {
+ g_debug("Happy with icon sized %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
+ resized_pixbuf = pixbuf;
+ }
+
+ gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), resized_pixbuf);
+
+ /* The other pixbuf should be free'd by the dbusmenu. */
+ if (resized_pixbuf != pixbuf) {
+ g_object_unref(resized_pixbuf);
+ }
}
} else {
g_warning("Indicator Item property '%s' unknown", prop);
@@ -201,11 +223,13 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
if (gdk_pixbuf_get_width(pixbuf) > width ||
gdk_pixbuf_get_height(pixbuf) > height) {
+ g_debug("Resizing icon from %dx%d to %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), width, height);
resized_pixbuf = gdk_pixbuf_scale_simple(pixbuf,
width,
height,
GDK_INTERP_BILINEAR);
} else {
+ g_debug("Happy with icon sized %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
resized_pixbuf = pixbuf;
}