[patch] still using eel-ellipsizing-label



Hi,

nautilus still uses eel-ellipsizing-label but GtkLabel has supported
ellipsisation for a long time now. Attached patch for bug
http://bugzilla.gnome.org/show_bug.cgi?id=409276 removes
eel-ellipsizing-label uses from nautilus; this enables the patch from
eel bug http://bugzilla.gnome.org/show_bug.cgi?id=409272 (removing
eel-ellipsizing-label) to be applied to eel too.

Regards,
	Christian
Index: libnautilus-private/nautilus-file-operations-progress.c
===================================================================
--- libnautilus-private/nautilus-file-operations-progress.c	(révision 12751)
+++ libnautilus-private/nautilus-file-operations-progress.c	(copie de travail)
@@ -29,7 +29,6 @@
 #include <config.h>
 #include "nautilus-file-operations-progress.h"
 
-#include <eel/eel-ellipsizing-label.h>
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gtk-extensions.h>
 #include <eel/eel-gtk-macros.h>
@@ -181,19 +180,19 @@ nautilus_file_operations_progress_update
 }
 
 static void
-set_text_unescaped_trimmed (EelEllipsizingLabel *label, const char *text)
+set_text_unescaped_trimmed (GtkLabel *label, const char *text)
 {
 	char *unescaped_text;
 	char *unescaped_utf8;
 	
 	if (text == NULL || text[0] == '\0') {
-		eel_ellipsizing_label_set_text (label, "");
+		gtk_label_set_text (label, "");
 		return;
 	}
 	
 	unescaped_text = gnome_vfs_unescape_string_for_display (text);
 	unescaped_utf8 = eel_make_valid_utf8 (unescaped_text);
-	eel_ellipsizing_label_set_text (label, unescaped_utf8);
+	gtk_label_set_text (label, unescaped_utf8);
 	g_free (unescaped_utf8);
 	g_free (unescaped_text);
 }
@@ -271,14 +270,15 @@ create_titled_label (GtkTable *table, in
 			  0, 0);
 	gtk_widget_show (*title_widget);
 
-	*label_text_widget = eel_ellipsizing_label_new ("");
+	*label_text_widget = gtk_label_new (NULL);
+        gtk_label_set_ellipsize (GTK_LABEL (*label_text_widget), PANGO_ELLIPSIZE_START);
+	gtk_misc_set_alignment (GTK_MISC (*label_text_widget), 0, 0);
 	gtk_table_attach (table, *label_text_widget,
 			  1, 2,
 			  row, row + 1,
 			  GTK_FILL | GTK_EXPAND, 0,
 			  0, 0);
 	gtk_widget_show (*label_text_widget);
-	gtk_misc_set_alignment (GTK_MISC (*label_text_widget), 0, 0);
 }
 
 static void
@@ -351,12 +351,12 @@ nautilus_file_operations_progress_init (
 	gtk_box_pack_start (GTK_BOX (progress_vbox), file_hbox, TRUE, TRUE, 2);
 
 	/* progress verb */
-	progress->details->operation_name_label = gtk_label_new ("");
+	progress->details->operation_name_label = gtk_label_new (NULL);
 	gtk_misc_set_alignment (GTK_MISC (progress->details->operation_name_label), 0.0, 0.0);
 	gtk_box_pack_start (GTK_BOX (file_hbox), progress->details->operation_name_label, FALSE, FALSE, 0);
 
 	/* file label */
-	progress->details->item_name = gtk_label_new ("");
+	progress->details->item_name = gtk_label_new (NULL);
 	gtk_misc_set_alignment (GTK_MISC (progress->details->item_name), 0.0, 0.0);
 	gtk_label_set_ellipsize (GTK_LABEL (progress->details->item_name), PANGO_ELLIPSIZE_END);
 	gtk_box_pack_start (GTK_BOX (file_hbox), progress->details->item_name, TRUE, TRUE, 0);
@@ -589,12 +589,12 @@ nautilus_file_operations_progress_new_fi
 
 		gtk_label_set_text (GTK_LABEL (progress->details->from_label), from_prefix);
 		set_text_unescaped_trimmed 
-			(EEL_ELLIPSIZING_LABEL (progress->details->from_path_label), from_path);
+			(GTK_LABEL (progress->details->from_path_label), from_path);
 	
 		if (progress->details->to_prefix != NULL && progress->details->to_path_label != NULL) {
 			gtk_label_set_text (GTK_LABEL (progress->details->to_label), to_prefix);
 			set_text_unescaped_trimmed 
-				(EEL_ELLIPSIZING_LABEL (progress->details->to_path_label), to_path);
+				(GTK_LABEL (progress->details->to_path_label), to_path);
 		}
 
 		if (progress->details->first_transfer_time == 0) {
Index: src/file-manager/fm-properties-window.c
===================================================================
--- src/file-manager/fm-properties-window.c	(révision 12751)
+++ src/file-manager/fm-properties-window.c	(copie de travail)
@@ -27,7 +27,6 @@
 
 #include "fm-error-reporting.h"
 #include <eel/eel-accessibility.h>
-#include <eel/eel-ellipsizing-label.h>
 #include <eel/eel-gdk-pixbuf-extensions.h>
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gnome-extensions.h>
@@ -1340,45 +1339,34 @@ file_list_all_directories (GList *file_l
 
 static void
 value_field_update_internal (GtkLabel *label, 
-			     GList *file_list, 
-			     gboolean ellipsize_text)
+			     GList *file_list)
 {
 	const char *attribute_name;
 	char *attribute_value;
 	char *inconsistent_string;
 
 	g_assert (GTK_IS_LABEL (label));
-	g_assert (!ellipsize_text || EEL_IS_ELLIPSIZING_LABEL (label));
 
 	attribute_name = g_object_get_data (G_OBJECT (label), "file_attribute");
 	inconsistent_string = g_object_get_data (G_OBJECT (label), "inconsistent_string");
 	attribute_value = file_list_get_string_attribute (file_list, 
 							  attribute_name,
 							  inconsistent_string);
-
-	if (ellipsize_text) {
-		eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (label), 
-						attribute_value);
-	} else {
-		gtk_label_set_text (label, attribute_value);
-	}
-	g_free (attribute_value);	
+	gtk_label_set_text (label, attribute_value);
+	g_free (attribute_value);
 }
 
 static void
 value_field_update (FMPropertiesWindow *window, GtkLabel *label)
 {
-	gboolean ellipsize_text;
-	gboolean use_original;	
+	gboolean use_original;
 
-	ellipsize_text = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "ellipsize_text"));
 	use_original = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "show_original"));
 
 	value_field_update_internal (label, 
 				     (use_original ?
 				      window->details->original_files : 
-				      window->details->target_files),
-				     ellipsize_text);
+				      window->details->target_files));
 }
 
 static GtkLabel *
@@ -1395,7 +1383,10 @@ attach_label (GtkTable *table,
 	GtkWidget *label_field;
 
 	if (ellipsize_text) {
-		label_field = eel_ellipsizing_label_new (initial_text);
+		label_field = gtk_label_new (initial_text);
+                gtk_label_set_ellipsize (GTK_LABEL (label_field),
+                                         right_aligned ? PANGO_ELLIPSIZE_START :
+                                                         PANGO_ELLIPSIZE_END);
 	} else if (mnemonic) {
 		label_field = gtk_label_new_with_mnemonic (initial_text);
 	} else {
@@ -1467,7 +1458,6 @@ attach_value_field_internal (FMPropertie
 				g_strdup (inconsistent_string), g_free);
 
 	g_object_set_data (G_OBJECT (value_field), "show_original", GINT_TO_POINTER (show_original));
-	g_object_set_data (G_OBJECT (value_field), "ellipsize_text", GINT_TO_POINTER (ellipsize_text));
 
 	window->details->value_fields = g_list_prepend (window->details->value_fields,
 							value_field);


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