Author: peter
Date: 2007-01-12 15:32:41 +0000 (Fri, 12 Jan 2007)
New Revision: 24371

Modified:
   squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
   squeeze/trunk/libsqueeze/archive-support-zip.c
   squeeze/trunk/src/preferences_dialog.c
Log:
bug #2751 fixed
the archive file is escaped


Modified: squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-gnu-tar.c  2007-01-12 13:51:30 UTC 
(rev 24370)
+++ squeeze/trunk/libsqueeze/archive-support-gnu-tar.c  2007-01-12 15:32:41 UTC 
(rev 24371)
@@ -269,23 +269,24 @@
                gchar *command = NULL;
                archive->files = lsq_concat_filenames(filenames);
                lsq_archive_set_status(archive, LSQ_ARCHIVESTATUS_ADD);
+               gchar *archive_path = g_shell_quote(archive->path);
                if(!archive->file_info) /* FIXME */
                {
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tar"))
                                command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name,
-                                                     " -cf \"", archive->path, 
"\"", NULL);
+                                                     " -cf ", archive_path, 
NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tarz"))
                                command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name,
-                                                     " -Zcf \"", 
archive->path, "\"", NULL);
+                                                     " -Zcf ", archive_path, 
NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-compressed-tar"))
                                command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name,
-                                                     " -zcf \"", 
archive->path, "\"", NULL);
+                                                     " -zcf ", archive_path, 
NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-bzip-compressed-tar"))
                                command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name,
-                                                     " -jcf \"", 
archive->path, "\"", NULL);
+                                                     " -jcf ", archive_path, 
NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tzo"))
                                command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name,
-                                                     " 
--use-compress-program=lzop -cf \"", archive->path, "\"", NULL);
+                                                     " 
--use-compress-program=lzop -cf ", archive_path, NULL);
                        if(command)
                        {
                                
if(strlen(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_add_mode))
@@ -308,31 +309,33 @@
                {
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tar"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -rf \"", 
archive->path, "\" ", archive->files, NULL);
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -rf ", 
archive_path, " ", archive->files, NULL);
                                lsq_execute(command, archive, NULL, NULL, NULL, 
NULL);
                                g_free(command);
+                               g_free(archive_path);
                                return 0;
                        }
                        archive->tmp_file = g_strconcat(lsq_tmp_dir, 
"/squeeze-XXXXXX" , NULL);
                        g_mkstemp(archive->tmp_file);
                        g_unlink(archive->tmp_file);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tarz"))
-                               command = g_strconcat("uncompress -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("uncompress -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-compressed-tar"))
-                               command = g_strconcat("gunzip -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("gunzip -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-bzip-compressed-tar"))
-                               command = g_strconcat("bunzip2 -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("bunzip2 -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tzo"))
-                               command = g_strconcat("lzop -dc \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("lzop -dc ", 
archive_path, NULL);
                        lsq_execute(command, archive, 
lsq_archive_support_gnu_tar_decompress_watch, NULL, 
lsq_archive_support_gnu_tar_decompress_parse_output, NULL);
                        g_free(command);
                }
+               g_free(archive_path);
        }
        return 0;
 }
 
 gint
-lsq_archive_support_gnu_tar_extract(LSQArchive *archive, gchar *dest_path, 
GSList *filenames)
+lsq_archive_support_gnu_tar_extract(LSQArchive *archive, gchar *extract_path, 
GSList *filenames)
 {
 
        if(!LSQ_IS_ARCHIVE_SUPPORT_GNU_TAR(archive->support))
@@ -356,43 +359,47 @@
                                );
                archive->files = lsq_concat_filenames(filenames);
                lsq_archive_set_status(archive, LSQ_ARCHIVESTATUS_EXTRACT);
+               gchar *archive_path = g_shell_quote(archive->path);
+               gchar *dest_path = g_shell_quote(extract_path);
                if(archive->file_info) /* FIXME */
                {
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tar"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -xf \"", 
archive->path,
-                                               "\" -C \"", dest_path, "\"", 
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -xf ", 
archive_path,
+                                               " -C ", dest_path, 
                                                command_options,
                                                archive->files, NULL);
                        }
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tarz"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -Zxf 
\"", archive->path,
-                                               "\" -C \"", dest_path, "\"", 
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -Zxf ", 
archive_path,
+                                               " -C ", dest_path, 
                                                command_options,
                                                archive->files, NULL);
                        }
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-compressed-tar"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -zxf 
\"", archive->path,
-                                               "\" -C \"", dest_path, "\"", 
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -zxf ", 
archive_path,
+                                               " -C ", dest_path, 
                                                command_options,
                                                archive->files, NULL);
                        }
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-bzip-compressed-tar"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -jxf 
\"", archive->path,
-                                               "\" -C \"", dest_path, "\"", 
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -jxf ", 
archive_path,
+                                               " -C ", dest_path, 
                                                command_options,
                                                archive->files, NULL);
                        }
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tzo"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -xf 
--use-compress-program=lzop \"", archive->path,
-                                               "\" -C \"", dest_path, "\"", 
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -xf 
--use-compress-program=lzop ", archive_path,
+                                               " -C ", dest_path, 
                                                command_options,
                                                archive->files, NULL);
                        }
