file-roller r2107 - in trunk: . src



Author: paobac
Date: Sun Jan 20 11:25:36 2008
New Revision: 2107
URL: http://svn.gnome.org/viewvc/file-roller?rev=2107&view=rev

Log:
2008-01-20  Paolo Bacchilega  <paobac svn gnome org>

	* src/fr-window.c: 
	* src/file-utils.h: 
	* src/file-utils.c: 

	Fixed bug #303213 â default to extract in home instead of tmp


Modified:
   trunk/ChangeLog
   trunk/src/file-utils.c
   trunk/src/file-utils.h
   trunk/src/fr-window.c

Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c	(original)
+++ trunk/src/file-utils.c	Sun Jan 20 11:25:36 2008
@@ -948,7 +948,8 @@
 
 
 gboolean
-is_temp_work_dir (const char *dir) {
+is_temp_work_dir (const char *dir)
+{
 	int i;
 
 	if (strncmp (dir, "file://", 7) == 0)
@@ -969,6 +970,20 @@
 }
 
 
+gboolean
+is_temp_dir (const char *dir)
+{
+	if (strncmp (dir, "file://", 7) == 0)
+		dir = dir + 7;
+	if (strcmp (g_get_tmp_dir (), dir) == 0)
+		return TRUE;
+	if (path_in_path (g_get_tmp_dir (), dir))
+		return TRUE;
+	else
+		return is_temp_work_dir (dir);
+}
+
+
 /* file list utils */
 
 

Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h	(original)
+++ trunk/src/file-utils.h	Sun Jan 20 11:25:36 2008
@@ -76,6 +76,7 @@
 GnomeVFSResult      make_tree                    (const char  *uri);
 char *              get_temp_work_dir            (void);
 gboolean            is_temp_work_dir             (const char *dir);
+gboolean            is_temp_dir                  (const char *dir);
 char *              escape_uri                   (const char *uri);
 
 /* misc functions used to parse a command output lines. */

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Sun Jan 20 11:25:36 2008
@@ -2491,7 +2491,7 @@
 	if (window->priv->batch_mode)
 		return;
 
-	if (is_temp_work_dir (uri))
+	if (is_temp_dir (uri))
 		return;
 
 	if (window->archive->mime_type != NULL) {
@@ -2822,7 +2822,7 @@
 		}
 
 		archive_dir = remove_level_from_path (window->priv->archive_uri);
-		temp_dir = is_temp_work_dir (archive_dir);
+		temp_dir = is_temp_dir (archive_dir);
 		if (! window->priv->archive_present) {
 			window->priv->archive_present = TRUE;
 
@@ -7727,6 +7727,16 @@
 /**/
 
 
+static char*
+get_default_dir (const char *dir) 
+{
+	if (! is_temp_dir (dir))
+		return get_uri_from_path (dir);
+	else
+		return NULL;
+}
+
+
 void
 fr_window_set_open_default_dir (FrWindow   *window,
 				const char *default_dir)
@@ -7736,7 +7746,7 @@
 
 	if (window->priv->open_default_dir != NULL)
 		g_free (window->priv->open_default_dir);
-	window->priv->open_default_dir = get_uri_from_path (default_dir);
+	window->priv->open_default_dir = get_default_dir (default_dir);
 }
 
 
@@ -7759,7 +7769,7 @@
 
 	if (window->priv->add_default_dir != NULL)
 		g_free (window->priv->add_default_dir);
-	window->priv->add_default_dir = get_uri_from_path (default_dir);
+	window->priv->add_default_dir = get_default_dir (default_dir);
 }
 
 
@@ -7790,7 +7800,7 @@
 
 	if (window->priv->extract_default_dir != NULL)
 		g_free (window->priv->extract_default_dir);
-	window->priv->extract_default_dir = get_uri_from_path (default_dir);
+	window->priv->extract_default_dir = get_default_dir (default_dir);
 }
 
 



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