Skip to content
Snippets Groups Projects
Commit 3fddd99e authored by Jérôme Guelfucci's avatar Jérôme Guelfucci
Browse files

Fix twp plugin for images with a quote in file name (bug #5056).

Simply use g_shell_quote instead of manually and wrongly quoting the string
which does not work if there already is a quote in the file name.
parent e6570532
No related branches found
No related tags found
No related merge requests found
......@@ -208,7 +208,7 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
static void
twp_action_set_wallpaper (GtkAction *action,
twp_action_set_wallpaper (GtkAction *action,
gpointer user_data)
{
ThunarxFileInfo *file_info = user_data;
......@@ -222,6 +222,7 @@ twp_action_set_wallpaper (GtkAction *action,
gchar *image_show_prop;
gchar *image_style_prop;
gchar *file_uri;
gchar *escaped_file_name;
gchar *file_name = NULL;
gchar *hostname = NULL;
gchar *command;
......@@ -235,14 +236,14 @@ twp_action_set_wallpaper (GtkAction *action,
g_free (hostname);
g_free (file_uri);
g_free (file_name);
return;
}
if (n_screens > 1)
screen = gdk_display_get_default_screen (display);
else
screen = gdk_display_get_screen (display, 0);
n_monitors = gdk_screen_get_n_monitors (screen);
if (n_monitors > 1)
{
......@@ -251,6 +252,8 @@ twp_action_set_wallpaper (GtkAction *action,
g_free(file_uri);
}
escaped_file_name = g_shell_quote (file_name);
switch (desktop_type)
{
case DESKTOP_TYPE_XFCE:
......@@ -259,7 +262,7 @@ twp_action_set_wallpaper (GtkAction *action,
image_show_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-show", screen_nr, monitor_nr);
image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-style", screen_nr, monitor_nr);
command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t string -s \"%s\"", image_path_prop, file_name);
command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t string -s %s", image_path_prop, escaped_file_name);
g_spawn_command_line_async (command, NULL);
g_free (command);
......@@ -275,13 +278,13 @@ twp_action_set_wallpaper (GtkAction *action,
g_free(image_show_prop);
g_free(image_style_prop);
break;
case DESKTOP_TYPE_NAUTILUS:
g_debug ("set on gnome");
image_path_prop = g_strdup_printf("/desktop/gnome/background/picture_filename");
image_show_prop = g_strdup_printf("/desktop/gnome/background/draw_background");
command = g_strdup_printf ("gconftool-2 %s --set %s--type string", image_path_prop, file_name);
command = g_strdup_printf ("gconftool-2 %s --set %s--type string", image_path_prop, escaped_file_name);
g_spawn_command_line_async (command, NULL);
g_free (command);
......@@ -299,5 +302,6 @@ twp_action_set_wallpaper (GtkAction *action,
break;
}
g_free (escaped_file_name);
g_free(file_name);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment