nautilus r14467 - in trunk: . src/file-manager



Author: cneumair
Date: Wed Aug 13 11:39:13 2008
New Revision: 14467
URL: http://svn.gnome.org/viewvc/nautilus?rev=14467&view=rev

Log:
2008-08-13  Christian Neumair  <cneumair gnome org>

	* libnautilus-private/nautilus-icon-info.h:
	* src/file-manager/fm-directory-view.c (file_should_show_foreach),
	(file_should_show_self), (real_update_menus_volumes):
	* src/file-manager/fm-tree-view.c (button_pressed_callback),
	(fm_tree_view_unmount_cb), (fm_tree_view_eject_cb),
	(create_popup_menu):
	Make eject and unmount labels consistent between tree side pane and
	places side pane, display both eject and unmount for volumes supporting
	both. Partially fixes #547275.


Modified:
   trunk/ChangeLog
   trunk/src/file-manager/fm-directory-view.c
   trunk/src/file-manager/fm-tree-view.c

Modified: trunk/src/file-manager/fm-directory-view.c
==============================================================================
--- trunk/src/file-manager/fm-directory-view.c	(original)
+++ trunk/src/file-manager/fm-directory-view.c	Wed Aug 13 11:39:13 2008
@@ -6687,7 +6687,7 @@
   /* tooltip */                  N_("Unmount the selected volume"),
                                  G_CALLBACK (action_unmount_volume_callback) },
   /* name, stock id */         { "Eject Volume", NULL,
-  /* label, accelerator */       N_("_Eject"), NULL,
+  /* label, accelerator */       N_("_Eject Volume"), NULL,
   /* tooltip */                  N_("Eject the selected volume"),
                                  G_CALLBACK (action_eject_volume_callback) },
   /* name, stock id */         { "Format Volume", NULL,
@@ -6703,7 +6703,7 @@
   /* tooltip */                  N_("Unmount the volume associated with the open folder"),
                                  G_CALLBACK (action_self_unmount_volume_callback) },
   /* name, stock id */         { "Self Eject Volume", NULL,
-  /* label, accelerator */       N_("_Eject"), NULL,
+  /* label, accelerator */       N_("_Eject Volume"), NULL,
   /* tooltip */                  N_("Eject the volume associated with the open folder"),
                                  G_CALLBACK (action_self_eject_volume_callback) },
   /* name, stock id */         { "Self Format Volume", NULL,
@@ -6772,7 +6772,7 @@
   /* tooltip */                  N_("Unmount the volume associated with this folder"),
                                  G_CALLBACK (action_location_unmount_volume_callback) },
   /* name, stock id */         { "Location Eject Volume", NULL,
-  /* label, accelerator */       N_("_Eject"), NULL,
+  /* label, accelerator */       N_("_Eject Volume"), NULL,
   /* tooltip */                  N_("Eject the volume associated with this folder"),
                                  G_CALLBACK (action_location_eject_volume_callback) },
   /* name, stock id */         { "Location Format Volume", NULL,
@@ -7076,7 +7076,9 @@
 
 	if (nautilus_file_can_eject (file)) {
 		*show_eject = TRUE;
-	} else if (nautilus_file_can_unmount (file)) {
+	}
+
+	if (nautilus_file_can_unmount (file)) {
 		*show_unmount = TRUE;
 	}
 
@@ -7123,7 +7125,9 @@
 	
 	if (nautilus_file_can_eject (file)) {
 		*show_eject = TRUE;
-	} else if (nautilus_file_can_unmount (file)) {
+	}
+
+	if (nautilus_file_can_unmount (file)) {
 		*show_unmount = TRUE;
 	}
 	
@@ -7225,12 +7229,6 @@
 		show_format &= show_format_one;
 	}
 
-	/* We don't want both eject and unmount, since eject
-	   unmounts too */
-	if (show_eject) {
-		show_unmount = FALSE;
-	}
-
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_CONNECT_TO_SERVER_LINK);
 	gtk_action_set_visible (action, show_connect);

Modified: trunk/src/file-manager/fm-tree-view.c
==============================================================================
--- trunk/src/file-manager/fm-tree-view.c	(original)
+++ trunk/src/file-manager/fm-tree-view.c	Wed Aug 13 11:39:13 2008
@@ -102,6 +102,7 @@
 	GtkWidget *popup_properties;
 	GtkWidget *popup_unmount_separator;
 	GtkWidget *popup_unmount;
