--- gnome-libs-1.2.1/libgnome/gnome-dentry.c.org Tue May 23 01:48:41 2000 +++ gnome-libs-1.2.1/libgnome/gnome-dentry.c Sun Jun 18 16:28:23 2000 @@ -517,7 +517,8 @@ void gnome_desktop_entry_launch_with_args (GnomeDesktopEntry *item, int the_argc, char *the_argv[]) { - char *uargv[9], *env [2]; + char *env [2]; + GPtrArray *uarray; char *exec_str; char **term_argv; int term_argc = 0; @@ -525,10 +526,11 @@ char **argv; GSList *args_to_free = NULL; gchar *sub_arg; - int i, argc, uargs=4; + int i, argc; int envc = 0; char **envp = NULL; char *xalf = NULL; + int no_xalf = 0; g_assert (item != NULL); @@ -599,24 +601,42 @@ g_free ((char *) argv); } + uarray = g_ptr_array_new(); - if (getenv ("GNOME_USE_XALF")) { + if (!strcmp (item->exec[0], "NO_XALF")) + no_xalf = 1; + + if (!no_xalf && gnome_config_get_bool("/xalf/settings/enabled")) { xalf = gnome_is_program_in_path ("xalf"); if (xalf) { - uargv[0] = xalf; - uargv[1] = "-i"; - uargv[2] = "--title"; - uargv[3] = item->name; - uargv[4] = "-m"; - uargs = 9; + char **options_argv; + int options_argc = 0; + int i; + + g_ptr_array_add (uarray, (gpointer) xalf); + g_ptr_array_add (uarray, (gpointer) "--title"); + g_ptr_array_add (uarray, (gpointer) item->name); + + gnome_config_get_vector ("/xalf/settings/options", + &options_argc, &options_argv); + + if ( (options_argc > 0) && options_argv && *options_argv[0]) { + for (i = 0; i < options_argc; i++) + g_ptr_array_add (uarray, options_argv[i]); + } + + g_free (options_argv); } } - uargv[uargs-4] = "/bin/sh"; - uargv[uargs-3] = "-c"; - uargv[uargs-2] = exec_str; - uargv[uargs-1] = NULL; + g_ptr_array_add (uarray, (gpointer) "/bin/sh"); + g_ptr_array_add (uarray, (gpointer) "-c"); + if (no_xalf) + /* Skip over "NO_XALF " (8 chars) in the string */ + g_ptr_array_add (uarray, (gpointer) exec_str+8); + else + g_ptr_array_add (uarray, (gpointer) exec_str); if (item->icon && !item->is_kde) { char *path = g_strdup_printf ("=%s=/Desktop Entry/X-GNOME-SetIcon=true", @@ -631,13 +651,14 @@ } /* FIXME: do something if there's an error. */ - gnome_execute_async_with_env (NULL, uargs, uargv, envc, envp); + gnome_execute_async_with_env (NULL, uarray->len, (char **) uarray->pdata, envc, envp); if (envp) g_free (env [0]); g_free (exec_str); g_free (xalf); + g_ptr_array_free (uarray, TRUE); } /**