From 86c2f402bbc078f538bccce5b2c52546fb7a185a Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 26 Oct 2004 22:14:05 +0000 Subject: Use ellipsising labels to shorten the bookmarks and topics titles in 2004-10-27 Christian Persch * src/bookmarks/ephy-bookmark-action.c: (create_tool_item), (ephy_bookmark_action_sync_label), (connect_proxy), (bookmark_changed_cb): * src/bookmarks/ephy-bookmarks-menu.c: (connect_proxy_cb), (ensure_bookmark_actions), (ephy_bookmarks_menu_rebuild): * src/bookmarks/ephy-favorites-menu.c: (connect_proxy_cb), (ephy_favorites_menu_rebuild): * src/bookmarks/ephy-topic-action.c: (ephy_topic_action_sync_label), (append_bookmarks_menu), (build_topics_menu), (connect_proxy), (topic_changed_cb): Use ellipsising labels to shorten the bookmarks and topics titles in menus, instead of chopping the strings off at the end. Fixes bug #147765. Use gtk_entry_set_width_chars() to set the smart bookmark entry width, not gtk_widget_set_size_request(). --- src/bookmarks/ephy-favorites-menu.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/bookmarks/ephy-favorites-menu.c') diff --git a/src/bookmarks/ephy-favorites-menu.c b/src/bookmarks/ephy-favorites-menu.c index 5b42cca94..673d7b407 100644 --- a/src/bookmarks/ephy-favorites-menu.c +++ b/src/bookmarks/ephy-favorites-menu.c @@ -31,6 +31,8 @@ #include #include +#define LABEL_WIDTH_CHARS 32 + #define EPHY_FAVORITES_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FAVORITES_MENU, EphyFavoritesMenuPrivate)) struct _EphyFavoritesMenuPrivate @@ -107,6 +109,21 @@ open_bookmark_cb (GtkAction *action, char *location, EphyWindow *window) ephy_window_load_url (window, location); } +static void +connect_proxy_cb (GtkActionGroup *action_group, + GtkAction *action, + GtkWidget *proxy) +{ + if (GTK_IS_MENU_ITEM (proxy)) + { + GtkLabel *label; + + label = (GtkLabel *) ((GtkBin *) proxy)->child; + gtk_label_set_width_chars (label, LABEL_WIDTH_CHARS); + gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); + } +} + static void ephy_favorites_menu_rebuild (EphyFavoritesMenu *menu) { @@ -126,7 +143,10 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *menu) children = ephy_node_get_children (fav); p->action_group = gtk_action_group_new ("FavoritesActions"); - gtk_ui_manager_insert_action_group (merge, p->action_group, 0); + gtk_ui_manager_insert_action_group (merge, p->action_group, -1); + g_signal_connect (p->action_group, "connect-proxy", + G_CALLBACK (connect_proxy_cb), NULL); + p->ui_id = gtk_ui_manager_new_merge_id (merge); for (i = 0; i < children->len; i++) -- cgit v1.2.3