From 958002b3264dd732991fa31e002d2ac65a8bd569 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Tue, 12 Sep 2000 19:41:41 +0000 Subject: Fixed bug 884 (Long URI in Go menu doesn't get cut off) Fixed bug 2667 (Really long bookmark titles stretch bookmarks menu) * libnautilus-extensions/nautilus-gtk-extensions.h: * libnautilus-extensions/nautilus-gtk-extensions.c: (nautilus_truncate_text_for_menu_item): New function, uses nautilus_str_middle_truncate to create a string that isn't ridiculously long. * libnautilus-extensions/nautilus-bookmark.c: (nautilus_bookmark_menu_item_new): Use new function to keep the menu items in the Back/Forward context menus from getting too wide. * src/nautilus-window-menus.c: (append_bookmark_to_menu): Use new function to keep the menu items in the Go and Bookmarks menus from getting too wide. --- libnautilus-private/nautilus-bookmark.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libnautilus-private/nautilus-bookmark.c') diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c index 7cd64e5a2..6e4ccad3c 100644 --- a/libnautilus-private/nautilus-bookmark.c +++ b/libnautilus-private/nautilus-bookmark.c @@ -38,6 +38,7 @@ #include #include #include +#include enum { CHANGED, @@ -522,7 +523,8 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark) { GtkWidget *menu_item; GtkWidget *pixmap_widget; - GtkWidget *accel_label; + GtkWidget *label; + char *display_name; /* Could check gnome_preferences_get_menus_have_icons here, but these * are more important than stock menu icons, since they're connected to @@ -536,12 +538,13 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark) gtk_widget_show (pixmap_widget); gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_item), pixmap_widget); } - accel_label = gtk_accel_label_new (bookmark->details->name); - gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); + display_name = nautilus_truncate_text_for_menu_item (bookmark->details->name); + label = gtk_label_new (display_name); + g_free (display_name); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (menu_item), accel_label); - gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), menu_item); - gtk_widget_show (accel_label); + gtk_container_add (GTK_CONTAINER (menu_item), label); + gtk_widget_show (label); return menu_item; } -- cgit v1.2.1