[gtk+] GtkApplication: only allow quit_response when it make sense
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkApplication: only allow quit_response when it make sense
- Date: Sun, 8 Jan 2012 01:02:36 +0000 (UTC)
commit f78696f3d0f1f687483bdbf4916f6772146bdbc8
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 7 20:01:23 2012 -0500
GtkApplication: only allow quit_response when it make sense
This check was present in the OS X implementation, but it
makes sense in the D-Bus implementation as well.
gtk/gtkapplication.c | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index e09866f..a31cf59 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -146,6 +146,7 @@ struct _GtkApplicationPrivate
GList *windows;
gboolean register_session;
+ gboolean quit_requested;
#ifdef GDK_WINDOWING_X11
GDBusConnection *session_bus;
@@ -163,7 +164,7 @@ struct _GtkApplicationPrivate
GMenu *combined;
AppleEvent quit_event, quit_reply;
- gboolean quit_requested, quitting;
+ gboolean quitting;
#endif
};
@@ -1026,6 +1027,8 @@ gtk_application_get_menubar (GtkApplication *application)
return menubar;
}
+#if defined(GDK_WINDOWING_X11)
+
/* D-Bus Session Management
*
* The protocol and the D-Bus API are described here:
@@ -1033,23 +1036,6 @@ gtk_application_get_menubar (GtkApplication *application)
* http://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html
*/
-#ifdef GDK_WINDOWING_X11
-
-/**
- * GtkApplicationInhibitFlags:
- * @GTK_APPLICATION_INHIBIT_LOGOUT: Inhibit logging out (including shutdown
- * of the computer)
- * @GTK_APPLICATION_INHIBIT_SWITCH: Inhibit user switching
- * @GTK_APPLICATION_INHIBIT_SUSPEND: Inhibit suspending the
- * session or computer
- * @GTK_APPLICATION_INHIBIT_IDLE: Inhibit the session being
- * marked as idle (and possibly locked)
- *
- * Types of user actions that may be blocked by gtk_application_inhibit().
- *
- * Since: 3.4
- */
-
static void
unregister_client (GtkApplication *app)
{
@@ -1087,6 +1073,7 @@ client_proxy_signal (GDBusProxy *proxy,
if (strcmp (signal_name, "QueryEndSession") == 0)
{
g_debug ("Received QueryEndSession");
+ app->priv->quit_requested = TRUE;
g_signal_emit (app, gtk_application_signals[QUIT_REQUESTED], 0);
}
else if (strcmp (signal_name, "EndSession") == 0)
@@ -1231,6 +1218,9 @@ gtk_application_quit_response (GtkApplication *application,
g_return_if_fail (GTK_IS_APPLICATION (application));
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
g_return_if_fail (application->priv->client_proxy != NULL);
+ g_return_if_fail (application->priv->quit_requested);
+
+ application->priv->quit_requested = FALSE;
g_debug ("Calling EndSessionResponse %d '%s'", will_quit, reason);
@@ -1243,6 +1233,21 @@ gtk_application_quit_response (GtkApplication *application,
}
/**
+ * GtkApplicationInhibitFlags:
+ * @GTK_APPLICATION_INHIBIT_LOGOUT: Inhibit logging out (including shutdown
+ * of the computer)
+ * @GTK_APPLICATION_INHIBIT_SWITCH: Inhibit user switching
+ * @GTK_APPLICATION_INHIBIT_SUSPEND: Inhibit suspending the
+ * session or computer
+ * @GTK_APPLICATION_INHIBIT_IDLE: Inhibit the session being
+ * marked as idle (and possibly locked)
+ *
+ * Types of user actions that may be blocked by gtk_application_inhibit().
+ *
+ * Since: 3.4
+ */
+
+/**
* gtk_application_inhibit:
* @application: the #GApplication
* @window: (allow-none): a #GtkWindow, or %NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]