mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
core: Add meta_close_dialog_is_visible() property
Since the last show/hide call should be effective, implement it without requiring an extra interface property. https://bugzilla.gnome.org/show_bug.cgi?id=762083
This commit is contained in:
parent
5aee5048ba
commit
aa47374d0e
@ -31,6 +31,8 @@ enum {
|
||||
|
||||
guint dialog_signals[N_SIGNALS] = { 0 };
|
||||
|
||||
static GQuark quark_visible = 0;
|
||||
|
||||
G_DEFINE_INTERFACE (MetaCloseDialog, meta_close_dialog, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
@ -50,6 +52,8 @@ meta_close_dialog_default_init (MetaCloseDialogInterface *iface)
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, META_TYPE_CLOSE_DIALOG_RESPONSE);
|
||||
|
||||
quark_visible = g_quark_from_static_string ("meta-close-dialog-visible");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,6 +71,7 @@ meta_close_dialog_show (MetaCloseDialog *dialog)
|
||||
|
||||
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
|
||||
iface->show (dialog);
|
||||
g_object_set_qdata (G_OBJECT (dialog), quark_visible, GINT_TO_POINTER (TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +89,7 @@ meta_close_dialog_hide (MetaCloseDialog *dialog)
|
||||
|
||||
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
|
||||
iface->hide (dialog);
|
||||
g_object_steal_qdata (G_OBJECT (dialog), quark_visible);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,3 +107,17 @@ meta_close_dialog_response (MetaCloseDialog *dialog,
|
||||
g_signal_emit (dialog, dialog_signals[RESPONSE], 0, response);
|
||||
meta_close_dialog_hide (dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_close_dialog_is_visible:
|
||||
* @dialog: a #MetaCloseDialog
|
||||
*
|
||||
* Returns whether @dialog is currently visible.
|
||||
*
|
||||
* Returns: #TRUE if @dialog is visible.
|
||||
**/
|
||||
gboolean
|
||||
meta_close_dialog_is_visible (MetaCloseDialog *dialog)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog), quark_visible));
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ struct _MetaCloseDialogInterface
|
||||
|
||||
void meta_close_dialog_show (MetaCloseDialog *dialog);
|
||||
void meta_close_dialog_hide (MetaCloseDialog *dialog);
|
||||
gboolean meta_close_dialog_is_visible (MetaCloseDialog *dialog);
|
||||
|
||||
void meta_close_dialog_response (MetaCloseDialog *dialog,
|
||||
MetaCloseDialogResponse response);
|
||||
|
Loading…
Reference in New Issue
Block a user