diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/daemon.c | 21 | ||||
-rw-r--r-- | src/daemon/stack.c | 8 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index a73ca93..62d7b04 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -53,6 +53,7 @@ #define MAX_NOTIFICATIONS 20 +#define WIDTH 400 #define IMAGE_SIZE 48 #define IDLE_SECONDS 30 #define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications" @@ -130,12 +131,32 @@ static void monitor_notification_source_windows(NotifyDaemon* daemon, NotifyTime G_DEFINE_TYPE(NotifyDaemon, notify_daemon, G_TYPE_OBJECT); +#if GTK_CHECK_VERSION (3, 0, 0) +static void +notify_daemon_get_preferred_width (GtkWidget *widget, + gint *min_width, + gint *nat_width) +{ + if (nat_width != NULL) { + *nat_width = WIDTH; + } +} +#endif + static void notify_daemon_class_init(NotifyDaemonClass* daemon_class) { GObjectClass* object_class = G_OBJECT_CLASS(daemon_class); +#if GTK_CHECK_VERSION (3, 0, 0) + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (daemon_class); +#endif + object_class->finalize = notify_daemon_finalize; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->get_preferred_width = notify_daemon_get_preferred_width; +#endif + g_type_class_add_private(daemon_class, sizeof(NotifyDaemonPrivate)); } diff --git a/src/daemon/stack.c b/src/daemon/stack.c index 97e328a..a60f2b2 100644 --- a/src/daemon/stack.c +++ b/src/daemon/stack.c @@ -301,7 +301,11 @@ notify_stack_shift_notifications (NotifyStack *stack, GtkRequisition req; if (nw == NULL || nw2 != nw) { +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (nw2), NULL, &req); +#else gtk_widget_size_request (GTK_WIDGET (nw2), &req); +#endif translate_coordinates (stack->location, &workarea, @@ -362,7 +366,11 @@ void notify_stack_add_window(NotifyStack* stack, GtkWindow* nw, gboolean new_not GtkRequisition req; gint x, y; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size(GTK_WIDGET(nw), NULL, &req); +#else gtk_widget_size_request(GTK_WIDGET(nw), &req); +#endif notify_stack_shift_notifications(stack, nw, NULL, req.width, req.height + NOTIFY_STACK_SPACING, &x, &y); theme_move_notification(nw, x, y); |