[libgd/wip/ernestask/gtk4: 2/5] notification: remove visibility_notify_event override



commit cb739eb0d886db4eb445f7babf77c2d3e21768aa
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 |   32 +++++++-------------------------
 1 files changed, 7 insertions(+), 25 deletions(-)
---
diff --git a/libgd/gd-notification.c b/libgd/gd-notification.c
index 06330c1..150afe1 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;
@@ -294,7 +293,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 +304,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
@@ -368,27 +372,6 @@ gd_notification_forall (GtkContainer *container,
     (* callback) (priv->close_button, callback_data);
 }
 
-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 void
 gd_notification_class_init (GdNotificationClass *klass)
 {
@@ -405,7 +388,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]