[gtk+/wip/session: 2/6] GtkApplication: add a way to opt out of session management



commit bbeca19803be611f24580b3715003a32037fb69d
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 3 14:56:51 2012 -0500

    GtkApplication: add a way to opt out of session management
    
    This commit adds a flag to the GApplicationFlags enum. Before
    this gets merged, GApplicationFlags needs to have an explicit
    range carved out for this purpose.

 gtk/gtkapplication.c |    3 +++
 gtk/gtkapplication.h |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 595266b..111f12e 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -969,6 +969,9 @@ gtk_application_startup_session_dbus (GtkApplication *app)
   GError *error = NULL;
   GVariant *res;
 
+  if ((g_application_get_flags (G_APPLICATION (app)) & GTK_APPLICATION_NO_SESSION) != 0)
+    return;
+
   if (app->priv->session_bus == NULL)
     return;
 
diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h
index aeb4688..3bd7b20 100644
--- a/gtk/gtkapplication.h
+++ b/gtk/gtkapplication.h
@@ -95,6 +95,11 @@ void             gtk_application_remove_accelerator (GtkApplication *application
                                                      const gchar    *action_name,
                                                      GVariant       *parameter);
 
+typedef enum
+{
+  GTK_APPLICATION_NO_SESSION = (1 << 16)
+} GtkApplicationFlags;
+
 void             gtk_application_quit_response      (GtkApplication *application,
                                                      gboolean        will_quit,
                                                      const gchar    *reason);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]