From 21089ece16e22808bd95da559f2a8da1d7adce40 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 18 Dec 2014 23:26:53 -0500 Subject: [PATCH] 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 file changed, 32 insertions(+) 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 [] = { -- 2.3.6