Merge lp://qastaging/~macslow/notify-osd/gconf-binding-for-title-and-body-sizes into lp://qastaging/notify-osd/karmic

Proposed by Mirco Müller
Status: Approved
Approved by: Ted Gould
Approved revision: 406
Proposed branch: lp://qastaging/~macslow/notify-osd/gconf-binding-for-title-and-body-sizes
Merge into: lp://qastaging/notify-osd/karmic
Diff against target: 386 lines
6 files modified
src/bubble.c (+10/-7)
src/bubble.h (+2/-1)
src/defaults.c (+134/-9)
src/defaults.h (+1/-1)
src/display.c (+3/-4)
src/stack.c (+25/-12)
To merge this branch: bzr merge lp://qastaging/~macslow/notify-osd/gconf-binding-for-title-and-body-sizes
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+13458@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Upon request from David I extracted just the gconf-binding for the sizing factors (in EMs) for title- and body-text from my branch lp:~macslow/notify-osd/gconf-style to be included in the karmic maintainance-branch of notify-osd.

The two watched keys are:

/apps/notify-osd/text-title-size
/apps/notify-osd/text-body-size

They take float values (accepted range: 0.5 - 1.5). If they are not set, built-in values as set forth by the design-team are used. 1.0 for text-title-size, 0.9 for text-body-size. If you want to inject/alter these gconf-keys on your system use:

gconftool-2 -s /apps/notify-osd/text-title-size -t float 1.0
gconftool-2 -s /apps/notify-osd/text-body-size -t float 0.9

To remove them use:

gconftool-2 -u /apps/notify-osd/text-title-size
gconftool-2 -u /apps/notify-osd/text-body-size

404. By Mirco Müller

added gconf-key for slot-allocation, upon startup can be chosen between fixed or dynamic, fixed always default in error case, needed to add trigger-flag for glow/dim-effect, because of bubble_sync_with(), needed to adapt position of bottom bubble in append-case for top bubble growing when dynamic allocation scheme is used

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

Also added upon request by David a gconf-key to control the slot-allocation scheme to use. This means either fixed (sync. bubble always on top, async. always on bottom) or dynamic (async. and sync. can take either top or bottom slot, depending on what somes first) schemes can be used. If reading the related gconf-key fails the fixed slot-allocation scheme will be used as fallback.

For fixed slot-allocation scheme do:

gconftools-2 -s /apps/notify-osd/slot-allocation -t int 1

For dynamic slot-allocation scheme do:

gconftools-2 -s /apps/notify-osd/slot-allocation -t int 2

To unset use:

gconftools-2 -u /apps/notify-osd/slot-allocation

To avoid opening another can of worms the slot-allocation scheme is only read upon startup of notify-osd. Changing the gconf-keys value during runtime will not affect notify-osd until it's restarted again.

Revision history for this message
Ted Gould (ted) :
review: Approve
405. By Mirco Müller

no need to sync timing if sync bubble in in bottom slot

406. By Mirco Müller

text-drop-shadow for title was not drawn at all, accidentally deleted that line somehow, now back in

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

Looked at the additional two commits. Looks good.

review: Approve

Unmerged revisions

406. By Mirco Müller

text-drop-shadow for title was not drawn at all, accidentally deleted that line somehow, now back in

405. By Mirco Müller

no need to sync timing if sync bubble in in bottom slot

404. By Mirco Müller

added gconf-key for slot-allocation, upon startup can be chosen between fixed or dynamic, fixed always default in error case, needed to add trigger-flag for glow/dim-effect, because of bubble_sync_with(), needed to adapt position of bottom bubble in append-case for top bubble growing when dynamic allocation scheme is used

403. By Mirco Müller

