file-roller r2226 - in trunk: . src



Author: paobac
Date: Thu Apr 10 18:57:34 2008
New Revision: 2226
URL: http://svn.gnome.org/viewvc/file-roller?rev=2226&view=rev

Log:
2008-04-10  Paolo Bacchilega  <paobac svn gnome org>

	* src/fr-command-tar.c:
	
	Do not use the tar update command because it adds a new file version 
	instead of replacing the old one.

	* src/glib-utils.c: 
	* src/gio-utils.c: 
	* src/fr-window.c: 
	* src/fr-process.h: 
	* src/fr-process.c:  
	* src/fr-command-jar.c: 
	* src/fr-command-iso.c: 
	* src/fr-command.c: 
	* src/fr-archive.c: 
	* src/file-utils.h: 
	* src/file-utils.c: 
	* src/dlg-add-folder.c: 

	Fixed many uri/path conversions. 

2008-04-10  Paolo Bacchilega  <paobac svn gnome org>

	* src/dlg-add-folder.c: added a left padding to the "Exclude folders that 
	are symbolic links"	option, because it's a sub-option of "Include 
	subfolders".

Modified:
   trunk/ChangeLog
   trunk/src/dlg-add-folder.c
   trunk/src/file-utils.c
   trunk/src/file-utils.h
   trunk/src/fr-archive.c
   trunk/src/fr-command-iso.c
   trunk/src/fr-command-jar.c
   trunk/src/fr-command-tar.c
   trunk/src/fr-command.c
   trunk/src/fr-process.c
   trunk/src/fr-process.h
   trunk/src/fr-window.c
   trunk/src/gio-utils.c
   trunk/src/glib-utils.c

Modified: trunk/src/dlg-add-folder.c
==============================================================================
--- trunk/src/dlg-add-folder.c	(original)
+++ trunk/src/dlg-add-folder.c	Thu Apr 10 18:57:34 2008
@@ -247,6 +247,7 @@
 	GtkWidget   *main_box;
 	GtkWidget   *vbox;
 	GtkWidget   *table;
+	GtkWidget   *align;
 
 	data = g_new0 (DialogData, 1);
 
@@ -296,11 +297,15 @@
 	gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
 	gtk_box_pack_start (GTK_BOX (main_box), vbox, TRUE, TRUE, 0);
 
-	gtk_box_pack_start (GTK_BOX (vbox), data->add_if_newer_checkbutton,
-			    TRUE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), data->include_subfold_checkbutton,
 			    TRUE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), data->exclude_symlinks,
+			    
+	align = gtk_alignment_new (0, 0, 0, 0);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0);
+	gtk_container_add (GTK_CONTAINER (align), data->exclude_symlinks);
+	gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+
+	gtk_box_pack_start (GTK_BOX (vbox), data->add_if_newer_checkbutton,
 			    TRUE, TRUE, 0);
 
 	table = gtk_table_new (2, 2, FALSE);
@@ -445,6 +450,7 @@
 	DialogData            *data = aod_data->data;
 	GtkTreeSelection      *selection;
 	GtkTreeIter            iter;
+	char                  *file_uri;
 	char                  *file_path;
 	char                  *include_files = NULL;
 	char                  *exclude_files = NULL;
@@ -458,15 +464,14 @@
 	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
 		return;
 
-	gtk_tree_model_get (aod_data->aod_model, &iter,
-			    1, &file_path,
-			    -1);
-
-	g_free (data->last_options);
-	data->last_options = g_strdup (file_name_from_path (file_path));
+	gtk_tree_model_get (aod_data->aod_model, &iter, 1, &file_uri, -1);
 
 	/* Load options. */
 
+	file_path = g_filename_from_uri (file_uri, NULL, NULL);
+	g_free (data->last_options);
+	data->last_options = g_strdup (file_name_from_path (file_path));
+	
 	base_dir = config_get_string (file_path, "base_dir");
 	filename = config_get_string (file_path, "filename");
 	include_files = config_get_string (file_path, "include_files");
@@ -476,12 +481,13 @@
 	no_symlinks = config_get_bool (file_path, "no_symlinks");
 
 	g_free (file_path);
+	g_free (file_uri);
 
 	/* Sync widgets with options. */
 
 	if (base_dir != NULL) {
 		if ((filename != NULL) && (strcmp (filename, base_dir) != 0))
-			gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (data->dialog), filename);
+			gtk_file_chooser_select_uri (GTK_FILE_CHOOSER (data->dialog), filename);
 		else
 			gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), base_dir);
 	}
@@ -527,10 +533,10 @@
 
 	gtk_list_store_clear (list_store);
 
-	options_dir = get_home_relative_dir (RC_OPTIONS_DIR);
+	options_dir = get_home_relative_uri (RC_OPTIONS_DIR);
 	ensure_dir_exists (options_dir, 0700, NULL);
 
-	file = g_file_new_for_path (options_dir);
+	file = g_file_new_for_uri (options_dir);
 	fileenum = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &err);
 	if (err != NULL) {
 		g_warning ("Failed to enumerate children in %s: %s", options_dir, err->message);
@@ -721,9 +727,10 @@
 save_options_cb (GtkWidget  *w,
 		 DialogData *data)
 {
-	char       *options_dir;
+	GFile      *options_dir;
+	GFile      *options_file;
 	char       *opt_filename;
-	char       *opt_file_path;
+	char       *options_path;
 	char       *base_dir;
 	char       *filename;
 	gboolean    update;
@@ -732,29 +739,31 @@
 	const char *include_files;
 	const char *exclude_files;
 
-	options_dir = get_home_relative_dir (RC_OPTIONS_DIR);
-	ensure_dir_exists (options_dir, 0700, NULL);
+	options_dir = get_home_relative_file (RC_OPTIONS_DIR);
+	make_directory_tree (options_dir, 0700, NULL);
 
 	opt_filename = _gtk_request_dialog_run (
-			GTK_WINDOW (data->dialog),
-			GTK_DIALOG_MODAL,
-			_("Save Options"),
-			_("Options Name:"),
-			(data->last_options != NULL)?data->last_options:"",
-			1024,
-			GTK_STOCK_CANCEL,
-			GTK_STOCK_SAVE);
-
+				GTK_WINDOW (data->dialog),
+				GTK_DIALOG_MODAL,
+				_("Save Options"),
+				_("Options Name:"),
+				(data->last_options != NULL) ? data->last_options : "",
+				1024,
+				GTK_STOCK_CANCEL,
+				GTK_STOCK_SAVE);
 	if (opt_filename == NULL)
 		return;
 
-	opt_file_path = g_build_filename (options_dir, opt_filename, NULL);
-	g_free (opt_filename);
+	options_file = g_file_get_child_for_display_name (options_dir, opt_filename, NULL);
+	g_object_unref (options_dir);	
+	
+	g_free (data->last_options);
+	data->last_options = opt_filename;
 
 	/* Get options. */
 
-	base_dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (data->dialog));
-	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data->dialog));
+	base_dir = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (data->dialog));
+	filename = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dialog));
 	update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->add_if_newer_checkbutton));
 	recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton));
 	no_symlinks = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks));
@@ -769,21 +778,18 @@
 
 	/* Save options. */
 
-	config_set_string (opt_file_path, "base_dir", base_dir);
-	config_set_string (opt_file_path, "filename", filename);
-	config_set_string (opt_file_path, "include_files", include_files);
-	config_set_string (opt_file_path, "exclude_files", exclude_files);
-	config_set_bool   (opt_file_path, "update", update);
-	config_set_bool   (opt_file_path, "recursive", recursive);
-	config_set_bool   (opt_file_path, "no_symlinks", no_symlinks);
+	options_path = g_file_get_path (options_file);
+	config_set_string (options_path, "base_dir", base_dir);
+	config_set_string (options_path, "filename", filename);
+	config_set_string (options_path, "include_files", include_files);
+	config_set_string (options_path, "exclude_files", exclude_files);
+	config_set_bool   (options_path, "update", update);
+	config_set_bool   (options_path, "recursive", recursive);
+	config_set_bool   (options_path, "no_symlinks", no_symlinks);
 	gnome_config_sync ();
-
-	g_free (data->last_options);
-	data->last_options = g_strdup (file_name_from_path (opt_file_path));
-
-	/**/
-
+	
+	g_free (options_path);
 	g_free (base_dir);
 	g_free (filename);
-	g_free (opt_file_path);
+	g_object_unref (options_file);	
 }

Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c	(original)
+++ trunk/src/file-utils.c	Thu Apr 10 18:57:34 2008
@@ -506,35 +506,35 @@
 		     mode_t    mode,
 		     GError  **error)
 {
-	GFile *parent;
-
+	gboolean  success = TRUE;
+	GFile    *parent;
+	
 	if (dir == NULL)
 		return TRUE;
 
 	parent = g_file_get_parent (dir);
-	if (parent != NULL) {
-		gboolean success;
-		
+	if (parent != NULL) {	
 		success = make_directory_tree (parent, mode, error);
 		g_object_unref (parent);
-		if (! success) 
+		if (! success)  
 			return FALSE;
 	}
 	
-	g_file_make_directory (dir, NULL, error);
-	if ((*error != NULL) && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+	success = g_file_make_directory (dir, NULL, error);
+	if ((error != NULL) && (*error != NULL) && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
 		g_clear_error (error);
-	if (*error != NULL) 
-		return FALSE;
+		success = TRUE;
+	}
+	
+	if (success) 
+		g_file_set_attribute_uint32 (dir,
+					     G_FILE_ATTRIBUTE_UNIX_MODE,
+					     mode, 
+					     0, 
+					     NULL, 
+					     NULL);
 
-	g_file_set_attribute_uint32 (dir,
-				     G_FILE_ATTRIBUTE_UNIX_MODE,
-				     mode, 
-				     0, 
-				     NULL, 
-				     NULL);
-				     
-	return TRUE;
+	return success;
 }
 
 
@@ -565,6 +565,22 @@
 
 
 gboolean
+make_directory_tree_from_path (const char  *path,
+		   	       mode_t       mode,
+		   	       GError     **error)
+{
+	char     *uri;
+	gboolean  result;
+	
+	uri = g_filename_to_uri (path, NULL, NULL);
+	result = ensure_dir_exists (uri, mode, error);
+	g_free (uri);
+	
+	return result;
+}
+
+
+gboolean
 file_extension_is (const char *filename,
 		   const char *ext)
 {
@@ -1037,6 +1053,30 @@
 }
 
 
+char *
+get_home_relative_uri (const char *partial_uri)
+{
+	return g_strconcat (get_home_uri (), 
+			    "/",
+			    partial_uri,
+			    NULL);
+}
+
+
+GFile *
+get_home_relative_file (const char *partial_uri)
+{
+	GFile *file;
+	char  *uri;
+	
+	uri = g_strconcat (get_home_uri (), "/", partial_uri, NULL);
+	file = g_file_new_for_uri (uri);
+	g_free (uri);
+	
+	return file;
+}
+
+
 const char *
 remove_host_from_uri (const char *uri)
 {

Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h	(original)
+++ trunk/src/file-utils.h	Thu Apr 10 18:57:34 2008
@@ -55,6 +55,9 @@
 gboolean            ensure_dir_exists            (const char  *uri,
 						  mode_t       mode,
 						  GError     **error);
+gboolean            make_directory_tree_from_path (const char  *path,
+		   	                           mode_t       mode,
+		   	                           GError     **error);
 gboolean            file_is_hidden               (const char  *name);
 G_CONST_RETURN char*file_name_from_path          (const char  *path);
 char *              dir_name_from_path           (const char  *path);
@@ -95,6 +98,8 @@
 /* URI utils */
 
 const char *        get_home_uri                 (void);
+char *              get_home_relative_uri        (const char *partial_uri);
+GFile *             get_home_relative_file       (const char *partial_uri);
 const char *        remove_host_from_uri         (const char *uri);
 char *              get_uri_host                 (const char *uri);
 char *              get_uri_root                 (const char *uri);

Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c	(original)
+++ trunk/src/fr-archive.c	Thu Apr 10 18:57:34 2008
@@ -1045,8 +1045,10 @@
 	switch (action) {
 	case FR_ACTION_DELETING_FILES:
 		if (error->type == FR_PROC_ERROR_NONE) {
-			copy_to_remote_location (archive, action);
-			return;
+			if (! g_file_has_uri_scheme (archive->file, "file")) {
+				copy_to_remote_location (archive, action);
+				return;
+			}
 		}
 		break;
 		
@@ -1431,7 +1433,8 @@
 	char *dest_dir;
 	char *temp_dir;
 	char *tmp;
-	char *parent_dir, *dir;
+	char *parent_dir;
+	char *dir;
 
 	if ((dest_path == NULL)
 	    || (*dest_path == '\0')
@@ -1450,16 +1453,13 @@
 	parent_dir =  g_build_filename (temp_dir, tmp, NULL);
 	g_free (tmp);
 
-	ensure_dir_exists (parent_dir, 0700, NULL);
-
 	debug (DEBUG_INFO, "mkdir %s\n", parent_dir);
-
+	make_directory_tree_from_path (parent_dir, 0700, NULL);
 	g_free (parent_dir);
 
 	dir = g_build_filename (temp_dir, "/", dest_dir, NULL);
-	symlink (base_dir, dir);
-
 	debug (DEBUG_INFO, "symlink %s --> %s\n", dir, base_dir);
+	symlink (base_dir, dir);
 
 	g_free (dir);
 	g_free (dest_dir);
@@ -1536,25 +1536,28 @@
 	for (scan = file_list; scan; scan = scan->next) {
 		char     *filename = scan->data;
 		char     *fullpath;
+		char     *uri;
 		FileData *fdata;
 
 		fdata = find_file_in_archive (archive, filename);
 
 		if (fdata == NULL) {
-			newer_files = g_list_prepend (newer_files, scan->data);
+			newer_files = g_list_prepend (newer_files, g_strdup (scan->data));
 			continue;
 		}
 
 		fullpath = g_strconcat (base_dir, "/", filename, NULL);
-
-		if (uri_exists (fullpath)
-		    && (fdata->modified >= get_file_mtime (fullpath))) {
+		uri = g_filename_to_uri (fullpath, NULL, NULL);
+		
+		if (fdata->modified >= get_file_mtime (uri)) {
 			g_free (fullpath);
+			g_free (uri);
 			continue;
 		}
-
-		newer_files = g_list_prepend (newer_files, scan->data);
 		g_free (fullpath);
+		g_free (uri);
+		
+		newer_files = g_list_prepend (newer_files, g_strdup (scan->data));
 	}
 
 	return newer_files;
@@ -1657,8 +1660,7 @@
 		archive->process->error.type = FR_PROC_ERROR_NONE;
 		g_signal_emit_by_name (G_OBJECT (archive->process),
 				       "done",
-				       FR_ACTION_ADDING_FILES,
-				       &archive->process->error);
+				       FR_ACTION_ADDING_FILES);
 		return;
 	}
 
@@ -1722,7 +1724,7 @@
 	}
 
 	path_list_free (e_file_list);
-	g_list_free (new_file_list);
+	path_list_free (new_file_list);
 
 	fr_command_recompress (archive->command, compression);
 
@@ -1973,11 +1975,6 @@
 				     FR_PROC_ERROR_NONE,
 				     NULL);
 
-/* FIXME
-	visit_dir_handle_free (archive->priv->vd_handle);
-	archive->priv->vd_handle = NULL;
-*/
-
 	if (file_list != NULL) {
 		fr_archive_add_files (aww_data->archive,
 				      file_list,
@@ -2008,7 +2005,6 @@
 {
 	AddWithWildcardData *aww_data;
 
-	/* FIXME: g_return_if_fail (archive->priv->vd_handle == NULL); */
 	g_return_if_fail (! archive->read_only);
 
 	aww_data = g_new0 (AddWithWildcardData, 1);
@@ -2023,20 +2019,6 @@
 		       fr_archive_signals[START],
 		       0,
 		       FR_ACTION_GETTING_FILE_LIST);
-
-/*
-	archive->priv->vd_handle = get_wildcard_file_list_async (
-					source_dir,
-					include_files,
-					recursive,
-					follow_links,
-					SAME_FS,
-					NO_BACKUP_FILES,
-					NO_DOT_FILES,
-					IGNORE_CASE,
-					add_with_wildcard__step2,
-					aww_data);
-*/
 					
 	g_directory_list_async (source_dir, 
 				source_dir,
@@ -2085,11 +2067,6 @@
 	AddDirectoryData *ad_data = data;
 	FrArchive        *archive = ad_data->archive;
 
-/* FIXME:
-	visit_dir_handle_free (archive->priv->vd_handle);
-	archive->priv->vd_handle = NULL;
-*/
-
 	if (error != NULL) {
 		fr_archive_action_completed (archive,
 					     FR_ACTION_GETTING_FILE_LIST,
@@ -2136,8 +2113,6 @@
 {
 	AddDirectoryData *ad_data;
 
-/* FIXME
-  	g_return_if_fail (archive->priv->vd_handle == NULL); */
 	g_return_if_fail (! archive->read_only);
 
 	ad_data = g_new0 (AddDirectoryData, 1);
@@ -2152,14 +2127,6 @@
 		       fr_archive_signals[START],
 		       0,
 		       FR_ACTION_GETTING_FILE_LIST);
-
-/* FIXME:
-	archive->priv->vd_handle = get_items_file_list_async (
-					ad_data->dir_list,
-					base_dir,
-					add_directory__step2,
-					ad_data);
-*/
 			    
 	g_directory_list_all_async (directory, 
 				    base_dir,
@@ -2183,8 +2150,6 @@
 {
 	AddDirectoryData *ad_data;
 
-/* FIXME
- 	g_return_if_fail (archive->priv->vd_handle == NULL); */
 	g_return_if_fail (! archive->read_only);
 
 	ad_data = g_new0 (AddDirectoryData, 1);
@@ -2199,14 +2164,6 @@
 		       fr_archive_signals[START],
 		       0,
 		       FR_ACTION_GETTING_FILE_LIST);
-
-/* FIXME:
-	archive->priv->vd_handle = get_items_file_list_async (
-					ad_data->dir_list,
-					base_dir,
-					add_directory__step2,
-					ad_data);
-*/
 				
 	g_list_items_async (item_list,
 			    base_dir,

Modified: trunk/src/fr-command-iso.c
==============================================================================
--- trunk/src/fr-command-iso.c	(original)
+++ trunk/src/fr-command-iso.c	Thu Apr 10 18:57:34 2008
@@ -177,7 +177,6 @@
 		char       *file_dir;
 		char       *e_temp_dest_dir = NULL;
 		char       *temp_dest_dir = NULL;
-		char       *temp_dest_dir_uri = NULL;
 
 		filename = file_name_from_path (path);
 		file_dir = remove_level_from_path (path);
@@ -191,8 +190,7 @@
 			continue;
 
 		temp_dest_dir = unescape_str (e_temp_dest_dir);
-		temp_dest_dir_uri = g_filename_to_uri (temp_dest_dir, NULL, NULL);
-		ensure_dir_exists (temp_dest_dir_uri, 0700, NULL);
+		make_directory_tree_from_path (temp_dest_dir, 0700, NULL);
 
 		fr_process_begin_command (comm->process, "sh " PRIVEXECDIR "isoinfo.sh");
 		fr_process_set_working_dir (comm->process, temp_dest_dir);
@@ -206,7 +204,6 @@
 
 		g_free (e_temp_dest_dir);
 		g_free (temp_dest_dir);
-		g_free (temp_dest_dir_uri);
 	}
 
 	g_free (e_dest_dir);

Modified: trunk/src/fr-command-jar.c
==============================================================================
--- trunk/src/fr-command-jar.c	(original)
+++ trunk/src/fr-command-jar.c	Thu Apr 10 18:57:34 2008
@@ -100,7 +100,7 @@
 					  jdata->package_minus_one_level,
 					  NULL);
 		
-		if (! ensure_dir_exists (pack_path, 0755, NULL)) { 
+		if (! make_directory_tree_from_path (pack_path, 0755, NULL)) { 
 			g_free (pack_path);
 			continue;
 		}

Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c	(original)
+++ trunk/src/fr-command-tar.c	Thu Apr 10 18:57:34 2008
@@ -326,10 +326,7 @@
 		g_free (e_base_dir);
 	}
 
-	if (update)
-		fr_process_add_arg (comm->process, "-uf");
-	else
-		fr_process_add_arg (comm->process, "-rf");
+	fr_process_add_arg (comm->process, "-rf");
 
 	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
 	fr_process_add_arg (comm->process, "--");
@@ -875,7 +872,7 @@
 	comm->file_type = FR_FILE_TYPE_TAR;
 
 	comm->propCanModify                = TRUE;
-	comm->propAddCanUpdate             = TRUE;
+	comm->propAddCanUpdate             = FALSE;
 	comm->propAddCanReplace            = FALSE;
 	comm->propAddCanStoreFolders       = TRUE;
 	comm->propExtractCanAvoidOverwrite = TRUE;

Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c	(original)
+++ trunk/src/fr-command.c	Thu Apr 10 18:57:34 2008
@@ -265,14 +265,13 @@
 
 static void
 fr_command_done (FrProcess   *process,
-		 FRProcError *error, 
 		 gpointer     data)
 {
 	FrCommand *comm = FR_COMMAND (data);
 
 	comm->process->restart = FALSE;
-	if (error->type != FR_PROC_ERROR_NONE)
-		fr_command_handle_error (comm, error);
+	if (process->error.type != FR_PROC_ERROR_NONE)
+		fr_command_handle_error (comm, &process->error);
 
 	if (comm->process->restart)
 		fr_process_start (comm->process);
@@ -281,7 +280,7 @@
 			       fr_command_signals[DONE], 
 			       0,
 			       comm->action, 
-			       error);
+			       &process->error);
 }
 
 

Modified: trunk/src/fr-process.c
==============================================================================
--- trunk/src/fr-process.c	(original)
+++ trunk/src/fr-process.c	Thu Apr 10 18:57:34 2008
@@ -136,9 +136,8 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (FrProcessClass, done),
 			      NULL, NULL,
-			      fr_marshal_VOID__POINTER,
-			      G_TYPE_NONE, 1,
-			      G_TYPE_POINTER);
+			      fr_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
 	fr_process_signals[STICKY_ONLY] =
 		g_signal_new ("sticky_only",
 			      G_TYPE_FROM_CLASS (class),
@@ -641,12 +640,12 @@
 					NULL,
 					&fr_proc->output_fd,
 					&fr_proc->error_fd,
-					&fr_proc->error.gerror)) {
+					&fr_proc->error.gerror)) 
+	{
 		fr_proc->error.type = FR_PROC_ERROR_SPAWN;
 		g_signal_emit (G_OBJECT (fr_proc),
 			       fr_process_signals[DONE],
-			       0,
-			       &fr_proc->error);
+			       0);
 
 		g_free (argv);
 		g_string_free (command, TRUE);
@@ -814,8 +813,7 @@
 
 	g_signal_emit (G_OBJECT (fr_proc),
 		       fr_process_signals[DONE],
-		       0,
-		       &fr_proc->error);
+		       0);
 
 	return FALSE;
 }
@@ -865,8 +863,7 @@
 		fr_proc->running = FALSE;
 		g_signal_emit (G_OBJECT (fr_proc),
 			       fr_process_signals[DONE],
-			       0,
-			       &fr_proc->error);
+			       0);
 	} 
 	else {
 		fr_proc->running = TRUE;
@@ -915,8 +912,7 @@
 		if (emit_signal)
 			g_signal_emit (G_OBJECT (fr_proc),
 				       fr_process_signals[DONE],
-				       0,
-				       &fr_proc->error);
+				       0);
 	}
 }
 

Modified: trunk/src/fr-process.h
==============================================================================
--- trunk/src/fr-process.h	(original)
+++ trunk/src/fr-process.h	Thu Apr 10 18:57:34 2008
@@ -124,8 +124,7 @@
 	/* -- Signals -- */
 
 	void (* start)         (FrProcess   *fr_proc);
-	void (* done)          (FrProcess   *fr_proc,
-				FRProcError *error);
+	void (* done)          (FrProcess   *fr_proc);
 	void (* sticky_only)   (FrProcess   *fr_proc);
 };
 

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Thu Apr 10 18:57:34 2008
@@ -2635,6 +2635,7 @@
 			break;
 
 		case FR_ACTION_EXTRACTING_FILES:
+		case FR_ACTION_COPYING_FILES_TO_REMOTE:
 			msg = _("An error occurred while extracting files.");
 			break;
 
@@ -2656,6 +2657,8 @@
 			break;
 
 		case FR_ACTION_ADDING_FILES:
+		case FR_ACTION_GETTING_FILE_LIST:
+		case FR_ACTION_COPYING_FILES_FROM_REMOTE:
 			msg = _("An error occurred while adding files to the archive.");
 			break;
 
@@ -2663,7 +2666,12 @@
 			msg = _("An error occurred while testing archive.");
 			break;
 
+		case FR_ACTION_SAVING_REMOTE_ARCHIVE:
+			msg = _("An error occurred while saving the archive.");
+			break;
+			
 		default:
+			msg = _("An error occurred.");
 			break;
 		}
 
@@ -2850,14 +2858,8 @@
 			fr_window_archive_reload (window);
 			return;
 		}
-
-		if (window->priv->archive_new) {
+		if (window->priv->archive_new) 
 			window->priv->archive_new = FALSE;
-			/* the archive file is created only when you add some
-			 * file to it. */
-			fr_window_add_to_recent_list (window, window->priv->archive_uri);
-		}
-
 		fr_window_add_to_recent_list (window, window->priv->archive_uri);
 		if (! window->priv->batch_mode) {
 			fr_window_archive_reload (window);
@@ -3659,7 +3661,7 @@
 	
 	list = g_string_new (NULL);
 	
-	local_filename = g_file_get_path (window->archive->local_copy);
+	local_filename = g_file_get_uri (window->archive->local_copy);
 	g_string_append (list, local_filename);
 	g_free (local_filename);
 	
@@ -7144,7 +7146,7 @@
 
 		new_file_list = g_list_prepend (new_file_list, new_name);
 	}
-
+  
 	fr_archive_add (window->archive,
 			new_file_list,
 			data->tmp_dir,
@@ -7178,7 +7180,7 @@
 {
 	FrWindow *window = data;
 	gboolean  continue_batch = FALSE;
-
+	
 #ifdef DEBUG
 	debug (DEBUG_INFO, "%s [DONE] (FR::Window)\n", action_names[action]);
 #endif
@@ -7202,15 +7204,15 @@
 	
 	switch (action) {
 	case FR_ACTION_LISTING_CONTENT:
-		fr_process_clear (window->priv->copy_from_archive->process);
-		fr_archive_extract (window->priv->copy_from_archive,
-				    window->priv->clipboard_data->files,
-				    window->priv->clipboard_data->tmp_dir,
-				    NULL,
-				    FALSE,
-				    TRUE,
-				    FALSE,
-				    window->priv->clipboard_data->archive_password);
+		fr_process_clear (window->priv->copy_from_archive->process); 
+		fr_archive_extract_to_local (window->priv->copy_from_archive,
+				    	     window->priv->clipboard_data->files,
+				    	     window->priv->clipboard_data->tmp_dir,
+				    	     NULL,
+				   	     FALSE,
+				    	     TRUE,
+				   	     FALSE,
+				   	     window->priv->clipboard_data->archive_password);
 		fr_process_start (window->priv->copy_from_archive->process);
 		break;
 		
@@ -7267,11 +7269,12 @@
 		char       *dir = remove_level_from_path (new_name);
 
 		if ((dir != NULL) && (g_hash_table_lookup (created_dirs, dir) == NULL)) {
-			char *dir_path = g_build_filename (data->tmp_dir, dir, NULL);
-
+			char *dir_path;
+			
+			dir_path = g_build_filename (data->tmp_dir, dir, NULL);
 			debug (DEBUG_INFO, "mktree %s\n", dir_path);
-
-			ensure_dir_exists (dir_path, 0700, NULL);
+			make_directory_tree_from_path (dir_path, 0700, NULL);
+			
 			g_free (dir_path);
 			g_hash_table_replace (created_dirs, g_strdup (dir), "1");
 		}

Modified: trunk/src/gio-utils.c
==============================================================================
--- trunk/src/gio-utils.c	(original)
+++ trunk/src/gio-utils.c	Thu Apr 10 18:57:34 2008
@@ -60,7 +60,7 @@
 	
 	filter = g_new0 (Filter, 1);
 
-	if (pattern != NULL) {
+	if ((pattern != NULL) && (strcmp (pattern, "*") != 0)) {
 		filter->pattern = g_strdup (pattern);
 		filter->patterns = search_util_get_patterns (pattern);
 	}
@@ -71,7 +71,7 @@
 	else
 		flags = 0;
 	
-	if (pattern != NULL) {
+	if (filter->pattern != NULL) {
 		filter->regexps = g_new0 (GRegex*, n_fields (filter->patterns) + 1);
 		for (i = 0; filter->patterns[i] != NULL; i++) 
 			filter->regexps[i] = g_regex_new (filter->patterns[i],
@@ -969,8 +969,8 @@
 	GList *source_files;
 	GList *destination_files;
 	
-	source_files = g_list_append (NULL, (gpointer)source);
-	destination_files = g_list_append (NULL, (gpointer)destination);
+	source_files = g_list_append (NULL, (gpointer) source);
+	destination_files = g_list_append (NULL, (gpointer) destination);
 	
 	g_copy_files_async (source_files, 
 			    destination_files, 
@@ -982,8 +982,8 @@
 			    callback, 
 			    user_data);
 				   
-	gio_file_list_free (source_files);
-	gio_file_list_free (destination_files);
+	g_list_free (source_files);
+	g_list_free (destination_files);
 }
 
 

Modified: trunk/src/glib-utils.c
==============================================================================
--- trunk/src/glib-utils.c	(original)
+++ trunk/src/glib-utils.c	Thu Apr 10 18:57:34 2008
@@ -352,8 +352,16 @@
 	int    i;
 
 	patterns = g_utf8_strsplit (pattern_string, ";", MAX_PATTERNS);
-	for (i = 0; patterns[i] != NULL; i++)
-		patterns[i] = g_utf8_strstrip (patterns[i]);
+	for (i = 0; patterns[i] != NULL; i++) {
+		char *p1, *p2;
+		
+		p1 = g_utf8_strstrip (patterns[i]);
+		p2 = str_substitute (p1, ".", "\\.");
+		patterns[i] = str_substitute (p2, "*", ".*");
+		
+		g_free (p2);
+		g_free (p1);
+	}
 
 	return patterns;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]