[nautilus] floating-bar: ellipsize the filename separately from the details



commit c68a487c8faaad3afede2b6454f0c1f5a006de0a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 31 15:14:35 2012 -0400

    floating-bar: ellipsize the filename separately from the details
    
    This patch does three things:
    - It adds API to the floating bar to have primary and details labels
      instead of a single label. The primary label is ellipsized separately
      from the details, so it makes a good fit for a filename.
    - Modifies the code setting status messages in NautilusView to split
      them into two separate strings
    - Removes obsolete code in NautilusView and NautilusWindowSlot that was
      setting long statuses for the old non-floating statusbar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660695

 src/nautilus-canvas-view.c         |   27 -----
 src/nautilus-floating-bar.c        |  126 +++++++++++++++++-----
 src/nautilus-floating-bar.h        |   10 ++-
 src/nautilus-list-view.c           |   12 --
 src/nautilus-view.c                |  205 +++++++----------------------------
 src/nautilus-view.h                |    2 -
 src/nautilus-window-manage-views.c |    8 +-
 src/nautilus-window-slot.c         |   38 ++++---
 src/nautilus-window-slot.h         |    5 +-
 9 files changed, 171 insertions(+), 262 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 69d4e94..0c41f45 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -1072,32 +1072,6 @@ nautilus_canvas_view_get_selection (NautilusView *view)
 }
 
 static void
