[gnome-settings-daemon] Export the session bus ID as an xsetting



commit 21089ece16e22808bd95da559f2a8da1d7adce40
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 18 23:26:53 2014 -0500

    Export the session bus ID as an xsetting
    
    This will allow GTK+ to detect ssh forwarded display situations
    where app menus won't work, and handle it better.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741740

 plugins/xsettings/gsd-xsettings-manager.c |   32 +++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index 489021c..1ec4e08 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -378,6 +378,37 @@ fixed_true_int (GnomeXSettingsManager *manager,
         xsettings_manager_set_int (manager->priv->manager, fixed->xsetting_name, TRUE);
 }
 
+static void
+fixed_bus_id (GnomeXSettingsManager *manager,
+              FixedEntry            *fixed)
+{
+        const gchar *id;
+        GDBusConnection *bus;
+        GVariant *res;
+
+        bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+        res = g_dbus_connection_call_sync (bus,
+                                           "org.freedesktop.DBus",
+                                           "/org/freedesktop/DBus",
+                                           "org.freedesktop.DBus",
+                                           "GetId",
+                                           NULL,
+                                           NULL,
+                                           G_DBUS_CALL_FLAGS_NONE,
+                                           -1,
+                                           NULL,
+                                           NULL);
+
+        if (res) {
+                g_variant_get (res, "(&s)", &id);
+
+                xsettings_manager_set_string (manager->priv->manager, fixed->xsetting_name, id);
+                g_variant_unref (res);
+        }
+
+        g_object_unref (bus);
+}
+
 static FixedEntry fixed_entries [] = {
         { "Gtk/MenuImages",          fixed_false_int },
         { "Gtk/ButtonImages",        fixed_false_int },
@@ -386,6 +417,7 @@ static FixedEntry fixed_entries [] = {
         { "Gtk/AutoMnemonics",       fixed_true_int },
         { "Gtk/EnablePrimaryPaste",  fixed_true_int },
         { "Gtk/DialogsUseHeader",    fixed_true_int },
+        { "Gtk/SessionBusId",        fixed_bus_id },
 };
 
 static TranslationEntry translations [] = {


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