gedit r6588 - in trunk: . plugins/filebrowser



Author: pborelli
Date: Sun Oct 19 15:22:55 2008
New Revision: 6588
URL: http://svn.gnome.org/viewvc/gedit?rev=6588&view=rev

Log:
2008-10-19  Paolo Borelli  <pborelli katamail com>

	* plugins/filebrowser/gedit-filebrowser-store.c: do not check if
	the node already exist if we know it's a new file.



Modified:
   trunk/ChangeLog
   trunk/plugins/filebrowser/gedit-file-browser-store.c

Modified: trunk/plugins/filebrowser/gedit-file-browser-store.c
==============================================================================
--- trunk/plugins/filebrowser/gedit-file-browser-store.c	(original)
+++ trunk/plugins/filebrowser/gedit-file-browser-store.c	Sun Oct 19 15:22:55 2008
@@ -1885,36 +1885,33 @@
 	gboolean free_info = FALSE;
 	GError * error = NULL;
 
-	// Check if it already exists
-	if ((node = model_file_exists (model, parent, file)) == NULL) {	
-		if (!info) {
-			info = g_file_query_info (file,
-						  STANDARD_ATTRIBUTE_TYPES,
-						  G_FILE_QUERY_INFO_NONE,
-						  NULL,
-						  &error);
-			free_info = TRUE;
-		}
-		
-		if (!info) {
-			g_warning ("Error querying file info: %s", error->message);
-			g_error_free (error);
-			
-			/* FIXME: What to do now then... */
-			node = file_browser_node_new (file, parent);
-		} else if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
-			node = file_browser_node_dir_new (model, file, parent);
-		} else {
-			node = file_browser_node_new (file, parent);
-		}
-
-		file_browser_node_set_from_info (model, node, info, FALSE);
-		model_add_node (model, node, parent);
+	if (info == NULL) {
+		info = g_file_query_info (file,
+					  STANDARD_ATTRIBUTE_TYPES,
+					  G_FILE_QUERY_INFO_NONE,
+					  NULL,
+					  &error);
+		free_info = TRUE;
+	}
+	
+	if (!info) {
+		g_warning ("Error querying file info: %s", error->message);
+		g_error_free (error);
 		
-		if (info && free_info)
-			g_object_unref (info);
+		/* FIXME: What to do now then... */
+		node = file_browser_node_new (file, parent);
+	} else if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+		node = file_browser_node_dir_new (model, file, parent);
+	} else {
+		node = file_browser_node_new (file, parent);
 	}
 
+	file_browser_node_set_from_info (model, node, info, FALSE);
+	model_add_node (model, node, parent);
+	
+	if (info && free_info)
+		g_object_unref (info);
+
 	return node;
 }
 
@@ -2037,7 +2034,9 @@
 		break;
 	case G_FILE_MONITOR_EVENT_CREATED:
 		if (g_file_query_exists (file, NULL)) {
-			model_add_node_from_file (dir->model, parent, file, NULL);
+			if (model_file_exists (dir->model, parent, file) == NULL) {
+				model_add_node_from_file (dir->model, parent, file, NULL);
+			}
 		}
 		
 		break;



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