[gnome-builder] main: check for dbus session address on startup



commit 9957668c9643f2b26b77efe329c895bc990cac71
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jan 8 19:40:55 2018 -0800

    main: check for dbus session address on startup
    
    Builder relies on a properly configured desktop session with the DBus
    session address propagated in the standard manner.

 src/main.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index e79e69a..74cfa3a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -19,7 +19,9 @@
 #define G_LOG_DOMAIN "builder"
 
 #include <ide.h>
+#include <glib/gi18n.h>
 #include <gtksourceview/gtksource.h>
+#include <stdlib.h>
 
 #include "application/ide-application-private.h"
 #include "plugins/gnome-builder-plugins.h"
@@ -106,6 +108,16 @@ main (int   argc,
   /* Setup our gdb fork()/exec() helper */
   bug_buddy_init ();
 
+  /*
+   * We require a desktop session that provides a properly working
+   * DBus environment. Bail if for some reason that is not the case.
+   */
+  if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
+    {
+      g_printerr (_("GNOME Builder requires a desktop session with DBus. Please set 
DBUS_SESSION_BUS_ADDRESS."));
+      return EXIT_FAILURE;
+    }
+
   /* Early init of logging so that we get messages in a consistent
    * format. If we deferred this to GApplication, we'd get them in
    * multiple formats.


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