wayland/inhibit-shortcuts-dialog: Make the dialog ownership clearer
Make it clear that the data object is the owner of the dialog; it creates it, and eventually destroys it. https://bugzilla.gnome.org/show_bug.cgi?id=786385
This commit is contained in:
parent
dceb0f1f1f
commit
c1439e141e
@ -30,6 +30,7 @@ typedef struct _InhibitShortcutsData
|
||||
MetaWaylandSurface *surface;
|
||||
MetaWaylandSeat *seat;
|
||||
MetaInhibitShortcutsDialog *dialog;
|
||||
gulong response_handler_id;
|
||||
gboolean has_last_response;
|
||||
MetaInhibitShortcutsDialogResponse last_response;
|
||||
} InhibitShortcutsData;
|
||||
@ -50,11 +51,19 @@ surface_inhibit_shortcuts_data_set (MetaWaylandSurface *surface,
|
||||
data);
|
||||
}
|
||||
|
||||
static void
|
||||
surface_inhibit_shortcuts_data_destroy_dialog (InhibitShortcutsData *data)
|
||||
{
|
||||
g_signal_handler_disconnect (data->dialog, data->response_handler_id);
|
||||
meta_inhibit_shortcuts_dialog_hide (data->dialog);
|
||||
g_clear_object (&data->dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
surface_inhibit_shortcuts_data_free (InhibitShortcutsData *data)
|
||||
{
|
||||
meta_inhibit_shortcuts_dialog_hide (data->dialog);
|
||||
|
||||
if (data->dialog)
|
||||
surface_inhibit_shortcuts_data_destroy_dialog (data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
@ -68,15 +77,6 @@ on_surface_destroyed (MetaWaylandSurface *surface,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
surface_inhibit_shortcuts_dialog_free (gpointer ptr,
|
||||
GClosure *closure)
|
||||
{
|
||||
InhibitShortcutsData *data = ptr;
|
||||
|
||||
meta_wayland_surface_hide_inhibit_shortcuts_dialog (data->surface);
|
||||
}
|
||||
|
||||
static void
|
||||
inhibit_shortcuts_dialog_response_apply (InhibitShortcutsData *data)
|
||||
{
|
||||
@ -125,11 +125,10 @@ meta_wayland_surface_ensure_inhibit_shortcuts_dialog (MetaWaylandSurface *surfac
|
||||
data->surface = surface;
|
||||
data->seat = seat;
|
||||
data->dialog = dialog;
|
||||
|
||||
g_signal_connect_data (dialog, "response",
|
||||
G_CALLBACK (inhibit_shortcuts_dialog_response_cb),
|
||||
data, surface_inhibit_shortcuts_dialog_free,
|
||||
0);
|
||||
data->response_handler_id =
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (inhibit_shortcuts_dialog_response_cb),
|
||||
data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user