]> spindle.queued.net Git - midori/commitdiff
Ellipsize titles and show tooltips in the tab panel
authorChristian Dywan <christian@twotoasts.de>
Sun, 26 Jul 2009 21:50:17 +0000 (23:50 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 27 Jul 2009 01:40:38 +0000 (03:40 +0200)
extensions/tab-panel.c
midori/midori-view.c
midori/midori-view.h

index a45dc70b4d6b75d916cd02eb89045d91639c4ebe..adc88b5317894e9279fb27bae96a5d156a030834 100644 (file)
@@ -75,7 +75,10 @@ midori_extension_treeview_render_text_cb (GtkTreeViewColumn* column,
 
     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);
 }
@@ -248,6 +251,9 @@ tab_panel_app_add_browser_cb (MidoriApp*       app,
     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_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 ();
     renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
     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,
         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_extension_treeview_render_text_cb,
         treeview, NULL);
@@ -314,7 +320,7 @@ tab_panel_activate_cb (MidoriExtension* extension,
     MidoriBrowser* browser;
     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);
 
     browsers = katze_object_get_object (app, "browsers");
index e9fc7ad36526dabd7ee95da43a7ec67c08c10fb8..6fc24260dc1cc57178c40f9fc37e145407f2ccff 100644 (file)
@@ -2745,6 +2745,27 @@ midori_view_tab_label_query_tooltip_cb (GtkWidget*  tab_label,
 }
 #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:
  * @view: a #MidoriView
index 017499a6d340000cd716a513dfacfe1ade3cd8ab..0dbfc52b118a13c5175f8b61334efed8bcbd5f60 100644 (file)
@@ -116,6 +116,9 @@ midori_view_get_proxy_menu_item        (MidoriView*        view);
 GtkWidget*
 midori_view_get_tab_menu               (MidoriView*        view);
 
+PangoEllipsizeMode
+midori_view_get_label_ellipsize        (MidoriView*        view);
+
 GtkWidget*
 midori_view_get_proxy_tab_label        (MidoriView*        view);