anjuta r4023 - trunk/plugins/file-manager



Author: jhs
Date: Sun Jun 15 14:38:36 2008
New Revision: 4023
URL: http://svn.gnome.org/viewvc/anjuta?rev=4023&view=rev

Log:
2008-06-15  Johannes Schmid  <jhs gnome org>
	
	* plugins/file-manager/file-model.c (on_file_model_changed):
	Fixed file monitoring
	
	* plugins/file-manager/file-view.c (file_view_show_extended_data),
	(file_view_selection_changed):
	
	Some code refactoring
	
	* plugins/file-manager/plugin.c (on_file_view_show_popup_menu):
	Hide \"rename\" menu item for now

Modified:
   trunk/plugins/file-manager/file-model.c
   trunk/plugins/file-manager/file-view.c
   trunk/plugins/file-manager/plugin.c

Modified: trunk/plugins/file-manager/file-model.c
==============================================================================
--- trunk/plugins/file-manager/file-model.c	(original)
+++ trunk/plugins/file-manager/file-model.c	Sun Jun 15 14:38:36 2008
@@ -177,40 +177,40 @@
 					   gpointer data)
 {
 	GtkTreeRowReference* reference = (GtkTreeRowReference*)data;
-	FileModel* model = FILE_MODEL (gtk_tree_row_reference_get_model(reference));
+	FileModel* model;
 	GtkTreeIter iter;
 	GtkTreePath* path;
 	GtkTreeIter file_iter;
+	gboolean found = FALSE;
 	
-	path = gtk_tree_row_reference_get_path (reference);
-	if (!path)
-	{
+	if (!gtk_tree_row_reference_valid(reference))
 		return;
-	}
+	
+	model = FILE_MODEL(gtk_tree_row_reference_get_model (reference));
+	path = gtk_tree_row_reference_get_path (reference);
 	
 	gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path);
 	gtk_tree_path_free (path);
-		
-	if (event_type == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ||
-		event_type == G_FILE_MONITOR_EVENT_DELETED)
+
+	if (gtk_tree_model_iter_children (GTK_TREE_MODEL(model), &file_iter, &iter))
 	{
-		gboolean found = FALSE;
-		if (gtk_tree_model_iter_children (GTK_TREE_MODEL(model), &file_iter, &iter))
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL(model), &file_iter))
 		{
-			while (gtk_tree_model_iter_next (GTK_TREE_MODEL(model), &file_iter))
+			GFile* model_file;
+			gtk_tree_model_get (GTK_TREE_MODEL(model), &file_iter,
+								COLUMN_FILE, &model_file, -1);
+			if (g_file_equal (model_file, file))
 			{
-				GFile* model_file;
-				gtk_tree_model_get (GTK_TREE_MODEL(model), &file_iter,
-									COLUMN_FILE, &model_file, -1);
-				if (g_file_equal (model_file, file))
-				{
-					g_object_unref (model_file);
-					found = TRUE;
-					break;
-				}
 				g_object_unref (model_file);
+				found = TRUE;
+				break;
 			}
+			g_object_unref (model_file);
 		}
+	}
+	if (event_type == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ||
+		event_type == G_FILE_MONITOR_EVENT_DELETED)
+	{
 		if (!found)
 			return;
 	}
@@ -218,19 +218,6 @@
 	switch (event_type)
 	{
 		case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
-		{
-			GFileInfo* file_info;
-			file_info = g_file_query_info (file,
-										   "standard::*",
-										   G_FILE_QUERY_INFO_NONE,
-										   NULL, NULL);
-			if (file_info)
-			{
-				file_model_update_file (model, &file_iter, file, file_info);
-				g_object_unref (file_info);
-			}
-			break;
-		}
 		case G_FILE_MONITOR_EVENT_CREATED:
 		{
 			GFileInfo* file_info;
@@ -240,7 +227,10 @@
 										   NULL, NULL);
 			if (file_info)
 			{
-				file_model_add_file (model, &iter, file, file_info);
+				if (!found)
+					file_model_add_file (model, &iter, file, file_info);
+				else
+					file_model_update_file (model, &file_iter, file, file_info);
 				g_object_unref (file_info);
 			}
 			break;

Modified: trunk/plugins/file-manager/file-view.c
==============================================================================
--- trunk/plugins/file-manager/file-view.c	(original)
+++ trunk/plugins/file-manager/file-view.c	Sun Jun 15 14:38:36 2008
@@ -194,7 +194,7 @@
 	GFile* file;
 	GFileInfo* file_info;
 	gboolean is_dir;
-	
+		
 	gtk_tree_model_get (file_model, iter, COLUMN_IS_DIR, &is_dir, -1);
 	if (!is_dir)
 	{
@@ -221,7 +221,6 @@
 		g_object_unref (file_info);
 		g_free(display);
 	}
-
 }
 
 static void
@@ -272,6 +271,7 @@
 		g_signal_emit_by_name (G_OBJECT (view), "current-uri-changed",
 							   NULL, NULL);
 	}
+	DEBUG_PRINT ("selection_changed");
 }
 
 static gboolean
@@ -287,11 +287,12 @@
 	GtkTreeIter real_iter;
 	gchar* filename;
 	
-	gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
-									   &x, &y, keyboard,
-									   &model_sort,
-									   &path,
-									   &iter);
+	if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
+											&x, &y, keyboard,
+											&model_sort,
+											&path,
+											&iter))
+		return FALSE;
 	
 	gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model_sort),
 											&real_iter, &iter);

Modified: trunk/plugins/file-manager/plugin.c
==============================================================================
--- trunk/plugins/file-manager/plugin.c	(original)
+++ trunk/plugins/file-manager/plugin.c	Sun Jun 15 14:38:36 2008
@@ -154,15 +154,15 @@
 							  guint32 time, AnjutaFileManager* file_manager)
 {
 	GtkWidget *popup;
-	GtkAction *rename;
+	GtkWidget *rename;
 	AnjutaUI* ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(file_manager)->shell, 
 										NULL);
 	popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
 									   "/PopupFileManager");
-	rename = gtk_ui_manager_get_action (GTK_UI_MANAGER (ui),
-									   "ActionPopupFileManagerRename");
+	rename = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
+									   "/PopupFileManager/PopupFileManagerRename");
 	/* TODO */
-	gtk_action_set_visible (rename, FALSE);
+	gtk_widget_hide (rename);
 	
 	g_return_if_fail (GTK_IS_WIDGET (popup));
 	gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, button, time);



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