[nautilus/gnome-3-6] query-editor: set a maximum width for the current location button



commit 0d7409b86720014854b2dcc509ccfd3e80bd026e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Nov 12 16:50:36 2012 -0500

    query-editor: set a maximum width for the current location button
    
    Like we do in the pathbar, otherwise it could potentially grow
    unboundedly large.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688186

 src/nautilus-query-editor.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index f89cb68..35261d8 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -1154,6 +1154,7 @@ static void
 update_location (NautilusQueryEditor *editor)
 {
 	NautilusFile *file;
+	GtkWidget *label;
 
 	file = nautilus_file_get_by_uri (editor->details->current_uri);
 
@@ -1167,10 +1168,14 @@ update_location (NautilusQueryEditor *editor)
 			name = g_strdup_printf ("\342\200\234%s\342\200\235", filename);
 			g_free (filename);
 		}
-		gtk_button_set_label (GTK_BUTTON (editor->details->search_current_button),
-				      name);
+
+		gtk_button_set_label (GTK_BUTTON (editor->details->search_current_button), name);
 		g_free (name);
 
+		label = gtk_bin_get_child (GTK_BIN (editor->details->search_current_button));
+		gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
+		g_object_set (label, "max-width-chars", 30, NULL);
+
 		nautilus_file_unref (file);
 	}
 }



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