Ellipsize titles and show tooltips in the tab panel
This commit is contained in:
parent
438566d87f
commit
d0d0b3bba7
3 changed files with 33 additions and 3 deletions
|
@ -75,7 +75,10 @@ midori_extension_treeview_render_text_cb (GtkTreeViewColumn* column,
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter, 0, &view, -1);
|
gtk_tree_model_get (model, iter, 0, &view, -1);
|
||||||
|
|
||||||
g_object_set (renderer, "text", midori_view_get_display_title (view), NULL);
|
g_object_set (renderer, "text", midori_view_get_display_title (view),
|
||||||
|
"ellipsize", midori_view_get_label_ellipsize (view), NULL);
|
||||||
|
gtk_tree_store_set (GTK_TREE_STORE (model), iter,
|
||||||
|
1, midori_view_get_display_title (view), -1);
|
||||||
|
|
||||||
g_object_unref (view);
|
g_object_unref (view);
|
||||||
}
|
}
|
||||||
|
@ -248,6 +251,9 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
|
||||||
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
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_show_expanders (GTK_TREE_VIEW (treeview), FALSE);
|
gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (treeview), FALSE);
|
||||||
|
#if GTK_CHECK_VERSION (2, 12, 0)
|
||||||
|
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), 1);
|
||||||
|
#endif
|
||||||
column = gtk_tree_view_column_new ();
|
column = gtk_tree_view_column_new ();
|
||||||
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);
|
||||||
|
@ -255,7 +261,7 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
|
||||||
(GtkTreeCellDataFunc)midori_extension_treeview_render_icon_cb,
|
(GtkTreeCellDataFunc)midori_extension_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_extension_treeview_render_text_cb,
|
(GtkTreeCellDataFunc)midori_extension_treeview_render_text_cb,
|
||||||
treeview, NULL);
|
treeview, NULL);
|
||||||
|
@ -314,7 +320,7 @@ tab_panel_activate_cb (MidoriExtension* extension,
|
||||||
MidoriBrowser* browser;
|
MidoriBrowser* browser;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
model = gtk_tree_store_new (1, MIDORI_TYPE_VIEW);
|
model = gtk_tree_store_new (2, MIDORI_TYPE_VIEW, G_TYPE_STRING);
|
||||||
g_object_set_data (G_OBJECT (extension), "treemodel", model);
|
g_object_set_data (G_OBJECT (extension), "treemodel", model);
|
||||||
|
|
||||||
browsers = katze_object_get_object (app, "browsers");
|
browsers = katze_object_get_object (app, "browsers");
|
||||||
|
|
|
@ -2745,6 +2745,27 @@ midori_view_tab_label_query_tooltip_cb (GtkWidget* tab_label,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_view_get_label_ellipsize:
|
||||||
|
* @view: a #MidoriView
|
||||||
|
*
|
||||||
|
* Determines how labels representing the view should be
|
||||||
|
* ellipsized, which is helpful for alternative labels.
|
||||||
|
*
|
||||||
|
* Return value: how to ellipsize the label
|
||||||
|
*
|
||||||
|
* Since: 0.1.9
|
||||||
|
**/
|
||||||
|
PangoEllipsizeMode
|
||||||
|
midori_view_get_label_ellipsize (MidoriView* view)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MIDORI_IS_VIEW (view), PANGO_ELLIPSIZE_END);
|
||||||
|
|
||||||
|
if (view->tab_label)
|
||||||
|
return gtk_label_get_ellipsize (GTK_LABEL (view->tab_title));
|
||||||
|
return PANGO_ELLIPSIZE_END;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_view_get_proxy_tab_label:
|
* midori_view_get_proxy_tab_label:
|
||||||
* @view: a #MidoriView
|
* @view: a #MidoriView
|
||||||
|
|
|
@ -116,6 +116,9 @@ midori_view_get_proxy_menu_item (MidoriView* view);
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_view_get_tab_menu (MidoriView* view);
|
midori_view_get_tab_menu (MidoriView* view);
|
||||||
|
|
||||||
|
PangoEllipsizeMode
|
||||||
|
midori_view_get_label_ellipsize (MidoriView* view);
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_view_get_proxy_tab_label (MidoriView* view);
|
midori_view_get_proxy_tab_label (MidoriView* view);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue