[libgd/wip/ernestask/gtk4: 19/22] notification: remove visibility_notify_event override
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 19/22] notification: remove visibility_notify_event override
- Date: Sun, 11 Mar 2018 08:36:11 +0000 (UTC)
commit d2ea3fc4d2d91d1e55510e6161771d7fa8f677de
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 | 79 ++++++++++++++++++----------------------------
1 files changed, 31 insertions(+), 48 deletions(-)
---
diff --git a/libgd/gd-notification.c b/libgd/gd-notification.c
index 0ae8fb1..513792e 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;
@@ -304,6 +303,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);
@@ -311,7 +334,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
@@ -320,9 +345,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
@@ -385,50 +413,6 @@ gd_notification_forall (GtkContainer *container,
(* callback) (priv->close_button, callback_data);
}
-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 gboolean
-gd_notification_visibility_notify_event (GtkWidget *widget,
- GdkEventVisibility *event)
-{
- GdNotification *notification = GD_NOTIFICATION (widget);
- GdNotificationPrivate *priv = notification->priv;
-
- if (!gtk_widget_get_visible (widget))
- return FALSE;
-
- if (priv->waiting_for_viewable)
- {
- start_animation (notification);
- priv->waiting_for_viewable = FALSE;
- }
-
- queue_autohide (notification);
-
- return FALSE;
-}
-
static gboolean
gd_notification_enter_notify (GtkWidget *widget,
GdkEvent *event)
@@ -502,7 +486,6 @@ gd_notification_class_init (GdNotificationClass *klass)
widget_class->size_allocate = gd_notification_size_allocate;
widget_class->realize = gd_notification_realize;
widget_class->unrealize = gd_notification_unrealize;
- widget_class->visibility_notify_event = gd_notification_visibility_notify_event;
widget_class->event = gd_notification_event;
container_class->add = gd_notification_add;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]