Ellipsize panel treeviews instead of scrolling

Fixes: https://bugs.launchpad.net/midori/+bug/1020353
This commit is contained in:
Christian Dywan 2012-08-03 21:45:16 +02:00
parent 242a1baf0b
commit fa3ab67cef
6 changed files with 18 additions and 9 deletions

View file

@ -1002,6 +1002,7 @@ static void cm_tree_render_text_cb(GtkTreeViewColumn *column, GtkCellRenderer *r
} }
else else
g_object_set(renderer, "text", name, NULL); g_object_set(renderer, "text", name, NULL);
g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
g_free(name); g_free(name);
} }
@ -1022,6 +1023,7 @@ static GtkWidget *cm_tree_prepare(CookieManagerPage *cmp)
renderer = gtk_cell_renderer_text_new(); renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes( column = gtk_tree_view_column_new_with_attributes(
_("Name"), renderer, "text", COOKIE_MANAGER_COL_NAME, NULL); _("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_indicator(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, COOKIE_MANAGER_COL_NAME); gtk_tree_view_column_set_sort_column_id(column, COOKIE_MANAGER_COL_NAME);
gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_resizable(column, TRUE);

View file

@ -618,7 +618,7 @@ midori_panel_append_page (MidoriPanel* panel,
{ {
scrolled = gtk_scrolled_window_new (NULL, NULL); scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_can_focus (scrolled, TRUE); gtk_widget_set_can_focus (scrolled, TRUE);
gtk_widget_show (scrolled); gtk_widget_show (scrolled);

View file

@ -688,8 +688,11 @@ midori_bookmarks_treeview_render_text_cb (GtkTreeViewColumn* column,
gtk_tree_model_get (model, iter, 0, &item, -1); gtk_tree_model_get (model, iter, 0, &item, -1);
if (item && katze_item_get_name (item)) if (item && katze_item_get_name (item))
{
g_object_set (renderer, "markup", NULL, g_object_set (renderer, "markup", NULL,
"ellipsize", PANGO_ELLIPSIZE_END,
"text", katze_item_get_name (item), NULL); "text", katze_item_get_name (item), NULL);
}
else else
g_object_set (renderer, "markup", _("<i>Separator</i>"), NULL); g_object_set (renderer, "markup", _("<i>Separator</i>"), 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_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1); gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1);
column = gtk_tree_view_column_new (); 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 (); renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf, gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf,
(GtkTreeCellDataFunc)midori_bookmarks_treeview_render_icon_cb, (GtkTreeCellDataFunc)midori_bookmarks_treeview_render_icon_cb,
treeview, NULL); treeview, NULL);
renderer_text = gtk_cell_renderer_text_new (); 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, gtk_tree_view_column_set_cell_data_func (column, renderer_text,
(GtkTreeCellDataFunc)midori_bookmarks_treeview_render_text_cb, (GtkTreeCellDataFunc)midori_bookmarks_treeview_render_text_cb,
treeview, NULL); treeview, NULL);

View file

@ -284,6 +284,7 @@ midori_extensions_treeview_render_text_cb (GtkTreeViewColumn* column,
g_object_set (renderer, g_object_set (renderer,
"markup", text, "markup", text,
"ellipsize", PANGO_ELLIPSIZE_END,
"sensitive", midori_extension_is_prepared (extension), "sensitive", midori_extension_is_prepared (extension),
NULL); NULL);
@ -461,10 +462,9 @@ midori_extensions_init (MidoriExtensions* extensions)
extensions->treeview, NULL); extensions->treeview, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column); gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column);
column = gtk_tree_view_column_new (); 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); 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, gtk_tree_view_column_set_cell_data_func (column, renderer_text,
(GtkTreeCellDataFunc)midori_extensions_treeview_render_text_cb, (GtkTreeCellDataFunc)midori_extensions_treeview_render_text_cb,
extensions->treeview, NULL); extensions->treeview, NULL);

View file

@ -624,11 +624,14 @@ midori_history_treeview_render_text_cb (GtkTreeViewColumn* column,
if (KATZE_ITEM_IS_BOOKMARK (item)) if (KATZE_ITEM_IS_BOOKMARK (item))
g_object_set (renderer, "markup", NULL, g_object_set (renderer, "markup", NULL,
"ellipsize", PANGO_ELLIPSIZE_END,
"text", katze_item_get_name (item), NULL); "text", katze_item_get_name (item), NULL);
else if (KATZE_ITEM_IS_FOLDER (item)) else if (KATZE_ITEM_IS_FOLDER (item))
{ {
gchar* formatted = midori_history_format_date (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); g_free (formatted);
} }
else 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_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1); gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1);
column = gtk_tree_view_column_new (); 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 (); renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf, gtk_tree_view_column_set_cell_data_func (column, renderer_pixbuf,
(GtkTreeCellDataFunc)midori_history_treeview_render_icon_cb, (GtkTreeCellDataFunc)midori_history_treeview_render_icon_cb,
treeview, NULL); treeview, NULL);
renderer_text = gtk_cell_renderer_text_new (); 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, gtk_tree_view_column_set_cell_data_func (column, renderer_text,
(GtkTreeCellDataFunc)midori_history_treeview_render_text_cb, (GtkTreeCellDataFunc)midori_history_treeview_render_text_cb,
treeview, NULL); treeview, NULL);

View file

@ -531,6 +531,7 @@ midori_transfers_init (MidoriTransfers* transfers)
transfers->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore)); transfers->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (transfers->treeview), FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (transfers->treeview), FALSE);
column = gtk_tree_view_column_new (); 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); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
renderer_pixbuf = gtk_cell_renderer_pixbuf_new (); renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE); gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);