summaryrefslogtreecommitdiff
path: root/src/themes/standard/theme.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-07-28 13:08:09 +0200
committerinfirit <[email protected]>2015-07-28 20:02:12 +0200
commita0fb3a8910cf0c9d4d2ec7d24faba5a68109da32 (patch)
treee21e6a978cd8ba2af40030830eab95751ed10d05 /src/themes/standard/theme.c
parentf0bcfaeca30ae5a7992007bbc47406144851cf26 (diff)
downloadmate-notification-daemon-a0fb3a8910cf0c9d4d2ec7d24faba5a68109da32.tar.bz2
mate-notification-daemon-a0fb3a8910cf0c9d4d2ec7d24faba5a68109da32.tar.xz
standard: Move countdown drawing to countdown_paint function
And handle the draw/expose_event outside of countdown_paint which makes things easier to read.
Diffstat (limited to 'src/themes/standard/theme.c')
-rw-r--r--src/themes/standard/theme.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index b91fe3e..0e75a4f 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -942,18 +942,14 @@ void set_notification_arrow(GtkWidget* nw, gboolean visible, int x, int y)
update_spacers(nw);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-static gboolean countdown_draw_cb(GtkWidget* pie, cairo_t* cr, WindowData* windata)
-#else
-static gboolean countdown_expose_cb(GtkWidget* pie, GdkEventExpose* event, WindowData* windata)
-#endif
+static void
+paint_countdown (GtkWidget *pie,
+ cairo_t *cr,
+ WindowData *windata)
{
GtkStyle* style;
cairo_t* cr2;
cairo_surface_t* surface;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_t* cr = gdk_cairo_create (event->window);
-#endif
style = gtk_widget_get_style(windata->win);
GtkAllocation alloc;
@@ -988,13 +984,28 @@ static gboolean countdown_expose_cb(GtkWidget* pie, GdkEventExpose* event, Windo
cairo_restore (cr);
cairo_surface_destroy(surface);
+}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy(cr);
-#endif
+static gboolean
+#if GTK_CHECK_VERSION (3, 0, 0)
+on_countdown_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata)
+{
+ paint_countdown (widget, cr, windata);
- return TRUE;
+ return FALSE;
}
+#else
+on_countdown_expose_event (GtkWidget *widget, GdkEventExpose *event, WindowData *windata)
+{
+ cairo_t *cr = gdk_cairo_create (event->window);
+
+ paint_countdown (widget, cr, windata);
+
+ cairo_destroy (cr);
+
+ return FALSE;
+}
+#endif
static void action_clicked_cb(GtkWidget* w, GdkEventButton* event, ActionInvokedCb action_cb)
{
@@ -1034,9 +1045,9 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
gtk_container_add(GTK_CONTAINER(alignment), windata->pie_countdown);
gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT);
#if GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", G_CALLBACK(countdown_draw_cb), windata);
+ g_signal_connect (G_OBJECT (windata->pie_countdown), "draw", G_CALLBACK (on_countdown_draw), windata);
#else
- g_signal_connect(G_OBJECT(windata->pie_countdown), "expose_event", G_CALLBACK(countdown_expose_cb), windata);
+ g_signal_connect (G_OBJECT (windata->pie_countdown), "expose_event", G_CALLBACK (on_countdown_expose_event), windata);
#endif
}