[libgd/wip/ernestask/gtk4: 2/5] notification: remove visibility_notify_event override
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 2/5] notification: remove visibility_notify_event override
- Date: Sun, 11 Mar 2018 13:32:19 +0000 (UTC)
commit 9255b02aed2e571f529d19e48e807b473509bf13
Author: Ernestas Kulik <ernestask gnome org>
Date: Sun Mar 11 10:10:04 2018 +0200
notification: remove visibility_notify_event override
The event no longer exists, so the bulk of the handler is moved to the
show/hide overrides.
libgd/gd-notification.c | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/libgd/gd-notification.c b/libgd/gd-notification.c
index 0e94796..37f6ca2 100644
--- a/libgd/gd-notification.c
+++ b/libgd/gd-notification.c
@@ -57,7 +57,6 @@ struct _GdNotificationPrivate {
GdkWindow *bin_window;
int animate_y; /* from 0 to allocation.height */
- gboolean waiting_for_viewable;
gboolean revealed;
gboolean dismissed;
gboolean sent_dismissed;
@@ -287,6 +286,30 @@ start_animation (GdNotification *notification)
}
static void
+unqueue_autohide (GdNotification *notification)
+{
+ GdNotificationPrivate *priv = notification->priv;
+
+ if (priv->timeout_source_id)
+ {
+ g_source_remove (priv->timeout_source_id);
+ priv->timeout_source_id = 0;
+ }
+}
+
+static void
+queue_autohide (GdNotification *notification)
+{
+ GdNotificationPrivate *priv = notification->priv;
+
+ if (priv->timeout_source_id == 0 &&
+ priv->timeout != -1)
+ priv->timeout_source_id =
+ g_timeout_add (priv->timeout * 1000, gd_notification_timeout_cb, notification);
+}
+
+
+static void
gd_notification_show (GtkWidget *widget)
{
GdNotification *notification = GD_NOTIFICATION (widget);
@@ -294,7 +317,9 @@ gd_notification_show (GtkWidget *widget)
GTK_WIDGET_CLASS (gd_notification_parent_class)->show (widget);
priv->revealed = TRUE;
- priv->waiting_for_viewable = TRUE;
+
+ start_animation (notification);
+ queue_autohide (notification);
}
static void
@@ -303,9 +328,12 @@ gd_notification_hide (GtkWidget *widget)
GdNotification *notification = GD_NOTIFICATION (widget);
GdNotificationPrivate *priv = notification->priv;
+ unqueue_autohide (notification);
+
GTK_WIDGET_CLASS (gd_notification_parent_class)->hide (widget);
priv->revealed = FALSE;
- priv->waiting_for_viewable = FALSE;
+
+ start_animation (notification);
}
static void
@@ -384,7 +412,6 @@ gd_notification_class_init (GdNotificationClass *klass)
widget_class->destroy = gd_notification_destroy;
widget_class->measure = gd_notification_measure;
widget_class->size_allocate = gd_notification_size_allocate;
- widget_class->visibility_notify_event = gd_notification_visibility_notify_event;
container_class->add = gd_notification_add;
container_class->forall = gd_notification_forall;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]