Commit 99f16d25 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent 13b37bd4
......@@ -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");
}
......
......@@ -48,6 +48,8 @@ struct _GtkPopoverClass
{
GtkBinClass parent_class;
void (* closed) (GtkPopover *popover);
/* Padding for future expansion */
gpointer reserved[10];
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment