diff options
author | Ikey Doherty <[email protected]> | 2016-11-16 18:09:50 +0000 |
---|---|---|
committer | monsta <[email protected]> | 2017-02-14 17:03:17 +0400 |
commit | 70425533f5648d00113e7bfeabe52198c6bbdad8 (patch) | |
tree | 19ca370a162a1b0185825e8c1e29eab17cffeab4 /src | |
parent | 124254a41b45b790866c8df8d116a7bbef47ca50 (diff) | |
download | mate-notification-daemon-70425533f5648d00113e7bfeabe52198c6bbdad8.tar.bz2 mate-notification-daemon-70425533f5648d00113e7bfeabe52198c6bbdad8.tar.xz |
themes: Ensure that we never add more than one pie_countdown
Prior to this commit we would always end up adding multiple pie_countdown
widgets in a number of situations when updating the notification. In modern
media player apps, many updates are sent for the lifetime of a single
notification window, leading to new drawing areas being added and counting
down with each track/information change.
Note this hasn't been noticable for quite some time, because in many of the
themes the pie countdown hasn't actually been visible due to the actions
box having become hidden completely, meaning that the actions and pie show
very briefly, and are immediately nuked on a change to the notification.
Signed-off-by: Ikey Doherty <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/themes/coco/coco-theme.c | 21 | ||||
-rw-r--r-- | src/themes/nodoka/nodoka-theme.c | 21 | ||||
-rw-r--r-- | src/themes/slider/theme.c | 20 | ||||
-rw-r--r-- | src/themes/standard/theme.c | 18 |
4 files changed, 48 insertions, 32 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index b72c743..6291354 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -578,15 +578,18 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, { gtk_widget_show(windata->actions_box); - windata->pie_countdown = gtk_drawing_area_new(); - gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); - gtk_widget_show(windata->pie_countdown); - - gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); - gtk_widget_set_size_request(windata->pie_countdown, - PIE_WIDTH, PIE_HEIGHT); - g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", - G_CALLBACK(countdown_expose_cb), windata); + /* Don't try to re-add a pie_countdown */ + if (!windata->pie_countdown) { + windata->pie_countdown = gtk_drawing_area_new(); + gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); + gtk_widget_show(windata->pie_countdown); + + gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); + gtk_widget_set_size_request(windata->pie_countdown, + PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", + G_CALLBACK(countdown_expose_cb), windata); + } } button = gtk_button_new(); diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c index 2119f61..3a5cb5e 100644 --- a/src/themes/nodoka/nodoka-theme.c +++ b/src/themes/nodoka/nodoka-theme.c @@ -975,15 +975,18 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, gtk_widget_show(windata->actions_box); update_content_hbox_visibility(windata); - windata->pie_countdown = gtk_drawing_area_new(); - gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); - gtk_widget_show(windata->pie_countdown); - - gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); - gtk_widget_set_size_request(windata->pie_countdown, - PIE_WIDTH, PIE_HEIGHT); - g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", - G_CALLBACK(countdown_expose_cb), windata); + /* Don't try to re-add a pie_countdown */ + if (!windata->pie_countdown) { + windata->pie_countdown = gtk_drawing_area_new(); + gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); + gtk_widget_show(windata->pie_countdown); + + gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); + gtk_widget_set_size_request(windata->pie_countdown, + PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", + G_CALLBACK(countdown_expose_cb), windata); + } } button = gtk_button_new(); diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c index 39c1977..d12b74d 100644 --- a/src/themes/slider/theme.c +++ b/src/themes/slider/theme.c @@ -718,14 +718,18 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A gtk_widget_show(windata->actions_box); update_content_hbox_visibility(windata); - windata->pie_countdown = gtk_drawing_area_new(); - - gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); - gtk_widget_show(windata->pie_countdown); - - gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); - gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT); - g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", G_CALLBACK(on_countdown_draw), windata); + /* Don't try to re-add a pie_countdown */ + if (!windata->pie_countdown) { + windata->pie_countdown = gtk_drawing_area_new(); + gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); + gtk_widget_show(windata->pie_countdown); + + gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); + gtk_widget_set_size_request(windata->pie_countdown, + PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", + G_CALLBACK(on_countdown_draw), windata); + } } button = gtk_button_new(); diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c index 2200e77..5508172 100644 --- a/src/themes/standard/theme.c +++ b/src/themes/standard/theme.c @@ -1022,12 +1022,18 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A gtk_widget_show(windata->actions_box); update_content_hbox_visibility(windata); - windata->pie_countdown = gtk_drawing_area_new(); - gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); - gtk_widget_show(windata->pie_countdown); - gtk_box_pack_end(GTK_BOX(windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); - gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT); - g_signal_connect (G_OBJECT (windata->pie_countdown), "draw", G_CALLBACK (on_countdown_draw), windata); + /* Don't try to re-add a pie_countdown */ + if (!windata->pie_countdown) { + windata->pie_countdown = gtk_drawing_area_new(); + gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); + gtk_widget_show(windata->pie_countdown); + + gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, TRUE, 0); + gtk_widget_set_size_request(windata->pie_countdown, + PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", + G_CALLBACK(on_countdown_draw), windata); + } } button = gtk_button_new(); |