diff options
author | Ramiro Estrugo <ramiro@eazel.com> | 2001-03-08 02:01:18 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-03-08 02:01:18 +0000 |
commit | d393d7c606289e0f561d43b86564a12e988749f8 (patch) | |
tree | 1a056d6ce6376069a44c0814f2e77f9cff1d7b16 | |
parent | ecb4df4078fd6d55684788cec3ce11886226519f (diff) | |
download | nautilus-d393d7c606289e0f561d43b86564a12e988749f8.tar.gz |
Merge from HEAD:
2001-03-07 Ramiro Estrugo <ramiro@eazel.com>
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)
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.c | 35 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.h | 1 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.c | 35 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.h | 1 | ||||
-rw-r--r-- | src/nautilus-sidebar-tabs.c | 28 | ||||
-rw-r--r-- | src/nautilus-sidebar-title.c | 9 |
7 files changed, 139 insertions, 3 deletions
@@ -1,3 +1,36 @@ +2001-03-07 Ramiro Estrugo <ramiro@eazel.com> + + Merge from HEAD: + + 2001-03-07 Ramiro Estrugo <ramiro@eazel.com> + + 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) + 2001-03-07 Eskil Olsen <eskil@eazel.com> reviewed by: Robey Pointer <robey@eazel.com> diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c index 61f716dc6..2ae55a2d5 100644 --- a/libnautilus-extensions/nautilus-global-preferences.c +++ b/libnautilus-extensions/nautilus-global-preferences.c @@ -1261,6 +1261,12 @@ nautilus_global_preferences_set_dialog_title (const char *title) gtk_window_set_title (GTK_WINDOW (dialog), title); } +/** + * nautilus_global_preferences_get_smooth_font + * + * Return value: The user's preferred smooth font. Need to + * unref the returned GtkObject when done with it. + */ NautilusScalableFont * nautilus_global_preferences_get_smooth_font (void) { @@ -1280,6 +1286,35 @@ nautilus_global_preferences_get_smooth_font (void) return scalable_font; } +/** + * nautilus_global_preferences_get_smooth_bold_font + * + * Return value: A bold flavor on the user's preferred smooth font. If + * no bold font is found, then the plain preffered font is + * used. Need to unref the returned GtkObject when done + * with it. + */ +NautilusScalableFont * +nautilus_global_preferences_get_smooth_bold_font (void) +{ + NautilusScalableFont *plain_font; + NautilusScalableFont *bold_font; + + plain_font = nautilus_global_preferences_get_smooth_font (); + g_assert (NAUTILUS_IS_SCALABLE_FONT (plain_font)); + + bold_font = nautilus_scalable_font_make_bold (plain_font); + + if (bold_font == NULL) { + bold_font = plain_font; + } else { + gtk_object_unref (GTK_OBJECT (plain_font)); + } + + g_assert (NAUTILUS_IS_SCALABLE_FONT (bold_font)); + return bold_font; +} + void nautilus_global_preferences_initialize (void) { diff --git a/libnautilus-extensions/nautilus-global-preferences.h b/libnautilus-extensions/nautilus-global-preferences.h index 2416de3b7..9409b1f03 100644 --- a/libnautilus-extensions/nautilus-global-preferences.h +++ b/libnautilus-extensions/nautilus-global-preferences.h @@ -144,6 +144,7 @@ void nautilus_global_preferences_set_dialog_title /* Sidebar */ GList * nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers (void); struct NautilusScalableFont *nautilus_global_preferences_get_smooth_font (void); +struct NautilusScalableFont *nautilus_global_preferences_get_smooth_bold_font (void); END_GNOME_DECLS diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c index 61f716dc6..2ae55a2d5 100644 --- a/libnautilus-private/nautilus-global-preferences.c +++ b/libnautilus-private/nautilus-global-preferences.c @@ -1261,6 +1261,12 @@ nautilus_global_preferences_set_dialog_title (const char *title) gtk_window_set_title (GTK_WINDOW (dialog), title); } +/** + * nautilus_global_preferences_get_smooth_font + * + * Return value: The user's preferred smooth font. Need to + * unref the returned GtkObject when done with it. + */ NautilusScalableFont * nautilus_global_preferences_get_smooth_font (void) { @@ -1280,6 +1286,35 @@ nautilus_global_preferences_get_smooth_font (void) return scalable_font; } +/** + * nautilus_global_preferences_get_smooth_bold_font + * + * Return value: A bold flavor on the user's preferred smooth font. If + * no bold font is found, then the plain preffered font is + * used. Need to unref the returned GtkObject when done + * with it. + */ +NautilusScalableFont * +nautilus_global_preferences_get_smooth_bold_font (void) +{ + NautilusScalableFont *plain_font; + NautilusScalableFont *bold_font; + + plain_font = nautilus_global_preferences_get_smooth_font (); + g_assert (NAUTILUS_IS_SCALABLE_FONT (plain_font)); + + bold_font = nautilus_scalable_font_make_bold (plain_font); + + if (bold_font == NULL) { + bold_font = plain_font; + } else { + gtk_object_unref (GTK_OBJECT (plain_font)); + } + + g_assert (NAUTILUS_IS_SCALABLE_FONT (bold_font)); + return bold_font; +} + void nautilus_global_preferences_initialize (void) { diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 2416de3b7..9409b1f03 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -144,6 +144,7 @@ void nautilus_global_preferences_set_dialog_title /* Sidebar */ GList * nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers (void); struct NautilusScalableFont *nautilus_global_preferences_get_smooth_font (void); +struct NautilusScalableFont *nautilus_global_preferences_get_smooth_bold_font (void); END_GNOME_DECLS 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 |