diff options
author | Alex Larsson <alexl@redhat.com> | 2002-05-11 23:53:50 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2002-05-11 23:53:50 +0000 |
commit | 9ebd9e20207e6d2c65f77a530d998239c8892a0c (patch) | |
tree | 4a11691cf61538950c08056c488dd755b6831f0b /src/nautilus-sidebar-tabs.c | |
parent | 2a263abf9891b69f425c18387ae601a77189ae77 (diff) | |
download | nautilus-9ebd9e20207e6d2c65f77a530d998239c8892a0c.tar.gz |
Don't use custom font.
2002-05-11 Alex Larsson <alexl@redhat.com>
* components/music/nautilus-music-view.c: (set_up_tree_view):
Don't use custom font.
* libnautilus-private/apps_nautilus_preferences.schemas:
Add preferences/desktop_font.
Remove old fonts keys
* libnautilus-private/nautilus-file.c:
(nautilus_file_get_display_name_nocopy):
Don't leak.
* libnautilus-private/nautilus-global-preferences.c:
* libnautilus-private/nautilus-global-preferences.h:
Remove old font prefs. Add desktop font prefs.
* libnautilus-private/nautilus-icon-canvas-item.c:
(create_label_layout):
Use default widget font unless one is set.
* libnautilus-private/nautilus-icon-container.c: (finalize),
(style_set), (nautilus_icon_container_class_init),
(nautilus_icon_container_instance_init),
(nautilus_icon_container_set_font):
* libnautilus-private/nautilus-icon-container.h:
* libnautilus-private/nautilus-icon-private.h:
Change nautilus_icon_container_set_font_name to
nautilus_icon_container_set_font.
Change font_size_table to have the difference from the base font size.
Invalidate labels on style_set.
* libnautilus-private/nautilus-icon-factory.c:
(embedded_text_font_changed_callback), (embed_text):
Use default widget font for embedded text.
* src/nautilus-preferences-dialog.c:
* src/nautilus-sidebar-title.c:
Remove font prefs. Update on style_set.
* src/nautilus-sidebar-tabs.c: (nautilus_sidebar_tabs_class_init),
(nautilus_sidebar_tabs_load_theme_data), (style_set),
(nautilus_sidebar_tabs_init), (nautilus_sidebar_tabs_destroy),
(make_tab_text_layout):
Use normal gtk+ fonts.
* src/file-manager/fm-desktop-icon-view.c: (font_changed_callback),
(fm_desktop_icon_view_update_icon_container_fonts),
(fm_desktop_icon_view_init):
Use desktop font.
* src/file-manager/fm-icon-view.c:
(default_zoom_level_changed_callback), (create_icon_container),
(fm_icon_view_instance_init):
(nautilus_sidebar_title_class_init), (style_set),
(nautilus_sidebar_title_init), (update_title_font):
Remove font handling.
Diffstat (limited to 'src/nautilus-sidebar-tabs.c')
-rw-r--r-- | src/nautilus-sidebar-tabs.c | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c index 80b71ee90..31a8e588d 100644 --- a/src/nautilus-sidebar-tabs.c +++ b/src/nautilus-sidebar-tabs.c @@ -104,7 +104,6 @@ struct NautilusSidebarTabsDetails { GdkColor prelit_text_color; GdkPixbuf *tab_piece_images[LAST_TAB_OFFSET]; - PangoFontDescription *tab_font; int tab_height; int tab_left_offset; char *title; @@ -138,7 +137,8 @@ static void draw_or_layout_all_tabs (NautilusSidebarTabs gboolean layout_only); static TabItem* tab_item_find_by_name (NautilusSidebarTabs *sidebar_tabs, const char *name); -static void default_font_changed_callback (gpointer callback_data); +static void style_set (GtkWidget *widget, + GtkStyle *previous_style); EEL_CLASS_BOILERPLATE (NautilusSidebarTabs, nautilus_sidebar_tabs, GTK_TYPE_WIDGET) @@ -154,6 +154,7 @@ nautilus_sidebar_tabs_class_init (NautilusSidebarTabsClass *class) object_class->destroy = nautilus_sidebar_tabs_destroy; widget_class->expose_event = nautilus_sidebar_tabs_expose; widget_class->size_allocate = nautilus_sidebar_tabs_size_allocate; + widget_class->style_set = style_set; } /* utilities to set up the text color alternatives */ @@ -235,35 +236,19 @@ nautilus_sidebar_tabs_load_theme_data (NautilusSidebarTabs *sidebar_tabs) } } } - } - - default_font_changed_callback (sidebar_tabs); + } + + gtk_widget_queue_resize (GTK_WIDGET (sidebar_tabs)); } -/* Use the font from preferences */ +static void recalculate_size(NautilusSidebarTabs *sidebar_tabs); + static void -default_font_changed_callback (gpointer callback_data) +style_set (GtkWidget *widget, + GtkStyle *previous_style) { - PangoFontDescription *new_font; - char *font_name; - NautilusSidebarTabs *sidebar_tabs; - - g_return_if_fail (NAUTILUS_IS_SIDEBAR_TABS (callback_data)); - - sidebar_tabs = NAUTILUS_SIDEBAR_TABS (callback_data); - - font_name = eel_preferences_get (NAUTILUS_PREFERENCES_DEFAULT_FONT); - new_font = pango_font_description_from_string (font_name); - pango_font_description_set_size (new_font, DEFAULT_FONT_SIZE * PANGO_SCALE); - - if (sidebar_tabs->details->tab_font != NULL) { - pango_font_description_free (sidebar_tabs->details->tab_font); - sidebar_tabs->details->tab_font = NULL; - } - - sidebar_tabs->details->tab_font = new_font; - - gtk_widget_queue_resize (GTK_WIDGET (sidebar_tabs)); + recalculate_size (NAUTILUS_SIDEBAR_TABS (widget)); + gtk_widget_queue_resize (widget); } /* initialize a newly allocated sidebar tabs object */ @@ -303,10 +288,6 @@ nautilus_sidebar_tabs_init (NautilusSidebarTabs *sidebar_tabs) (EelPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, sidebar_tabs); - eel_preferences_add_callback (NAUTILUS_PREFERENCES_DEFAULT_FONT, - default_font_changed_callback, - sidebar_tabs); - sidebar_tabs->details->title_prelit = FALSE; } @@ -406,12 +387,6 @@ nautilus_sidebar_tabs_destroy (GtkObject *object) (EelPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, sidebar_tabs); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DEFAULT_FONT, - default_font_changed_callback, - sidebar_tabs); - - pango_font_description_free (sidebar_tabs->details->tab_font); - g_free (sidebar_tabs->details); sidebar_tabs->details = NULL; } @@ -603,11 +578,18 @@ make_tab_text_layout (NautilusSidebarTabs *sidebar_tabs, const char *tab_name) { PangoLayout *layout; + PangoFontDescription *desc; + PangoContext *context; - layout = pango_layout_new (eel_gtk_widget_get_pango_ft2_context (GTK_WIDGET (sidebar_tabs))); + context = eel_gtk_widget_get_pango_ft2_context (GTK_WIDGET (sidebar_tabs)); + layout = pango_layout_new (context); pango_layout_set_text (layout, tab_name, -1); - pango_layout_set_font_description (layout, sidebar_tabs->details->tab_font); + desc = pango_font_description_copy (pango_context_get_font_description (context)); + pango_font_description_set_size (desc, DEFAULT_FONT_SIZE * PANGO_SCALE); + pango_layout_set_font_description (layout, desc); + pango_font_description_free (desc); + return layout; } |