extracted just the gconf-key binding for size-factors (in EMs) of title- and body-text

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 22:05:05 +0000
3+++ src/bubble.c 2009-10-20 02:12:10 +0000
4@@ -1012,6 +1012,7 @@
5 TEXT_SHADOW_COLOR_G,
6 TEXT_SHADOW_COLOR_B,
7 TEXT_SHADOW_COLOR_A);
8+ pango_cairo_show_layout (cr, layout);
9
10 // ... blur it
11 blur = raico_blur_create (RAICO_BLUR_QUALITY_HIGH);
12@@ -2878,7 +2879,7 @@
13 gtk_window_set_opacity (bubble_get_window (bubble),
14 WINDOW_MAX_OPACITY);
15
16- bubble_start_timer (bubble);
17+ bubble_start_timer (bubble, TRUE);
18 }
19
20 void
21@@ -2896,7 +2897,7 @@
22 || msecs == 0)
23 {
24 bubble_show (self);
25- bubble_start_timer (self);
26+ bubble_start_timer (self, TRUE);
27 return;
28 }
29
30@@ -3049,7 +3050,8 @@
31 }
32
33 void
34-bubble_start_timer (Bubble* self)
35+bubble_start_timer (Bubble* self,
36+ gboolean trigger)
37 {
38 guint timer_id;
39 BubblePrivate* priv;
40@@ -3075,8 +3077,9 @@
41
42 /* if the bubble is displaying a value that is out of bounds
43 trigger a dim/glow animation */
44- if (priv->value == -1 || priv->value == 101)
45- bubble_start_glow_effect (self, 500);
46+ if (trigger)
47+ if (priv->value == -1 || priv->value == 101)
48+ bubble_start_glow_effect (self, 500);
49 }
50
51 void
52@@ -3732,6 +3735,6 @@
53
54 bubble_set_timeout (self,
55 bubble_get_timeout (other));
56- bubble_start_timer (self);
57- bubble_start_timer (other);
58+ bubble_start_timer (self, FALSE);
59+ bubble_start_timer (other, FALSE);
60 }
61
62=== modified file 'src/bubble.h'
63--- src/bubble.h 2009-10-15 18:16:31 +0000
64+++ src/bubble.h 2009-10-20 02:12:10 +0000
65@@ -189,7 +189,8 @@
66 bubble_is_visible (Bubble* self);
67
68 void
69-bubble_start_timer (Bubble* self);
70+bubble_start_timer (Bubble* self,
71+ gboolean trigger);
72
73 void
74 bubble_get_position (Bubble* self,
75
76=== modified file 'src/defaults.c'
77--- src/defaults.c 2009-10-19 17:59:53 +0000
78+++ src/defaults.c 2009-10-20 02:12:10 +0000
79@@ -162,8 +162,11 @@
80 #define GCONF_NOSD_TREE "/apps/notify-osd"
81
82 /* notify-osd settings */
83-#define GCONF_MULTIHEAD_MODE "/apps/notify-osd/multihead_mode"
84-#define GCONF_GRAVITY "/apps/notify-osd/gravity"
85+#define GCONF_MULTIHEAD_MODE "/apps/notify-osd/multihead_mode"
86+#define GCONF_GRAVITY "/apps/notify-osd/gravity"
87+#define GCONF_TEXT_TITLE_SIZE "/apps/notify-osd/text-title-size"
88+#define GCONF_TEXT_BODY_SIZE "/apps/notify-osd/text-body-size"
89+#define GCONF_SLOT_ALLOCATION "/apps/notify-osd/slot_allocation"
90
91 static guint g_defaults_signals[LAST_SIGNAL] = { 0 };
92
93@@ -403,6 +406,76 @@
94 g_signal_emit (defaults, g_defaults_signals[GRAVITY_CHANGED], 0);
95 }
96
97+static void
98+_text_title_size_changed (GConfClient* client, // not used
99+ guint cnxn_id, // not used
100+ GConfEntry* entry, // not used
101+ gpointer data)
102+{
103+ Defaults* defaults;
104+ GError* error = NULL;
105+ gdouble size;
106+
107+ // sanity checks
108+ if (!data)
109+ return;
110+
111+ defaults = (Defaults*) data;
112+ if (!IS_DEFAULTS (defaults))
113+ return;
114+
115+ // get title-size (factor) from gconf
116+ size = gconf_client_get_float (defaults->context,
117+ GCONF_TEXT_TITLE_SIZE,
118+ &error);
119+ if (error)
120+ {
121+ g_warning ("%s(): %s", G_STRFUNC, error->message);
122+ g_error_free (error);
123+ size = DEFAULT_TEXT_TITLE_SIZE;
124+ }
125+
126+ // set title-size-property
127+ g_object_set (defaults, "text-title-size", size, NULL);
128+
129+ g_signal_emit (defaults, g_defaults_signals[VALUE_CHANGED], 0);
130+}
131+
132+static void
133+_text_body_size_changed (GConfClient* client, // not used
134+ guint cnxn_id, // not used
135+ GConfEntry* entry, // not used
136+ gpointer data)
137+{
138+ Defaults* defaults;
139+ GError* error = NULL;
140+ gdouble size;
141+
142+ // sanity checks
143+ if (!data)
144+ return;
145+
146+ defaults = (Defaults*) data;
147+ if (!IS_DEFAULTS (defaults))
148+ return;
149+
150+ // get title-size (factor) from gconf
151+ size = gconf_client_get_float (defaults->context,
152+ GCONF_TEXT_BODY_SIZE,
153+ &error);
154+ if (error)
155+ {
156+ g_warning ("%s(): %s", G_STRFUNC, error->message);
157+ g_error_free (error);
158+ size = DEFAULT_TEXT_BODY_SIZE;
159+ }
160+
161+ // set body-size-property
162+ g_object_set (defaults, "text-body-size", size, NULL);
163+
164+ g_signal_emit (defaults, g_defaults_signals[VALUE_CHANGED], 0);
165+}
166+
167 void
168 defaults_refresh_screen_dimension_properties (Defaults *self)
169 {
170@@ -519,6 +592,9 @@
171 NULL);
172 }
173
174+ _text_title_size_changed (NULL, 0, NULL, (gpointer) self);
175+ _text_body_size_changed (NULL, 0, NULL, (gpointer) self);
176+
177 /* FIXME: calling this here causes a segfault */
178 /* chain up to the parent class */
179 /*G_OBJECT_CLASS (defaults_parent_class)->constructed (gobject);*/
180@@ -537,6 +613,8 @@
181 gconf_client_notify_remove (defaults->context, defaults->notifier[3]);
182 gconf_client_notify_remove (defaults->context, defaults->notifier[4]);
183 gconf_client_notify_remove (defaults->context, defaults->notifier[5]);
184+ gconf_client_notify_remove (defaults->context, defaults->notifier[6]);
185+ gconf_client_notify_remove (defaults->context, defaults->notifier[7]);
186 gconf_client_remove_dir (defaults->context, GCONF_UI_TREE, NULL);
187 gconf_client_remove_dir (defaults->context, GCONF_FONT_TREE, NULL);
188 gconf_client_remove_dir (defaults->context, GCONF_NOSD_TREE, NULL);
189@@ -613,6 +691,8 @@
190 gconf_client_notify_remove (self->context, self->notifier[3]);
191 gconf_client_notify_remove (self->context, self->notifier[4]);
192 gconf_client_notify_remove (self->context, self->notifier[5]);
193+ gconf_client_notify_remove (self->context, self->notifier[6]);
194+ gconf_client_notify_remove (self->context, self->notifier[7]);
195 gconf_client_remove_dir (self->context, GCONF_UI_TREE, NULL);
196 gconf_client_remove_dir (self->context, GCONF_FONT_TREE, NULL);
197 gconf_client_remove_dir (self->context, GCONF_NOSD_TREE, NULL);
198@@ -624,7 +704,8 @@
199 static void
200 defaults_init (Defaults* self)
201 {
202- GError* error;
203+ GError* error;
204+ SlotAllocation slot_allocation = SLOT_ALLOCATION_NONE;
205
206 /* "connect" to the whole gconf-thing */
207 self->context = gconf_client_get_default ();
208@@ -754,8 +835,52 @@
209 return;
210 }
211
212- // use fixed slot-allocation for async. and sync. bubbles
213- self->slot_allocation = SLOT_ALLOCATION_FIXED;
214+ // hook up notifiier for title-text size changes
215+ error = NULL;
216+ self->notifier[6] = gconf_client_notify_add (self->context,
217+ GCONF_TEXT_TITLE_SIZE,
218+ _text_title_size_changed,
219+ (gpointer) self,
220+ NULL,
221+ &error);
222+ if (error)
223+ {
224+ _handle_error (self, error);
225+ return;
226+ }
227+
228+ // hook up notifiier for body-text size changes
229+ error = NULL;
230+ self->notifier[7] = gconf_client_notify_add (self->context,
231+ GCONF_TEXT_BODY_SIZE,
232+ _text_body_size_changed,
233+ (gpointer) self,
234+ NULL,
235+ &error);
236+ if (error)
237+ {
238+ _handle_error (self, error);
239+ return;
240+ }
241+
242+ // get prefered slot-allocation scheme from gconf, this is
243+ // _intentionally_ only read at startup
244+ slot_allocation = gconf_client_get_int (self->context,
245+ GCONF_SLOT_ALLOCATION,
246+ &error);
247+ if (error)
248+ {
249+ g_error_free (error);
250+ error = NULL;
251+ }
252+
253+ // default to fixed slot-allocation for async. and sync. bubbles, if
254+ // no or out-of-bounds value was read
255+ if (slot_allocation != SLOT_ALLOCATION_FIXED &&
256+ slot_allocation != SLOT_ALLOCATION_DYNAMIC)
257+ self->slot_allocation = SLOT_ALLOCATION_FIXED;
258+ else
259+ self->slot_allocation = slot_allocation;
260 }
261
262 static void
263@@ -1658,8 +1783,8 @@
264 "text-title-size",
265 "text-title-size",
266 "Size (in em) of font to use for content title-text",
267- 0.0f,
268- 32.0f,
269+ 0.5f,
270+ 1.5f,
271 DEFAULT_TEXT_TITLE_SIZE,
272 G_PARAM_CONSTRUCT |
273 G_PARAM_READWRITE |
274@@ -1698,8 +1823,8 @@
275 "text-body-size",
276 "text-body-size",
277 "Size (in em) of font to use for content body-text",
278- 0.0f,
279- 32.0f,
280+ 0.5f,
281+ 1.5f,
282 DEFAULT_TEXT_BODY_SIZE,
283 G_PARAM_CONSTRUCT |
284 G_PARAM_READWRITE |
285
286=== modified file 'src/defaults.h'
287--- src/defaults.h 2009-09-10 13:11:32 +0000
288+++ src/defaults.h 2009-10-20 02:12:10 +0000
289@@ -75,7 +75,7 @@
290
291 /* private */
292 GConfClient* context;
293- guint notifier[6];
294+ guint notifier[8];
295 gint desktop_width;
296 gint desktop_height;
297 gint desktop_top;
298
299=== modified file 'src/display.c'
300--- src/display.c 2009-09-23 13:14:20 +0000
301+++ src/display.c 2009-10-20 02:12:10 +0000
302@@ -191,7 +191,6 @@
303 }
304
305 static void
306-
307 stack_display_sync_bubble (Stack *self, Bubble *bubble)
308 {
309 g_return_if_fail (IS_STACK (self));
310@@ -215,7 +214,7 @@
311 /* is the notification reusing the current bubble? */
312 if (sync_bubble == bubble)
313 {
314- bubble_start_timer (bubble);
315+ bubble_start_timer (bubble, TRUE);
316 bubble_refresh (bubble);
317 return;
318 }
319@@ -313,10 +312,10 @@
320 bubble_set_timeout (bubble,
321 defaults_get_on_screen_timeout (self->defaults));
322
323- defaults_get_top_corner (self->defaults, &x, &y);
324-
325 d = self->defaults;
326
327+ defaults_get_top_corner (d, &x, &y);
328+
329 switch (defaults_get_slot_allocation (d))
330 {
331 case SLOT_ALLOCATION_FIXED:
332
333=== modified file 'src/stack.c'
334--- src/stack.c 2009-10-15 18:16:31 +0000
335+++ src/stack.c 2009-10-20 02:12:11 +0000
336@@ -389,7 +389,7 @@
337 /* check if this is just an update */
338 if (find_bubble_by_id (self, bubble_get_id (bubble)))
339 {
340- bubble_start_timer (bubble);
341+ bubble_start_timer (bubble, TRUE);
342 bubble_refresh (bubble);
343
344 /* resync the synchronous bubble if it's at the top */
345@@ -763,17 +763,30 @@
346 else
347 log_bubble (bubble, app_name, "");
348
349- /* make sure the sync. bubble is positioned correctly
350- even for the append case
351- */
352- // no longer needed since we have the two-slots mechanism now
353- //if (sync_bubble != NULL
354- // && bubble_is_visible (sync_bubble))
355- // stack_display_position_sync_bubble (self, sync_bubble);
356-
357- /* update the layout of the stack;
358- * this will also open the new bubble */
359- stack_layout (self);
360+ // make sure the sync. bubble is positioned correctly even for
361+ // the append case
362+ if (defaults_get_slot_allocation (self->defaults) == SLOT_ALLOCATION_DYNAMIC &&
363+ !stack_is_slot_vacant (self, SLOT_TOP) &&
364+ !stack_is_slot_vacant (self, SLOT_BOTTOM) &&
365+ sync_bubble == self->slots[SLOT_BOTTOM])
366+ {
367+ gint x = 0;
368+ gint y = 0;
369+ gint height = 0;
370+ Defaults* d = self->defaults;
371+
372+ height = bubble_get_future_height (self->slots[SLOT_TOP]) -
373+ EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
374+
375+ bubble_get_position (self->slots[SLOT_TOP], &x, &y);
376+ bubble_move (self->slots[SLOT_BOTTOM], x, y + height);
377+ }
378+ else
379+ {
380+ // update the layout of the stack, this will also open
381+ // the new bubble
382+ stack_layout (self);
383+ }
384 }
385
386 if (bubble)

Subscribers

People subscribed via source and target branches

to all changes: