summaryrefslogtreecommitdiff
path: root/libnautilus-extensions
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2000-07-05 17:26:37 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2000-07-05 17:26:37 +0000
commit1a3bf03d52dea207526d86a24cbf283ac0a6a52b (patch)
treee9900ef26fc86f67591ddafb07c20153d76afadc /libnautilus-extensions
parentfb85312413c21b4a3a6cce67998b9c0fab70f699 (diff)
downloadnautilus-1a3bf03d52dea207526d86a24cbf283ac0a6a52b.tar.gz
libnautilus-extensions/nautilus-icon-container.c, New function to set the
* libnautilus-extensions/nautilus-icon-container.c, * libnautilus-extensions/nautilus-icon-container.h: (nautilus_icon_container_set_label_font_for_zoom_level): New function to set the font for a zoom level. (nautilus_icon_container_initialize), Initialize to fonts to a well known font. Dont look at font preferences here. Fonts should be suppied by the icon container user. * src/file-manager/fm-icon-view.c: (fm_icon_view_update_icon_container_fonts), New function to update the icon container's zoom level specific fonts. (directory_view_font_familiy_changed_callback), (fm_icon_view_initialize), (fm_icon_view_destroy), Keep track of font familiy preference changes and update the icon container fonts as needed. (create_icon_container): Update the fonts for the first time when the icon container is created.
Diffstat (limited to 'libnautilus-extensions')
-rw-r--r--libnautilus-extensions/nautilus-icon-container.c37
-rw-r--r--libnautilus-extensions/nautilus-icon-container.h78
2 files changed, 70 insertions, 45 deletions
diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c
index 55b0fcf7d..2d89deeeb 100644
--- a/libnautilus-extensions/nautilus-icon-container.c
+++ b/libnautilus-extensions/nautilus-icon-container.c
@@ -2406,17 +2406,14 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
- /* FIXME: Fonts should be supplied by the caller and not
- * hard-wired calls from NautilusIconContainer to font factory.
- */
/* font table - this isn't exactly proportional, but it looks better than computed */
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = nautilus_font_factory_get_font_from_preferences (8);
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_from_preferences (8);
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = nautilus_font_factory_get_font_from_preferences (10);
- details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = nautilus_font_factory_get_font_from_preferences (12);
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = nautilus_font_factory_get_font_from_preferences (14);
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = nautilus_font_factory_get_font_from_preferences (18);
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_from_preferences (18);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = nautilus_font_factory_get_font_by_family ("helvetica", 10);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = nautilus_font_factory_get_font_by_family ("helvetica", 12);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = nautilus_font_factory_get_font_by_family ("helvetica", 14);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
+ details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
container->details = details;
@@ -3708,6 +3705,26 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai
return FALSE;
}
+void
+nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
+ int zoom_level,
+ GdkFont *font)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
+ g_return_if_fail (font != NULL);
+ g_return_if_fail (zoom_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST);
+ g_return_if_fail (zoom_level <= NAUTILUS_ZOOM_LEVEL_LARGEST);
+
+ if (container->details->label_font[zoom_level] != NULL) {
+ gdk_font_unref (container->details->label_font[zoom_level]);
+ }
+
+ gdk_font_ref (font);
+
+ container->details->label_font[zoom_level] = font;
+}
+
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char *
diff --git a/libnautilus-extensions/nautilus-icon-container.h b/libnautilus-extensions/nautilus-icon-container.h
index 45c0c5fc1..0cc2ec9ba 100644
--- a/libnautilus-extensions/nautilus-icon-container.h
+++ b/libnautilus-extensions/nautilus-icon-container.h
@@ -123,50 +123,58 @@ struct NautilusIconContainerClass {
};
/* GtkObject */
-guint nautilus_icon_container_get_type (void);
-GtkWidget *nautilus_icon_container_new (void);
+guint nautilus_icon_container_get_type (void);
+GtkWidget *nautilus_icon_container_new (void);
+
/* adding, removing, and managing icons */
-void nautilus_icon_container_clear (NautilusIconContainer *view);
-gboolean nautilus_icon_container_add (NautilusIconContainer *view,
- NautilusIconData *data);
-gboolean nautilus_icon_container_remove (NautilusIconContainer *view,
- NautilusIconData *data);
-void nautilus_icon_container_request_update (NautilusIconContainer *view,
- NautilusIconData *data);
-void nautilus_icon_container_request_update_all (NautilusIconContainer *container);
+void nautilus_icon_container_clear (NautilusIconContainer *view);
+gboolean nautilus_icon_container_add (NautilusIconContainer *view,
+ NautilusIconData *data);
+gboolean nautilus_icon_container_remove (NautilusIconContainer *view,
+ NautilusIconData *data);
+void nautilus_icon_container_request_update (NautilusIconContainer *view,
+ NautilusIconData *data);
+void nautilus_icon_container_request_update_all (NautilusIconContainer *container);
+
/* control the layout */
-gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container);
-void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
- gboolean auto_layout);
-void nautilus_icon_container_sort (NautilusIconContainer *container);
-void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container);
+gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container);
+void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
+ gboolean auto_layout);
+void nautilus_icon_container_sort (NautilusIconContainer *container);
+void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container);
+
/* operations on all icons */
-void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
-void nautilus_icon_container_select_all (NautilusIconContainer *view);
+void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
+void nautilus_icon_container_select_all (NautilusIconContainer *view);
+
/* operations on the selection */
-GList *nautilus_icon_container_get_selection (NautilusIconContainer *view);
-void nautilus_icon_container_set_selection (NautilusIconContainer *view,
- GList *selection);
-gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container);
-gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container);
-void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container);
-void nautilus_icon_container_unstretch (NautilusIconContainer *container);
-void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container);
-gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container);
+GList *nautilus_icon_container_get_selection (NautilusIconContainer *view);
+void nautilus_icon_container_set_selection (NautilusIconContainer *view,
+ GList *selection);
+gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container);
+gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container);
+void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container);
+void nautilus_icon_container_unstretch (NautilusIconContainer *container);
+void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container);
+gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container);
+
/* options */
-int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view);
-void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view,
- int new_zoom_level);
-void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view,
- gboolean single_click_mode);
-void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
- gboolean enable);
-void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view,
- gboolean anti_aliased_mode);
+int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view);
+void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view,
+ int new_zoom_level);
+void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view,
+ gboolean single_click_mode);
+void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
+ gboolean enable);
+void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view,
+ gboolean anti_aliased_mode);
+void nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
+ int zoom_level,
+ GdkFont *font);
#endif