diff options
author | Darin Adler <darin@src.gnome.org> | 2001-03-29 22:49:27 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-03-29 22:49:27 +0000 |
commit | de78d5d546b9207e181540da0b97386174bd108e (patch) | |
tree | acde07a928eda5d13b9ac680a933083ba18e44fe /src | |
parent | 661f4e24af74c8816031ac32652c636eba1bcb75 (diff) | |
download | nautilus-de78d5d546b9207e181540da0b97386174bd108e.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>
Fix bug 7915 (update_font called repeatedly causes slowdown).
Fix black line on right side of icon view that I introduced when I
was doing the cut/copy/paste work.
* libnautilus-extensions/nautilus-label.h:
* libnautilus-extensions/nautilus-label.c:
(nautilus_label_set_text): Add a boolean result to tell whether
the label text was changed for the convenience of callers who want
to do work only if it changes.
* src/nautilus-sidebar-title.c: (update_title): Only call
update_font if the title changed.
* src/file-manager/fm-directory-view.c: (real_realize): Set
background to the normal background from the style. Now we see a
gray background again instead of a black one.
(fm_directory_view_initialize_class): Set scrollbar_spacing to 0
since the extra 3 pixels don't do us any good.
Diffstat (limited to 'src')
-rw-r--r-- | src/file-manager/fm-directory-view.c | 8 | ||||
-rw-r--r-- | src/nautilus-sidebar-title.c | 58 |
2 files changed, 37 insertions, 29 deletions
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index bfa1fcde4..78c1731be 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -5417,6 +5417,7 @@ real_realize (GtkWidget *widget) gdk_window_set_user_data (widget->window, widget); widget->style = gtk_style_attach (widget->style, widget->window); + gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); } static void @@ -5448,9 +5449,11 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; + GtkScrolledWindowClass *scrolled_window_class; object_class = GTK_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); + scrolled_window_class = GTK_SCROLLED_WINDOW_CLASS (klass); object_class->destroy = fm_directory_view_destroy; @@ -5460,6 +5463,11 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass) widget_class->selection_received = real_selection_received; widget_class->size_allocate = real_size_allocate; + /* Get rid of the strange 3-pixel gap that GtkScrolledWindow + * uses by default. It does no good. + */ + scrolled_window_class->scrollbar_spacing = 0; + signals[CLEAR] = gtk_signal_new ("clear", GTK_RUN_LAST, diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c index ef05524cb..a8d0ef350 100644 --- a/src/nautilus-sidebar-title.c +++ b/src/nautilus-sidebar-title.c @@ -3,7 +3,7 @@ /* * Nautilus * - * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 2000, 2001 Eazel, Inc. * * Nautilus is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,16 +22,13 @@ * Author: Andy Hertzfeld <andy@eazel.com> */ -/* This is the index title widget, which is the title part of the index panel - */ +/* This is the sidebar title widget, which is the title part of the sidebar. */ #include <config.h> #include "nautilus-sidebar-title.h" -#include "nautilus-sidebar.h" +#include "nautilus-sidebar.h" #include <ctype.h> -#include <string.h> -#include <math.h> #include <gtk/gtkhbox.h> #include <gtk/gtklabel.h> #include <gtk/gtkpixmap.h> @@ -41,6 +38,7 @@ #include <libgnomevfs/gnome-vfs-uri.h> #include <libnautilus-extensions/nautilus-background.h> #include <libnautilus-extensions/nautilus-file-attributes.h> +#include <libnautilus-extensions/nautilus-font-factory.h> #include <libnautilus-extensions/nautilus-gdk-extensions.h> #include <libnautilus-extensions/nautilus-gdk-font-extensions.h> #include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h> @@ -49,13 +47,14 @@ #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-image-with-background.h> +#include <libnautilus-extensions/nautilus-label-with-background.h> #include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-search-uri.h> -#include <libnautilus-extensions/nautilus-font-factory.h> #include <libnautilus-extensions/nautilus-string.h> #include <libnautilus-extensions/nautilus-theme.h> -#include <libnautilus-extensions/nautilus-label-with-background.h> -#include <libnautilus-extensions/nautilus-image-with-background.h> +#include <math.h> +#include <string.h> /* maximum allowable size to be displayed as the title */ #define MAX_TITLE_SIZE 256 @@ -480,12 +479,13 @@ update_font (NautilusSidebarTitle *sidebar_title) /* Update the smooth font */ smooth_font = nautilus_global_preferences_get_default_smooth_font (); - largest_fitting_smooth_font_size = nautilus_scalable_font_largest_fitting_font_size (smooth_font, - sidebar_title->details->title_text, - available_width, - minimum_acceptable_font_size, - maximum_acceptable_font_size); - + largest_fitting_smooth_font_size = nautilus_scalable_font_largest_fitting_font_size + (smooth_font, + sidebar_title->details->title_text, + available_width, + minimum_acceptable_font_size, + maximum_acceptable_font_size); + nautilus_label_set_smooth_font (NAUTILUS_LABEL (sidebar_title->details->title_label), smooth_font); nautilus_label_set_smooth_font_size (NAUTILUS_LABEL (sidebar_title->details->title_label), largest_fitting_smooth_font_size); @@ -499,32 +499,33 @@ update_font (NautilusSidebarTitle *sidebar_title) bold_template_font = nautilus_gdk_font_get_bold (template_font); - largest_fitting_font = nautilus_gdk_font_get_largest_fitting (template_font, - sidebar_title->details->title_text, - available_width, - minimum_acceptable_font_size, - maximum_acceptable_font_size); + largest_fitting_font = nautilus_gdk_font_get_largest_fitting + (template_font, + sidebar_title->details->title_text, + available_width, + minimum_acceptable_font_size, + maximum_acceptable_font_size); if (largest_fitting_font == NULL) { largest_fitting_font = nautilus_gdk_font_get_fixed (); } - nautilus_gtk_widget_set_font (sidebar_title->details->title_label, largest_fitting_font); + nautilus_gtk_widget_set_font (sidebar_title->details->title_label, + largest_fitting_font); gdk_font_unref (largest_fitting_font); gdk_font_unref (bold_template_font); gdk_font_unref (template_font); } -/* set up the filename label */ static void update_title (NautilusSidebarTitle *sidebar_title) { /* FIXME bugzilla.eazel.com 2500: We could defer showing the title until the icon is ready. */ - nautilus_label_set_text (NAUTILUS_LABEL (sidebar_title->details->title_label), - sidebar_title->details->title_text); - - update_font (sidebar_title); + if (nautilus_label_set_text (NAUTILUS_LABEL (sidebar_title->details->title_label), + sidebar_title->details->title_text)) { + update_font (sidebar_title); + } } static void @@ -573,8 +574,7 @@ update_more_info (NautilusSidebarTitle *sidebar_title) g_free (search_string); append_and_eat (info_string, "\n ", nautilus_file_get_string_attribute (file, "size")); - } - else { + } else { info_string = g_string_new (NULL); type_string = nautilus_file_get_string_attribute (file, "type"); if (type_string != NULL) { @@ -591,7 +591,7 @@ update_more_info (NautilusSidebarTitle *sidebar_title) } nautilus_label_set_text (NAUTILUS_LABEL (sidebar_title->details->more_info_label), - info_string->str); + info_string->str); g_string_free (info_string, TRUE); } |