Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- === modified file 'src/bubble.c'
- --- a/src/bubble.c 2009-10-01 08:34:39 +0000
- +++ b/src/bubble.c 2009-10-01 15:03:25 +0000
- @@ -46,16 +46,18 @@
- #include "defaults.h"
- #include "stack.h"
- #include "dbus.h"
- #include "util.h"
- #include "bubble-window.h"
- #include "raico-blur.h"
- #include "tile.h"
- +#define NOTIFY_OSD_ICON_PREFIX "notification"
- +
- G_DEFINE_TYPE (Bubble, bubble, G_TYPE_OBJECT);
- #define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), BUBBLE_TYPE, BubblePrivate))
- struct _BubblePrivate {
- BubbleLayout layout;
- GtkWidget* widget;
- @@ -2376,37 +2378,71 @@ bubble_get_message_body (Bubble* self)
- {
- if (!self || !IS_BUBBLE (self))
- return NULL;
- return GET_PRIVATE (self)->message_body->str;
- }
- void
- +bubble_set_icon_from_path (Bubble* self,
- + const gchar* file_path)
- +{
- + Defaults* d;
- + BubblePrivate* priv;
- +
- + if (!self || !IS_BUBBLE (self) || !g_strcmp0 (file_path, ""))
- + return;
- +
- + priv = GET_PRIVATE (self);
- +
- + if (priv->icon_pixbuf)
- + {
- + g_object_unref (priv->icon_pixbuf);
- + priv->icon_pixbuf = NULL;
- + }
- +
- + d = self->defaults;
- + priv->icon_pixbuf = load_icon (file_path,
- + EM2PIXELS (defaults_get_icon_size (d),
- + d));
- +
- + _refresh_icon (self);
- +}
- +
- +void
- bubble_set_icon (Bubble* self,
- const gchar* filename)
- {
- Defaults* d;
- BubblePrivate* priv;
- + gchar *notify_osd_iconname;
- if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filename, ""))
- return;
- priv = GET_PRIVATE (self);
- if (priv->icon_pixbuf)
- {
- g_object_unref (priv->icon_pixbuf);
- priv->icon_pixbuf = NULL;
- }
- + notify_osd_iconname = g_strdup_printf (NOTIFY_OSD_ICON_PREFIX "-%s", filename);
- d = self->defaults;
- - priv->icon_pixbuf = load_icon (filename,
- + priv->icon_pixbuf = load_icon (notify_osd_iconname,
- EM2PIXELS (defaults_get_icon_size (d),
- d));
- + g_free (notify_osd_iconname);
- + /* fallback to not notify-osd name */
- + if (!priv->icon_pixbuf)
- + priv->icon_pixbuf = load_icon (filename,
- + EM2PIXELS (defaults_get_icon_size (d),
- + d));
- _refresh_icon (self);
- }
- static GdkPixbuf *
- scale_pixbuf (const GdkPixbuf *pixbuf, gint size)
- {
- GdkPixbuf *scaled_icon;
- === modified file 'src/bubble.h'
- --- a/src/bubble.h 2009-08-27 09:52:34 +0000
- +++ b/src/bubble.h 2009-10-01 14:58:39 +0000
- @@ -104,16 +104,20 @@ bubble_get_title (Bubble* self);
- void
- bubble_set_message_body (Bubble* self,
- const gchar* body);
- const gchar*
- bubble_get_message_body (Bubble* self);
- void
- +bubble_set_icon_from_path (Bubble* self,
- + const gchar* file_path);
- +
- +void
- bubble_set_icon (Bubble* self,
- const gchar* filename);
- void
- bubble_set_icon_from_pixbuf (Bubble* self,
- GdkPixbuf* pixbuf);
- GdkPixbuf*
- === modified file 'src/stack.c'
- --- a/src/stack.c 2009-09-24 12:59:26 +0000
- +++ b/src/stack.c 2009-10-01 15:01:29 +0000
- @@ -720,17 +720,17 @@ stack_notify_handler (Stack*
- g_debug("Using image_data hint\n");
- pixbuf = process_dbus_icon_data (data);
- bubble_set_icon_from_pixbuf (bubble, pixbuf);
- }
- else if ((data = (GValue*) g_hash_table_lookup (hints, "image_path")))
- {
- g_debug("Using image_path hint\n");
- if ((data && G_VALUE_HOLDS_STRING (data)))
- - bubble_set_icon (bubble, g_value_get_string(data));
- + bubble_set_icon_from_path (bubble, g_value_get_string(data));
- else
- g_warning ("image_path hint is not a string\n");
- }
- else if (icon && *icon != '\0')
- {
- g_debug("Using icon parameter\n");
- bubble_set_icon (bubble, icon);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement