diff options
author | Alexander Larsson <alexl@redhat.com> | 2009-12-14 14:08:51 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2009-12-14 14:12:59 +0100 |
commit | fb39afae9bf1027cf405f7309685327abd67f1bf (patch) | |
tree | 52672fdea5d4442f4217dd0cd697d7fb6a5d4de0 | |
parent | 7fb432ba6b6816076e9eb5cd6f586df2e90ed33a (diff) | |
download | nautilus-fb39afae9bf1027cf405f7309685327abd67f1bf.tar.gz |
Better tab size
This removes the minimum size of tabs, since that causes problems
when there are little availible horizontal size (such as in split
view), as it caused ellipsizion to only work for strings larger
than the minimum set size.
However, doing *just* this causes the tabs by default to be only
3 chars wide, which is obviously also bad. So we enable tab-expansio
to solve this.
The new situation is not ideal either, but its the best we can do
before this gtk bug is fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=125250
-rw-r--r-- | src/nautilus-notebook.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c index a7e44a448..afb4c90f1 100644 --- a/src/nautilus-notebook.c +++ b/src/nautilus-notebook.c @@ -337,34 +337,6 @@ close_button_clicked_cb (GtkWidget *widget, } } -static void -tab_label_style_set_cb (GtkWidget *hbox, - GtkStyle *previous_style, - gpointer user_data) -{ - PangoFontMetrics *metrics; - PangoContext *context; - GtkWidget *button; - int char_width, h, w; - - context = gtk_widget_get_pango_context (hbox); - metrics = pango_context_get_metrics (context, - hbox->style->font_desc, - pango_context_get_language (context)); - - char_width = pango_font_metrics_get_approximate_digit_width (metrics); - pango_font_metrics_unref (metrics); - - gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox), - GTK_ICON_SIZE_MENU, &w, &h); - - gtk_widget_set_size_request - (hbox, TAB_WIDTH_N_CHARS * PANGO_PIXELS(char_width) + 2 * w, -1); - - button = g_object_get_data (G_OBJECT (hbox), "close-button"); - gtk_widget_set_size_request (button, w + 2, h + 2); -} - static GtkWidget * build_tab_label (NautilusNotebook *nb, NautilusWindowSlot *slot) { @@ -415,10 +387,6 @@ build_tab_label (NautilusNotebook *nb, NautilusWindowSlot *slot) gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); gtk_widget_show (close_button); - /* Set minimal size */ - g_signal_connect (hbox, "style-set", - G_CALLBACK (tab_label_style_set_cb), NULL); - drag_info = g_new0 (NautilusDragSlotProxyInfo, 1); drag_info->target_slot = slot; g_object_set_data_full (G_OBJECT (hbox), "proxy-drag-info", @@ -475,6 +443,11 @@ nautilus_notebook_add_tab (NautilusNotebook *notebook, tab_label, position); + gtk_container_child_set (GTK_CONTAINER (notebook), + slot->content_box, + "tab-expand", TRUE, + NULL); + nautilus_notebook_sync_tab_label (notebook, slot); nautilus_notebook_sync_loading (notebook, slot); |