Merge lp:~muktupavels/notify-osd/some-improvements into lp:notify-osd

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Lars Karlitski
Approved revision: 493
Merged at revision: 487
Proposed branch: lp:~muktupavels/notify-osd/some-improvements
Merge into: lp:notify-osd
Prerequisite: lp:~muktupavels/notify-osd/fix-deprecation-warnings
Diff against target: 835 lines (+103/-111)
1 file modified
src/bubble.c (+103/-111)
To merge this branch: bzr merge lp:~muktupavels/notify-osd/some-improvements
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Review via email: mp+245283@code.launchpad.net

Commit message

Some improvements:
1) Fix incorrect parameter in widget draw event function.
2) Use G_DEFINE_TYPE_WITH_PRIVATE.

Description of the change

Some improvements:
1) Fix incorrect parameter in widget draw event function.
2) Use G_DEFINE_TYPE_WITH_PRIVATE.

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

Great !Thanks for the patch.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bubble.c'
--- src/bubble.c 2014-12-20 22:08:45 +0000
+++ src/bubble.c 2014-12-20 22:08:45 +0000
@@ -51,11 +51,6 @@
51#include "raico-blur.h"51#include "raico-blur.h"
52#include "tile.h"52#include "tile.h"
5353
54G_DEFINE_TYPE (Bubble, bubble, G_TYPE_OBJECT);
55
56#define GET_PRIVATE(o) \
57 (G_TYPE_INSTANCE_GET_PRIVATE ((o), BUBBLE_TYPE, BubblePrivate))
58
59struct _BubblePrivate {54struct _BubblePrivate {
60 BubbleLayout layout;55 BubbleLayout layout;
61 GtkWidget* widget;56 GtkWidget* widget;
@@ -102,6 +97,8 @@
102 GString* old_icon_filename;97 GString* old_icon_filename;
103};98};
10499
100G_DEFINE_TYPE_WITH_PRIVATE (Bubble, bubble, G_TYPE_OBJECT);
101
105enum102enum
106{103{
107 TIMED_OUT,104 TIMED_OUT,
@@ -498,7 +495,7 @@
498static gdouble495static gdouble
499get_shadow_size (Bubble *bubble)496get_shadow_size (Bubble *bubble)
500{497{
501 BubblePrivate* priv = GET_PRIVATE (bubble);498 BubblePrivate* priv = bubble->priv;
502 Defaults* d = bubble->defaults;499 Defaults* d = bubble->defaults;
503 return defaults_get_bubble_shadow_size (d, priv->composited);500 return defaults_get_bubble_shadow_size (d, priv->composited);
504}501}
@@ -506,7 +503,7 @@
506static gdouble503static gdouble
507get_corner_radius (Bubble *bubble)504get_corner_radius (Bubble *bubble)
508{505{
509 BubblePrivate* priv = GET_PRIVATE (bubble);506 BubblePrivate* priv = bubble->priv;
510 Defaults* d = bubble->defaults;507 Defaults* d = bubble->defaults;
511 return defaults_get_bubble_corner_radius (d, priv->composited);508 return defaults_get_bubble_corner_radius (d, priv->composited);
512}509}
@@ -638,7 +635,7 @@
638void635void
639_refresh_background (Bubble* self)636_refresh_background (Bubble* self)
640{637{
641 BubblePrivate* priv = GET_PRIVATE (self);638 BubblePrivate* priv = self->priv;
642 Defaults* d = self->defaults;639 Defaults* d = self->defaults;
643 cairo_t* cr = NULL;640 cairo_t* cr = NULL;
644 cairo_surface_t* scratch = NULL;641 cairo_surface_t* scratch = NULL;
@@ -939,7 +936,7 @@
939void936void
940_refresh_icon (Bubble* self)937_refresh_icon (Bubble* self)
941{938{
942 BubblePrivate* priv = GET_PRIVATE (self);939 BubblePrivate* priv = self->priv;
943 Defaults* d = self->defaults;940 Defaults* d = self->defaults;
944 cairo_surface_t* normal = NULL;941 cairo_surface_t* normal = NULL;
945 cairo_t* cr = NULL;942 cairo_t* cr = NULL;
@@ -991,7 +988,7 @@
991void988void
992_refresh_title (Bubble* self)989_refresh_title (Bubble* self)
993{990{
994 BubblePrivate* priv = GET_PRIVATE (self);991 BubblePrivate* priv = self->priv;
995 Defaults* d = self->defaults;992 Defaults* d = self->defaults;
996 cairo_surface_t* normal = NULL;993 cairo_surface_t* normal = NULL;
997 cairo_t* cr = NULL;994 cairo_t* cr = NULL;
@@ -1099,7 +1096,7 @@
1099void1096void
1100_refresh_body (Bubble* self)1097_refresh_body (Bubble* self)
1101{1098{
1102 BubblePrivate* priv = GET_PRIVATE (self);1099 BubblePrivate* priv = self->priv;
1103 Defaults* d = self->defaults;1100 Defaults* d = self->defaults;
1104 cairo_surface_t* normal = NULL;1101 cairo_surface_t* normal = NULL;
1105 cairo_t* cr = NULL;1102 cairo_t* cr = NULL;
@@ -1209,7 +1206,7 @@
1209void1206void
1210_refresh_indicator (Bubble* self)1207_refresh_indicator (Bubble* self)
1211{1208{
1212 BubblePrivate* priv = GET_PRIVATE (self);1209 BubblePrivate* priv = self->priv;
1213 Defaults* d = self->defaults;1210 Defaults* d = self->defaults;
1214 cairo_surface_t* normal = NULL;1211 cairo_surface_t* normal = NULL;
1215 cairo_t* cr = NULL;1212 cairo_t* cr = NULL;
@@ -1362,7 +1359,7 @@
1362 gdouble alpha_normal,1359 gdouble alpha_normal,
1363 gdouble alpha_blur)1360 gdouble alpha_blur)
1364{1361{
1365 BubblePrivate* priv = GET_PRIVATE (self);1362 BubblePrivate* priv = self->priv;
1366 cairo_pattern_t* pattern;1363 cairo_pattern_t* pattern;
13671364
1368 tile_paint (priv->tile_icon,1365 tile_paint (priv->tile_icon,
@@ -1432,7 +1429,7 @@
1432 gdouble alpha_normal,1429 gdouble alpha_normal,
1433 gdouble alpha_blur)1430 gdouble alpha_blur)
1434{1431{
1435 BubblePrivate* priv = GET_PRIVATE (self);1432 BubblePrivate* priv = self->priv;
1436 cairo_pattern_t* pattern;1433 cairo_pattern_t* pattern;
14371434
1438 tile_paint (priv->tile_indicator,1435 tile_paint (priv->tile_indicator,
@@ -1533,7 +1530,7 @@
1533 _render_body (self,1530 _render_body (self,
1534 cr,1531 cr,
1535 shadow + 2 * margin + 2 * icon_half - BUBBLE_CONTENT_BLUR_RADIUS,1532 shadow + 2 * margin + 2 * icon_half - BUBBLE_CONTENT_BLUR_RADIUS,
1536 shadow + margin + GET_PRIVATE (self)->title_height - BUBBLE_CONTENT_BLUR_RADIUS,1533 shadow + margin + self->priv->title_height - BUBBLE_CONTENT_BLUR_RADIUS,
1537 alpha_normal,1534 alpha_normal,
1538 alpha_blur);1535 alpha_blur);
1539 break;1536 break;
@@ -1548,7 +1545,7 @@
1548 _render_body (self,1545 _render_body (self,
1549 cr,1546 cr,
1550 shadow + margin - BUBBLE_CONTENT_BLUR_RADIUS,1547 shadow + margin - BUBBLE_CONTENT_BLUR_RADIUS,
1551 shadow + margin + GET_PRIVATE (self)->title_height - BUBBLE_CONTENT_BLUR_RADIUS,1548 shadow + margin + self->priv->title_height - BUBBLE_CONTENT_BLUR_RADIUS,
1552 alpha_normal,1549 alpha_normal,
1553 alpha_blur);1550 alpha_blur);
1554 break;1551 break;
@@ -1668,7 +1665,7 @@
1668 if (!self || !IS_BUBBLE (self))1665 if (!self || !IS_BUBBLE (self))
1669 return;1666 return;
16701667
1671 priv = GET_PRIVATE (self);1668 priv = self->priv;
16721669
1673 // do we actually need a shape-mask at all?1670 // do we actually need a shape-mask at all?
1674 if (priv->composited)1671 if (priv->composited)
@@ -1710,33 +1707,30 @@
1710composited_changed_handler (GtkWidget* window,1707composited_changed_handler (GtkWidget* window,
1711 gpointer data)1708 gpointer data)
1712{1709{
1713 Bubble* bubble;1710 Bubble* bubble;
17141711 BubblePrivate* priv;
1715 bubble = (Bubble*) G_OBJECT (data);1712
17161713 bubble = BUBBLE (data);
1717 GET_PRIVATE (bubble)->composited = gdk_screen_is_composited (1714 priv = bubble->priv;
1718 gtk_widget_get_screen (window));1715
1716 priv->composited = gdk_screen_is_composited (gtk_widget_get_screen (window));
17191717
1720 update_shape (bubble);1718 update_shape (bubble);
1721}1719}
17221720
1723static1721static gboolean
1724gboolean1722bubble_draw (GtkWidget* widget,
1725expose_handler (GtkWidget* window,1723 cairo_t* cr,
1726 GdkEventExpose* event,1724 gpointer data)
1727 gpointer data)
1728{1725{
1729 Bubble* bubble;1726 Bubble* bubble;
1730 cairo_t* cr;
1731 Defaults* d;1727 Defaults* d;
1732 BubblePrivate* priv;1728 BubblePrivate* priv;
17331729
1734 bubble = (Bubble*) G_OBJECT (data);1730 bubble = (Bubble*) G_OBJECT (data);
17351731
1736 d = bubble->defaults;1732 d = bubble->defaults;
1737 priv = GET_PRIVATE (bubble);1733 priv = bubble->priv;
1738
1739 cr = gdk_cairo_create (gtk_widget_get_window (window));
17401734
1741 // clear bubble-background1735 // clear bubble-background
1742 cairo_scale (cr, 1.0f, 1.0f);1736 cairo_scale (cr, 1.0f, 1.0f);
@@ -1767,9 +1761,7 @@
1767 1.0f - priv->distance);1761 1.0f - priv->distance);
1768 }1762 }
17691763
1770 cairo_destroy (cr);1764 _set_bg_blur (widget,
1771
1772 _set_bg_blur (window,
1773 TRUE,1765 TRUE,
1774 EM2PIXELS (get_shadow_size (bubble), d));1766 EM2PIXELS (get_shadow_size (bubble), d));
17751767
@@ -1788,7 +1780,7 @@
1788 if (!bubble_is_visible (bubble))1780 if (!bubble_is_visible (bubble))
1789 return FALSE;1781 return FALSE;
17901782
1791 priv = GET_PRIVATE (bubble);1783 priv = bubble->priv;
17921784
1793 if (!priv->composited)1785 if (!priv->composited)
1794 return TRUE;1786 return TRUE;
@@ -1897,7 +1889,7 @@
1897 if (!bubble_is_visible (bubble))1889 if (!bubble_is_visible (bubble))
1898 return FALSE;1890 return FALSE;
18991891
1900 priv = GET_PRIVATE (bubble);1892 priv = bubble->priv;
1901 window = priv->widget;1893 window = priv->widget;
19021894
1903 if (!GTK_IS_WINDOW (window))1895 if (!GTK_IS_WINDOW (window))
@@ -1976,12 +1968,14 @@
1976static void1968static void
1977bubble_dispose (GObject* gobject)1969bubble_dispose (GObject* gobject)
1978{1970{
1971 Bubble* bubble;
1979 BubblePrivate* priv;1972 BubblePrivate* priv;
19801973
1981 if (!gobject || !IS_BUBBLE (gobject))1974 if (!gobject || !IS_BUBBLE (gobject))
1982 return;1975 return;
19831976
1984 priv = GET_PRIVATE (gobject);1977 bubble = BUBBLE (gobject);
1978 priv = bubble->priv;
19851979
1986 if (GTK_IS_WIDGET (priv->widget))1980 if (GTK_IS_WIDGET (priv->widget))
1987 {1981 {
@@ -2113,7 +2107,7 @@
21132107
2114 BubblePrivate *priv;2108 BubblePrivate *priv;
21152109
2116 self->priv = priv = GET_PRIVATE (self);2110 self->priv = priv = bubble_get_instance_private (self);
2117 priv->layout = LAYOUT_NONE;2111 priv->layout = LAYOUT_NONE;
2118 priv->title = NULL;2112 priv->title = NULL;
2119 priv->message_body = NULL;2113 priv->message_body = NULL;
@@ -2147,8 +2141,6 @@
2147{2141{
2148 GObjectClass* gobject_class = G_OBJECT_CLASS (klass);2142 GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
21492143
2150 g_type_class_add_private (klass, sizeof (BubblePrivate));
2151
2152 gobject_class->dispose = bubble_dispose;2144 gobject_class->dispose = bubble_dispose;
2153 gobject_class->finalize = bubble_finalize;2145 gobject_class->finalize = bubble_finalize;
2154 gobject_class->get_property = bubble_get_property;2146 gobject_class->get_property = bubble_get_property;
@@ -2216,7 +2208,7 @@
2216 return NULL;2208 return NULL;
22172209
2218 this->defaults = defaults;2210 this->defaults = defaults;
2219 priv = GET_PRIVATE (this);2211 priv = this->priv;
22202212
2221 priv->widget = bubble_window_new();2213 priv->widget = bubble_window_new();
2222 window = priv->widget;2214 window = priv->widget;
@@ -2255,10 +2247,10 @@
2255 &transparent);2247 &transparent);
22562248
2257 // hook up window-event handlers to window2249 // hook up window-event handlers to window
2258 g_signal_connect (G_OBJECT (window),2250 g_signal_connect (window,
2259 "draw",2251 "draw",
2260 G_CALLBACK (expose_handler),2252 G_CALLBACK (bubble_draw),
2261 this);2253 this);
22622254
2263 // "clear" input-mask, set title/icon/attributes2255 // "clear" input-mask, set title/icon/attributes
2264 gtk_widget_set_app_paintable (window, TRUE);2256 gtk_widget_set_app_paintable (window, TRUE);
@@ -2271,7 +2263,7 @@
2271 gtk_widget_set_opacity (window, 0.0f);2263 gtk_widget_set_opacity (window, 0.0f);
22722264
2273 // TODO: fold some of that back into bubble_init2265 // TODO: fold some of that back into bubble_init
2274 this->priv = GET_PRIVATE (this);2266 this->priv = this->priv;
2275 this->priv->layout = LAYOUT_NONE;2267 this->priv->layout = LAYOUT_NONE;
2276 this->priv->widget = window;2268 this->priv->widget = window;
2277 this->priv->title = g_string_new ("");2269 this->priv->title = g_string_new ("");
@@ -2313,7 +2305,7 @@
2313{2305{
2314 g_return_val_if_fail (IS_BUBBLE (self), NULL);2306 g_return_val_if_fail (IS_BUBBLE (self), NULL);
23152307
2316 return GET_PRIVATE (self)->synchronous;2308 return self->priv->synchronous;
2317}2309}
23182310
2319gchar*2311gchar*
@@ -2321,7 +2313,7 @@
2321{2313{
2322 g_return_val_if_fail (IS_BUBBLE (self), NULL);2314 g_return_val_if_fail (IS_BUBBLE (self), NULL);
23232315
2324 return GET_PRIVATE (self)->sender;2316 return self->priv->sender;
2325}2317}
23262318
2327void2319void
@@ -2334,7 +2326,7 @@
2334 if (!self || !IS_BUBBLE (self))2326 if (!self || !IS_BUBBLE (self))
2335 return;2327 return;
23362328
2337 priv = GET_PRIVATE (self);2329 priv = self->priv;
23382330
2339 // convert any newline to space2331 // convert any newline to space
2340 text = newline_to_space (title);2332 text = newline_to_space (title);
@@ -2350,7 +2342,7 @@
2350 priv->title = g_string_new (text);2342 priv->title = g_string_new (text);
23512343
2352 g_object_notify (2344 g_object_notify (
2353 G_OBJECT (gtk_widget_get_accessible (GET_PRIVATE(self)->widget)), 2345 G_OBJECT (gtk_widget_get_accessible (self->priv->widget)),
2354 "accessible-name");2346 "accessible-name");
23552347
2356 g_free (text);2348 g_free (text);
@@ -2362,7 +2354,7 @@
2362 if (!self || !IS_BUBBLE (self))2354 if (!self || !IS_BUBBLE (self))
2363 return NULL;2355 return NULL;
23642356
2365 return GET_PRIVATE (self)->title->str;2357 return self->priv->title->str;
2366}2358}
23672359
2368void2360void
@@ -2375,7 +2367,7 @@
2375 if (!self || !IS_BUBBLE (self))2367 if (!self || !IS_BUBBLE (self))
2376 return;2368 return;
23772369
2378 priv = GET_PRIVATE (self);2370 priv = self->priv;
23792371
2380 // filter out any HTML/markup if possible2372 // filter out any HTML/markup if possible
2381 text = filter_text (body);2373 text = filter_text (body);
@@ -2408,7 +2400,7 @@
2408 if (!self || !IS_BUBBLE (self))2400 if (!self || !IS_BUBBLE (self))
2409 return NULL;2401 return NULL;
24102402
2411 return GET_PRIVATE (self)->message_body->str;2403 return self->priv->message_body->str;
2412}2404}
24132405
2414void2406void
@@ -2421,7 +2413,7 @@
2421 if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filepath, ""))2413 if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filepath, ""))
2422 return;2414 return;
24232415
2424 priv = GET_PRIVATE (self);2416 priv = self->priv;
24252417
2426 // check if an app tries to set the same file as icon again, this check2418 // check if an app tries to set the same file as icon again, this check
2427 // avoids superfluous regeneration of the tile/blur-cache for the icon,2419 // avoids superfluous regeneration of the tile/blur-cache for the icon,
@@ -2458,7 +2450,7 @@
2458 if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filename, ""))2450 if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filename, ""))
2459 return;2451 return;
24602452
2461 priv = GET_PRIVATE (self);2453 priv = self->priv;
24622454
2463 //basename = g_path_get_basename (filename);2455 //basename = g_path_get_basename (filename);
24642456
@@ -2565,7 +2557,7 @@
2565 if (!self || !IS_BUBBLE (self) || !pixbuf)2557 if (!self || !IS_BUBBLE (self) || !pixbuf)
2566 return;2558 return;
25672559
2568 priv = GET_PRIVATE (self);2560 priv = self->priv;
25692561
2570 // "reset" the stored the icon-filename, fixes LP: #4510862562 // "reset" the stored the icon-filename, fixes LP: #451086
2571 g_string_assign (priv->old_icon_filename, "\0");2563 g_string_assign (priv->old_icon_filename, "\0");
@@ -2599,7 +2591,7 @@
2599{2591{
2600 g_return_val_if_fail (IS_BUBBLE (self), NULL);2592 g_return_val_if_fail (IS_BUBBLE (self), NULL);
26012593
2602 return GET_PRIVATE (self)->icon_pixbuf;2594 return self->priv->icon_pixbuf;
2603}2595}
26042596
2605void2597void
@@ -2611,7 +2603,7 @@
2611 if (!self || !IS_BUBBLE (self))2603 if (!self || !IS_BUBBLE (self))
2612 return;2604 return;
26132605
2614 priv = GET_PRIVATE (self);2606 priv = self->priv;
26152607
2616 // only really cause a refresh (blur, recreating tile-/blur-cache) if2608 // only really cause a refresh (blur, recreating tile-/blur-cache) if
2617 // a different value has been set, this helps improve performance when2609 // a different value has been set, this helps improve performance when
@@ -2633,7 +2625,7 @@
2633 if (!self || !IS_BUBBLE (self))2625 if (!self || !IS_BUBBLE (self))
2634 return -2;2626 return -2;
26352627
2636 return GET_PRIVATE (self)->value;2628 return self->priv->value;
2637}2629}
26382630
2639void2631void
@@ -2644,7 +2636,7 @@
2644 if (!self || !IS_BUBBLE (self))2636 if (!self || !IS_BUBBLE (self))
2645 return;2637 return;
26462638
2647 gtk_widget_set_size_request (GET_PRIVATE(self)->widget, width, height);2639 gtk_widget_set_size_request (self->priv->widget, width, height);
2648}2640}
26492641
2650void2642void
@@ -2655,7 +2647,7 @@
2655 if (!self || !IS_BUBBLE (self))2647 if (!self || !IS_BUBBLE (self))
2656 return;2648 return;
26572649
2658 gtk_widget_get_size_request (GET_PRIVATE(self)->widget, width, height);2650 gtk_widget_get_size_request (self->priv->widget, width, height);
2659}2651}
26602652
2661void2653void
@@ -2665,7 +2657,7 @@
2665 if (!self || !IS_BUBBLE (self))2657 if (!self || !IS_BUBBLE (self))
2666 return;2658 return;
26672659
2668 GET_PRIVATE (self)->timeout = timeout;2660 self->priv->timeout = timeout;
2669}2661}
26702662
2671/* a timeout of 0 doesn't make much sense now does it, thus 0 indicates an2663/* a timeout of 0 doesn't make much sense now does it, thus 0 indicates an
@@ -2676,7 +2668,7 @@
2676 if (!self || !IS_BUBBLE (self))2668 if (!self || !IS_BUBBLE (self))
2677 return 0;2669 return 0;
26782670
2679 return GET_PRIVATE(self)->timeout;2671 return self->priv->timeout;
2680}2672}
26812673
2682void2674void
@@ -2686,7 +2678,7 @@
2686 if (!self || !IS_BUBBLE (self))2678 if (!self || !IS_BUBBLE (self))
2687 return;2679 return;
26882680
2689 GET_PRIVATE(self)->timer_id = timer_id;2681 self->priv->timer_id = timer_id;
2690}2682}
26912683
2692/* a valid GLib timer-id is always > 0, thus 0 indicates an error */2684/* a valid GLib timer-id is always > 0, thus 0 indicates an error */
@@ -2696,7 +2688,7 @@
2696 if (!self || !IS_BUBBLE (self))2688 if (!self || !IS_BUBBLE (self))
2697 return 0;2689 return 0;
26982690
2699 return GET_PRIVATE(self)->timer_id;2691 return self->priv->timer_id;
2700}2692}
27012693
2702void2694void
@@ -2708,7 +2700,7 @@
2708 if (!self || !IS_BUBBLE (self))2700 if (!self || !IS_BUBBLE (self))
2709 return;2701 return;
27102702
2711 priv = GET_PRIVATE (self);2703 priv = self->priv;
27122704
2713 /* did anything change? */2705 /* did anything change? */
2714 if (priv->mouse_over != flag)2706 if (priv->mouse_over != flag)
@@ -2737,7 +2729,7 @@
2737 if (!self || !IS_BUBBLE (self))2729 if (!self || !IS_BUBBLE (self))
2738 return FALSE;2730 return FALSE;
27392731
2740 priv = GET_PRIVATE (self);2732 priv = self->priv;
27412733
2742 if (priv->prevent_fade)2734 if (priv->prevent_fade)
2743 return FALSE;2735 return FALSE;
@@ -2753,7 +2745,7 @@
2753 if (!self || !IS_BUBBLE (self))2745 if (!self || !IS_BUBBLE (self))
2754 return;2746 return;
27552747
2756 gtk_window_move (GTK_WINDOW (GET_PRIVATE (self)->widget), x, y);2748 gtk_window_move (GTK_WINDOW (self->priv->widget), x, y);
2757}2749}
27582750
2759static void2751static void
@@ -2764,7 +2756,7 @@
27642756
2765 g_return_if_fail (IS_BUBBLE (bubble));2757 g_return_if_fail (IS_BUBBLE (bubble));
27662758
2767 priv = GET_PRIVATE (bubble);2759 priv = bubble->priv;
27682760
2769 /* get rid of the alpha, so that the mouse-over algorithm notices */2761 /* get rid of the alpha, so that the mouse-over algorithm notices */
2770 if (priv->alpha)2762 if (priv->alpha)
@@ -2799,7 +2791,7 @@
27992791
2800 g_return_if_fail (IS_BUBBLE (self));2792 g_return_if_fail (IS_BUBBLE (self));
28012793
2802 priv = GET_PRIVATE (self);2794 priv = self->priv;
28032795
2804 timeline = egg_timeline_new_for_duration (msecs);2796 timeline = egg_timeline_new_for_duration (msecs);
2805 egg_timeline_set_speed (timeline, FPS);2797 egg_timeline_set_speed (timeline, FPS);
@@ -2836,7 +2828,7 @@
2836 if (!self || !IS_BUBBLE (self))2828 if (!self || !IS_BUBBLE (self))
2837 return;2829 return;
28382830
2839 priv = GET_PRIVATE (self);2831 priv = self->priv;
28402832
2841 priv->visible = TRUE;2833 priv->visible = TRUE;
2842 gtk_widget_show_all (priv->widget);2834 gtk_widget_show_all (priv->widget);
@@ -2869,7 +2861,7 @@
2869 return;2861 return;
28702862
2871 /* force a redraw */2863 /* force a redraw */
2872 gtk_widget_queue_draw (GET_PRIVATE (self)->widget);2864 gtk_widget_queue_draw (self->priv->widget);
2873}2865}
28742866
2875static inline gboolean2867static inline gboolean
@@ -2877,13 +2869,13 @@
2877{2869{
2878 /* no g_return_if_fail(), the caller should have already2870 /* no g_return_if_fail(), the caller should have already
2879 checked that */2871 checked that */
2880 return gtk_widget_is_composited (GET_PRIVATE (bubble)->widget);2872 return gtk_widget_is_composited (bubble->priv->widget);
2881}2873}
28822874
2883static inline GtkWindow*2875static inline GtkWindow*
2884bubble_get_window (Bubble *bubble)2876bubble_get_window (Bubble *bubble)
2885{2877{
2886 return GTK_WINDOW (GET_PRIVATE (bubble)->widget);2878 return GTK_WINDOW (bubble->priv->widget);
2887}2879}
28882880
2889static void2881static void
@@ -2895,15 +2887,15 @@
28952887
2896 g_return_if_fail (IS_BUBBLE (bubble));2888 g_return_if_fail (IS_BUBBLE (bubble));
28972889
2898 opacity = (float)egg_alpha_get_alpha (GET_PRIVATE (bubble)->alpha)2890 opacity = (float)egg_alpha_get_alpha (bubble->priv->alpha)
2899 / (float)EGG_ALPHA_MAX_ALPHA2891 / (float)EGG_ALPHA_MAX_ALPHA
2900 * WINDOW_MAX_OPACITY;2892 * WINDOW_MAX_OPACITY;
29012893
2902 if (bubble_is_mouse_over (bubble))2894 if (bubble_is_mouse_over (bubble))
2903 gtk_widget_set_opacity (GET_PRIVATE (bubble)->widget,2895 gtk_widget_set_opacity (bubble->priv->widget,
2904 WINDOW_MIN_OPACITY);2896 WINDOW_MIN_OPACITY);
2905 else2897 else
2906 gtk_widget_set_opacity (GET_PRIVATE (bubble)->widget, opacity);2898 gtk_widget_set_opacity (bubble->priv->widget, opacity);
2907}2899}
29082900
2909static void2901static void
@@ -2929,7 +2921,7 @@
29292921
2930 g_return_if_fail (IS_BUBBLE (bubble));2922 g_return_if_fail (IS_BUBBLE (bubble));
29312923
2932 priv = GET_PRIVATE (bubble);2924 priv = bubble->priv;
29332925
2934 /* get rid of the alpha, so that the mouse-over algorithm notices */2926 /* get rid of the alpha, so that the mouse-over algorithm notices */
2935 if (priv->alpha)2927 if (priv->alpha)
@@ -2945,10 +2937,10 @@
2945 }2937 }
29462938
2947 if (bubble_is_mouse_over (bubble))2939 if (bubble_is_mouse_over (bubble))
2948 gtk_widget_set_opacity (GET_PRIVATE (bubble)->widget,2940 gtk_widget_set_opacity (bubble->priv->widget,
2949 WINDOW_MIN_OPACITY);2941 WINDOW_MIN_OPACITY);
2950 else2942 else
2951 gtk_widget_set_opacity (GET_PRIVATE (bubble)->widget,2943 gtk_widget_set_opacity (bubble->priv->widget,
2952 WINDOW_MAX_OPACITY);2944 WINDOW_MAX_OPACITY);
29532945
2954 bubble_start_timer (bubble, TRUE);2946 bubble_start_timer (bubble, TRUE);
@@ -2963,7 +2955,7 @@
29632955
2964 g_return_if_fail (IS_BUBBLE (self));2956 g_return_if_fail (IS_BUBBLE (self));
29652957
2966 priv = GET_PRIVATE (self);2958 priv = self->priv;
29672959
2968 if (!bubble_is_composited (self)2960 if (!bubble_is_composited (self)
2969 || msecs == 0)2961 || msecs == 0)
@@ -2999,7 +2991,7 @@
29992991
3000 egg_timeline_start (timeline);2992 egg_timeline_start (timeline);
30012993
3002 gtk_widget_set_opacity (GET_PRIVATE (self)->widget, 0.0f);2994 gtk_widget_set_opacity (self->priv->widget, 0.0f);
30032995
3004 bubble_show (self);2996 bubble_show (self);
3005}2997}
@@ -3013,7 +3005,7 @@
30133005
3014 g_return_if_fail (IS_BUBBLE (self));3006 g_return_if_fail (IS_BUBBLE (self));
30153007
3016 priv = GET_PRIVATE (self);3008 priv = self->priv;
30173009
3018 timeline = egg_timeline_new_for_duration (msecs);3010 timeline = egg_timeline_new_for_duration (msecs);
3019 egg_timeline_set_speed (timeline, FPS);3011 egg_timeline_set_speed (timeline, FPS);
@@ -3052,7 +3044,7 @@
3052 * g_source_remove() on it later. */3044 * g_source_remove() on it later. */
3053 bubble_set_timer_id (self, 0);3045 bubble_set_timer_id (self, 0);
30543046
3055 if (GET_PRIVATE (self)->composited)3047 if (self->priv->composited)
3056 {3048 {
3057 bubble_fade_out (self, 300);3049 bubble_fade_out (self, 300);
3058 return FALSE;3050 return FALSE;
@@ -3077,7 +3069,7 @@
3077 if (!self || !IS_BUBBLE (self) || !bubble_is_visible (self))3069 if (!self || !IS_BUBBLE (self) || !bubble_is_visible (self))
3078 return;3070 return;
30793071
3080 priv = GET_PRIVATE (self);3072 priv = self->priv;
30813073
3082 priv->visible = FALSE;3074 priv->visible = FALSE;
3083 gtk_widget_hide (priv->widget);3075 gtk_widget_hide (priv->widget);
@@ -3105,7 +3097,7 @@
3105 if (!self || !IS_BUBBLE (self))3097 if (!self || !IS_BUBBLE (self))
3106 return;3098 return;
31073099
3108 GET_PRIVATE (self)->id = id;3100 self->priv->id = id;
3109}3101}
31103102
3111guint3103guint
@@ -3114,7 +3106,7 @@
3114 if (!self || !IS_BUBBLE (self))3106 if (!self || !IS_BUBBLE (self))
3115 return 0;3107 return 0;
31163108
3117 return GET_PRIVATE (self)->id;3109 return self->priv->id;
3118}3110}
31193111
3120gboolean3112gboolean
@@ -3123,7 +3115,7 @@
3123 if (!self || !IS_BUBBLE (self))3115 if (!self || !IS_BUBBLE (self))
3124 return FALSE;3116 return FALSE;
31253117
3126 return GET_PRIVATE (self)->visible;3118 return self->priv->visible;
3127}3119}
31283120
3129void3121void
@@ -3136,7 +3128,7 @@
3136 if (!self || !IS_BUBBLE (self))3128 if (!self || !IS_BUBBLE (self))
3137 return;3129 return;
31383130
3139 priv = GET_PRIVATE (self);3131 priv = self->priv;
31403132
3141 timer_id = bubble_get_timer_id (self);3133 timer_id = bubble_get_timer_id (self);
3142 if (timer_id > 0)3134 if (timer_id > 0)
@@ -3167,7 +3159,7 @@
3167 if (!self || !IS_BUBBLE (self))3159 if (!self || !IS_BUBBLE (self))
3168 return;3160 return;
3169 3161
3170 timer_id = GET_PRIVATE(self)->timer_id;3162 timer_id = self->priv->timer_id;
31713163
3172 if (timer_id > 0) {3164 if (timer_id > 0) {
3173 g_source_remove (timer_id);3165 g_source_remove (timer_id);
@@ -3183,7 +3175,7 @@
3183 if (!self || !IS_BUBBLE (self))3175 if (!self || !IS_BUBBLE (self))
3184 return;3176 return;
31853177
3186 gtk_window_get_position (GTK_WINDOW (GET_PRIVATE (self)->widget),3178 gtk_window_get_position (GTK_WINDOW (self->priv->widget),
3187 x, y);3179 x, y);
3188}3180}
31893181
@@ -3196,7 +3188,7 @@
3196 if (!self || !IS_BUBBLE (self))3188 if (!self || !IS_BUBBLE (self))
3197 return 0;3189 return 0;
31983190
3199 gtk_window_get_size (GTK_WINDOW (GET_PRIVATE (self)->widget),3191 gtk_window_get_size (GTK_WINDOW (self->priv->widget),
3200 &width,3192 &width,
3201 &height);3193 &height);
32023194
@@ -3209,7 +3201,7 @@
3209 if (!self || !IS_BUBBLE (self))3201 if (!self || !IS_BUBBLE (self))
3210 return 0;3202 return 0;
32113203
3212 return GET_PRIVATE (self)->future_height;3204 return self->priv->future_height;
3213}3205}
32143206
3215gint3207gint
@@ -3230,7 +3222,7 @@
3230 return 0;3222 return 0;
32313223
3232 d = self->defaults;3224 d = self->defaults;
3233 priv = GET_PRIVATE (self);3225 priv = self->priv;
32343226
3235 surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 1, 1);3227 surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 1, 1);
3236 if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {3228 if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
@@ -3306,7 +3298,7 @@
3306 return 0;3298 return 0;
33073299
3308 d = self->defaults;3300 d = self->defaults;
3309 priv = GET_PRIVATE (self);3301 priv = self->priv;
33103302
3311 cr = gdk_cairo_create (gtk_widget_get_window (priv->widget));3303 cr = gdk_cairo_create (gtk_widget_get_window (priv->widget));
3312 if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {3304 if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
@@ -3413,7 +3405,7 @@
3413 return;3405 return;
34143406
3415 d = self->defaults;3407 d = self->defaults;
3416 priv = GET_PRIVATE (self);3408 priv = self->priv;
34173409
3418 /* FIXME: a quick fix to rescale an icon (e.g. user changed font-size or3410 /* FIXME: a quick fix to rescale an icon (e.g. user changed font-size or
3419 ** DPI while a bubble is displayed, thus bubble is re-rendered and the3411 ** DPI while a bubble is displayed, thus bubble is re-rendered and the
@@ -3448,7 +3440,7 @@
34483440
3449 priv->title_height = _calc_title_height (3441 priv->title_height = _calc_title_height (
3450 self,3442 self,
3451 GET_PRIVATE (self)->title_width);3443 self->priv->title_width);
34523444
3453 new_bubble_height =3445 new_bubble_height =
3454 EM2PIXELS (defaults_get_bubble_min_height (d), d) +3446 EM2PIXELS (defaults_get_bubble_min_height (d), d) +
@@ -3467,7 +3459,7 @@
34673459
3468 priv->title_height = _calc_title_height (3460 priv->title_height = _calc_title_height (
3469 self,3461 self,
3470 GET_PRIVATE (self)->title_width);3462 self->priv->title_width);
34713463
3472 priv->body_width =3464 priv->body_width =
3473 EM2PIXELS (defaults_get_bubble_width (d), d) -3465 EM2PIXELS (defaults_get_bubble_width (d), d) -
@@ -3610,7 +3602,7 @@
36103602
3611 g_return_if_fail (IS_BUBBLE (self));3603 g_return_if_fail (IS_BUBBLE (self));
36123604
3613 priv = GET_PRIVATE (self);3605 priv = self->priv;
36143606
3615 if (priv->synchronous != NULL)3607 if (priv->synchronous != NULL)
3616 g_free (priv->synchronous);3608 g_free (priv->synchronous);
@@ -3626,7 +3618,7 @@
36263618
3627 g_return_if_fail (IS_BUBBLE (self));3619 g_return_if_fail (IS_BUBBLE (self));
36283620
3629 priv = GET_PRIVATE (self);3621 priv = self->priv;
36303622
3631 if (priv->sender != NULL)3623 if (priv->sender != NULL)
3632 g_free (priv->sender);3624 g_free (priv->sender);
@@ -3640,7 +3632,7 @@
3640 if (!self || !IS_BUBBLE (self))3632 if (!self || !IS_BUBBLE (self))
3641 return FALSE;3633 return FALSE;
36423634
3643 return (GET_PRIVATE (self)->synchronous != NULL);3635 return (self->priv->synchronous != NULL);
3644}3636}
36453637
3646gboolean3638gboolean
@@ -3648,7 +3640,7 @@
3648{3640{
3649 g_return_val_if_fail (IS_BUBBLE (self), FALSE);3641 g_return_val_if_fail (IS_BUBBLE (self), FALSE);
36503642
3651 return (GET_PRIVATE (self)->urgency == 2);3643 return (self->priv->urgency == 2);
3652}3644}
36533645
3654guint3646guint
@@ -3656,7 +3648,7 @@
3656{3648{
3657 g_return_val_if_fail (IS_BUBBLE (self), 0);3649 g_return_val_if_fail (IS_BUBBLE (self), 0);
36583650
3659 return GET_PRIVATE (self)->urgency;3651 return self->priv->urgency;
3660}3652}
36613653
3662void3654void
@@ -3665,7 +3657,7 @@
3665{3657{
3666 g_return_if_fail (IS_BUBBLE (self));3658 g_return_if_fail (IS_BUBBLE (self));
36673659
3668 GET_PRIVATE (self)->urgency = urgency;3660 self->priv->urgency = urgency;
3669}3661}
36703662
3671void3663void
@@ -3677,7 +3669,7 @@
3677 if (!self || !IS_BUBBLE (self))3669 if (!self || !IS_BUBBLE (self))
3678 return;3670 return;
36793671
3680 priv = GET_PRIVATE (self);3672 priv = self->priv;
36813673
3682 /* set a sane default */3674 /* set a sane default */
3683 priv->layout = LAYOUT_NONE;3675 priv->layout = LAYOUT_NONE;
@@ -3748,7 +3740,7 @@
3748 if (!self || !IS_BUBBLE (self))3740 if (!self || !IS_BUBBLE (self))
3749 return LAYOUT_NONE;3741 return LAYOUT_NONE;
37503742
3751 return GET_PRIVATE (self)->layout;3743 return self->priv->layout;
3752}3744}
37533745
3754void3746void
@@ -3758,7 +3750,7 @@
3758 if (!self || !IS_BUBBLE (self))3750 if (!self || !IS_BUBBLE (self))
3759 return;3751 return;
37603752
3761 GET_PRIVATE (self)->icon_only = allowed;3753 self->priv->icon_only = allowed;
3762}3754}
37633755
3764void3756void
@@ -3768,7 +3760,7 @@
3768 if (!self || !IS_BUBBLE (self))3760 if (!self || !IS_BUBBLE (self))
3769 return;3761 return;
37703762
3771 GET_PRIVATE (self)->append = allowed;3763 self->priv->append = allowed;
3772}3764}
37733765
37743766
@@ -3778,7 +3770,7 @@
3778 if (!self || !IS_BUBBLE (self))3770 if (!self || !IS_BUBBLE (self))
3779 return FALSE;3771 return FALSE;
37803772
3781 return GET_PRIVATE (self)->append;3773 return self->priv->append;
3782}3774}
37833775
3784void3776void
@@ -3793,7 +3785,7 @@
3793 if (!self || !IS_BUBBLE (self) || !append_body)3785 if (!self || !IS_BUBBLE (self) || !append_body)
3794 return;3786 return;
37953787
3796 priv = GET_PRIVATE (self);3788 priv = self->priv;
37973789
3798 // filter out any HTML/markup if possible3790 // filter out any HTML/markup if possible
3799 result = pango_parse_markup (append_body,3791 result = pango_parse_markup (append_body,

Subscribers

People subscribed via source and target branches