Commit 1a3bf03d authored by Ramiro Estrugo's avatar Ramiro Estrugo
Browse files

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.
parent fb853124
2000-07-05 Ramiro Estrugo <ramiro@eazel.com>
* 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.
2000-07-05 Ramiro Estrugo <ramiro@eazel.com> 2000-07-05 Ramiro Estrugo <ramiro@eazel.com>
* libnautilus-extensions/nautilus-string-picker.c: * libnautilus-extensions/nautilus-string-picker.c:
......
...@@ -2406,17 +2406,14 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) ...@@ -2406,17 +2406,14 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; 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 */ /* 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_SMALLEST] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_from_preferences (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_from_preferences (10); 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_from_preferences (12); 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_from_preferences (14); 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_from_preferences (18); 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_from_preferences (18); details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
container->details = details; container->details = details;
...@@ -3708,6 +3705,26 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai ...@@ -3708,6 +3705,26 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai
return FALSE; 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) #if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char * static char *
......
...@@ -123,50 +123,58 @@ struct NautilusIconContainerClass { ...@@ -123,50 +123,58 @@ struct NautilusIconContainerClass {
}; };
/* GtkObject */ /* GtkObject */
guint nautilus_icon_container_get_type (void); guint nautilus_icon_container_get_type (void);
GtkWidget *nautilus_icon_container_new (void); GtkWidget *nautilus_icon_container_new (void);
/* adding, removing, and managing icons */ /* adding, removing, and managing icons */
void nautilus_icon_container_clear (NautilusIconContainer *view); void nautilus_icon_container_clear (NautilusIconContainer *view);
gboolean nautilus_icon_container_add (NautilusIconContainer *view, gboolean nautilus_icon_container_add (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
gboolean nautilus_icon_container_remove (NautilusIconContainer *view, gboolean nautilus_icon_container_remove (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
void nautilus_icon_container_request_update (NautilusIconContainer *view, void nautilus_icon_container_request_update (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
void nautilus_icon_container_request_update_all (NautilusIconContainer *container); void nautilus_icon_container_request_update_all (NautilusIconContainer *container);
/* control the layout */ /* control the layout */
gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container); gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container);
void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container, void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
gboolean auto_layout); gboolean auto_layout);
void nautilus_icon_container_sort (NautilusIconContainer *container); void nautilus_icon_container_sort (NautilusIconContainer *container);
void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container); void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container);
/* operations on all icons */ /* operations on all icons */
void nautilus_icon_container_unselect_all (NautilusIconContainer *view); void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
void nautilus_icon_container_select_all (NautilusIconContainer *view); void nautilus_icon_container_select_all (NautilusIconContainer *view);
/* operations on the selection */ /* operations on the selection */
GList *nautilus_icon_container_get_selection (NautilusIconContainer *view); GList *nautilus_icon_container_get_selection (NautilusIconContainer *view);
void nautilus_icon_container_set_selection (NautilusIconContainer *view, void nautilus_icon_container_set_selection (NautilusIconContainer *view,
GList *selection); GList *selection);
gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container); gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container);
gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container); gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container);
void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container); void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container);
void nautilus_icon_container_unstretch (NautilusIconContainer *container); void nautilus_icon_container_unstretch (NautilusIconContainer *container);
void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container); void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container);
gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container); gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container);
/* options */ /* options */
int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view); int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view);
void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view, void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view,
int new_zoom_level); int new_zoom_level);
void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view, void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view,
gboolean single_click_mode); gboolean single_click_mode);
void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view, void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
gboolean enable); gboolean enable);
void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view, void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view,
gboolean anti_aliased_mode); gboolean anti_aliased_mode);
void nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
int zoom_level,
GdkFont *font);
#endif #endif
...@@ -2406,17 +2406,14 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) ...@@ -2406,17 +2406,14 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; 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 */ /* 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_SMALLEST] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_from_preferences (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_from_preferences (10); 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_from_preferences (12); 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_from_preferences (14); 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_from_preferences (18); 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_from_preferences (18); details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
container->details = details; container->details = details;
...@@ -3708,6 +3705,26 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai ...@@ -3708,6 +3705,26 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai
return FALSE; 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) #if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char * static char *
......
...@@ -123,50 +123,58 @@ struct NautilusIconContainerClass { ...@@ -123,50 +123,58 @@ struct NautilusIconContainerClass {
}; };
/* GtkObject */ /* GtkObject */
guint nautilus_icon_container_get_type (void); guint nautilus_icon_container_get_type (void);
GtkWidget *nautilus_icon_container_new (void); GtkWidget *nautilus_icon_container_new (void);
/* adding, removing, and managing icons */ /* adding, removing, and managing icons */
void nautilus_icon_container_clear (NautilusIconContainer *view); void nautilus_icon_container_clear (NautilusIconContainer *view);
gboolean nautilus_icon_container_add (NautilusIconContainer *view, gboolean nautilus_icon_container_add (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
gboolean nautilus_icon_container_remove (NautilusIconContainer *view, gboolean nautilus_icon_container_remove (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
void nautilus_icon_container_request_update (NautilusIconContainer *view, void nautilus_icon_container_request_update (NautilusIconContainer *view,
NautilusIconData *data); NautilusIconData *data);
void nautilus_icon_container_request_update_all (NautilusIconContainer *container); void nautilus_icon_container_request_update_all (NautilusIconContainer *container);
/* control the layout */ /* control the layout */
gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container); gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container);
void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container, void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
gboolean auto_layout); gboolean auto_layout);
void nautilus_icon_container_sort (NautilusIconContainer *container); void nautilus_icon_container_sort (NautilusIconContainer *container);
void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container); void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container);
/* operations on all icons */ /* operations on all icons */
void nautilus_icon_container_unselect_all (NautilusIconContainer *view); void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
void nautilus_icon_container_select_all (NautilusIconContainer *view); void nautilus_icon_container_select_all (NautilusIconContainer *view);
/* operations on the selection */ /* operations on the selection */
GList *nautilus_icon_container_get_selection (NautilusIconContainer *view); GList *nautilus_icon_container_get_selection (NautilusIconContainer *view);
void nautilus_icon_container_set_selection (NautilusIconContainer *view, void nautilus_icon_container_set_selection (NautilusIconContainer *view,
GList *selection); GList *selection);
gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container); gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container);
gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container); gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container);
void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container); void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container);
void nautilus_icon_container_unstretch (NautilusIconContainer *container); void nautilus_icon_container_unstretch (NautilusIconContainer *container);
void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container); void nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *container);
gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container); gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container);
/* options */ /* options */
int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view); int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view);
void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view, void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view,
int new_zoom_level); int new_zoom_level);
void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view, void nautilus_icon_container_set_single_click_mode (NautilusIconContainer *view,
gboolean single_click_mode); gboolean single_click_mode);
void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view, void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
gboolean enable); gboolean enable);
void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view, void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view,
gboolean anti_aliased_mode); gboolean anti_aliased_mode);
void nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
int zoom_level,
GdkFont *font);
#endif #endif
...@@ -48,17 +48,18 @@ ...@@ -48,17 +48,18 @@
#include <libgnomevfs/gnome-vfs-xfer.h> #include <libgnomevfs/gnome-vfs-xfer.h>
#include <libgnomevfs/gnome-vfs-async-ops.h> #include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libnautilus/nautilus-bonobo-ui.h> #include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-directory-background.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h> #include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h> #include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-icon-container.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-link.h> #include <libnautilus-extensions/nautilus-link.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h> #include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-directory-background.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-icon-container.h>
/* Paths to use when creating & referring to Bonobo menu items */ /* Paths to use when creating & referring to Bonobo menu items */
#define MENU_PATH_STRETCH_ICON "/Settings/Stretch" #define MENU_PATH_STRETCH_ICON "/Settings/Stretch"
...@@ -75,13 +76,15 @@ ...@@ -75,13 +76,15 @@
#define MENU_PATH_RENAME "/File/Rename" #define MENU_PATH_RENAME "/File/Rename"
/* forward declarations */ /* forward declarations */
static void create_icon_container (FMIconView *icon_view); static void create_icon_container (FMIconView *icon_view);
static void fm_icon_view_initialize (FMIconView *icon_view); static void fm_icon_view_initialize (FMIconView *icon_view);
static void fm_icon_view_initialize_class (FMIconViewClass *klass); static void fm_icon_view_initialize_class (FMIconViewClass *klass);
static void fm_icon_view_set_zoom_level (FMIconView *view, static void fm_icon_view_set_zoom_level (FMIconView *view,
NautilusZoomLevel new_level, NautilusZoomLevel new_level,
gboolean always_set_level); gboolean always_set_level);
static void text_attribute_names_changed_callback (gpointer user_data); static void fm_icon_view_update_icon_container_fonts (FMIconView *icon_view);
static void text_attribute_names_changed_callback (gpointer user_data);
static void directory_view_font_familiy_changed_callback (gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW); NAUTILUS_DEFINE_CLASS_BOILERPLATE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW);
...@@ -166,6 +169,10 @@ fm_icon_view_destroy (GtkObject *object) ...@@ -166,6 +169,10 @@ fm_icon_view_destroy (GtkObject *object)
text_attribute_names_changed_callback, text_attribute_names_changed_callback,
icon_view); icon_view);
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
directory_view_font_familiy_changed_callback,
icon_view);
if (icon_view->details->react_to_icon_change_idle_id != 0) { if (icon_view->details->react_to_icon_change_idle_id != 0) {
gtk_idle_remove (icon_view->details->react_to_icon_change_idle_id); gtk_idle_remove (icon_view->details->react_to_icon_change_idle_id);
} }
...@@ -1505,6 +1512,15 @@ text_attribute_names_changed_callback (gpointer user_data) ...@@ -1505,6 +1512,15 @@ text_attribute_names_changed_callback (gpointer user_data)
(get_icon_container (FM_ICON_VIEW (user_data))); (get_icon_container (FM_ICON_VIEW (user_data)));
} }
static void
directory_view_font_familiy_changed_callback (gpointer user_data)
{
g_assert (user_data != NULL);
g_assert (FM_IS_ICON_VIEW (user_data));
fm_icon_view_update_icon_container_fonts (FM_ICON_VIEW (user_data));
}
/* GtkObject methods. */ /* GtkObject methods. */
static void static void
...@@ -1549,11 +1565,15 @@ fm_icon_view_initialize (FMIconView *icon_view) ...@@ -1549,11 +1565,15 @@ fm_icon_view_initialize (FMIconView *icon_view)
icon_view->details->default_zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; icon_view->details->default_zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
icon_view->details->sort = &sort_criteria[0]; icon_view->details->sort = &sort_criteria[0];
nautilus_preferences_add_callback
(NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES,
text_attribute_names_changed_callback, icon_view);
create_icon_container (icon_view); create_icon_container (icon_view);
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES,
text_attribute_names_changed_callback,
icon_view);
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
directory_view_font_familiy_changed_callback,
icon_view);
} }
static gboolean static gboolean
...@@ -1585,6 +1605,30 @@ icon_view_move_copy_items (NautilusIconContainer *container, ...@@ -1585,6 +1605,30 @@ icon_view_move_copy_items (NautilusIconContainer *container,
copy_action, x, y, view); copy_action, x, y, view);
} }
static void
fm_icon_view_update_icon_container_fonts (FMIconView *icon_view)
{
/* font size table - this isn't exactly proportional, but it looks better than computed */
static guint font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1] = {
8, 8, 10, 12, 14, 18, 18 };
NautilusIconContainer *icon_container;
guint i;
icon_container = get_icon_container (icon_view);
g_assert (icon_container != NULL);
for (i = 0; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
GdkFont *font;
font = nautilus_font_factory_get_font_from_preferences (font_size_table[i]);
g_assert (font != NULL);
nautilus_icon_container_set_label_font_for_zoom_level (icon_container, i, font);
gdk_font_unref (font);
}
nautilus_icon_container_request_update_all (icon_container);
}
static void static void
create_icon_container (FMIconView *icon_view) create_icon_container (FMIconView *icon_view)
{ {
...@@ -1664,5 +1708,7 @@ create_icon_container (FMIconView *icon_view) ...@@ -1664,5 +1708,7 @@ create_icon_container (FMIconView *icon_view)
gtk_container_add (GTK_CONTAINER (icon_view), gtk_container_add (GTK_CONTAINER (icon_view),
GTK_WIDGET (icon_container)); GTK_WIDGET (icon_container));
fm_icon_view_update_icon_container_fonts (icon_view);
gtk_widget_show (GTK_WIDGET (icon_container)); gtk_widget_show (GTK_WIDGET (icon_container));
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment