diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-10-27 06:14:05 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-10-27 06:14:05 +0800 |
commit | 86c2f402bbc078f538bccce5b2c52546fb7a185a (patch) | |
tree | 4f5fa4e8e53eced0790ba85c19a84ec3167a9b43 /src/bookmarks/ephy-favorites-menu.c | |
parent | d51326e6b1a458b57cfae445fda4ed4b97b715a6 (diff) | |
download | gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar.gz gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar.bz2 gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar.lz gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar.xz gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.tar.zst gsoc2013-epiphany-86c2f402bbc078f538bccce5b2c52546fb7a185a.zip |
Use ellipsising labels to shorten the bookmarks and topics titles in
2004-10-27 Christian Persch <chpe@cvs.gnome.org>
* 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().
Diffstat (limited to 'src/bookmarks/ephy-favorites-menu.c')
-rw-r--r-- | src/bookmarks/ephy-favorites-menu.c | 22 |
1 files changed, 21 insertions, 1 deletions
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 <gtk/gtkuimanager.h> #include <glib/gprintf.h> +#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 @@ -108,6 +110,21 @@ open_bookmark_cb (GtkAction *action, char *location, EphyWindow *window) } 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) { EphyFavoritesMenuPrivate *p = menu->priv; @@ -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++) |