aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/menubar.vala37
-rw-r--r--src/util.vala30
2 files changed, 35 insertions, 32 deletions
diff --git a/src/menubar.vala b/src/menubar.vala
index b9772fa..6dd802b 100644
--- a/src/menubar.vala
+++ b/src/menubar.vala
@@ -288,33 +288,6 @@ public class MenuBar : Gtk.MenuBar
nat = HEIGHT;
}
- private void greeter_set_env (string key, string val)
- {
- GLib.Environment.set_variable (key, val, true);
-
- /* And also set it in the DBus activation environment so that any
- * indicator services pick it up. */
- try
- {
- var proxy = new GLib.DBusProxy.for_bus_sync (GLib.BusType.SESSION,
- GLib.DBusProxyFlags.NONE, null,
- "org.freedesktop.DBus",
- "/org/freedesktop/DBus",
- "org.freedesktop.DBus",
- null);
-
- var builder = new GLib.VariantBuilder (GLib.VariantType.ARRAY);
- builder.add ("{ss}", key, val);
-
- proxy.call_sync ("UpdateActivationEnvironment", new GLib.Variant ("(a{ss})", builder), GLib.DBusCallFlags.NONE, -1, null);
- }
- catch (Error e)
- {
- warning ("Could not get set environment for indicators: %s", e.message);
- return;
- }
- }
-
private Indicator.Object? load_indicator_file (string indicator_name)
{
string dir = Config.INDICATOR_FILE_DIR;
@@ -386,20 +359,20 @@ public class MenuBar : Gtk.MenuBar
private void setup_indicators ()
{
/* Set indicators to run with reduced functionality */
- greeter_set_env ("INDICATOR_GREETER_MODE", "1");
+ AGUtils.greeter_set_env ("INDICATOR_GREETER_MODE", "1");
/* Don't allow virtual file systems? */
- greeter_set_env ("GIO_USE_VFS", "local");
- greeter_set_env ("GVFS_DISABLE_FUSE", "1");
+ AGUtils.greeter_set_env ("GIO_USE_VFS", "local");
+ AGUtils.greeter_set_env ("GVFS_DISABLE_FUSE", "1");
/* Hint to have mate-settings-daemon run in greeter mode */
- greeter_set_env ("RUNNING_UNDER_GDM", "1");
+ AGUtils.greeter_set_env ("RUNNING_UNDER_GDM", "1");
/* Let indicators know about our unique dbus name */
try
{
var conn = Bus.get_sync (BusType.SESSION);
- greeter_set_env ("ARCTICA_GREETER_DBUS_NAME", conn.get_unique_name ());
+ AGUtils.greeter_set_env ("ARCTICA_GREETER_DBUS_NAME", conn.get_unique_name ());
}
catch (IOError e)
{
diff --git a/src/util.vala b/src/util.vala
index 6b82f50..a9116f7 100644
--- a/src/util.vala
+++ b/src/util.vala
@@ -26,3 +26,33 @@
[CCode(cname = "GTK_IS_CONTAINER", cheader_filename="gtk/gtk.h", simple_generics = true, has_target = false)]
static extern bool gtk_is_container<T> (T widget);
#endif
+
+namespace AGUtils {
+ public void greeter_set_env (string key, string val)
+ {
+ GLib.Environment.set_variable (key, val, true);
+
+ /* And also set it in the DBus activation environment so that any
+ * indicator services pick it up. */
+ try
+ {
+ var proxy = new GLib.DBusProxy.for_bus_sync (GLib.BusType.SESSION,
+ GLib.DBusProxyFlags.NONE, null,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ null);
+
+ var builder = new GLib.VariantBuilder (GLib.VariantType.ARRAY);
+ builder.add ("{ss}", key, val);
+
+ debug ("Updating DBus activation environment, updating '%s' to '%s'", key, val);
+ proxy.call_sync ("UpdateActivationEnvironment", new GLib.Variant ("(a{ss})", builder), GLib.DBusCallFlags.NONE, -1, null);
+ }
+ catch (Error e)
+ {
+ warning ("Could not set environment variable '%s' to '%s', error was: '%s'", key, val, e.message);
+ return;
+ }
+ }
+}