diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-02-06 15:30:55 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-02-06 15:32:48 +0100 |
commit | 99f16d25a73f50715126ca7f9c48bc03d8d82727 (patch) | |
tree | 6aba5940b5337166d6d2a7b1405f59ee6554fe5f /gtk | |
parent | 13b37bd4e0c725bdca4daa5b8753388dbc3c44d4 (diff) | |
download | gtk+-99f16d25a73f50715126ca7f9c48bc03d8d82727.tar.gz |
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.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkpopover.c | 16 | ||||
-rw-r--r-- | gtk/gtkpopover.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index ac5170f561..76b31d16cd 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 2d2e6303d9..b3b5a05cb9 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]; }; |