Re: desktop font + PATCH for 82565



> ahh i see. ok list view and icon view fonts use the gtk system font. the
> desktop font uses the "file manager font" but that string was fixed to
> be "Desktop font." So you need to pretty much upgrade everything to cvs.
> 

Just as this was fixed I started working on the attached patch that
makes Nautilus use the "File manager font" for all the views. I think we
should revert that string change and use this patch instead. It makes
way more sense to let the file manager use a different font for all
views, not only the desktop view.

If the patch will be used I can clean it up. Major issue with it right
now is that I can't get the treeview (for the list view) to use a
different font after it is shown. Any ideas? I tried to destroy and
re-show it but that just gives me a blank window. This is needed so that
the dynamic update after a GConf notify works. 

Patch is attached.

- Frank

Index: file-manager/fm-desktop-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-desktop-icon-view.c,v
retrieving revision 1.175
diff -u -p -r1.175 fm-desktop-icon-view.c
--- file-manager/fm-desktop-icon-view.c	2002/05/24 21:54:08	1.175
+++ file-manager/fm-desktop-icon-view.c	2002/05/28 22:16:47
@@ -122,7 +122,6 @@ static void     update_disks_menu       
 static void     free_volume_black_list                            (FMDesktopIconView      *view);
 static gboolean	volume_link_is_selection 			  (FMDirectoryView 	  *view);
 static NautilusDeviceType volume_link_device_type                 (FMDirectoryView        *view);
-static void     fm_desktop_icon_view_update_icon_container_fonts  (FMDesktopIconView      *view);
 
 EEL_CLASS_BOILERPLATE (FMDesktopIconView,
 			      fm_desktop_icon_view,
@@ -567,30 +566,6 @@ delayed_init (FMDesktopIconView *desktop
 }
 
 static void
-font_changed_callback (gpointer callback_data)
-{
- 	g_return_if_fail (FM_IS_DESKTOP_ICON_VIEW (callback_data));
-	
-	fm_desktop_icon_view_update_icon_container_fonts (FM_DESKTOP_ICON_VIEW (callback_data));
-}
-
-static void
-fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *icon_view)
-{
-	NautilusIconContainer *icon_container;
-	char *font;
-	
-	icon_container = get_icon_container (icon_view);
-	g_assert (icon_container != NULL);
-
-	font = eel_preferences_get (NAUTILUS_PREFERENCES_DESKTOP_FONT);
-
-	nautilus_icon_container_set_font (icon_container, font);
-
-	g_free (font);
-}
-
-static void
 fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
 {
 	GList *list;
@@ -676,12 +651,7 @@ fm_desktop_icon_view_init (FMDesktopIcon
 				      default_zoom_level_changed,
 				      desktop_icon_view);
 	
-	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_FONT,
-						  font_changed_callback, 
-						  desktop_icon_view, G_OBJECT (desktop_icon_view));
-	
 	default_zoom_level_changed (desktop_icon_view);
-	fm_desktop_icon_view_update_icon_container_fonts (desktop_icon_view);
 
 	/* Read out the panel desktop area and update the icon container
 	 * accordingly */
Index: file-manager/fm-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-container.c,v
retrieving revision 1.3
diff -u -p -r1.3 fm-icon-container.c
--- file-manager/fm-icon-container.c	2002/05/17 19:58:11	1.3
+++ file-manager/fm-icon-container.c	2002/05/28 22:16:47
@@ -47,6 +47,26 @@ get_icon_view (NautilusIconContainer *co
 	return FM_ICON_CONTAINER (container)->view;
 }
 
+static void
+fm_icon_container_update_font (NautilusIconContainer *container)
+{
+	char *font;
+	
+	font = eel_preferences_get (NAUTILUS_PREFERENCES_DESKTOP_FONT);
+
+	nautilus_icon_container_set_font (container, font);
+
+	g_free (font);
+}
+
+static void 
+font_changed_callback (gpointer callback_data)
+{
+	g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (callback_data));
+	
+	fm_icon_container_update_font (NAUTILUS_ICON_CONTAINER (callback_data));
+}
+
 static NautilusScalableIcon *
 fm_icon_container_get_icon_images (NautilusIconContainer *container,
 				   NautilusIconData      *data,
@@ -408,9 +428,19 @@ fm_icon_container_construct (FMIconConta
 NautilusIconContainer *
 fm_icon_container_new (FMIconView *view)
 {
-	return fm_icon_container_construct
-		(g_object_new (FM_TYPE_ICON_CONTAINER, NULL),
-		 view);
+	NautilusIconContainer *container;
+	
+	container = fm_icon_container_construct
+				(g_object_new (FM_TYPE_ICON_CONTAINER, NULL),
+				 view);
+
+	fm_icon_container_update_font (container);
+
+	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_FONT,
+						  font_changed_callback, 
+						  container, G_OBJECT (container));
+						  
+	return container;
 }
 
 void
Index: file-manager/fm-list-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-view.c,v
retrieving revision 1.174
diff -u -p -r1.174 fm-list-view.c
--- file-manager/fm-list-view.c	2002/05/21 09:43:37	1.174
+++ file-manager/fm-list-view.c	2002/05/28 22:16:47
@@ -31,6 +31,7 @@
 #include "fm-error-reporting.h"
 #include "fm-list-model.h"
 #include <eel/eel-cell-renderer-pixbuf-list.h>
+#include <eel/eel-gtk-extensions.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkcellrendererpixbuf.h>
 #include <gtk/gtkcellrenderertext.h>
@@ -80,6 +81,7 @@ static GList *              fm_list_view
 static void                 fm_list_view_set_zoom_level        (FMListView *view,
 								NautilusZoomLevel new_level,
 								gboolean always_set_level);
+static void				create_and_set_up_tree_view 		(FMListView *view);
 
 GNOME_CLASS_BOILERPLATE (FMListView, fm_list_view,
 			 FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
@@ -281,6 +283,28 @@ cell_renderer_edited (GtkCellRendererTex
 	nautilus_file_unref (file);
 }
 
+static void update_tree_view_font (GtkTreeView *tree_view)
+{
+	char *font;
+	
+	font = eel_preferences_get (NAUTILUS_PREFERENCES_DESKTOP_FONT);
+	
+	eel_gtk_widget_set_font_by_name (GTK_WIDGET (tree_view), font);
+	
+	g_free (font);
+}
+
+static void font_changed_callback (gpointer callback_data)
+{
+	FMListView *view;
+	
+	g_return_if_fail (FM_IS_LIST_VIEW (callback_data));
+	
+	view = FM_LIST_VIEW (callback_data);
+
+	update_tree_view_font (view->details->tree_view);
+}
+
 static void
 create_and_set_up_tree_view (FMListView *view)
 {
@@ -314,6 +338,12 @@ create_and_set_up_tree_view (FMListView 
 	gtk_tree_view_enable_model_drag_source (view->details->tree_view, 0,
 						drag_types, G_N_ELEMENTS (drag_types),
 						GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
+
+	update_tree_view_font (view->details->tree_view);
+	
+	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_FONT,
+						  font_changed_callback, 
+						  view, G_OBJECT (view));
 
 	/* Create the file name column */
 	cell = gtk_cell_renderer_pixbuf_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]