summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2012-05-04 20:19:00 +0200
committerNick Schermer <nick@xfce.org>2013-05-05 17:30:55 +0200
commitab6be105489d53e0ae4886a06b1cbb0ebf2a8ad3 (patch)
tree4cfa7575fbcf4bc12548f8d5623fc1b0da0aabbb
parenta9da851bffd32a604e703472857c4206d9479347 (diff)
downloadxfce4-session-ab6be105489d53e0ae4886a06b1cbb0ebf2a8ad3.tar.gz
Remove xfce environment functions and use glib.
All the functions are provided by glib, except for xfce_putenv, which requires splitting the value for g_setenv. (cherry picked from commit 54002463867cdd01d5639e6a44f3bc74cd50f9ff)
-rw-r--r--xfce4-session/main.c6
-rw-r--r--xfce4-session/sm-layer.c2
-rw-r--r--xfce4-session/xfsm-compat-gnome.c42
-rw-r--r--xfce4-session/xfsm-shutdown.c6
4 files changed, 32 insertions, 24 deletions
diff --git a/xfce4-session/main.c b/xfce4-session/main.c
index 82dc1d43..0a95714f 100644
--- a/xfce4-session/main.c
+++ b/xfce4-session/main.c
@@ -99,14 +99,14 @@ setup_environment (void)
xfsm_enable_verbose ();
/* pass correct DISPLAY to children, in case of --display in argv */
- xfce_setenv ("DISPLAY", gdk_display_get_name (gdk_display_get_default ()), TRUE);
+ g_setenv ("DISPLAY", gdk_display_get_name (gdk_display_get_default ()), TRUE);
/* this is for compatibility with the GNOME Display Manager */
lang = g_getenv ("GDM_LANG");
if (lang != NULL && strlen (lang) > 0)
{
- xfce_setenv ("LANG", lang, TRUE);
- xfce_unsetenv ("GDM_LANG");
+ g_setenv ("LANG", lang, TRUE);
+ g_unsetenv ("GDM_LANG");
}
/* check access to $ICEAUTHORITY or $HOME/.ICEauthority if unset */
diff --git a/xfce4-session/sm-layer.c b/xfce4-session/sm-layer.c
index b71a986d..313172fe 100644
--- a/xfce4-session/sm-layer.c
+++ b/xfce4-session/sm-layer.c
@@ -140,7 +140,7 @@ sm_init (XfconfChannel *channel,
ice_setup_listeners (num_listeners, listen_objs, manager);
network_idlist = IceComposeNetworkIdList (num_listeners, listen_objs);
- xfce_setenv ("SESSION_MANAGER", network_idlist, TRUE);
+ g_setenv ("SESSION_MANAGER", network_idlist, TRUE);
free (network_idlist);
}
diff --git a/xfce4-session/xfsm-compat-gnome.c b/xfce4-session/xfsm-compat-gnome.c
index e1fa16fe..d02df5ac 100644
--- a/xfce4-session/xfsm-compat-gnome.c
+++ b/xfce4-session/xfsm-compat-gnome.c
@@ -92,15 +92,17 @@ child_setup (gpointer user_data)
static void
gnome_keyring_daemon_startup (void)
{
- GError *error = NULL;
- gchar *sout;
- gchar **lines;
- gsize lineno;
- gint status;
- long pid;
- gchar *pid_str;
- gchar *end;
- char *argv[3];
+ GError *error = NULL;
+ gchar *sout;
+ gchar **lines;
+ gsize lineno;
+ gint status;
+ glong pid;
+ gchar *end;
+ gchar *argv[3];
+ gchar *p;
+ gchar *name;
+ const gchar *value;
/* Pipe to slave keyring lifetime to */
if (pipe (keyring_lifetime_pipe))
@@ -136,17 +138,23 @@ gnome_keyring_daemon_startup (void)
for (lineno = 0; lines[lineno] != NULL; lineno++)
{
- xfce_putenv (lines[lineno]);
+ p = strchr (lines[lineno], '=');
+ if (p == NULL)
+ continue;
- if (g_str_has_prefix (lines[lineno], "GNOME_KEYRING_PID="))
+ name = g_strndup (lines[lineno], p - lines[lineno]);
+ value = p + 1;
+
+ g_setenv (name, value, TRUE);
+
+ if (g_strcmp0 (name, "GNOME_KEYRING_PID") == 0)
{
- pid_str = lines[lineno] + strlen ("GNOME_KEYRING_PID=");
- pid = strtol (pid_str, &end, 10);
- if (end != pid_str)
- {
- gnome_keyring_daemon_pid = pid;
- }
+ pid = strtol (value, &end, 10);
+ if (end != value)
+ gnome_keyring_daemon_pid = pid;
}
+
+ g_free (name);
}
g_strfreev (lines);
diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c
index cde71234..4c483a74 100644
--- a/xfce4-session/xfsm-shutdown.c
+++ b/xfce4-session/xfsm-shutdown.c
@@ -284,9 +284,9 @@ xfsm_shutdown_sudo_init (XfsmShutdown *shutdown,
signal (SIGPIPE, SIG_IGN);
/* setup environment */
- xfce_setenv ("LC_ALL", "C", TRUE);
- xfce_setenv ("LANG", "C", TRUE);
- xfce_setenv ("LANGUAGE", "C", TRUE);
+ g_setenv ("LC_ALL", "C", TRUE);
+ g_setenv ("LANG", "C", TRUE);
+ g_setenv ("LANGUAGE", "C", TRUE);
/* setup the 3 standard file handles */
dup2 (child_pipe[0], STDIN_FILENO);