summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-03-08 00:40:19 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-03-08 00:40:19 +0000
commit47496b27cbefa0e6fdc0c2674f07a63fda156e05 (patch)
tree683f72bd930039cc9765c796d1724337bea44634 /src
parent2832fe1009198522cd2b920a6e16cc598e1a9a98 (diff)
downloadnautilus-47496b27cbefa0e6fdc0c2674f07a63fda156e05.tar.gz
reviewed by: John Sullivan <sullivan@eazel.com>
Fix bugs: 7349 - Sidebar tabs no longer display in a bold font 7477 - Sidebar tab labels don't update to new font when font is changed 7492 - Font style regression on Sidebar title * libnautilus-extensions/nautilus-global-preferences.h: * libnautilus-extensions/nautilus-global-preferences.c: (nautilus_global_preferences_get_smooth_font): Add documentation to clarify the fact that the result needs to be unrefed. (nautilus_global_preferences_get_smooth_bold_font): New function that returns a bold version of the user's preferred font. * src/nautilus-sidebar-tabs.c: (nautilus_sidebar_tabs_load_theme_data): Use the user's bold preffered font instead of the default font. (bug 7349) (smooth_font_changed_callback), (nautilus_sidebar_tabs_initialize), (nautilus_sidebar_tabs_destroy): Listen for changes in the user's preferred font and update the tabs accordingly (bug 7477) * src/nautilus-sidebar-title.c: (smooth_font_changed_callback): Use the user's bold preferred font instead of the plain one. Also unref the font when done to plug a tiny leak. (bug 7492)
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-sidebar-tabs.c28
-rw-r--r--src/nautilus-sidebar-title.c9
2 files changed, 34 insertions, 3 deletions
diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c
index cf33b3d89..faa2d9907 100644
--- a/src/nautilus-sidebar-tabs.c
+++ b/src/nautilus-sidebar-tabs.c
@@ -233,10 +233,30 @@ nautilus_sidebar_tabs_load_theme_data (NautilusSidebarTabs *sidebar_tabs)
*/
/* use the default font. In the future, it should fetch the font name and properties from the theme */
- sidebar_tabs->details->tab_font = nautilus_scalable_font_get_default_bold_font ();
+ sidebar_tabs->details->tab_font = nautilus_global_preferences_get_smooth_bold_font ();
sidebar_tabs->details->font_size = 12;
}
+static void
+smooth_font_changed_callback (gpointer callback_data)
+{
+ NautilusScalableFont *new_font;
+ NautilusSidebarTabs *sidebar_tabs;
+
+ g_return_if_fail (NAUTILUS_IS_SIDEBAR_TABS (callback_data));
+
+ sidebar_tabs = NAUTILUS_SIDEBAR_TABS (callback_data);
+ new_font = nautilus_global_preferences_get_smooth_bold_font ();
+
+ if (sidebar_tabs->details->tab_font != NULL) {
+ gtk_object_unref (GTK_OBJECT (sidebar_tabs->details->tab_font));
+ }
+
+ sidebar_tabs->details->tab_font = new_font;
+
+ gtk_widget_queue_resize (GTK_WIDGET (sidebar_tabs));
+}
+
/* initialize a newly allocated sidebar tabs object */
static void
nautilus_sidebar_tabs_initialize (NautilusSidebarTabs *sidebar_tabs)
@@ -273,6 +293,9 @@ nautilus_sidebar_tabs_initialize (NautilusSidebarTabs *sidebar_tabs)
nautilus_preferences_add_callback(NAUTILUS_PREFERENCES_THEME,
(NautilusPreferencesCallback) nautilus_sidebar_tabs_load_theme_data,
sidebar_tabs);
+ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_SMOOTH_FONT,
+ smooth_font_changed_callback,
+ sidebar_tabs);
sidebar_tabs->details->title_prelit = FALSE;
}
@@ -321,6 +344,9 @@ nautilus_sidebar_tabs_destroy (GtkObject *object)
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
(NautilusPreferencesCallback) nautilus_sidebar_tabs_load_theme_data,
sidebar_tabs);
+ nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_SMOOTH_FONT,
+ smooth_font_changed_callback,
+ sidebar_tabs);
g_free (sidebar_tabs->details);
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index d3a178263..31347d10b 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -128,16 +128,21 @@ static void
smooth_font_changed_callback (gpointer callback_data)
{
NautilusScalableFont *new_font;
+ NautilusScalableFont *new_bold_font;
NautilusSidebarTitle *sidebar_title;
g_return_if_fail (NAUTILUS_IS_SIDEBAR_TITLE (callback_data));
sidebar_title = NAUTILUS_SIDEBAR_TITLE (callback_data);
-
+
new_font = nautilus_global_preferences_get_smooth_font ();
+ new_bold_font = nautilus_global_preferences_get_smooth_bold_font ();
- nautilus_label_set_smooth_font (NAUTILUS_LABEL (sidebar_title->details->title_label), new_font);
+ nautilus_label_set_smooth_font (NAUTILUS_LABEL (sidebar_title->details->title_label), new_bold_font);
nautilus_label_set_smooth_font (NAUTILUS_LABEL (sidebar_title->details->more_info_label), new_font);
+
+ gtk_object_unref (GTK_OBJECT (new_font));
+ gtk_object_unref (GTK_OBJECT (new_bold_font));
}
static void