From fa3ab67cef4f1bd9db159f3fd732ac29f7a1e21e Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 3 Aug 2012 21:45:16 +0200 Subject: [PATCH] Ellipsize panel treeviews instead of scrolling Fixes: https://bugs.launchpad.net/midori/+bug/1020353 --- extensions/cookie-manager/cookie-manager-page.c | 2 ++ midori/midori-panel.c | 2 +- panels/midori-bookmarks.c | 7 +++++-- panels/midori-extensions.c | 6 +++--- panels/midori-history.c | 9 ++++++--- panels/midori-transfers.c | 1 + 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/extensions/cookie-manager/cookie-manager-page.c b/extensions/cookie-manager/cookie-manager-page.c index fb450b8c..d8a71add 100644 --- a/extensions/cookie-manager/cookie-manager-page.c +++ b/extensions/cookie-manager/cookie-manager-page.c @@ -1002,6 +1002,7 @@ static void cm_tree_render_text_cb(GtkTreeViewColumn *column, GtkCellRenderer *r } else g_object_set(renderer, "text", name, NULL); + g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); g_free(name); } @@ -1022,6 +1023,7 @@ static GtkWidget *cm_tree_prepare(CookieManagerPage *cmp) renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Name"), renderer, "text", COOKIE_MANAGER_COL_NAME, NULL); + gtk_tree_view_column_set_expand (column, TRUE); gtk_tree_view_column_set_sort_indicator(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, COOKIE_MANAGER_COL_NAME); gtk_tree_view_column_set_resizable(column, TRUE); diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 7685f5cb..22ec10c7 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -618,7 +618,7 @@ midori_panel_append_page (MidoriPanel* panel, { scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_AUTOMATIC, + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_widget_set_can_focus (scrolled, TRUE); gtk_widget_show (scrolled); diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index 8ef87c3a..0a7b8808 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -688,8 +688,11 @@ midori_bookmarks_treeview_render_text_cb (GtkTreeViewColumn* column, gtk_tree_model_get (model, iter, 0, &item, -1); if (item && katze_item_get_name (item)) + { g_object_set (renderer, "markup", NULL, + "ellipsize", PANGO_ELLIPSIZE_END, "text", katze_item_get_name (item), NULL); + } else g_object_set (renderer, "markup", _("Separator"), NULL); @@ -1052,14 +1055,14 @@ midori_bookmarks_init (MidoriBookmarks* bookmarks) gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1); column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_column_set_expand (column, TRUE); renderer_pixbuf = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf, (GtkTreeCellDataFunc)midori_bookmarks_treeview_render_icon_cb, treeview, NULL); renderer_text = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer_text, FALSE); + gtk_tree_view_column_pack_start (column, renderer_text, TRUE); gtk_tree_view_column_set_cell_data_func (column, renderer_text, (GtkTreeCellDataFunc)midori_bookmarks_treeview_render_text_cb, treeview, NULL); diff --git a/panels/midori-extensions.c b/panels/midori-extensions.c index 8121fbc0..f9100d1c 100644 --- a/panels/midori-extensions.c +++ b/panels/midori-extensions.c @@ -284,6 +284,7 @@ midori_extensions_treeview_render_text_cb (GtkTreeViewColumn* column, g_object_set (renderer, "markup", text, + "ellipsize", PANGO_ELLIPSIZE_END, "sensitive", midori_extension_is_prepared (extension), NULL); @@ -461,10 +462,9 @@ midori_extensions_init (MidoriExtensions* extensions) extensions->treeview, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column); column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); - renderer_text = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer_text, FALSE); gtk_tree_view_column_set_expand (column, TRUE); + renderer_text = gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start (column, renderer_text, TRUE); gtk_tree_view_column_set_cell_data_func (column, renderer_text, (GtkTreeCellDataFunc)midori_extensions_treeview_render_text_cb, extensions->treeview, NULL); diff --git a/panels/midori-history.c b/panels/midori-history.c index b5d6af38..8c6edfd1 100644 --- a/panels/midori-history.c +++ b/panels/midori-history.c @@ -624,11 +624,14 @@ midori_history_treeview_render_text_cb (GtkTreeViewColumn* column, if (KATZE_ITEM_IS_BOOKMARK (item)) g_object_set (renderer, "markup", NULL, + "ellipsize", PANGO_ELLIPSIZE_END, "text", katze_item_get_name (item), NULL); else if (KATZE_ITEM_IS_FOLDER (item)) { gchar* formatted = midori_history_format_date (item); - g_object_set (renderer, "markup", NULL, "text", formatted, NULL); + g_object_set (renderer, "markup", NULL, "text", formatted, + "ellipsize", PANGO_ELLIPSIZE_END, + NULL); g_free (formatted); } else @@ -1022,14 +1025,14 @@ midori_history_init (MidoriHistory* history) gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1); column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_column_set_expand (column, TRUE); renderer_pixbuf = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf, (GtkTreeCellDataFunc)midori_history_treeview_render_icon_cb, treeview, NULL); renderer_text = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer_text, FALSE); + gtk_tree_view_column_pack_start (column, renderer_text, TRUE); gtk_tree_view_column_set_cell_data_func (column, renderer_text, (GtkTreeCellDataFunc)midori_history_treeview_render_text_cb, treeview, NULL); diff --git a/panels/midori-transfers.c b/panels/midori-transfers.c index 1c90fe21..ea73f3a1 100644 --- a/panels/midori-transfers.c +++ b/panels/midori-transfers.c @@ -531,6 +531,7 @@ midori_transfers_init (MidoriTransfers* transfers) transfers->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (transfers->treeview), FALSE); column = gtk_tree_view_column_new (); + gtk_tree_view_column_set_expand (column, TRUE); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); renderer_pixbuf = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); -- 2.39.5