file-roller r2213 - in trunk: . src



Author: paobac
Date: Sat Apr  5 11:34:42 2008
New Revision: 2213
URL: http://svn.gnome.org/viewvc/file-roller?rev=2213&view=rev

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

	* src/file-utils.h: 
	* src/file-utils.c: 
	
	renamed many functions for clarity, removed unused functions.

	* src/main.c: 
	* src/gio-utils.c: 
	* src/fr-window.c: 
	* src/fr-command-tar.c: 
	* src/fr-archive.h: 
	* src/fr-archive.c:	
	* src/dlg-extract.c: 
	* src/dlg-batch-add.c: 
	* src/dlg-add-folder.c: 
	* src/dlg-add-files.c: 
	* src/actions.c: 
	
	updated function calls.

Modified:
   trunk/ChangeLog
   trunk/src/actions.c
   trunk/src/dlg-add-files.c
   trunk/src/dlg-add-folder.c
   trunk/src/dlg-batch-add.c
   trunk/src/dlg-extract.c
   trunk/src/file-utils.c
   trunk/src/file-utils.h
   trunk/src/fr-archive.c
   trunk/src/fr-archive.h
   trunk/src/fr-command-tar.c
   trunk/src/fr-window.c
   trunk/src/gio-utils.c
   trunk/src/main.c

Modified: trunk/src/actions.c
==============================================================================
--- trunk/src/actions.c	(original)
+++ trunk/src/actions.c	Sat Apr  5 11:34:42 2008
@@ -209,7 +209,7 @@
 
 	debug (DEBUG_INFO, "create/save %s\n", path);
 
-	if (path_is_file (path)) {
+	if (uri_exists (path)) {
 		GtkWidget *dialog;
 		int        r;
 

Modified: trunk/src/dlg-add-files.c
==============================================================================
--- trunk/src/dlg-add-files.c	(original)
+++ trunk/src/dlg-add-files.c	Sat Apr  5 11:34:42 2008
@@ -74,7 +74,7 @@
 
 	/* check folder permissions. */
 
-	if (path_is_dir (current_folder)
+	if (uri_is_dir (current_folder)
 	    && ! check_permissions (current_folder, R_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;
@@ -134,7 +134,7 @@
 
 	/* check folder permissions. */
 
-	if (path_is_dir (current_folder)
+	if (uri_is_dir (current_folder)
 	    && ! check_permissions (current_folder, R_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;

Modified: trunk/src/dlg-add-folder.c
==============================================================================
--- trunk/src/dlg-add-folder.c	(original)
+++ trunk/src/dlg-add-folder.c	Sat Apr  5 11:34:42 2008
@@ -110,7 +110,7 @@
 
 	/* check folder permissions. */
 
-	if (path_is_dir (current_folder)
+	if (uri_is_dir (current_folder)
 	    && ! check_permissions (current_folder, R_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;
@@ -199,7 +199,7 @@
 
 	/* check folder permissions. */
 
-	if (path_is_dir (current_folder) && ! check_permissions (current_folder, R_OK | X_OK)) {
+	if (uri_is_dir (current_folder) && ! check_permissions (current_folder, R_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;
 
@@ -482,11 +482,8 @@
 	if (base_dir != NULL) {
 		if ((filename != NULL) && (strcmp (filename, base_dir) != 0))
 			gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (data->dialog), filename);
-		else {
-			char *uri = get_uri_from_path (base_dir);
-			gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), uri);
-			g_free (uri);
-		}
+		else
+			gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), base_dir);
 	}
 
 	if (include_files != NULL)

Modified: trunk/src/dlg-batch-add.c
==============================================================================
--- trunk/src/dlg-batch-add.c	(original)
+++ trunk/src/dlg-batch-add.c	Sat Apr  5 11:34:42 2008
@@ -177,7 +177,7 @@
 		return;
 	}
 
-	if (! path_is_dir (archive_dir)) {
+	if (! uri_is_dir (archive_dir)) {
 		GtkWidget *d;
 		int        r;
 		char      *folder_name;
@@ -205,7 +205,7 @@
 		do_not_add = (r != GTK_RESPONSE_YES);
 	}
 
-	if (! do_not_add && ! make_tree (archive_dir, &error)) {
+	if (! do_not_add && ! ensure_dir_exists (archive_dir, 0755, &error)) {
 		GtkWidget  *d;
 
 		d = _gtk_error_dialog_new (GTK_WINDOW (window),
@@ -252,7 +252,7 @@
 	archive_file = g_strconcat (archive_dir, "/", archive_name, NULL);
 	eel_gconf_set_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, archive_ext);
 
-	if (path_is_dir (archive_file)) {
+	if (uri_is_dir (archive_file)) {
 		GtkWidget  *d;
 
 		d = _gtk_error_dialog_new (GTK_WINDOW (window),
@@ -270,7 +270,7 @@
 		return;
 	}
 
-	if (path_is_file (archive_file)) {
+	if (uri_exists (archive_file)) {
 		GtkWidget *d;
 		int        r;
 
@@ -312,7 +312,7 @@
 
 	gtk_widget_destroy (data->dialog);
 
-	if (! path_is_file (archive_file))
+	if (! uri_exists (archive_file))
 		fr_window_archive_new (window, archive_file);
 	else
 		fr_window_archive_open (window, archive_file, GTK_WINDOW (window));
@@ -431,7 +431,7 @@
 
 	data->window = window;
 	data->file_list = file_list;
-	data->single_file = ((file_list->next == NULL) && path_is_file ((char*) file_list->data));
+	data->single_file = ((file_list->next == NULL) && uri_is_file ((char*) file_list->data));
 	data->add_clicked = FALSE;
 
 	/* Get the widgets. */

Modified: trunk/src/dlg-extract.c
==============================================================================
--- trunk/src/dlg-extract.c	(original)
+++ trunk/src/dlg-extract.c	Sat Apr  5 11:34:42 2008
@@ -103,7 +103,7 @@
 
 	/* check directory existence. */
 
-	if (! path_is_dir (extract_to_dir)) {
+	if (! uri_is_dir (extract_to_dir)) {
 		if (! ForceDirectoryCreation) {
 			GtkWidget *d;
 			int        r;
@@ -133,7 +133,7 @@
 				do_not_extract = TRUE;
 		}
 
-		if (! do_not_extract && ! make_tree (extract_to_dir, &error)) {
+		if (! do_not_extract && ! ensure_dir_exists (extract_to_dir, 0755, &error)) {
 			GtkWidget  *d;
 			char       *message;
 
@@ -176,7 +176,7 @@
 
 	/* check extraction directory permissions. */
 
-	if (path_is_dir (extract_to_dir)
+	if (uri_is_dir (extract_to_dir)
 	    && ! check_permissions (extract_to_dir, R_OK | W_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;

Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c	(original)
+++ trunk/src/file-utils.c	Sat Apr  5 11:34:42 2008
@@ -56,21 +56,13 @@
 uri_exists (const char *uri)
 {
 	GFile     *file;
-	GFileInfo *info;
-	GError    *err = NULL;
 	gboolean   exists;
 
 	if (uri == NULL) 
 		return FALSE;
 
 	file = g_file_new_for_uri (uri);
-	info = g_file_query_info (file,	G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &err);
-	
-	exists = (err != NULL);
-	
-	if (err != NULL)
-		g_error_free (err);
-	g_object_unref (info);
+	exists = g_file_query_exists (file, NULL);
 	g_object_unref (file);
 
 	return exists;	
@@ -104,14 +96,14 @@
 
 
 gboolean
-path_is_file (const char *uri)
+uri_is_file (const char *uri)
 {
 	return uri_is_filetype (uri, G_FILE_TYPE_REGULAR);
 }
 
 
 gboolean
-path_is_dir (const char *uri)
+uri_is_dir (const char *uri)
 {
 	return uri_is_filetype (uri, G_FILE_TYPE_DIRECTORY);
 }
@@ -202,7 +194,7 @@
 
 
 char *
-get_directory_content_if_unique (const char  *uri)
+get_dir_content_if_unique (const char  *uri)
 {
 	GFile           *file;
 	GFileEnumerator *file_enum;
@@ -487,7 +479,7 @@
 }
 
 
-static gboolean
+gboolean
 make_directory_tree (GFile    *dir,
 		     mode_t    mode,
 		     GError  **error)
@@ -724,27 +716,11 @@
 }
 
 
-gboolean
-make_tree (const char  *uri,
-	   GError     **error)
-{
-	GFile  *dir;
-	
-	dir = g_file_new_for_uri (uri);
-	if (! make_directory_tree (dir, 0755, error)) {
-		g_warning ("could create directory %s: %s", uri, (*error)->message);
-		return FALSE;
-	}
-	
-	return TRUE;
-}
-
-
 static const char *try_folder[] = { "~", "tmp", NULL };
 
 
-static const char *
-get_folder_from_try_folder_list (int n)
+static char *
+ith_temp_folder_to_try (int n)
 {
 	const char *folder;
 
@@ -754,7 +730,7 @@
 	else if (strcmp (folder, "tmp") == 0)
 		folder = g_get_tmp_dir ();
 
-	return folder;
+	return g_filename_to_uri (folder, NULL, NULL);
 }
 
 
@@ -770,21 +746,18 @@
 	/* find the folder with more free space. */
 
 	for (i = 0; try_folder[i] != NULL; i++) {
-		const char *folder;
-		char       *uri;
-		guint64     size;
-
-		folder = get_folder_from_try_folder_list (i);
-		uri = g_filename_to_uri (folder, NULL, NULL);
+		char    *folder;
+		guint64  size;
 
-		size = get_dest_free_space (uri);
+		folder = ith_temp_folder_to_try (i);
+		size = get_dest_free_space (folder);
 		if (max_size < size) {
 			max_size = size;
 			g_free (best_folder);
-			best_folder = uri;
+			best_folder = folder;
 		}
 		else
-			g_free (uri);
+			g_free (folder);
 	}
 
 	template = g_strconcat (best_folder + strlen ("file://"), "/.fr-XXXXXX", NULL);
@@ -812,7 +785,7 @@
 	for (i = 0; try_folder[i] != NULL; i++) {
 		const char *folder;
 
-		folder = get_folder_from_try_folder_list (i);
+		folder = ith_temp_folder_to_try (i);
 		if (strncmp (dir, folder, strlen (folder)) == 0) 
 			if (strncmp (dir + strlen (folder), "/.fr-", 5) == 0)
 				return TRUE;
@@ -1014,65 +987,11 @@
 {
 	static char *home_uri = NULL;
 	if (home_uri == NULL)
-		home_uri = g_strconcat ("file://", g_get_home_dir (), NULL);
+		home_uri = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
 	return home_uri;
 }
 
 
-char *
-get_uri_from_local_path (const char *path)
-{
-	return g_filename_to_uri (path, NULL, NULL);
-}
-
-
-char *
-get_local_path_from_uri (const char *uri)
-{
-	return g_filename_from_uri (uri, NULL, NULL);
-}
-
-
-const char *
-get_file_path_from_uri (const char *uri)
-{
-	if (uri == NULL)
-		return NULL;
-	if (uri_scheme_is_file (uri))
-		return uri + FILE_PREFIX_L;
-	else if (uri[0] == '/')
-		return uri;
-	else
-		return NULL;
-}
-
-
-gboolean
-uri_has_scheme (const char *uri)
-{
-	return strstr (uri, "://") != NULL;
-}
-
-
-gboolean
-uri_is_local (const char *uri)
-{
-	return (! uri_has_scheme (uri)) || uri_scheme_is_file (uri);
-}
-
-
-gboolean
-uri_scheme_is_file (const char *uri)
-{
-        if (uri == NULL)
-                return FALSE;
-        if (g_utf8_strlen (uri, -1) < FILE_PREFIX_L)
-                return FALSE;
-        return strncmp (uri, FILE_PREFIX, FILE_PREFIX_L) == 0;
-
-}
-
-
 const char *
 remove_host_from_uri (const char *uri)
 {
@@ -1125,38 +1044,16 @@
 }
 
 
-char *
-get_uri_from_path (const char *path)
-{
-	if (path == NULL)
-		return NULL;
-	if ((path[0] == '\0') || (path[0] == '/'))
-		return g_strconcat ("file://", path, NULL);
-	return g_strdup (path);
-}
-
-
 int
-uricmp (const char *path1,
-	const char *path2)
+uricmp (const char *uri1,
+	const char *uri2)
 {
-	char *uri1, *uri2;
-	int   result;
-
-	uri1 = get_uri_from_path (path1);
-	uri2 = get_uri_from_path (path2);
-
-	result = strcmp_null_tolerant (uri1, uri2);
-
-	g_free (uri1);
-	g_free (uri2);
-
-	return result;
+	return strcmp_null_tolerant (uri1, uri2);
 }
 
 
 char *
-get_new_uri (const char *folder,
+get_alternative_uri (const char *folder,
 	     const char *name)
 {
 	char *new_uri = NULL;
@@ -1176,13 +1073,13 @@
 
 
 char *
-get_new_uri_from_uri (const char *uri)
+get_alternative_uri_for_uri (const char *uri)
 {
 	char *base_uri;
 	char *new_uri;
 	
 	base_uri = remove_level_from_path (uri);
-	new_uri = get_new_uri (base_uri, file_name_from_path (uri));
+	new_uri = get_alternative_uri (base_uri, file_name_from_path (uri));
 	g_free (base_uri);
 	
 	return new_uri;

Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h	(original)
+++ trunk/src/file-utils.h	Sat Apr  5 11:34:42 2008
@@ -28,26 +28,26 @@
 #include <gio/gio.h>
 
 
-#define FILENAME_MAX_LENGTH 30 /* FIXME: find out the best value */
-
 #define get_home_relative_dir(x)        \
 	g_strconcat (g_get_home_dir (), \
 		     "/",               \
 		     (x),               \
 		     NULL)
 
-gboolean            path_is_file                 (const gchar *s);
 gboolean            uri_exists                   (const char  *uri);
-gboolean            path_is_dir                  (const gchar *s);
+gboolean            uri_is_file                  (const char  *uri);
+gboolean            uri_is_dir                   (const char  *uri);
 gboolean            dir_is_empty                 (const char  *uri);
 gboolean            dir_contains_one_object      (const char  *uri);
-char *              get_directory_content_if_unique (const char  *uri);
+char *              get_dir_content_if_unique    (const char  *uri);
 gboolean            path_in_path                 (const char  *path_src,
 						  const char  *path_dest);
 goffset             get_file_size                (const char  *uri);
 time_t              get_file_mtime               (const char  *s);
 time_t              get_file_ctime               (const char  *s);
-gint                file_in_path                 (const char  *name);
+gboolean            make_directory_tree          (GFile       *dir,
+		     				  mode_t       mode,
+		     				  GError     **error);
 gboolean            ensure_dir_exists            (const char  *uri,
 						  mode_t       mode,
 						  GError     **error);
@@ -59,8 +59,6 @@
 char *              remove_ending_separator      (const char  *path);
 gboolean            file_extension_is            (const char  *filename,
 						  const char  *ext);
-void                path_list_free               (GList       *path_list);
-GList *             path_list_dup                (GList       *path_list);
 gboolean            is_mime_type                 (const char  *type,
 						  const char  *pattern);
 const char*         get_file_mime_type           (const char  *filename,
@@ -68,8 +66,6 @@
 guint64             get_dest_free_space          (const char  *path);
 gboolean            remove_directory             (const char  *uri);
 gboolean            remove_local_directory       (const char  *directory);
-gboolean            make_tree                    (const char  *uri,
-	   					  GError     **error);
 char *              get_temp_work_dir            (void);
 gboolean            is_temp_work_dir             (const char *dir);
 gboolean            is_temp_dir                  (const char *dir);
@@ -90,24 +86,20 @@
 						  int         mode);
 gboolean 	    is_program_in_path		 (const char *filename);
 
-/* URI/Path utils */
+/* URI utils */
 
 const char *        get_home_uri                 (void);
-char *              get_uri_from_local_path      (const char *local_path);
-char *              get_local_path_from_uri      (const char *uri);
-const char *        get_file_path_from_uri       (const char *uri);
-gboolean            uri_has_scheme               (const char *uri);
-gboolean            uri_is_local                 (const char *uri);
-gboolean            uri_scheme_is_file           (const char *uri);
 const char *        remove_host_from_uri         (const char *uri);
 char *              get_uri_host                 (const char *uri);
 char *              get_uri_root                 (const char *uri);
-char *              get_uri_from_path            (const char *path);
-int                 uricmp                       (const char *path1,
-						  const char *path2);
-char *              get_new_uri                  (const char *folder,
+int                 uricmp                       (const char *uri1,
+						  const char *uri2);
+char *              get_alternative_uri          (const char *folder,
 	     					  const char *name);
-char *              get_new_uri_from_uri         (const char *uri);
+char *              get_alternative_uri_for_uri  (const char *uri);
+
+void                path_list_free               (GList       *path_list);
+GList *             path_list_dup                (GList       *path_list);
 
 GList *             gio_file_list_dup               (GList *l);
 void                gio_file_list_free              (GList *l);

Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c	(original)
+++ trunk/src/fr-archive.c	Sat Apr  5 11:34:42 2008
@@ -383,22 +383,22 @@
 static GFile *
 get_local_copy_for_file (GFile *remote_file)
 {
-	char  *dir;
-	char  *name;
-	char  *uri;
-	GFile *local_copy;
+	char  *temp_dir;
+	GFile *local_copy = NULL;
 
-	dir = get_temp_work_dir ();
-	if (dir == NULL)
-		return NULL;
+	temp_dir = get_temp_work_dir ();
+	if (temp_dir != NULL) {
+		char  *archive_name;
+		char  *local_uri;
 
-	name = g_file_get_basename (remote_file);
-	uri = g_build_filename (dir, name, NULL);
-	local_copy = g_file_new_for_uri (uri);
+		archive_name = g_file_get_basename (remote_file);
+		local_uri = g_build_filename (temp_dir, archive_name, NULL);
+		local_copy = g_file_new_for_uri (local_uri);
 	
-	g_free (uri);
-	g_free (name);
-	g_free (dir);
+		g_free (local_uri);
+		g_free (archive_name);
+	}
+	g_free (temp_dir);
 
 	return local_copy;
 }
@@ -674,7 +674,7 @@
 						       FR_COMPRESS_PROGRAM_LZMA);
 	}
 	else if (file_extension_is (filename, ".tar.lzo")
-	    || file_extension_is (filename, ".tzo")) 
+		 || file_extension_is (filename, ".tzo")) 
 	{
 		archive->command = fr_command_tar_new (archive->process,
 						       filename,
@@ -883,7 +883,7 @@
 	GFile  *source, *destination, *parent_file;
 	GError *error;
 
-	content_uri = get_directory_content_if_unique (archive->priv->extraction_destination);
+	content_uri = get_dir_content_if_unique (archive->priv->extraction_destination);
 	if (content_uri == NULL)
 		return;	
 
@@ -892,7 +892,7 @@
 	if (uricmp (parent, archive->priv->extraction_destination) == 0) {
 		char *new_uri;
 		
-		new_uri = get_new_uri_from_uri (archive->priv->extraction_destination);
+		new_uri = get_alternative_uri_for_uri (archive->priv->extraction_destination);
 		 
 		source = g_file_new_for_uri (archive->priv->extraction_destination);
 		destination = g_file_new_for_uri (new_uri);
@@ -908,7 +908,7 @@
 
 		g_free (parent);
 		
-		content_uri = get_directory_content_if_unique (archive->priv->extraction_destination);
+		content_uri = get_dir_content_if_unique (archive->priv->extraction_destination);
 		if (content_uri == NULL)
 			return;	
 
@@ -916,7 +916,7 @@
 	}
 
 	parent_parent = remove_level_from_path (parent);
-	new_content_uri = get_new_uri (parent_parent, file_name_from_path (content_uri));
+	new_content_uri = get_alternative_uri (parent_parent, file_name_from_path (content_uri));
 	
 	source = g_file_new_for_uri (content_uri);
 	destination = g_file_new_for_uri (new_content_uri);
@@ -1522,7 +1522,7 @@
 
 		fullpath = g_strconcat (base_dir, "/", filename, NULL);
 
-		if (path_is_file (fullpath)
+		if (uri_exists (fullpath)
 		    && (fdata->modified >= get_file_mtime (fullpath))) {
 			g_free (fullpath);
 			continue;
@@ -1801,7 +1801,7 @@
 		local_folder_uri = remove_level_from_path (local_uri);
 		if (g_hash_table_lookup (created_folders, local_folder_uri) == NULL) {
 			GError *error;
-			if (! make_tree (local_uri, &error)) {
+			if (! ensure_dir_exists (local_uri, 0755, &error)) {
 				g_free (local_folder_uri);
 				g_free (local_uri);
 				gio_file_list_free (sources);
@@ -2275,7 +2275,7 @@
 		char *path = scan->data;
 		char *base_dir;
 
-		if (! path_is_dir (path))
+		if (! uri_is_dir (path))
 			continue;
 
 		data->item_list = g_list_remove_link (list, scan);

Modified: trunk/src/fr-archive.h
==============================================================================
--- trunk/src/fr-archive.h	(original)
+++ trunk/src/fr-archive.h	Sat Apr  5 11:34:42 2008
@@ -51,10 +51,11 @@
 	FrProcess   *process;
 	FRProcError  error;
 	gboolean     can_create_compressed_file;
-	gboolean     is_compressed_file;         /* Whether the file is an archive
-						  * or a compressed file. */
-	gboolean     read_only;                  /* Whether archive is read-only
-						  * or not. */
+	gboolean     is_compressed_file;         /* Whether the file is an 
+						  * archive or a compressed 
+						  * file. */
+	gboolean     read_only;                  /* Whether archive is 
+						  * read-only or not. */
 
 	FrArchivePrivData *priv;
 };

Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c	(original)
+++ trunk/src/fr-command-tar.c	Sat Apr  5 11:34:42 2008
@@ -723,7 +723,7 @@
 
 	{
 		char *uri = get_uri_from_local_path (comm->filename);
-		archive_exists = path_is_file (uri);
+		archive_exists = uri_exists (uri);
 		g_free (uri);
 	}
 

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Sat Apr  5 11:34:42 2008
@@ -2511,14 +2511,8 @@
 fr_window_remove_from_recent_list (FrWindow *window,
 				   char     *filename)
 {
-	char *uri;
-
-	if (filename == NULL)
-		return;
-
-	uri = get_uri_from_path (filename);
-	gtk_recent_manager_remove_item (window->priv->recent_manager, uri, NULL);
-	g_free (uri);
+	if (filename != NULL)
+		gtk_recent_manager_remove_item (window->priv->recent_manager, filename, NULL);
 }
 
 
@@ -5919,7 +5913,7 @@
 					    edata,
 					    (GFreeFunc) extract_data_free);
 
-	if (! path_is_dir (edata->extract_to_dir)) {
+	if (! uri_is_dir (edata->extract_to_dir)) {
 		if (! ForceDirectoryCreation) {
 			GtkWidget *d;
 			int        r;
@@ -7747,7 +7741,7 @@
 get_default_dir (const char *dir) 
 {
 	if (! is_temp_dir (dir))
-		return get_uri_from_path (dir);
+		return g_strdup (dir);
 	else
 		return NULL;
 }
@@ -7927,7 +7921,7 @@
 	case FR_BATCH_ACTION_LOAD:
 		debug (DEBUG_INFO, "[BATCH] LOAD\n");
 
-		if (! path_is_file ((char*) action->data))
+		if (! uri_exists ((char*) action->data))
 			fr_window_archive_new (window, (char*) action->data);
 		else
 			fr_window_archive_open (window, (char*) action->data, GTK_WINDOW (window));
@@ -8247,7 +8241,7 @@
 			  const char *archive,
 			  GList      *file_list)
 {
-	window->priv->batch_adding_one_file = (file_list->next == NULL) && (path_is_file (file_list->data));
+	window->priv->batch_adding_one_file = (file_list->next == NULL) && (uri_is_file (file_list->data));
 
 	if (archive != NULL)
 		fr_window_append_batch_action (window,

Modified: trunk/src/gio-utils.c
==============================================================================
--- trunk/src/gio-utils.c	(original)
+++ trunk/src/gio-utils.c	Sat Apr  5 11:34:42 2008
@@ -643,7 +643,7 @@
 	FilterOptions    filter_options;
 	
 	gfl = g_new0 (GetFileListData, 1);
-	gfl->directory = get_uri_from_path (directory);
+	gfl->directory = g_strdup (directory);
 	gfl->base_dir = g_strdup (base_dir);
 	gfl->done_func = done_func;
 	gfl->done_data = done_data;
@@ -775,8 +775,9 @@
 		char *path = scan->data;
 
 		/* FIXME: this is not async */
-		if (path_is_dir (path))
+		if (uri_is_dir (path)) {
 			gfl->to_visit = g_list_prepend (gfl->to_visit, g_strdup (path));
+		}
 		else {
 			char *rel_path = g_strdup (path + base_len + 1);
 			gfl->files = g_list_prepend (gfl->files, rel_path);

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sat Apr  5 11:34:42 2008
@@ -259,8 +259,7 @@
 void
 viewer_done (ViewerData *vdata)
 {
-	if ((vdata->temp_dir != NULL)
-	    && path_is_dir (vdata->temp_dir)) {
+	if ((vdata->temp_dir != NULL) && uri_is_dir (vdata->temp_dir)) {
 		char *argv[4];
 
 		argv[0] = "rm";
@@ -291,8 +290,7 @@
 	if (cdata == NULL)
 		return;
 		
-	if ((cdata->temp_dir != NULL)
-	    && path_is_dir (cdata->temp_dir)) {
+	if ((cdata->temp_dir != NULL) && uri_is_dir (cdata->temp_dir)) {
 		char *argv[4];
 
 		argv[0] = "rm";
@@ -349,7 +347,7 @@
 	from_path = get_home_relative_dir (from_dir);
 	to_path = get_home_relative_dir (to_dir);
 
-	if (path_is_dir (from_path) && ! path_is_dir (to_path)) {
+	if (uri_is_dir (from_path) && ! uri_exists (to_path)) {
 		char *line;
 		char *e1;
 		char *e2;
@@ -379,7 +377,7 @@
 	from_path = get_home_relative_dir (from_file);
 	to_path = get_home_relative_dir (to_file);
 
-	if (path_is_file (from_path) && ! path_is_file (to_path)) {
+	if (uri_is_file (from_path) && ! uri_exists (to_path)) {
 		char *line;
 		char *e1;
 		char *e2;
@@ -490,8 +488,13 @@
 	g_free (path);
 	
 	/* before the gconf port this was a file, now it's folder. */
-	if (path_is_file (uri))
-		unlink (uri);
+	if (uri_is_file (uri)) {
+		GFile *file;
+		
+		file = g_file_new_for_uri (uri);
+		g_file_delete (file, NULL, NULL);
+		g_object_unref (file);
+	}
 
 	ensure_dir_exists (uri, 0700, NULL);
 	g_free (uri);



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