Remove font preferences from Nautilus
- From: Pier Luigi Fiorini <plfiorini supereva it>
- To: nautilus-list gnome org
- Cc: gnome-doc-list gnome org
- Subject: Remove font preferences from Nautilus
- Date: 11 May 2002 11:46:02 +0200
Hello guys.
In GNOME 2.0 Control Center there's a "Font" capplet that makes easy and
comfortable, for the users, change widget and desktop fonts.
But in Nautilus you can find 3 font preferences (relative to
desktop/sidebar, icon view and list view).
I think for usability this is bad, so I filled this bug in bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=81337
I made 2 patches (one for Nautilus and one for the font capplet).
The Nautilus patch removes font preferences from Nautilus and makes icon
view, list view and music view fonts match to the desktop fonts using
the gconf key /desktop/gnome/interface/desktop_font_name
The old /apps/nautilus/preferences/default_font_size gconf key is
obsolete now, because I used the pango_font_description_* API to
retrieve the font size defined in
/desktop/gnome/interface/desktop_font_name
The font capplet patch remove the
/apps/nautilus/preferences/default_font_size gconf key and change the
desktop font key to /desktop/gnome/interface/desktop_font_name
Here's the nautilus patch:
--- nautilus/components/music/nautilus-music-view.c-bak Fri Apr 5 13:54:34 2002
+++ nautilus/components/music/nautilus-music-view.c Sat May 11 00:31:23 2002
@@ -336,26 +336,22 @@
set_up_tree_view (NautilusMusicView *music_view)
{
int standard_font_size;
- char *font_name;
- PangoFontDescription *new_font;
+ PangoFontDescription *font;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
GtkTreeView *tree_view;
- font_name = eel_preferences_get (NAUTILUS_PREFERENCES_LIST_VIEW_FONT);
- standard_font_size = eel_preferences_get_enum (
- NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE);
-
- new_font = pango_font_description_from_string (font_name);
- pango_font_description_set_size (new_font, standard_font_size * PANGO_SCALE);
+ font = pango_font_description_from_string (eel_preferences_get (NAUTILUS_PREFERENCES_DEFAULT_FONT));
+ standard_font_size = pango_font_description_get_size (font);
+ pango_font_description_set_size (font, standard_font_size * PANGO_SCALE);
tree_view = GTK_TREE_VIEW (music_view->details->tree_view);
- gtk_widget_modify_font (GTK_WIDGET (tree_view), new_font);
+ gtk_widget_modify_font (GTK_WIDGET (tree_view), font);
/* The track number column */
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "xalign", 1.0, "font_desc", new_font, NULL);
+ g_object_set (cell, "xalign", 1.0, "font_desc", font, NULL);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Track"));
@@ -369,7 +365,7 @@
/* The name column */
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "font_desc", new_font, NULL);
+ g_object_set (cell, "font_desc", font, NULL);
column = gtk_tree_view_column_new_with_attributes (_("Title"),
cell,
"text", TITLE_COLUMN,
@@ -380,7 +376,7 @@
/* The artist column */
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "font_desc", new_font, NULL);
+ g_object_set (cell, "font_desc", font, NULL);
column = gtk_tree_view_column_new_with_attributes (_("Artist"),
cell,
"text", ARTIST_COLUMN,
@@ -391,7 +387,7 @@
/* The bitrate column */
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "xalign", 1.0, "font_desc", new_font, NULL);
+ g_object_set (cell, "xalign", 1.0, "font_desc", font, NULL);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Bit Rate"));
gtk_tree_view_column_pack_start (column, cell, TRUE);
@@ -404,7 +400,7 @@
/* The time column */
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "xalign", 1.0, "font_desc", new_font, NULL);
+ g_object_set (cell, "xalign", 1.0, "font_desc", font, NULL);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Time"));
gtk_tree_view_column_pack_start (column, cell, TRUE);
@@ -415,7 +411,7 @@
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (tree_view, column);
- pango_font_description_free (new_font);
+ pango_font_description_free (font);
}
/* initialize ourselves by connecting to the location change signal and allocating our subviews */
--- nautilus/libnautilus-private/nautilus-global-preferences.c-bak Thu May 9 21:49:32 2002
+++ nautilus/libnautilus-private/nautilus-global-preferences.c Sat May 11 00:38:32 2002
@@ -52,7 +52,6 @@
/* Forward declarations */
static void global_preferences_install_defaults (void);
static void global_preferences_register_enumerations (void);
-static gpointer default_font_callback (void);
static gpointer default_home_location_callback (void);
static gpointer default_default_folder_viewer_callback (void);
static void import_old_preferences_if_needed (void);
@@ -198,19 +197,6 @@
{ NULL }
};
-static EelEnumerationEntry standard_font_size_entries[] = {
- { "8", N_("8"), 8 },
- { "10", N_("10"), 10 },
- { "12", N_("12"), 12 },
- { "14", N_("14"), 14 },
- { "16", N_("16"), 16 },
- { "18", N_("18"), 18 },
- { "20", N_("20"), 20 },
- { "22", N_("22"), 22 },
- { "24", N_("24"), 24 },
- { NULL }
-};
-
static EelEnumerationEntry icon_captions_enum_entries[] = {
{ "size", N_("size"), 0 },
{ "type", N_("type"), 1 },
@@ -241,7 +227,6 @@
{ "icon_captions", icon_captions_enum_entries },
{ "search_bar_type", search_bar_type_enum_entries },
{ "speed_tradeoff", speed_tradeoff_enum_entries },
- { "standard_font_size", standard_font_size_entries },
{ NULL }
};
@@ -448,30 +433,7 @@
NULL, default_home_location_callback, g_free
},
- /* Default fonts */
- { NAUTILUS_PREFERENCES_DEFAULT_FONT,
- PREFERENCE_STRING,
- NULL, default_font_callback, g_free
- },
- { NAUTILUS_PREFERENCES_DEFAULT_FONT_SIZE,
- PREFERENCE_STRING,
- "12",
- NULL, NULL,
- "standard_font_size"
- },
-
/* Icon View Default Preferences */
-
- { NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
- PREFERENCE_STRING,
- NULL, default_font_callback, g_free
- },
- { NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- PREFERENCE_STRING,
- "12",
- NULL, NULL,
- "standard_font_size"
- },
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
PREFERENCE_STRING,
"name",
@@ -504,16 +466,6 @@
},
/* List View Default Preferences */
- { NAUTILUS_PREFERENCES_LIST_VIEW_FONT,
- PREFERENCE_STRING,
- NULL, default_font_callback, g_free
- },
- { NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- PREFERENCE_STRING,
- "12",
- NULL, NULL,
- "standard_font_size"
- },
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
PREFERENCE_STRING,
"name",
@@ -674,12 +626,6 @@
preference_defaults[i].type,
&preference_defaults[i]);
}
-}
-
-static gpointer
-default_font_callback (void)
-{
- return g_strdup ("sans");
}
static int
--- nautilus/libnautilus-private/nautilus-global-preferences.h-bak Thu May 9 21:49:32 2002
+++ nautilus/libnautilus-private/nautilus-global-preferences.h Sat May 11 01:00:44 2002
@@ -60,8 +60,7 @@
#define NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS "preferences/hide_built_in_bookmarks"
/* Content fonts */
-#define NAUTILUS_PREFERENCES_DEFAULT_FONT "preferences/default_font"
-#define NAUTILUS_PREFERENCES_DEFAULT_FONT_SIZE "preferences/default_font_size"
+#define NAUTILUS_PREFERENCES_DEFAULT_FONT "/desktop/gnome/interface/desktop_font_name"
/* Single/Double click preference */
#define NAUTILUS_PREFERENCES_CLICK_POLICY "preferences/click_policy"
@@ -104,7 +103,6 @@
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "icon_view/default_zoom_level"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE "icon_view/default_zoom_level_font_size"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon_view/default_use_manual_layout"
-#define NAUTILUS_PREFERENCES_ICON_VIEW_FONT "icon_view/font"
/* The icon view uses 2 variables to store the sort order and
* whether to use manual layout. However, the UI for these
@@ -123,7 +121,6 @@
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER "list_view/default_sort_order"
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "list_view/default_zoom_level"
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE "list_view/default_zoom_level_font_size"
-#define NAUTILUS_PREFERENCES_LIST_VIEW_FONT "list_view/font"
/* News panel */
#define NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS "news/max_items"
--- nautilus/libnautilus-private/apps_nautilus_preferences.schemas-bak Thu May 9 21:49:31 2002
+++ nautilus/libnautilus-private/apps_nautilus_preferences.schemas Sat May 11 00:59:38 2002
@@ -593,33 +593,5 @@
</locale>
</schema>
- <schema>
- <key>/schemas/apps/nautilus/list_view/font</key>
- <applyto>/apps/nautilus/list_view/font</applyto>
- <owner>nautilus</owner>
- <type>string</type>
- <default>sans</default>
- <locale name="C">
- <short>The default list view font</short>
- <long>
- The default font for use in the list view.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/nautilus/list_view/default_zoom_level_font_size</key>
- <applyto>/apps/nautilus/list_view/default_zoom_level_font_size</applyto>
- <owner>nautilus</owner>
- <type>string</type>
- <default>12</default>
- <locale name="C">
- <short>Default zoom font size</short>
- <long>
- The font size at default zoom in the list view.
- </long>
- </locale>
- </schema>
-
</schemalist>
</gconfschemafile>
--- nautilus/src/file-manager/fm-icon-view.c-bak Thu May 9 22:40:53 2002
+++ nautilus/src/file-manager/fm-icon-view.c Sat May 11 11:12:59 2002
@@ -1893,13 +1893,6 @@
g_return_if_fail (FM_IS_ICON_VIEW (callback_data));
fm_icon_view_update_icon_container_fonts (FM_ICON_VIEW (callback_data));
-}
-
-static void
-default_zoom_level_font_size_changed_callback (gpointer callback_data)
-{
- g_return_if_fail (FM_IS_ICON_VIEW (callback_data));
-
fm_icon_view_update_icon_container_font_size_table (FM_ICON_VIEW (callback_data));
}
@@ -2081,7 +2074,7 @@
icon_container = get_icon_container (icon_view);
g_assert (icon_container != NULL);
- font_name = eel_preferences_get (NAUTILUS_PREFERENCES_ICON_VIEW_FONT);
+ font_name = eel_preferences_get (NAUTILUS_PREFERENCES_DEFAULT_FONT);
nautilus_icon_container_set_font_name (icon_container, font_name);
@@ -2093,13 +2086,14 @@
static int
get_default_zoom_level_font_size (void)
{
- static gboolean auto_storaged_added = FALSE;
+ char *font_name;
+ PangoFontDescription *font;
- if (auto_storaged_added == FALSE) {
- auto_storaged_added = TRUE;
- eel_preferences_add_auto_enum (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- &default_zoom_level_font_size);
- }
+ font_name = eel_preferences_get (NAUTILUS_PREFERENCES_DEFAULT_FONT);
+ font = pango_font_description_from_string (font_name);
+ default_zoom_level_font_size = (pango_font_description_get_size (font) / PANGO_SCALE);
+ pango_font_description_free (font);
+ g_free (font_name);
return default_zoom_level_font_size;
}
@@ -2447,11 +2441,8 @@
setup_sound_preview = TRUE;
}
- eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
+ eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DEFAULT_FONT,
font_changed_callback,
- icon_view, G_OBJECT (icon_view));
- eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- default_zoom_level_font_size_changed_callback,
icon_view, G_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
default_sort_order_changed_callback,
--- nautilus/src/nautilus-preferences-dialog.c-bak Thu May 9 21:49:33 2002
+++ nautilus/src/nautilus-preferences-dialog.c Sat May 11 00:14:24 2002
@@ -51,11 +51,6 @@
static GtkWidget *preferences_dialog;
static EelPreferencesItemDescription appearance_items[] = {
- { N_("Fonts"),
- NAUTILUS_PREFERENCES_DEFAULT_FONT,
- N_("Default font:"),
- EEL_PREFERENCE_ITEM_FONT,
- },
{ N_("Nautilus Themes"),
NULL,
NULL,
@@ -189,11 +184,6 @@
EEL_PREFERENCE_ITEM_BOOLEAN
},
{ N_("Icon View Defaults"),
- NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
- N_("Font:"),
- EEL_PREFERENCE_ITEM_FONT
- },
- { N_("Icon View Defaults"),
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
N_("Default zoom level:"),
EEL_PREFERENCE_ITEM_ENUMERATION_MENU,
@@ -205,12 +195,6 @@
EEL_PREFERENCE_ITEM_BOOLEAN,
NULL, 0, 1
},
- { N_("Icon View Defaults"),
- NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- N_("Font size at default zoom level:"),
- EEL_PREFERENCE_ITEM_ENUMERATION_MENU,
- NULL, 0, 1
- },
/* List View Defaults */
{ N_("List View Defaults"),
@@ -224,11 +208,6 @@
EEL_PREFERENCE_ITEM_BOOLEAN
},
{ N_("List View Defaults"),
- NAUTILUS_PREFERENCES_LIST_VIEW_FONT,
- N_("Font:"),
- EEL_PREFERENCE_ITEM_FONT
- },
- { N_("List View Defaults"),
NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
N_("Default zoom level:"),
EEL_PREFERENCE_ITEM_ENUMERATION_MENU,
@@ -238,12 +217,6 @@
"dummy-string",
NULL,
EEL_PREFERENCE_ITEM_PADDING,
- NULL, 0, 1
- },
- { N_("List View Defaults"),
- NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
- N_("Font size at default zoom level:"),
- EEL_PREFERENCE_ITEM_ENUMERATION_MENU,
NULL, 0, 1
},
{ NULL }
--- nautilus/ChangeLog-bak Thu May 9 22:49:44 2002
+++ nautilus/ChangeLog Sat May 11 11:43:59 2002
@@ -0,0 +1,16 @@
+2002-05-11 Pier Luigi Fiorini <plfiorini supereva it>
+
+ * src/file-manager/fm-icon-view.c (get_default_zoom_level_font_size):
+ Divide for PANGO_SCALE the font size because pango_font_description_get_size()
+ return a large number.
+
+2002-05-10 Pier Luigi Fiorini <plfiorini supereva it>
+
+ * libnautilus-private/apps_nautilus_preferences.schemas:
+ * libnautilus-private/nautilus-global-preferences.[ch]:
+ * src/nautilus-preferences-dialog.c:
+ * src/file-manager/fm-icon-view.c:
+ * components/music/nautilus-music-view.c:
+ Removed font preferences from Nautilus.
+ Fixes bug #81337.
+
Here's the capplet patch:
--- gnome-control-center/capplets/font/main.c-bak Fri May 10 23:30:06 2002
+++ gnome-control-center/capplets/font/main.c Sat May 11 01:54:19 2002
@@ -15,8 +15,7 @@
#include "gconf-property-editor.h"
#define GTK_FONT_KEY "/desktop/gnome/interface/font_name"
-#define DESKTOP_FONT_NAME_KEY "/apps/nautilus/preferences/default_font"
-#define DESKTOP_FONT_SIZE_KEY "/apps/nautilus/preferences/default_font_size"
+#define DESKTOP_FONT_NAME_KEY "/desktop/gnome/interface/desktop_font_name"
static GladeXML *
create_dialog (void)
@@ -64,11 +63,7 @@
peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_NAME_KEY,
WID ("desktop_font"),
- PEDITOR_FONT_NAME, NULL);
-
- peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_SIZE_KEY,
- WID ("desktop_font"),
- PEDITOR_FONT_SIZE, NULL);
+ PEDITOR_FONT_COMBINED, NULL);
widget = WID ("font_dialog");
gtk_widget_show (widget);
--- gnome-control-center/capplets/font/ChangeLog-bak Fri May 10 23:30:06 2002
+++ gnome-control-center/capplets/font/ChangeLog Sat May 11 00:55:53 2002
@@ -0,0 +1,5 @@
+2002-05-10 Pier Luigi Fiorini <plfiorini supereva it>
+
+ * main.c: Changed DESKTOP_FONT_NAME_KEY to the new GConf key name and remove obsolete
+ DESKTOP_FONT_SIZE_KEY GConf key.
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]