+	GtkWidget *popup_eject;
 	NautilusFile *popup_file;
 	
 	guint selection_changed_timer;
@@ -675,8 +676,8 @@
 	gboolean can_delete_file;
 
 	if (event->button == 3) {
-		gboolean unmount_is_eject = FALSE;
 		gboolean show_unmount = FALSE;
+		gboolean show_eject = FALSE;
 		GMount *mount = NULL;
 		
 		if (!gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
@@ -728,22 +729,28 @@
 		
 		mount = fm_tree_model_get_mount_for_root_node_file (view->details->child_model, view->details->popup_file);
 		if (mount) {
-			show_unmount = g_mount_can_unmount (mount) || g_mount_can_eject (mount);
 			/* TODO: show both unmount and eject if there are more than one volume for the drive */
-			unmount_is_eject = g_mount_can_eject (mount);
+			show_unmount = g_mount_can_unmount (mount);
+			show_eject = g_mount_can_eject (mount);
 		} 
 		
-		gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_MENU_ITEM (view->details->popup_unmount))->child),
-				    unmount_is_eject? _("E_ject"):_("_Unmount Volume"));
-		gtk_label_set_use_underline (GTK_LABEL (GTK_BIN (GTK_MENU_ITEM (view->details->popup_unmount))->child),
-				    TRUE);
 		if (show_unmount) {
-			gtk_widget_show (view->details->popup_unmount_separator);
 			gtk_widget_show (view->details->popup_unmount);
 		} else {
-			gtk_widget_hide (view->details->popup_unmount_separator);
 			gtk_widget_hide (view->details->popup_unmount);
-		}		
+		}
+
+		if (show_eject) {
+			gtk_widget_show (view->details->popup_eject);
+		} else {
+			gtk_widget_hide (view->details->popup_eject);
+		}
+
+		if (show_unmount || show_eject) {
+			gtk_widget_show (view->details->popup_unmount_separator);
+		} else {
+			gtk_widget_hide (view->details->popup_unmount_separator);
+		}
 
 		g_object_ref (view);
 		
@@ -1125,8 +1132,26 @@
 	
 	if (mount != NULL) {
 		nautilus_file_operations_unmount_mount (fm_tree_view_get_containing_window (view),
-							mount,
-							g_mount_can_eject (mount), TRUE);
+							mount, FALSE, TRUE);
+	}
+}
+
+static void
+fm_tree_view_eject_cb (GtkWidget *menu_item,
+		       FMTreeView *view)
+{
+	NautilusFile *file = view->details->popup_file;
+	GMount *mount;
+	
+	if (file == NULL) {
+		return;
+	}
+
+	mount = fm_tree_model_get_mount_for_root_node_file (view->details->child_model, file);
+	
+	if (mount != NULL) {
+		nautilus_file_operations_unmount_mount (fm_tree_view_get_containing_window (view),
+							mount, TRUE, TRUE);
 	}
 }
 
@@ -1247,7 +1272,7 @@
 	eel_gtk_menu_append_separator (GTK_MENU (popup));
 
 	/* add the "Unmount" menu item */
-	menu_item = gtk_image_menu_item_new_with_label ("eject label");
+	menu_item = gtk_image_menu_item_new_with_mnemonic ("_Unmount");
 	g_signal_connect (menu_item, "activate",
 			  G_CALLBACK (fm_tree_view_unmount_cb),
 			  view);
@@ -1255,6 +1280,15 @@
 	gtk_menu_shell_append (GTK_MENU_SHELL (popup), menu_item);
 	view->details->popup_unmount = menu_item;
 
+	/* add the "Eject" menu item */
+	menu_item = gtk_image_menu_item_new_with_mnemonic ("E_ject");
+	g_signal_connect (menu_item, "activate",
+			  G_CALLBACK (fm_tree_view_eject_cb),
+			  view);
+	gtk_widget_show (menu_item);
+	gtk_menu_shell_append (GTK_MENU_SHELL (popup), menu_item);
+	view->details->popup_eject = menu_item;
+
 	/* add the unmount separator menu item */
 	view->details->popup_unmount_separator =
 		GTK_WIDGET (eel_gtk_menu_append_separator (GTK_MENU (popup)));



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