diff options
author | Mark McLoughlin <mark@skynet.ie> | 2005-11-04 08:43:33 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@src.gnome.org> | 2005-11-04 08:43:33 +0000 |
commit | 60d70230a911f050646eb6d23465cb84fd2f24b1 (patch) | |
tree | 46ffd423aef08732bfb8724298549e9ed23abd7f | |
parent | 753fa3419393491cdfe52a2a1c77275783dbc387 (diff) | |
download | gnome-desktop-60d70230a911f050646eb6d23465cb84fd2f24b1.tar.gz |
Fixes build on Darwin - bug #124277
2005-11-04 Mark McLoughlin <mark@skynet.ie>
Fixes build on Darwin - bug #124277
* gnome-desktop-item.c:
(make_spawn_environment_for_sn_context),
(make_environment_for_screen): Use g_listenv() instead
of environ
2005-11-04 Mark McLoughlin <mark@skynet.ie>
* configure.in: require glib >= 2.8.0 for g_listenv()
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | libgnome-desktop/ChangeLog | 9 | ||||
-rw-r--r-- | libgnome-desktop/gnome-desktop-item.c | 46 |
4 files changed, 47 insertions, 14 deletions
@@ -1,3 +1,7 @@ +2005-11-04 Mark McLoughlin <mark@skynet.ie> + + * configure.in: require glib >= 2.8.0 for g_listenv() + 2005-10-31 Simos Xenitellis <simos@gnome.org> * configure.in: Added ky (Kirghiz) to ALL_LINGUAS. diff --git a/configure.in b/configure.in index 3a1421ab..b786ceb1 100644 --- a/configure.in +++ b/configure.in @@ -70,7 +70,7 @@ dnl it too, or it will never make it into the spec file! GDK_PIXBUF_REQUIRED=2.4.0 GTK_REQUIRED=2.4.0 -GLIB_REQUIRED=2.6.0 +GLIB_REQUIRED=2.8.0 LIBGNOMECANVAS_REQUIRED=2.0.0 LIBGNOMEUI_REQUIRED=2.6.0 GNOME_VFS_REQUIRED=2.0.0 diff --git a/libgnome-desktop/ChangeLog b/libgnome-desktop/ChangeLog index 939627cd..9e54ac45 100644 --- a/libgnome-desktop/ChangeLog +++ b/libgnome-desktop/ChangeLog @@ -1,3 +1,12 @@ +2005-11-04 Mark McLoughlin <mark@skynet.ie> + + Fixes build on Darwin - bug #124277 + + * gnome-desktop-item.c: + (make_spawn_environment_for_sn_context), + (make_environment_for_screen): Use g_listenv() instead + of environ + ==================== 2.13.1 ==================== ==================== 2.12.0 ==================== diff --git a/libgnome-desktop/gnome-desktop-item.c b/libgnome-desktop/gnome-desktop-item.c index e73fa6dd..99e75575 100644 --- a/libgnome-desktop/gnome-desktop-item.c +++ b/libgnome-desktop/gnome-desktop-item.c @@ -61,8 +61,6 @@ #define sure_string(s) ((s)!=NULL?(s):"") -extern char **environ; - struct _GnomeDesktopItem { int refcount; @@ -1492,23 +1490,32 @@ static char ** make_spawn_environment_for_sn_context (SnLauncherContext *sn_context, char **envp) { - char **retval = NULL; + char **retval; + char **freeme; int i, j; int desktop_startup_id_len; - if (envp == NULL) - envp = environ; - - for (i = 0; envp[i]; i++) - ; + retval = freeme = NULL; + + if (envp == NULL) { + envp = freeme = g_listenv (); + for (i = 0; envp[i]; i++) { + char *name = envp[i]; + + envp[i] = g_strjoin ("=", name, g_getenv (name), NULL); + g_free (name); + } + } else { + for (i = 0; envp[i]; i++) + ; + } retval = g_new (char *, i + 2); desktop_startup_id_len = strlen ("DESKTOP_STARTUP_ID"); for (i = 0, j = 0; envp[i]; i++) { - if (strncmp (envp[i], "DESKTOP_STARTUP_ID", desktop_startup_id_len) != 0) - { + if (strncmp (envp[i], "DESKTOP_STARTUP_ID", desktop_startup_id_len) != 0) { retval[j] = g_strdup (envp[i]); ++j; } @@ -1519,6 +1526,8 @@ make_spawn_environment_for_sn_context (SnLauncherContext *sn_context, ++j; retval[j] = NULL; + g_strfreev (freeme); + return retval; } @@ -1666,15 +1675,25 @@ static char ** make_environment_for_screen (GdkScreen *screen, char **envp) { - char **retval = NULL; + char **retval; + char **freeme; char *display_name; int display_index = -1; int i, env_len; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - if (envp == NULL) - envp = environ; + retval = freeme = NULL; + + if (envp == NULL) { + envp = freeme = g_listenv (); + for (i = 0; envp [i]; i++) { + char *name = envp[i]; + + envp[i] = g_strjoin ("=", name, g_getenv (name), NULL); + g_free (name); + } + } for (env_len = 0; envp [env_len]; env_len++) if (strncmp (envp [env_len], "DISPLAY", strlen ("DISPLAY")) == 0) @@ -1694,6 +1713,7 @@ make_environment_for_screen (GdkScreen *screen, g_assert (i == env_len); g_free (display_name); + g_free (freeme); return retval; } |