[Galago-commits] r2497 - in trunk/notification-daemon: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Wed Jan 25 00:22:49 PST 2006
Author: chipx86
Date: 2006-01-25 00:22:43 -0800 (Wed, 25 Jan 2006)
New Revision: 2497
Modified:
trunk/notification-daemon/ChangeLog
trunk/notification-daemon/src/daemon.c
Log:
When using icontheme icons, use the size closest to 48x48. However, if the closest image is smaller, use the small image instead of scaling up. If it's bigger, scale down to 48x48.
Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog 2006-01-25 08:08:21 UTC (rev 2496)
+++ trunk/notification-daemon/ChangeLog 2006-01-25 08:22:43 UTC (rev 2497)
@@ -1,3 +1,10 @@
+Wed Jan 25 00:21:49 PST 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/daemon.c:
+ - When using icontheme icons, use the size closest to 48x48. However,
+ if the closest image is smaller, use the small image instead of
+ scaling up. If it's bigger, scale down to 48x48.
+
Wed Jan 25 00:01:56 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* src/daemon.c:
Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c 2006-01-25 08:08:21 UTC (rev 2496)
+++ trunk/notification-daemon/src/daemon.c 2006-01-25 08:22:43 UTC (rev 2497)
@@ -887,7 +887,7 @@
}
else
{
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
if (!strncmp(icon, "file://", 7) || *icon == '/')
{
@@ -901,11 +901,20 @@
{
/* Load icon theme icon */
GtkIconTheme *theme = gtk_icon_theme_new();
- pixbuf = gtk_icon_theme_load_icon(theme, icon, IMAGE_SIZE,
- GTK_ICON_LOOKUP_USE_BUILTIN,
- NULL);
- g_object_unref(G_OBJECT(theme));
+ GtkIconInfo *icon_info =
+ gtk_icon_theme_lookup_icon(theme, icon, IMAGE_SIZE,
+ GTK_ICON_LOOKUP_USE_BUILTIN);
+ if (icon_info != NULL)
+ {
+ pixbuf = gtk_icon_theme_load_icon(
+ theme, icon,
+ MAX(IMAGE_SIZE, gtk_icon_info_get_base_size(icon_info)),
+ GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+
+ gtk_icon_info_free(icon_info);
+ }
+
if (pixbuf == NULL)
{
/* Well... maybe this is a file afterall. */
More information about the galago-commits
mailing list