+                       g_free(extract_path);
+                       g_free(archive_path);
                } else
                {
                        g_free(command_options);
@@ -426,30 +433,36 @@
                gchar *command = NULL;
                archive->files = lsq_concat_filenames(filenames);
                lsq_archive_set_status(archive, LSQ_ARCHIVESTATUS_REMOVE);
+               gchar *archive_path = g_shell_quote(archive->path);
                if(archive->file_info)
                {
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tar"))
                        {
-                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -f \"", 
archive->path, "\" --delete ", archive->files, NULL);
+                               command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -f ", 
archive_path, " --delete ", archive->files, NULL);
                                lsq_execute(command, archive, NULL, NULL, NULL, 
NULL);
                                g_free(command);
+                               g_free(archive_path);
                                return 0;
                        }
                        archive->tmp_file = g_strconcat(lsq_tmp_dir, 
"/squeeze-XXXXXX" , NULL);
                        g_mkstemp(archive->tmp_file);
                        g_unlink(archive->tmp_file);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tarz"))
-                               command = g_strconcat("uncompress -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("uncompress -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-compressed-tar"))
-                               command = g_strconcat("gunzip -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("gunzip -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-bzip-compressed-tar"))
-                               command = g_strconcat("bunzip2 -c \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("bunzip2 -c ", 
archive_path, NULL);
                        
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tzo"))
-                               command = g_strconcat("lzop -dc \"", 
archive->path, "\"", NULL);
+                               command = g_strconcat("lzop -dc ", 
archive_path, NULL);
                        lsq_execute(command, archive, 
lsq_archive_support_gnu_tar_decompress_watch, NULL, 
lsq_archive_support_gnu_tar_decompress_parse_output, NULL);
                        g_free(command);
                } else
+               {
+                       g_free(archive_path);
                        return 1;
+               }
+               g_free(archive_path);
        }
        return 0;
 }
@@ -473,6 +486,7 @@
        {
                lsq_archive_clear_entry_property_types(archive);
                i = LSQ_ARCHIVE_PROP_USER;
+               gchar *archive_path = g_shell_quote(archive->path);
                if(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_rights) 
{
                        lsq_archive_set_entry_property_type(archive, i, 
G_TYPE_STRING, _("Permissions"));
                        i++;
@@ -494,11 +508,12 @@
                        i++;
                }
                
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), 
"application/x-tzo"))
-                       command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " 
--use-compress-program=lzop -tvf \"" , archive->path, "\"", NULL);
+                       command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " 
--use-compress-program=lzop -tvf ", archive_path, NULL);
                else
-                       command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -tvf \"" 
, archive->path, "\"", NULL);
+                       command = 
g_strconcat(LSQ_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " -tvf ", 
archive_path, NULL);
                lsq_execute(command, archive, NULL, NULL, 
lsq_archive_support_gnu_tar_refresh_parse_output, NULL);
                g_free(command);
+               g_free(archive_path);
        }
        return 0;
 }

