Quote the passed command line...

2007-04-29  Emmanuele Bassi  <ebassi@gnome.org>

	* glib/gbookmarkfile.c:
	(g_bookmark_file_set_app_info): Quote the passed command line...
	
	(g_bookmark_file_get_app_info): ... and unquote it when giving it
	back. (#432274)

svn path=/trunk/; revision=5466
This commit is contained in:
Emmanuele Bassi 2007-04-29 11:48:40 +00:00 committed by Emmanuele Bassi
parent 94b419c3e0
commit 788b109b39
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2007-04-29 Emmanuele Bassi <ebassi@gnome.org>
* glib/gbookmarkfile.c:
(g_bookmark_file_set_app_info): Quote the passed command line...
(g_bookmark_file_get_app_info): ... and unquote it when giving it
back. (#432274)
2007-04-27 Matthias Clasen <mclasen@redhat.com>
* glib/gstrfuncs.c: small coding style cleanups.

View File

@ -3257,7 +3257,7 @@ g_bookmark_file_set_app_info (GBookmarkFile *bookmark,
if (exec && exec[0] != '\0')
{
g_free (ai->exec);
ai->exec = g_strdup (exec);
ai->exec = g_shell_quote (exec);
}
item->modified = time (NULL);
@ -3338,7 +3338,9 @@ expand_exec_line (const gchar *exec_fmt,
* @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
* event that no application with name @app_name has registered a bookmark
* for @uri, %FALSE is returned and error is set to
* #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
* #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
* the command line fails, an error of the #G_SHELL_ERROR domain is
* set and %FALSE is returned.
*
* Return value: %TRUE on success.
*
@ -3383,15 +3385,29 @@ g_bookmark_file_get_app_info (GBookmarkFile *bookmark,
if (exec)
{
*exec = expand_exec_line (ai->exec, uri);
GError *unquote_error = NULL;
gchar *command_line;
command_line = g_shell_unquote (ai->exec, &unquote_error);
if (unquote_error)
{
g_propagate_error (unquote_error, error);
return FALSE;
}
*exec = expand_exec_line (command_line, uri);
if (!*exec)
{
g_set_error (error, G_BOOKMARK_FILE_ERROR,
G_BOOKMARK_FILE_ERROR_INVALID_URI,
_("Failed to expand exec line '%s' with URI '%s'"),
ai->exec, uri);
g_free (command_line);
return FALSE;
}
else
g_free (command_line);
}
if (count)