ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00428
[Merge] lp:~asac/notify-osd/theme-icon-prefix into lp:notify-osd
Alexander Sack has proposed merging lp:~asac/notify-osd/theme-icon-prefix into lp:notify-osd.
Requested reviews:
Sebastien Bacher (seb128):
Notify OSD Developers (notify-osd-developers)
based on discussion we had in #ubuntu-desktop. Allows the use of notify-osd specific icons through prefix.
please consider that to ease the time until notification- prefix is standardized.
--
https://code.launchpad.net/~asac/notify-osd/theme-icon-prefix/+merge/12731
Your team ayatana-commits is subscribed to branch lp:notify-osd.
=== modified file 'src/bubble.c'
--- src/bubble.c 2009-10-01 08:34:39 +0000
+++ src/bubble.c 2009-10-01 15:50:32 +0000
@@ -51,6 +51,8 @@
#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) \
@@ -2381,11 +2383,38 @@
}
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;
@@ -2398,10 +2427,17 @@
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);
}
=== modified file 'src/bubble.h'
--- src/bubble.h 2009-08-27 09:52:34 +0000
+++ src/bubble.h 2009-10-01 15:50:32 +0000
@@ -109,6 +109,10 @@
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);
=== modified file 'src/stack.c'
--- src/stack.c 2009-09-24 12:59:26 +0000
+++ src/stack.c 2009-10-01 15:50:32 +0000
@@ -725,7 +725,7 @@
{
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");
}