Merge lp:~macslow/notify-osd/theme-icon-prefix into lp:notify-osd/karmic

Proposed by Mirco Müller
Status: Merged
Merged at revision: not available
Proposed branch: lp:~macslow/notify-osd/theme-icon-prefix
Merge into: lp:notify-osd/karmic
Diff against target: 106 lines
3 files modified
src/bubble.c (+46/-1)
src/bubble.h (+4/-0)
src/stack.c (+1/-1)
To merge this branch: bzr merge lp:~macslow/notify-osd/theme-icon-prefix
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+13434@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :
404. By Mirco Müller

added ifdef-guard for the special icon-name-substituion

Revision history for this message
Ted Gould (ted) wrote :

Looks good. In general I wouldn't use the globing like this:

  NOTIFY_OSD_ICON_PREFIX "-%s"

As if that ever was to include a format string or anything it would create weird errors and/or bugs. Now it's all very self contained, but it just sets you up for an easy bug later.

review: Approve
405. By Mirco Müller

clearly indicate that the icon-name-substitution is only a temp. workaround and will not be kept forever in notify-osd

Revision history for this message
Mirco Müller (macslow) wrote :

> Looks good. In general I wouldn't use the globing like this:
>
> NOTIFY_OSD_ICON_PREFIX "-%s"
>
> As if that ever was to include a format string or anything it would create
> weird errors and/or bugs. Now it's all very self contained, but it just sets
> you up for an easy bug later.

This is not meant to be kept around for long, so making this more robust would only lure us into keeping it longer than we want. It'

406. By Mirco Müller

issue a warning message during compilation about the temp. nature of the icon-name-substitution

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bubble.c'
2--- src/bubble.c 2009-10-19 18:06:10 +0000
3+++ src/bubble.c 2009-10-19 19:29:10 +0000
4@@ -113,6 +113,12 @@
5 A
6 };
7
8+#define TEMPORARY_ICON_PREFIX_WORKAROUND 1
9+#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND
10+#warning "--== Using the icon-name-substitution! This is a temp. workaround not going to be maintained for long! ==--"
11+#define NOTIFY_OSD_ICON_PREFIX "notification"
12+#endif
13+
14 // FIXME: this is in class Defaults already, but not yet hooked up so for the
15 // moment we use the macros here, these values reflect the visual-guideline
16 // for jaunty notifications
17@@ -2377,11 +2383,39 @@
18 }
19
20 void
21+bubble_set_icon_from_path (Bubble* self,
22+ const gchar* filepath)
23+{
24+ Defaults* d;
25+ BubblePrivate* priv;
26+
27+ if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filepath, ""))
28+ return;
29+
30+ priv = GET_PRIVATE (self);
31+
32+ if (priv->icon_pixbuf)
33+ {
34+ g_object_unref (priv->icon_pixbuf);
35+ priv->icon_pixbuf = NULL;
36+ }
37+
38+ d = self->defaults;
39+ priv->icon_pixbuf = load_icon (filepath,
40+ EM2PIXELS (defaults_get_icon_size (d), d));
41+
42+ _refresh_icon (self);
43+}
44+
45+void
46 bubble_set_icon (Bubble* self,
47 const gchar* filename)
48 {
49 Defaults* d;
50 BubblePrivate* priv;
51+#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND
52+ gchar* notify_osd_iconname;
53+#endif
54
55 if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filename, ""))
56 return;
57@@ -2395,9 +2429,20 @@
58 }
59
60 d = self->defaults;
61- priv->icon_pixbuf = load_icon (filename,
62+
63+#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND
64+ notify_osd_iconname = g_strdup_printf (NOTIFY_OSD_ICON_PREFIX "-%s",
65+ filename);
66+ priv->icon_pixbuf = load_icon (notify_osd_iconname,
67 EM2PIXELS (defaults_get_icon_size (d),
68 d));
69+ g_free (notify_osd_iconname);
70+#endif
71+
72+ // fallback to non-notify-osd name
73+ if (!priv->icon_pixbuf)
74+ priv->icon_pixbuf = load_icon (filename,
75+ EM2PIXELS (defaults_get_icon_size (d), d));
76
77 _refresh_icon (self);
78 }
79
80=== modified file 'src/bubble.h'
81--- src/bubble.h 2009-08-27 09:52:34 +0000
82+++ src/bubble.h 2009-10-19 19:29:10 +0000
83@@ -109,6 +109,10 @@
84 bubble_get_message_body (Bubble* self);
85
86 void
87+bubble_set_icon_from_path (Bubble* self,
88+ const gchar* filepath);
89+
90+void
91 bubble_set_icon (Bubble* self,
92 const gchar* filename);
93
94
95=== modified file 'src/stack.c'
96--- src/stack.c 2009-09-24 12:59:26 +0000
97+++ src/stack.c 2009-10-19 19:29:10 +0000
98@@ -725,7 +725,7 @@
99 {
100 g_debug("Using image_path hint\n");
101 if ((data && G_VALUE_HOLDS_STRING (data)))
102- bubble_set_icon (bubble, g_value_get_string(data));
103+ bubble_set_icon_from_path (bubble, g_value_get_string(data));
104 else
105 g_warning ("image_path hint is not a string\n");
106 }

Subscribers

People subscribed via source and target branches

to all changes: