file-roller r2431 - in trunk: . src



Author: paobac
Date: Sat Aug 16 17:57:03 2008
New Revision: 2431
URL: http://svn.gnome.org/viewvc/file-roller?rev=2431&view=rev

Log:
2008-08-16  Paolo Bacchilega  <paobac svn gnome org>

	* src/gio-utils.c (get_dir_list_from_file_list)
	(get_file_list_for_each_file, get_file_list_start_dir): add the
	first directory to the list of directories as well.
	
	* src/main.c (get_uri_from_command_line):  use gfile to make the 
	conversion.
	
	Fixes bug #350640 â sending an empty folder doesn't work.


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/gio-utils.c
   trunk/src/main.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Sat Aug 16 17:57:03 2008
@@ -25,6 +25,8 @@
 
 [ ] #547982 â Failure dialog for file extraction should be more useful
 
+[ ] #350640 â sending an empty folder doesn't work
+
 == DONE == 
 
 [x] optimization of the add_folder operation: if the command supports all the

Modified: trunk/src/gio-utils.c
==============================================================================
--- trunk/src/gio-utils.c	(original)
+++ trunk/src/gio-utils.c	Sat Aug 16 17:57:03 2008
@@ -520,10 +520,14 @@
 	if (base_dir == NULL)
 		base_dir = "";
 	base_dir_len = strlen (base_dir);
+	
 	for (scan = files; scan; scan = scan->next) {
 		char *filename = scan->data;
 		char *dir_name;
 
+		if (strlen (filename) <= base_dir_len)
+			continue;
+
 		if (is_dir_list)
 			dir_name = g_strdup (filename + base_dir_len + 1);
 		else
@@ -631,12 +635,9 @@
 	GetFileListData *gfl = user_data;
 
 	switch (g_file_info_get_file_type (info)) {
-	case G_FILE_TYPE_DIRECTORY:
-		gfl->dirs = g_list_prepend (gfl->dirs, g_strdup (uri));
-		break;
 	case G_FILE_TYPE_REGULAR:
 		if (filter_matches (gfl->include_filter, uri))
-			if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
+			if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri)) 
 				gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
 		break;
 	default:
@@ -652,27 +653,29 @@
 {
 	GetFileListData *gfl = user_data;
 
-	if ((gfl->exclude_folders_filter->pattern == NULL) || ! filter_matches (gfl->exclude_folders_filter, uri))
+	if ((gfl->exclude_folders_filter->pattern == NULL) || ! filter_matches (gfl->exclude_folders_filter, uri)) {
+		gfl->dirs = g_list_prepend (gfl->dirs, g_strdup (uri));
 		return DIR_OP_CONTINUE;
+	}
 	else
 		return DIR_OP_SKIP;
 }
 
 
 void
-g_directory_list_async (const char           *directory,
-		       const char            *base_dir,
-		       gboolean               recursive,
-		       gboolean               follow_links,
-		       gboolean               no_backup_files,
-		       gboolean               no_dot_files,
-		       const char            *include_files,
-		       const char            *exclude_files,
-		       const char            *exclude_folders,
-		       gboolean               ignorecase,
-		       GCancellable          *cancellable,
-		       ListReadyCallback      done_func,
-		       gpointer               done_data)
+g_directory_list_async (const char        *directory,
+		        const char        *base_dir,
+		        gboolean           recursive,
+		        gboolean           follow_links,
+		        gboolean           no_backup_files,
+		        gboolean           no_dot_files,
+		        const char        *include_files,
+		        const char        *exclude_files,
+		        const char        *exclude_folders,
+		        gboolean           ignorecase,
+		        GCancellable      *cancellable,
+		        ListReadyCallback  done_func,
+		        gpointer           done_data)
 {
 	GetFileListData *gfl;
 	FilterOptions    filter_options;

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sat Aug 16 17:57:03 2008
@@ -673,27 +673,13 @@
 static char *
 get_uri_from_command_line (const char *path)
 {
-	char *full_path;
-	char *uri;
-
-	if (strstr (path, "://") != NULL)
-		return g_strdup (path);
-
-	if (g_path_is_absolute (path))
-		full_path = g_strdup (path);
-	else {
-		char *current_dir;
-
-		current_dir = g_get_current_dir ();
-		full_path = g_build_filename (current_dir,
-					      path,
-					      NULL);
-		g_free (current_dir);
-	}
-
-	uri = g_filename_to_uri (full_path, NULL, NULL);
-	g_free (full_path);
-
+	GFile *file;
+	char  *uri;
+		
+	file = g_file_new_for_commandline_arg (path);
+	uri = g_file_get_uri (file);
+	g_object_unref (file);
+	
 	return uri;
 }
 



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