-count_item (NautilusCanvasIconData *icon_data,
-	    gpointer callback_data)
-{
-	guint *count;
-
-	count = callback_data;
-	(*count)++;
-}
-
-static guint
-nautilus_canvas_view_get_item_count (NautilusView *view)
-{
-	guint count;
-
-	g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), 0);
-
-	count = 0;
-	
-	nautilus_canvas_container_for_each
-		(get_canvas_container (NAUTILUS_CANVAS_VIEW (view)),
-		 count_item, &count);
-
-	return count;
-}
-
-static void
 set_sort_criterion_by_sort_type (NautilusCanvasView *canvas_view,
 				 NautilusFileSortType  sort_type)
 {
@@ -2282,7 +2256,6 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
 	nautilus_view_class->get_selected_icon_locations = nautilus_canvas_view_get_selected_icon_locations;
 	nautilus_view_class->get_selection = nautilus_canvas_view_get_selection;
 	nautilus_view_class->get_selection_for_file_transfer = nautilus_canvas_view_get_selection;
-	nautilus_view_class->get_item_count = nautilus_canvas_view_get_item_count;
 	nautilus_view_class->is_empty = nautilus_canvas_view_is_empty;
 	nautilus_view_class->remove_file = nautilus_canvas_view_remove_file;
 	nautilus_view_class->reset_to_defaults = nautilus_canvas_view_reset_to_defaults;
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index 4298dca..c90fdc3 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -25,19 +25,24 @@
 
 #include <config.h>
 
+#include <string.h>
+
 #include "nautilus-floating-bar.h"
 
 struct _NautilusFloatingBarDetails {
-	gchar *label;
+	gchar *primary_label;
+	gchar *details_label;
 
-	GtkWidget *label_widget;
+	GtkWidget *primary_label_widget;
+	GtkWidget *details_label_widget;
 	GtkWidget *spinner;
 	gboolean show_spinner;
 	gboolean is_interactive;
 };
 
 enum {
-	PROP_LABEL = 1,
+	PROP_PRIMARY_LABEL = 1,
+	PROP_DETAILS_LABEL,
 	PROP_SHOW_SPINNER,
 	NUM_PROPERTIES
 };
@@ -70,7 +75,8 @@ nautilus_floating_bar_finalize (GObject *obj)
 {
 	NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (obj);
 
-	g_free (self->priv->label);
+	g_free (self->priv->primary_label);
+	g_free (self->priv->details_label);
 
 	G_OBJECT_CLASS (nautilus_floating_bar_parent_class)->finalize (obj);
 }
@@ -84,8 +90,11 @@ nautilus_floating_bar_get_property (GObject *object,
 	NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (object);
 
 	switch (property_id) {
-	case PROP_LABEL:
-		g_value_set_string (value, self->priv->label);
+	case PROP_PRIMARY_LABEL:
+		g_value_set_string (value, self->priv->primary_label);
+		break;
+	case PROP_DETAILS_LABEL:
+		g_value_set_string (value, self->priv->details_label);
 		break;
 	case PROP_SHOW_SPINNER:
 		g_value_set_boolean (value, self->priv->show_spinner);
@@ -105,8 +114,11 @@ nautilus_floating_bar_set_property (GObject *object,
 	NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (object);
 
 	switch (property_id) {
-	case PROP_LABEL:
-		nautilus_floating_bar_set_label (self, g_value_get_string (value));
+	case PROP_PRIMARY_LABEL:
+		nautilus_floating_bar_set_primary_label (self, g_value_get_string (value));
+		break;
+	case PROP_DETAILS_LABEL:
+		nautilus_floating_bar_set_details_label (self, g_value_get_string (value));
 		break;
 	case PROP_SHOW_SPINNER:
 		nautilus_floating_bar_set_show_spinner (self, g_value_get_boolean (value));
@@ -118,9 +130,22 @@ nautilus_floating_bar_set_property (GObject *object,
 }
 
 static void
-update_label (NautilusFloatingBar *self)
+update_labels (NautilusFloatingBar *self)
 {
-	gtk_label_set_text (GTK_LABEL (self->priv->label_widget), self->priv->label);
+	gboolean primary_visible, details_visible;
+
+	primary_visible = (self->priv->primary_label != NULL) &&
+		(strlen (self->priv->primary_label) > 0);
+	details_visible = (self->priv->details_label != NULL) &&
+		(strlen (self->priv->details_label) > 0);
+
+	gtk_label_set_text (GTK_LABEL (self->priv->primary_label_widget),
+			    self->priv->primary_label);
+	gtk_widget_set_visible (self->priv->primary_label_widget, primary_visible);
+
+	gtk_label_set_text (GTK_LABEL (self->priv->details_label_widget),
+			    self->priv->details_label);
+	gtk_widget_set_visible (self->priv->details_label_widget, details_visible);
 }
 
 static gboolean
@@ -218,7 +243,7 @@ static void
 nautilus_floating_bar_constructed (GObject *obj)
 {
 	NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (obj);
-	GtkWidget *w, *box;
+	GtkWidget *w, *box, *labels_box;
 
 	G_OBJECT_CLASS (nautilus_floating_bar_parent_class)->constructed (obj);
 
@@ -232,17 +257,27 @@ nautilus_floating_bar_constructed (GObject *obj)
 	gtk_widget_set_size_request (w, 16, 16);
 	gtk_widget_set_margin_left (w, 8);
 
-	w = gtk_label_new (NULL);
-	gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END);
-	gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
-	gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
-	g_object_set (w,
+	labels_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+	gtk_box_pack_start (GTK_BOX (box), labels_box, TRUE, TRUE, 0);
+	g_object_set (labels_box,
 		      "margin-top", 2,
 		      "margin-bottom", 2,
 		      "margin-left", 12,
 		      "margin-right", 12,
 		      NULL);
-	self->priv->label_widget = w;
+	gtk_widget_show (labels_box);
+
+	w = gtk_label_new (NULL);
+	gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_MIDDLE);
+	gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
+	gtk_container_add (GTK_CONTAINER (labels_box), w);
+	self->priv->primary_label_widget = w;
+	gtk_widget_show (w);
+
+	w = gtk_label_new (NULL);
+	gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
+	gtk_container_add (GTK_CONTAINER (labels_box), w);
+	self->priv->details_label_widget = w;
 	gtk_widget_show (w);
 }
 
@@ -274,10 +309,16 @@ nautilus_floating_bar_class_init (NautilusFloatingBarClass *klass)
 	wclass->hide = nautilus_floating_bar_hide;
 	wclass->parent_set = nautilus_floating_bar_parent_set;
 
-	properties[PROP_LABEL] =
-		g_param_spec_string ("label",
-				     "Bar's label",
-				     "Label displayed by the bar",
+	properties[PROP_PRIMARY_LABEL] =
+		g_param_spec_string ("primary-label",
+				     "Bar's primary label",
+				     "Primary label displayed by the bar",
+				     NULL,
+				     G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+	properties[PROP_DETAILS_LABEL] =
+		g_param_spec_string ("details-label",
+				     "Bar's details label",
+				     "Details label displayed by the bar",
 				     NULL,
 				     G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
 	properties[PROP_SHOW_SPINNER] =
@@ -301,20 +342,43 @@ nautilus_floating_bar_class_init (NautilusFloatingBarClass *klass)
 }
 
 void
-nautilus_floating_bar_set_label (NautilusFloatingBar *self,
-				 const gchar *label)
+nautilus_floating_bar_set_primary_label (NautilusFloatingBar *self,
+					 const gchar *label)
+{
+	if (g_strcmp0 (self->priv->primary_label, label) != 0) {
+		g_free (self->priv->primary_label);
+		self->priv->primary_label = g_strdup (label);
+
+		g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PRIMARY_LABEL]);
+
+		update_labels (self);
+	}
+}
+
+void
+nautilus_floating_bar_set_details_label (NautilusFloatingBar *self,
+					 const gchar *label)
 {
-	if (g_strcmp0 (self->priv->label, label) != 0) {
-		g_free (self->priv->label);
-		self->priv->label = g_strdup (label);
+	if (g_strcmp0 (self->priv->details_label, label) != 0) {
+		g_free (self->priv->details_label);
+		self->priv->details_label = g_strdup (label);
 
-		g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LABEL]);
+		g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DETAILS_LABEL]);
 
-		update_label (self);
+		update_labels (self);
 	}
 }
 
 void
+nautilus_floating_bar_set_labels (NautilusFloatingBar *self,
+				  const gchar *primary_label,
+				  const gchar *details_label)
+{
+	nautilus_floating_bar_set_primary_label (self, primary_label);
+	nautilus_floating_bar_set_details_label (self, details_label);
+}
+
+void
 nautilus_floating_bar_set_show_spinner (NautilusFloatingBar *self,
 					gboolean show_spinner)
 {
@@ -328,11 +392,13 @@ nautilus_floating_bar_set_show_spinner (NautilusFloatingBar *self,
 }
 
 GtkWidget *
-nautilus_floating_bar_new (const gchar *label,
+nautilus_floating_bar_new (const gchar *primary_label,
+			   const gchar *details_label,
 			   gboolean show_spinner)
 {
 	return g_object_new (NAUTILUS_TYPE_FLOATING_BAR,
-			     "label", label,
+			     "primary-label", primary_label,
+			     "details-label", details_label,
 			     "show-spinner", show_spinner,
 			     "orientation", GTK_ORIENTATION_HORIZONTAL,
 			     "spacing", 8,
diff --git a/src/nautilus-floating-bar.h b/src/nautilus-floating-bar.h
index 03ea0f9..8bcec0f 100644
--- a/src/nautilus-floating-bar.h
+++ b/src/nautilus-floating-bar.h
@@ -58,11 +58,17 @@ struct _NautilusFloatingBarClass {
 /* GObject */
 GType       nautilus_floating_bar_get_type  (void);
 
-GtkWidget * nautilus_floating_bar_new              (const gchar *label,
+GtkWidget * nautilus_floating_bar_new              (const gchar *primary_label,
+						    const gchar *details_label,
 						    gboolean show_spinner);
 
-void        nautilus_floating_bar_set_label        (NautilusFloatingBar *self,
+void       nautilus_floating_bar_set_primary_label (NautilusFloatingBar *self,
 						    const gchar *label);
+void       nautilus_floating_bar_set_details_label (NautilusFloatingBar *self,
+						    const gchar *label);
+void        nautilus_floating_bar_set_labels        (NautilusFloatingBar *self,
+						     const gchar *primary,
+						     const gchar *detail);
 void        nautilus_floating_bar_set_show_spinner (NautilusFloatingBar *self,
 						    gboolean show_spinner);
 
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 11d45d0..4a2b6e9 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2056,17 +2056,6 @@ nautilus_list_view_get_selection_for_file_transfer (NautilusView *view)
 	return g_list_reverse (selection_data.list);
 }
 
-
-
-
-static guint
-nautilus_list_view_get_item_count (NautilusView *view)
-{
-	g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), 0);
-
-	return nautilus_list_model_get_length (NAUTILUS_LIST_VIEW (view)->details->model);
-}
-
 static gboolean
 nautilus_list_view_is_empty (NautilusView *view)
 {
@@ -3015,7 +3004,6 @@ nautilus_list_view_class_init (NautilusListViewClass *class)
 	nautilus_view_class->get_backing_uri = nautilus_list_view_get_backing_uri;
 	nautilus_view_class->get_selection = nautilus_list_view_get_selection;
 	nautilus_view_class->get_selection_for_file_transfer = nautilus_list_view_get_selection_for_file_transfer;
-	nautilus_view_class->get_item_count = nautilus_list_view_get_item_count;
 	nautilus_view_class->is_empty = nautilus_list_view_is_empty;
 	nautilus_view_class->remove_file = nautilus_list_view_remove_file;
 	nautilus_view_class->merge_menus = nautilus_list_view_merge_menus;
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 68328d1..4b1a882 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -489,14 +489,6 @@ nautilus_view_using_manual_layout (NautilusView  *view)
 	return 	NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->using_manual_layout (view);
 }
 
-static guint
-nautilus_view_get_item_count (NautilusView *view)
-{
-	g_return_val_if_fail (NAUTILUS_IS_VIEW (view), 0);
-
-	return 	NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->get_item_count (view);
-}
-
 /**
  * nautilus_view_can_rename_file
  *
@@ -2850,13 +2842,12 @@ nautilus_view_display_selection_info (NautilusView *view)
 	guint file_item_count;
 	GList *p;
 	char *first_item_name;
-	char *non_folder_str;
+	char *non_folder_count_str;
+	char *non_folder_item_count_str;
 	char *folder_count_str;
 	char *folder_item_count_str;
-	char *status_string;
-	char *view_status_string;
-	char *free_space_str;
-	char *obj_selected_free_space_str;
+	char *primary_status;
+	char *detail_status;
 	NautilusFile *file;
 
 	g_return_if_fail (NAUTILUS_IS_VIEW (view));
@@ -2871,12 +2862,9 @@ nautilus_view_display_selection_info (NautilusView *view)
 	non_folder_size = 0;
 	first_item_name = NULL;
 	folder_count_str = NULL;
-	non_folder_str = NULL;
 	folder_item_count_str = NULL;
-	free_space_str = NULL;
-	obj_selected_free_space_str = NULL;
-	status_string = NULL;
-	view_status_string = NULL;
+	non_folder_count_str = NULL;
+	non_folder_item_count_str = NULL;
 	
 	for (p = selection; p != NULL; p = p->next) {
 		file = p->data;
@@ -2920,8 +2908,8 @@ nautilus_view_display_selection_info (NautilusView *view)
 			if (!folder_item_count_known) {
 				folder_item_count_str = g_strdup ("");
 			} else {
-				folder_item_count_str = g_strdup_printf (ngettext(" (containing %'d item)",
-										  " (containing %'d items)",
+				folder_item_count_str = g_strdup_printf (ngettext("(containing %'d item)",
+										  "(containing %'d items)",
 										  folder_item_count), 
 									 folder_item_count);
 			}
@@ -2931,8 +2919,8 @@ nautilus_view_display_selection_info (NautilusView *view)
 				folder_item_count_str = g_strdup ("");
 			} else {
 				/* translators: this is preceded with a string of form 'N folders' (N more than 1) */
-				folder_item_count_str = g_strdup_printf (ngettext(" (containing a total of %'d item)",
-										  " (containing a total of %'d items)",
+				folder_item_count_str = g_strdup_printf (ngettext("(containing a total of %'d item)",
+										  "(containing a total of %'d items)",
 										  folder_item_count), 
 									 folder_item_count);
 			}
@@ -2941,24 +2929,22 @@ nautilus_view_display_selection_info (NautilusView *view)
 	}
 
 	if (non_folder_count != 0) {
-		char *items_string;
-
 		if (folder_count == 0) {
 			if (non_folder_count == 1) {
-				items_string = g_strdup_printf (_("â%sâ selected"), 
-								first_item_name);
+				non_folder_count_str = g_strdup_printf (_("â%sâ selected"),
+									first_item_name);
 			} else {
-				items_string = g_strdup_printf (ngettext("%'d item selected",
-									 "%'d items selected",
-									 non_folder_count), 
-								non_folder_count);
+				non_folder_count_str = g_strdup_printf (ngettext("%'d item selected",
+										 "%'d items selected",
+										 non_folder_count),
+									non_folder_count);
 			}
 		} else {
 			/* Folders selected also, use "other" terminology */
-			items_string = g_strdup_printf (ngettext("%'d other item selected",
-								 "%'d other items selected",
-								 non_folder_count), 
-							non_folder_count);
+			non_folder_count_str = g_strdup_printf (ngettext("%'d other item selected",
+									 "%'d other items selected",
+									 non_folder_count),
+								non_folder_count);
 		}
 
 		if (non_folder_size_known) {
@@ -2967,72 +2953,24 @@ nautilus_view_display_selection_info (NautilusView *view)
 			size_string = g_format_size (non_folder_size);
 			/* This is marked for translation in case a localiser
 			 * needs to use something other than parentheses. The
-			 * first message gives the number of items selected;
-			 * the message in parentheses the size of those items.
+			 * the message in parentheses is the size of the selected items.
 			 */
-			non_folder_str = g_strdup_printf (_("%s (%s)"), 
-							  items_string, 
-							  size_string);
-
+			non_folder_item_count_str = g_strdup_printf (_("(%s)"), size_string);
 			g_free (size_string);
-			g_free (items_string);
 		} else {
-			non_folder_str = items_string;
+			non_folder_item_count_str = g_strdup ("");
 		}
 	}
 
-	free_space_str = nautilus_file_get_volume_free_space (view->details->directory_as_file);
-	if (free_space_str != NULL) {
-		obj_selected_free_space_str = g_strdup_printf (_("Free space: %s"), free_space_str);
-	}
 	if (folder_count == 0 && non_folder_count == 0)	{
-		char *item_count_str;
-		guint item_count;
-
-		item_count = nautilus_view_get_item_count (view);
-		
-		item_count_str = g_strdup_printf (ngettext ("%'u item", "%'u items", item_count), item_count);
-
-		if (free_space_str != NULL) {
-			status_string = g_strdup_printf (_("%s, Free space: %s"), item_count_str, free_space_str);
-			g_free (item_count_str);
-		} else {
-			status_string = item_count_str;
-		}
-
+		primary_status = NULL;
+		detail_status = NULL;
 	} else if (folder_count == 0) {
-		view_status_string = g_strdup (non_folder_str);
-
-		if (free_space_str != NULL) {
-			/* Marking this for translation, since you
-			 * might want to change "," to something else.
-			 * After the comma the amount of free space will
-			 * be shown.
-			 */
-			status_string = g_strdup_printf (_("%s, %s"),
-							 non_folder_str,
-							 obj_selected_free_space_str);
-		}
+		primary_status = g_strdup (non_folder_count_str);
+		detail_status = g_strdup (non_folder_item_count_str);
 	} else if (non_folder_count == 0) {
-		/* No use marking this for translation, since you
-		 * can't reorder the strings, which is the main thing
-		 * you'd want to do.
-		 */
-		view_status_string = g_strdup_printf ("%s%s",
-						      folder_count_str,
-						      folder_item_count_str);
-
-		if (free_space_str != NULL) {
-			/* Marking this for translation, since you
-			 * might want to change "," to something else.
-			 * After the comma the amount of free space will
-			 * be shown.
-			 */
-			status_string = g_strdup_printf (_("%s%s, %s"),
-							 folder_count_str,
-							 folder_item_count_str,
-							 obj_selected_free_space_str);
-		}
+		primary_status = g_strdup (folder_count_str);
+		detail_status  = g_strdup (folder_item_count_str);
 	} else {
 		/* This is marked for translation in case a localizer
 		 * needs to change ", " to something else. The comma
@@ -3041,45 +2979,25 @@ nautilus_view_display_selection_info (NautilusView *view)
 		 * message about the number of other items and the
 		 * total size of those items.
 		 */
-		view_status_string = g_strdup_printf (_("%s%s, %s"),
-						      folder_count_str,
-						      folder_item_count_str,
-						      non_folder_str);
-
-		if (obj_selected_free_space_str != NULL) {
-			/* This is marked for translation in case a localizer
-			 * needs to change ", " to something else. The first comma
-			 * is between the message about the number of folders
-			 * and the number of items in those folders and the
-			 * message about the number of other items and the
-			 * total size of those items. After the second comma
-			 * the free space is written.
-			 */
-			status_string = g_strdup_printf (_("%s%s, %s, %s"),
-							 folder_count_str,
-							 folder_item_count_str,
-							 non_folder_str,
-							 obj_selected_free_space_str);
-		}
+		primary_status = g_strdup_printf (_("%s %s, %s %s"),
+						  folder_count_str,
+						  folder_item_count_str,
+						  non_folder_count_str,
+						  non_folder_item_count_str);
+		detail_status = NULL;
 	}
 
-	g_free (free_space_str);
-	g_free (obj_selected_free_space_str);
 	g_free (first_item_name);
 	g_free (folder_count_str);
 	g_free (folder_item_count_str);
-	g_free (non_folder_str);
-
-	if (status_string == NULL) {
-		status_string = g_strdup (view_status_string);
-	}
+	g_free (non_folder_count_str);
+	g_free (non_folder_item_count_str);
 
 	nautilus_window_slot_set_status (view->details->slot,
-					 status_string,
-					 view_status_string);
+					 primary_status, detail_status);
 
-	g_free (status_string);
-	g_free (view_status_string);
+	g_free (primary_status);
+	g_free (detail_status);
 }
 
 static void
@@ -6100,8 +6018,6 @@ copy_or_cut_files (NautilusView *view,
 		   GList           *clipboard_contents,
 		   gboolean         cut)
 {
-	int count;
-	char *status_string, *name;
 	NautilusClipboardInfo info;
         GtkTargetList *target_list;
         GtkTargetEntry *targets;
@@ -6125,41 +6041,6 @@ copy_or_cut_files (NautilusView *view,
         gtk_target_table_free (targets, n_targets);
 
 	nautilus_clipboard_monitor_set_clipboard_info (nautilus_clipboard_monitor_get (), &info);
-
-	count = g_list_length (clipboard_contents);
-	if (count == 1) {
-		name = nautilus_file_get_display_name (clipboard_contents->data);
-		if (cut) {
-			status_string = g_strdup_printf (_("â%sâ will be moved "
-							   "if you select the Paste command"),
-							 name);
-		} else {
-			status_string = g_strdup_printf (_("â%sâ will be copied "
-							   "if you select the Paste command"),
-							 name);
-		}
-		g_free (name);
-	} else {
-		if (cut) {
-			status_string = g_strdup_printf (ngettext("The %'d selected item will be moved "
-								  "if you select the Paste command",
-								  "The %'d selected items will be moved "
-								  "if you select the Paste command",
-								  count),
-							 count);
-		} else {
-			status_string = g_strdup_printf (ngettext("The %'d selected item will be copied "
-								  "if you select the Paste command",
-								  "The %'d selected items will be copied "
-								  "if you select the Paste command",
-								  count),
-							 count);
-		}
-	}
-
-	nautilus_window_slot_set_status (view->details->slot,
-					 status_string, NULL);
-	g_free (status_string);
 }
 
 static void
@@ -6222,11 +6103,7 @@ paste_clipboard_data (NautilusView *view,
 	item_uris = nautilus_clipboard_get_uri_list_from_selection_data (selection_data, &cut,
 									 copied_files_atom);
 
-	if (item_uris == NULL|| destination_uri == NULL) {
-		nautilus_window_slot_set_status (view->details->slot,
-						 _("There is nothing on the clipboard to paste."),
-						 NULL);
-	} else {
+	if (item_uris != NULL && destination_uri != NULL) {
 		nautilus_view_move_copy_items (view, item_uris, NULL, destination_uri,
 					       cut ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
 					       0, 0);
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index ccb9821..3bdebf0 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -188,8 +188,6 @@ struct NautilusViewClass {
 	/* Return an array of locations of selected icons in their view. */
 	GArray * (* get_selected_icon_locations) (NautilusView *view);
 
-	guint    (* get_item_count)             (NautilusView *view);
-
         /* bump_zoom_level is a function pointer that subclasses must override
          * to change the zoom level of an object. */
         void    (* bump_zoom_level)      	(NautilusView *view,
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 5820128..1a19b79 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -652,7 +652,7 @@ begin_location_change (NautilusWindowSlot *slot,
 	end_location_change (slot);
 
 	nautilus_window_slot_set_allow_stop (slot, TRUE);
-	nautilus_window_slot_set_status (slot, " ", NULL);
+	nautilus_window_slot_set_status (slot, NULL, NULL);
 
 	g_assert (slot->pending_location == NULL);
 	g_assert (slot->pending_selection == NULL);
@@ -1183,9 +1183,9 @@ real_setup_loading_floating_bar (NautilusWindowSlot *slot)
 		return;
 	}
 
-	nautilus_floating_bar_set_label (NAUTILUS_FLOATING_BAR (slot->floating_bar),
-					 NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->content_view)) ?
-					 _("Searching...") : _("Loading..."));
+	nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (slot->floating_bar),
+						 NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->content_view)) ?
+						 _("Searching...") : _("Loading..."));
 	nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (slot->floating_bar),
 						TRUE);
 	nautilus_floating_bar_add_action (NAUTILUS_FLOATING_BAR (slot->floating_bar),
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index c680f18..7ff816a 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -356,7 +356,7 @@ nautilus_window_slot_constructed (GObject *object)
 	gtk_box_pack_start (GTK_BOX (slot), slot->view_overlay, TRUE, TRUE, 0);
 	gtk_widget_show (slot->view_overlay);
 
-	slot->floating_bar = nautilus_floating_bar_new ("", FALSE);
+	slot->floating_bar = nautilus_floating_bar_new (NULL, NULL, FALSE);
 	gtk_widget_set_halign (slot->floating_bar, GTK_ALIGN_END);
 	gtk_widget_set_valign (slot->floating_bar, GTK_ALIGN_END);
 	gtk_overlay_add_overlay (GTK_OVERLAY (slot->view_overlay),
@@ -436,9 +436,6 @@ nautilus_window_slot_dispose (GObject *object)
 	g_free (slot->title);
 	slot->title = NULL;
 
-	g_free (slot->status_text);
-	slot->status_text = NULL;
-
 	G_OBJECT_CLASS (nautilus_window_slot_parent_class)->dispose (object);
 }
 
@@ -618,7 +615,8 @@ nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
 
 static void
 real_slot_set_short_status (NautilusWindowSlot *slot,
-			    const gchar *status)
+			    const gchar *primary_status,
+			    const gchar *detail_status)
 {
 	gboolean disable_chrome;
 
@@ -630,17 +628,19 @@ real_slot_set_short_status (NautilusWindowSlot *slot,
 		      "disable-chrome", &disable_chrome,
 		      NULL);
 
-	if (status == NULL || disable_chrome) {
+	if ((primary_status == NULL && detail_status == NULL) || disable_chrome) {
 		gtk_widget_hide (slot->floating_bar);
 		return;
 	}
 
-	nautilus_floating_bar_set_label (NAUTILUS_FLOATING_BAR (slot->floating_bar), status);
+	nautilus_floating_bar_set_labels (NAUTILUS_FLOATING_BAR (slot->floating_bar),
+					  primary_status, detail_status);
 	gtk_widget_show (slot->floating_bar);
 }
 
 typedef struct {
-	gchar *status;
+	gchar *primary_status;
+	gchar *detail_status;
 	NautilusWindowSlot *slot;
 } SetStatusData;
 
@@ -649,7 +649,8 @@ set_status_data_free (gpointer data)
 {
 	SetStatusData *status_data = data;
 
-	g_free (status_data->status);
+	g_free (status_data->primary_status);
+	g_free (status_data->detail_status);
 
 	g_slice_free (SetStatusData, data);
 }
@@ -660,14 +661,17 @@ set_status_timeout_cb (gpointer data)
 	SetStatusData *status_data = data;
 
 	status_data->slot->set_status_timeout_id = 0;
-	real_slot_set_short_status (status_data->slot, status_data->status);
+	real_slot_set_short_status (status_data->slot,
+				    status_data->primary_status,
+				    status_data->detail_status);
 
 	return FALSE;
 }
 
 static void
 set_floating_bar_status (NautilusWindowSlot *slot,
-			 const gchar *status)
+			 const gchar *primary_status,
+			 const gchar *detail_status)
 {
 	GtkSettings *settings;
 	gint double_click_time;
@@ -684,7 +688,8 @@ set_floating_bar_status (NautilusWindowSlot *slot,
 		      NULL);
 
 	status_data = g_slice_new0 (SetStatusData);
-	status_data->status = g_strdup (status);
+	status_data->primary_status = g_strdup (primary_status);
+	status_data->detail_status = g_strdup (detail_status);
 	status_data->slot = slot;
 
 	/* waiting for half of the double-click-time before setting
@@ -701,16 +706,13 @@ set_floating_bar_status (NautilusWindowSlot *slot,
 
 void
 nautilus_window_slot_set_status (NautilusWindowSlot *slot,
-				 const char *status,
-				 const char *short_status)
+				 const char *primary_status,
+				 const char *detail_status)
 {
 	g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
 
-	g_free (slot->status_text);
-	slot->status_text = g_strdup (status);
-
 	if (slot->content_view != NULL) {
-		set_floating_bar_status (slot, short_status);
+		set_floating_bar_status (slot, primary_status, detail_status);
 	}
 }
 
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index b55a419..ea91752 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -81,7 +81,6 @@ struct NautilusWindowSlot {
 	/* Current location. */
 	GFile *location;
 	char *title;
-	char *status_text;
 
 	NautilusFile *viewed_file;
 	gboolean viewed_file_seen;
@@ -164,8 +163,8 @@ void    nautilus_window_slot_set_viewed_file		   (NautilusWindowSlot *slot,
 void    nautilus_window_slot_set_allow_stop		   (NautilusWindowSlot *slot,
 							    gboolean	    allow_stop);
 void    nautilus_window_slot_set_status			   (NautilusWindowSlot *slot,
-							    const char	 *status,
-							    const char   *short_status);
+							    const char         *primary_status,
+							    const char         *detail_status);
 
 void    nautilus_window_slot_add_extra_location_widget     (NautilusWindowSlot *slot,
 							    GtkWidget       *widget);



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