Modified: squeeze/trunk/libsqueeze/archive-support-zip.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-zip.c      2007-01-12 13:51:30 UTC 
(rev 24370)
+++ squeeze/trunk/libsqueeze/archive-support-zip.c      2007-01-12 15:32:41 UTC 
(rev 24371)
@@ -225,18 +225,20 @@
        {
                gchar *command = NULL;
                gchar *files = lsq_concat_filenames(filenames);
+               gchar *archive_path = g_shell_quote(archive->path);
                if(!g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/x-zip") || 
                   !g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/zip"))
                {
-                       command = g_strconcat("zip -r \"", archive->path, "\" 
", files, NULL);
+                       command = g_strconcat("zip -r ", archive_path, " ", 
files, NULL);
                        lsq_execute(command, archive, NULL, NULL, NULL, NULL);
                }
+               g_free(archive_path);
        }
        return 0;
 }
 
 static gint
-lsq_archive_support_zip_extract(LSQArchive *archive, gchar *dest_path, GSList 
*filenames)
+lsq_archive_support_zip_extract(LSQArchive *archive, gchar *extract_path, 
GSList *filenames)
 {
        if(!LSQ_IS_ARCHIVE_SUPPORT_ZIP(archive->support))
        {
@@ -252,16 +254,24 @@
        {
                gchar *command = NULL;
                gchar *files = lsq_concat_filenames(filenames);
+               gchar *archive_path = g_shell_quote(archive->path);
+               gchar *dest_path = g_shell_quote(extract_path);
                if(archive->file_info) /* FIXME */
                {
                        if(!g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/x-zip") || 
                     !g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/zip"))
                        {
-                               command = g_strconcat("unzip -o \"", 
archive->path, "\" ", files, " -d ", dest_path, NULL);
+                               command = g_strconcat("unzip -o ", 
archive_path, " ", files, " -d ", dest_path, NULL);
                                lsq_execute(command, archive, NULL, NULL, NULL, 
NULL);
                        }       
                } else
+               {
+                       g_free(extract_path);
+                       g_free(archive_path);
                        return 1;
+               }
+               g_free(extract_path);
+               g_free(archive_path);
        }
        return 0;
 }
@@ -283,12 +293,14 @@
        {
                gchar *command = NULL;
                gchar *files = lsq_concat_filenames(filenames);
+               gchar *archive_path = g_shell_quote(archive->path);
                if(!g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/x-zip") || 
                   !g_strcasecmp((gchar 
*)thunar_vfs_mime_info_get_name(archive->mime_info), "application/zip"))
                {
-                       command = g_strconcat("zip -d \"", archive->path, "\" 
", files, NULL);
+                       command = g_strconcat("zip -d ", archive_path, " ", 
files, NULL);
                        lsq_execute(command, archive, NULL, NULL, NULL, NULL);
                }
+               g_free(archive_path);
        }
        return 0;
 }
@@ -311,6 +323,7 @@
        {
                lsq_archive_clear_entry_property_types(archive);
                i = LSQ_ARCHIVE_PROP_USER;
+               gchar *archive_path = g_shell_quote(archive->path);
                if(LSQ_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_length) {
                        lsq_archive_set_entry_property_type(archive, i, 
G_TYPE_UINT64, _("Size"));
                        i++;
@@ -339,9 +352,10 @@
                        lsq_archive_set_entry_property_type(archive, i, 
G_TYPE_STRING, _("Checksum"));
                        i++;
                }
-               gchar *command = g_strconcat("unzip -lv -qq \"" , 
archive->path, "\"", NULL);
+               gchar *command = g_strconcat("unzip -lv -qq ", archive_path, 
NULL);
                lsq_execute(command, archive, NULL, NULL, 
lsq_archive_support_zip_refresh_parse_output, NULL);
                g_free(command);
+               g_free(archive_path);
        }
        return 0;
 }

Modified: squeeze/trunk/src/preferences_dialog.c
===================================================================
--- squeeze/trunk/src/preferences_dialog.c      2007-01-12 13:51:30 UTC (rev 
24370)
+++ squeeze/trunk/src/preferences_dialog.c      2007-01-12 15:32:41 UTC (rev 
24371)
@@ -269,7 +269,7 @@
        gtk_box_pack_start(GTK_BOX(box), dialog->support.notebook, TRUE, TRUE, 
0);
        gtk_widget_show_all(box);
 }
-
+#if 1
 static GtkWidget *
 sq_preferences_dialog_create_support_object_page(SQSupportTuple *tuple)
 {
@@ -299,7 +299,56 @@
 
        return vbox;
 }
+#else
+static GtkWidget *
+sq_preferences_dialog_create_support_object_page(SQSupportTuple *tuple)
+{
+       GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
 
+       GtkTreeModel *store = GTK_TREE_MODEL(gtk_list_store_new(2, 
G_TYPE_STRING, G_TYPE_STRING));
+
+       tuple->box = gtk_tree_view_new_with_model(store);
+       GtkTreeView *tree_view = GTK_TREE_VIEW(tuple->box);
+       gtk_tree_view_set_reorderable(tree_view, TRUE);
+
+       GtkCellRenderer *render = gtk_cell_renderer_text_new();
+       GtkTreeViewColumn *column = 
gtk_tree_view_column_new_with_attributes("Column", render, "text", 0, NULL);
+       gtk_tree_view_append_column(tree_view, column);
+
+       GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_set_size_request(scroll, 100, 100);
+
+       gtk_container_add(GTK_CONTAINER(scroll), tuple->box);
+       /* gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), 
iconview); */
+       gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), 
GTK_SHADOW_IN);
+
+       render = gtk_cell_renderer_text_new();
+       column = gtk_tree_view_column_new_with_attributes("Discription", 
render, "text", 1, NULL);
+       gtk_tree_view_append_column(tree_view, column);
+
+       gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
+
+       GSList *iter, *view_props = iter = 
lsq_archive_support_list_properties(tuple->support, "view");
+       GParamSpec *spec;
+       gboolean visible;
+       GtkTreeIter titer;
+
+       while(iter)
+       {
+               spec = G_PARAM_SPEC(iter->data);
+               g_object_get(G_OBJECT(tuple->support), 
g_param_spec_get_name(spec), &visible, NULL);
+
+               gtk_list_store_append(GTK_LIST_STORE(store), &titer);
+               gtk_list_store_set(GTK_LIST_STORE(store), &titer, 0, 
g_param_spec_get_nick(spec), 1, g_param_spec_get_blurb(spec), -1);
+
+               iter = g_slist_next(iter);
+       }
+
+       g_slist_free(view_props);
+
+       return vbox;
+}
+#endif
 static void
 cb_sq_preferences_dialog_item_changed(GtkWidget *widget, gpointer user_data)
 {

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to