Implement (show_screensaver): Call fix_arguments to handle quoted strings
2000-10-08 Bradford Hovinen <hovinen@helixcode.com> * preview.c (fix_arguments): Implement (show_screensaver): Call fix_arguments to handle quoted strings in the command line
This commit is contained in:
parent
89e394e737
commit
650b11cd19
3 changed files with 50 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2000-10-08 Bradford Hovinen <hovinen@helixcode.com>
|
||||||
|
|
||||||
|
* preview.c (fix_arguments): Implement
|
||||||
|
(show_screensaver): Call fix_arguments to handle quoted strings in
|
||||||
|
the command line
|
||||||
|
|
||||||
2000-10-07 Bradford Hovinen <hovinen@helixcode.com>
|
2000-10-07 Bradford Hovinen <hovinen@helixcode.com>
|
||||||
|
|
||||||
* screensaver-prefs-dialog.c (set_widgets_sensitive): Set
|
* screensaver-prefs-dialog.c (set_widgets_sensitive): Set
|
||||||
|
|
|
@ -143,6 +143,46 @@ add_window_arg (char **args, GdkWindow *window)
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fix_arguments
|
||||||
|
*
|
||||||
|
* Given an array of CLI arguments naively split, convert them into actual CLI
|
||||||
|
* arguments. Note: leaks memory a lot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char **
|
||||||
|
fix_arguments (char **argv)
|
||||||
|
{
|
||||||
|
char **out;
|
||||||
|
gchar *tmp, *tmp1;
|
||||||
|
int i, j, argc;
|
||||||
|
|
||||||
|
for (argc = 0; argv[argc]; argc++);
|
||||||
|
|
||||||
|
out = g_new0 (char *, argc + 1);
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < argc; i++) {
|
||||||
|
if (argv[i][0] != '\"') {
|
||||||
|
out[j++] = argv[i];
|
||||||
|
} else {
|
||||||
|
tmp = g_strdup (argv[i] + 1);
|
||||||
|
while (i < argc) {
|
||||||
|
if (argv[i][strlen (argv[i]) - 1] == '\"') {
|
||||||
|
tmp[strlen (tmp) - 1] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
tmp1 = g_strconcat (tmp, " ", argv[i], NULL);
|
||||||
|
g_free (tmp);
|
||||||
|
tmp = tmp1;
|
||||||
|
}
|
||||||
|
|
||||||
|
out[j++] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
/* show_screensaver
|
/* show_screensaver
|
||||||
*
|
*
|
||||||
* Given a GdkWindow in which to render and a particular screensaver,
|
* Given a GdkWindow in which to render and a particular screensaver,
|
||||||
|
@ -164,6 +204,7 @@ show_screensaver (GdkWindow *window, Screensaver *saver, pid_t *pid)
|
||||||
nice (20); /* Very low priority */
|
nice (20); /* Very low priority */
|
||||||
|
|
||||||
args = g_strsplit (saver->command_line, " ", -1);
|
args = g_strsplit (saver->command_line, " ", -1);
|
||||||
|
args = fix_arguments (args);
|
||||||
args = strip_arg (args, "-root");
|
args = strip_arg (args, "-root");
|
||||||
args = add_window_arg (args, window);
|
args = add_window_arg (args, window);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
<!-- Specific options for XLOCKMORE program ... -->
|
<!-- Specific options for XLOCKMORE program ... -->
|
||||||
|
|
||||||
<string id="text" label="Text for flag" arg="-text"/>
|
<string id="text" label="Text for flag" arg="-text %"/>
|
||||||
<file id="bitmap" label="Bitmap for flag" arg="-bitmap"/>
|
<file id="bitmap" label="Bitmap for flag" arg="-bitmap %"/>
|
||||||
|
|
||||||
<!-- Generic XLOCKMORE options... -->
|
<!-- Generic XLOCKMORE options... -->
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
default="64"/>
|
default="64"/>
|
||||||
|
|
||||||
<select id="use_color">
|
<select id="use_color">
|
||||||
<option id="color" label="Full Color"/>
|
<option id="color" label="Full Color" enable="ncolours"/>
|
||||||
<option id="mono" label="Monochrome" arg-set="-mono" test="mono"/>
|
<option id="mono" label="Monochrome" arg-set="-mono" test="mono"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue