[gtk+] popover: Add ::closed signal



commit 99f16d25a73f50715126ca7f9c48bc03d8d82727
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 6 15:30:55 2014 +0100

    popover: Add ::closed signal
    
    This signal is emitted when the popover is dismissed either through
    API or user interaction, somewhat more friendly than connecting to
    ::unmap.

 gtk/gtkpopover.c |   16 ++++++++++++++++
 gtk/gtkpopover.h |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index ac5170f..76b31d1 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -66,6 +66,11 @@ enum {
   PROP_MODAL
 };
 
+enum {
+  CLOSED,
+  N_SIGNALS
+};
+
 struct _GtkPopoverPrivate
 {
   GtkWidget *widget;
@@ -89,6 +94,7 @@ struct _GtkPopoverPrivate
 };
 
 static GQuark quark_widget_popovers = 0;
+static guint signals[N_SIGNALS] = { 0 };
 
 static void gtk_popover_update_position    (GtkPopover *popover);
 static void gtk_popover_update_relative_to (GtkPopover *popover,
@@ -289,6 +295,8 @@ gtk_popover_unmap (GtkWidget *widget)
   priv = GTK_POPOVER (widget)->priv;
   priv->button_pressed = FALSE;
 
+  g_signal_emit (widget, signals[CLOSED], 0);
+
   if (priv->modal)
     gtk_popover_apply_modality (GTK_POPOVER (widget), FALSE);
 
@@ -1226,6 +1234,14 @@ gtk_popover_class_init (GtkPopoverClass *klass)
                                                          TRUE,
                                                          GTK_PARAM_READWRITE));
 
+  signals[CLOSED] =
+    g_signal_new (I_("closed"),
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GtkPopoverClass, closed),
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
+
   quark_widget_popovers = g_quark_from_static_string ("gtk-quark-widget-popovers");
 }
 
diff --git a/gtk/gtkpopover.h b/gtk/gtkpopover.h
index 2d2e630..b3b5a05 100644
--- a/gtk/gtkpopover.h
+++ b/gtk/gtkpopover.h
@@ -48,6 +48,8 @@ struct _GtkPopoverClass
 {
   GtkBinClass parent_class;
 
+  void (* closed) (GtkPopover *popover);
+
   /* Padding for future expansion */
   gpointer reserved[10];
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]