summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/capplet/mate-notification-properties.c65
-rw-r--r--src/themes/coco/coco-theme.c66
-rw-r--r--src/themes/nodoka/nodoka-theme.c80
-rw-r--r--src/themes/slider/theme.c41
-rw-r--r--src/themes/standard/theme.c28
5 files changed, 169 insertions, 111 deletions
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index d8ce983..d8a5eab 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -46,7 +46,8 @@ typedef struct {
GtkWidget* dnd_checkbox;
GtkWidget* monitor_label;
- NotifyNotification* preview;
+ NotifyNotification* preview1;
+ NotifyNotification* preview2;
} NotificationAppletDialog;
enum {
@@ -387,14 +388,19 @@ static void show_message(NotificationAppletDialog* dialog, const gchar* message)
static void notification_properties_dialog_preview_closed(NotifyNotification* preview, NotificationAppletDialog* dialog)
{
- if (preview == dialog->preview)
- {
- dialog->preview = NULL;
- }
+ if (preview == dialog->preview1)
+ dialog->preview1 = NULL;
+ else if (preview == dialog->preview2)
+ dialog->preview2 = NULL;
g_object_unref(preview);
}
+static gboolean notification_properties_dialog_preview_action(void *data) {
+ // @todo call notification_properties_dialog_preview_closed
+ return FALSE;
+}
+
static void notification_properties_dialog_preview(NotificationAppletDialog* dialog)
{
if (!notify_is_initted() && !notify_init("n-d"))
@@ -405,16 +411,23 @@ static void notification_properties_dialog_preview(NotificationAppletDialog* dia
GError* error = NULL;
- if (dialog->preview)
+ if (dialog->preview1)
{
- notify_notification_close(dialog->preview, NULL);
- g_object_unref(dialog->preview);
- dialog->preview = NULL;
+ notify_notification_close(dialog->preview1, NULL);
+ g_object_unref(dialog->preview1);
+ dialog->preview1 = NULL;
+ }
+ if (dialog->preview2)
+ {
+ notify_notification_close(dialog->preview2, NULL);
+ g_object_unref(dialog->preview2);
+ dialog->preview2 = NULL;
}
- dialog->preview = notify_notification_new(_("Notification Test"), _("Just a test"), "dialog-information");
+ dialog->preview1 = notify_notification_new(_("Notification Test"), _("Just a test"), "dialog-information");
+ notify_notification_set_timeout (dialog->preview1, 50000);
- if (!notify_notification_show(dialog->preview, &error))
+ if (!notify_notification_show(dialog->preview1, &error))
{
char* message = g_strdup_printf(_("Error while displaying notification: %s"), error->message);
show_message(dialog, message);
@@ -422,7 +435,20 @@ static void notification_properties_dialog_preview(NotificationAppletDialog* dia
g_free(message);
}
- g_signal_connect(dialog->preview, "closed", G_CALLBACK(notification_properties_dialog_preview_closed), dialog);
+ dialog->preview2 = notify_notification_new(_("Notification Test"), _("Just a test"), "dialog-information");
+ notify_notification_add_action (dialog->preview2, "nothing", _("Close"), NOTIFY_ACTION_CALLBACK (notification_properties_dialog_preview_action), NULL, NULL);
+ notify_notification_set_timeout (dialog->preview2, 50000);
+
+ if (!notify_notification_show(dialog->preview2, &error))
+ {
+ char* message = g_strdup_printf(_("Error while displaying notification: %s"), error->message);
+ show_message(dialog, message);
+ g_error_free(error);
+ g_free(message);
+ }
+
+ g_signal_connect(dialog->preview1, "closed", G_CALLBACK(notification_properties_dialog_preview_closed), dialog);
+ g_signal_connect(dialog->preview2, "closed", G_CALLBACK(notification_properties_dialog_preview_closed), dialog);
}
static void notification_properties_dialog_response(GtkWidget* widget, int response, NotificationAppletDialog* dialog)
@@ -491,7 +517,8 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di
gtk_widget_show_all(dialog->dialog);
- dialog->preview = NULL;
+ dialog->preview1 = NULL;
+ dialog->preview2 = NULL;
return TRUE;
}
@@ -504,11 +531,17 @@ static void notification_properties_dialog_finalize(NotificationAppletDialog* di
dialog->dialog = NULL;
}
- if (dialog->preview)
+ if (dialog->preview1)
+ {
+ notify_notification_close(dialog->preview1, NULL);
+ dialog->preview1 = NULL;
+ }
+ if (dialog->preview2)
{
- notify_notification_close(dialog->preview, NULL);
- dialog->preview = NULL;
+ notify_notification_close(dialog->preview2, NULL);
+ dialog->preview2 = NULL;
}
+
g_free (dialog);
}
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index 82b74bd..5524974 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -1,11 +1,8 @@
/*
- * coco-theme.c
- * This file is part of notification-daemon-engine-coco
- *
* Copyright (C) 2012 - Stefano Karapetsas <[email protected]>
* Copyright (C) 2010 - Eduardo Grajeda
* Copyright (C) 2008 - Martin Sourada
- * Copyright (C) 2012-2021 MATE Developers
+ * Copyright (C) 2012-2025 MATE Developers
*
* notification-daemon-engine-coco is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
@@ -110,6 +107,24 @@ void notification_tick(GtkWindow *nw, glong remaining);
/* Support Nodoka Functions */
+static void
+get_background_color (GtkStyleContext *context,
+ GtkStateFlags state,
+ GdkRGBA *color)
+{
+ GdkRGBA *c;
+
+ g_return_if_fail (color != NULL);
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ gtk_style_context_get (context, state,
+ "background-color", &c,
+ NULL);
+
+ *color = *c;
+ gdk_rgba_free (c);
+}
+
/* Handle clicking on link */
static gboolean
activate_link (GtkLabel *label, const char *url, WindowData *windata)
@@ -172,17 +187,28 @@ draw_pie(GtkWidget *pie, WindowData *windata, cairo_t *cr)
return;
gdouble arc_angle = 1.0 - (gdouble)windata->remaining / (gdouble)windata->timeout;
-
- // .notification-box .countdown:active { color:#aabbcc; }
- GdkRGBA colorFront, colorBack;
- GtkStyleContext *context = gtk_widget_get_style_context (pie);
- gtk_style_context_get_color (context, GTK_STATE_FLAG_ACTIVE, &colorFront);
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &colorBack);
- if (gdk_rgba_equal (&colorFront, &colorBack))
- cairo_set_source_rgba (cr, 1.0, 0.4, 0.0, 0.3);
+ GtkStyleContext *context;
+ GdkRGBA orig, bg;
+
+ // :selected { background-color:#aabbcc; } ignored -> 1.0, 1.0, 1.0, 0.3
+ context = gtk_widget_get_style_context (windata->win);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+ get_background_color (context, GTK_STATE_FLAG_SELECTED, &orig);
+ gtk_style_context_restore (context);
+
+ // .notification-box .countdown:selected { background-color:#aabbcc; }
+ context = gtk_widget_get_style_context (pie);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+ get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg);
+ gtk_style_context_restore (context);
+
+ if (gdk_rgba_equal (&orig, &bg))
+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.3);
else
- cairo_set_source_rgba (cr, colorFront.red, colorFront.green, colorFront.blue, colorFront.alpha);
-
+ cairo_set_source_rgba (cr, bg.red, bg.green, bg.blue, bg.alpha);
+
cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS);
cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS,
-G_PI/2, (-0.25 + arc_angle)*2*G_PI);
@@ -265,7 +291,6 @@ paint_window (GtkWidget *widget,
cairo_restore (cr);
update_shape_region (surface, windata);
-
cairo_surface_destroy (surface);
}
@@ -301,11 +326,7 @@ countdown_expose_cb(GtkWidget *pie, cairo_t *cr, WindowData *windata)
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
gtk_widget_get_allocation (pie, &alloc);
- surface = cairo_surface_create_similar (cairo_get_target (cr),
- CAIRO_CONTENT_COLOR_ALPHA,
- alloc.width,
- alloc.height);
-
+ surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, alloc.width, alloc.height);
cr2 = cairo_create (surface);
cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0); // transparent background color
cairo_paint (cr2);
@@ -446,7 +467,7 @@ create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(windata->main_hbox), 13);
- /* The icon goes at the left */
+ /* The icon goes at the left */
windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show(windata->iconbox);
gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox,
@@ -456,7 +477,7 @@ create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start(GTK_BOX(windata->iconbox), windata->icon,
FALSE, FALSE, 0);
- /* The title and the text at the right */
+ /* The title and the text at the right */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_halign (vbox, GTK_ALIGN_START);
gtk_widget_set_margin_start (vbox, 8);
@@ -642,6 +663,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
if (!windata->pie_countdown) {
windata->pie_countdown = gtk_drawing_area_new();
gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END);
+ gtk_widget_set_valign (windata->pie_countdown, GTK_ALIGN_CENTER);
gtk_widget_show(windata->pie_countdown);
#if GTK_CHECK_VERSION (4,0,0)
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index b497901..c520368 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -1,10 +1,7 @@
/*
- * nodoka-theme.c
- * This file is part of notification-daemon-engine-nodoka
- *
* Copyright (C) 2012 - Stefano Karapetsas <[email protected]>
* Copyright (C) 2008 - Martin Sourada
- * Copyright (C) 2012-2021 MATE Developers
+ * Copyright (C) 2012-2025 MATE Developers
*
* notification-daemon-engine-nodoka is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
@@ -31,7 +28,6 @@
#include <libxml/xmlmemory.h>
#include <libxml/xpath.h>
-/* Define basic nodoka types */
typedef void (*ActionInvokedCb)(GtkWindow *nw, const char *key);
typedef void (*UrlClickedCb)(GtkWindow *nw, const char *url);
@@ -124,6 +120,24 @@ void notification_tick(GtkWindow *nw, glong remaining);
/* Support Nodoka Functions */
+static void
+get_background_color (GtkStyleContext *context,
+ GtkStateFlags state,
+ GdkRGBA *color)
+{
+ GdkRGBA *c;
+
+ g_return_if_fail (color != NULL);
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ gtk_style_context_get (context, state,
+ "background-color", &c,
+ NULL);
+
+ *color = *c;
+ gdk_rgba_free (c);
+}
+
/* Handle clicking on link */
static gboolean
activate_link (GtkLabel *label, const char *url, WindowData *windata)
@@ -514,7 +528,28 @@ draw_pie(GtkWidget *pie, WindowData *windata, cairo_t *cr)
return;
gdouble arc_angle = 1.0 - (gdouble)windata->remaining / (gdouble)windata->timeout;
- cairo_set_source_rgba (cr, 1.0, 0.4, 0.0, 0.3);
+ GtkStyleContext *context;
+ GdkRGBA orig, bg;
+
+ // :selected { background-color:#aabbcc; } ignored -> 1.0, 0.4, 0.0, 0.3
+ context = gtk_widget_get_style_context (windata->win);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+ get_background_color (context, GTK_STATE_FLAG_SELECTED, &orig);
+ gtk_style_context_restore (context);
+
+ // .notification-box .countdown:selected { background-color:#aabbcc; }
+ context = gtk_widget_get_style_context (pie);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+ get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg);
+ gtk_style_context_restore (context);
+
+ if (gdk_rgba_equal (&orig, &bg))
+ cairo_set_source_rgba (cr, 1.0, 0.4, 0.0, 0.3);
+ else
+ cairo_set_source_rgba (cr, bg.red, bg.green, bg.blue, bg.alpha);
+
cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS);
cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS,
-G_PI/2, (-0.25 + arc_angle)*2*G_PI);
@@ -580,11 +615,9 @@ paint_window (GtkWidget *widget,
windata->height);
cr2 = cairo_create (surface);
-
- /* transparent background */
- cairo_rectangle (cr2, 0, 0, windata->width, windata->height);
- cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0);
- cairo_fill (cr2);
+ cairo_rectangle (cr2, 0, 0, windata->width, windata->height);
+ cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0); // transparent background color
+ cairo_fill (cr2);
if (windata->arrow.has_arrow) {
nodoka_rounded_rectangle_with_arrow (cr2, 0, 0,
@@ -614,7 +647,6 @@ paint_window (GtkWidget *widget,
cairo_restore (cr);
update_shape_region (surface, windata);
-
cairo_surface_destroy (surface);
}
@@ -649,30 +681,21 @@ static void on_composited_changed (GtkWidget* window, WindowData* windata)
}
static gboolean
-countdown_expose_cb(GtkWidget *pie,
- cairo_t *cr,
- WindowData *windata)
+countdown_expose_cb(GtkWidget *pie, cairo_t *cr, WindowData *windata)
{
cairo_t *cr2;
cairo_surface_t *surface;
GtkAllocation alloc;
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
gtk_widget_get_allocation (pie, &alloc);
- surface = cairo_surface_create_similar (cairo_get_target (cr),
- CAIRO_CONTENT_COLOR_ALPHA,
- alloc.width,
- alloc.height);
+ surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, alloc.width, alloc.height);
cr2 = cairo_create (surface);
-
- cairo_translate (cr2, -alloc.x, -alloc.y);
- fill_background (pie, windata, cr2);
- cairo_translate (cr2, alloc.x, alloc.y);
- draw_pie (pie, windata, cr2);
+ cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0); // transparent background color
+ cairo_paint (cr2);
+ draw_pie (pie, windata, cr2); // countdown
cairo_fill (cr2);
-
cairo_destroy (cr2);
cairo_save (cr);
@@ -1042,6 +1065,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
if (!windata->pie_countdown) {
windata->pie_countdown = gtk_drawing_area_new();
gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END);
+ gtk_widget_set_valign (windata->pie_countdown, GTK_ALIGN_CENTER);
gtk_widget_show(windata->pie_countdown);
#if GTK_CHECK_VERSION (4,0,0)
@@ -1052,7 +1076,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
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);
+ g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", G_CALLBACK(countdown_expose_cb), windata);
}
}
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index 9cd3ae9..94a8f46 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -1,9 +1,8 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
+/*
* Copyright (C) 2006-2007 Christian Hammond <[email protected]>
* Copyright (C) 2009 Red Hat, Inc.
* Copyright (C) 2011 Perberos <[email protected]>
- * Copyright (C) 2012-2021 MATE Developers
+ * Copyright (C) 2012-2025 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -234,14 +233,10 @@ static void paint_window (GtkWidget *widget,
windata->height);
cr2 = cairo_create (surface);
-
- /* transparent background */
cairo_rectangle (cr2, 0, 0, windata->width, windata->height);
- cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0);
+ cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0); // transparent background color
cairo_fill (cr2);
-
fill_background (widget, windata, cr2);
-
cairo_destroy(cr2);
cairo_save (cr);
@@ -694,45 +689,37 @@ paint_countdown (GtkWidget *pie,
cairo_t* cr2;
cairo_surface_t* surface;
- context = gtk_widget_get_style_context(windata->win);
-
+ // :selected { background-color:#aabbcc; } or
+ // .notification-box .countdown:selected { background-color:#aabbcc; }
+ context = gtk_widget_get_style_context (pie);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
-
get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg);
-
gtk_style_context_restore (context);
gtk_widget_get_allocation(pie, &allocation);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- surface = cairo_surface_create_similar(cairo_get_target(cr),
- CAIRO_CONTENT_COLOR_ALPHA,
- allocation.width,
- allocation.height);
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+ surface = cairo_surface_create_similar (cairo_get_target(cr),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ allocation.width,
+ allocation.height);
cr2 = cairo_create (surface);
-
- fill_background (pie, windata, cr2);
-
if (windata->timeout > 0)
{
gdouble pct = (gdouble) windata->remaining / (gdouble) windata->timeout;
-
gdk_cairo_set_source_rgba (cr2, &bg);
-
cairo_move_to (cr2, PIE_RADIUS, PIE_RADIUS);
cairo_arc_negative (cr2, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, -G_PI_2, -(pct * G_PI * 2) - G_PI_2);
cairo_line_to (cr2, PIE_RADIUS, PIE_RADIUS);
cairo_fill (cr2);
}
-
- cairo_destroy(cr2);
+ cairo_destroy (cr2);
cairo_save (cr);
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint (cr);
cairo_restore (cr);
-
cairo_surface_destroy(surface);
}
@@ -765,7 +752,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
g_assert(windata != NULL);
- if (!gtk_widget_get_visible(windata->actions_box))
+ if (gtk_widget_get_visible(windata->actions_box))
{
gtk_widget_show(windata->actions_box);
update_content_hbox_visibility(windata);
@@ -785,7 +772,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
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);
+ g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", G_CALLBACK(on_countdown_draw), windata);
}
}
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index f21b3b3..82c6b51 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -1,9 +1,8 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
+/*
* Copyright (C) 2006-2007 Christian Hammond <[email protected]>
* Copyright (C) 2009 Red Hat, Inc.
* Copyright (C) 2011 Perberos <[email protected]>
- * Copyright (C) 2012-2021 MATE Developers
+ * Copyright (C) 2012-2025 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
+
#include "config.h"
#include <glib/gi18n.h>
@@ -153,7 +153,6 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
#ifdef ENABLE_GRADIENT_LOOK
cairo_pattern_t *gradient;
int gradient_y;
-
gradient_y = allocation.height - BOTTOM_GRADIENT_HEIGHT;
#endif
@@ -999,45 +998,37 @@ paint_countdown (GtkWidget *pie,
cairo_t* cr2;
cairo_surface_t* surface;
- context = gtk_widget_get_style_context (windata->win);
-
+ // :selected { background-color:#aabbcc; } or
+ // .notification-box .countdown:selected { background-color:#aabbcc; }
+ context = gtk_widget_get_style_context (pie);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
-
get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg);
-
gtk_style_context_restore (context);
gtk_widget_get_allocation(pie, &alloc);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
surface = cairo_surface_create_similar (cairo_get_target(cr),
CAIRO_CONTENT_COLOR_ALPHA,
alloc.width,
alloc.height);
cr2 = cairo_create (surface);
-
- fill_background (pie, windata, cr2);
-
if (windata->timeout > 0)
{
gdouble pct = (gdouble) windata->remaining / (gdouble) windata->timeout;
-
gdk_cairo_set_source_rgba (cr2, &bg);
-
cairo_move_to (cr2, PIE_RADIUS, PIE_RADIUS);
cairo_arc_negative (cr2, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, -G_PI_2, -(pct * G_PI * 2) - G_PI_2);
cairo_line_to (cr2, PIE_RADIUS, PIE_RADIUS);
cairo_fill (cr2);
}
-
- cairo_destroy(cr2);
+ cairo_destroy (cr2);
cairo_save (cr);
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint (cr);
cairo_restore (cr);
-
cairo_surface_destroy(surface);
}
@@ -1080,6 +1071,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
if (!windata->pie_countdown) {
windata->pie_countdown = gtk_drawing_area_new();
gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END);
+ gtk_widget_set_valign (windata->pie_countdown, GTK_ALIGN_CENTER);
gtk_widget_show(windata->pie_countdown);
#if GTK_CHECK_VERSION (4,0,0)
@@ -1090,7 +1082,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
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);
+ g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", G_CALLBACK(on_countdown_draw), windata);
}
}