diff options
author | Diego Escalante Urrelo <descalante@igalia.com> | 2010-12-08 02:51:11 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <descalante@igalia.com> | 2010-12-08 23:56:12 +0800 |
commit | 4015281028a036ee859360bb7feb3a6aeb8f56cb (patch) | |
tree | f9d8b7f71a4229d8b44d1180698e8f892635e880 /embed | |
parent | bc03f56a7483e499274cf1632975dfbb7e09e9ec (diff) | |
download | gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar.gz gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar.bz2 gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar.lz gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar.xz gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.tar.zst gsoc2013-epiphany-4015281028a036ee859360bb7feb3a6aeb8f56cb.zip |
prefs-dialog: new custom font selection UI
Allow users to set custom sans, serif and monospace fonts if they don't want
the defaults, which are the desktop wide settings in the
org.gnome.desktop.interface schema.
Bug #636761
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-prefs.c | 107 |
1 files changed, 105 insertions, 2 deletions
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c index e2a279dc4..daea9fb8e 100644 --- a/embed/ephy-embed-prefs.c +++ b/embed/ephy-embed-prefs.c @@ -151,6 +151,19 @@ webkit_pref_callback_font_size (GSettings *settings, char *value = NULL; int size = 9; /* FIXME: What to use here? */ + char *schema = NULL; + g_object_get (settings, "schema", &schema, NULL); + + /* If we are changing a GNOME font value and we are not using GNOME fonts in + * Epiphany, return. */ + if (g_strcmp0 (schema, EPHY_PREFS_WEB_SCHEMA) != 0 && + g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE) + { + g_free (schema); + return; + } + g_free (schema); + value = g_settings_get_string (settings, key); if (value) { @@ -175,6 +188,19 @@ webkit_pref_callback_font_family (GSettings *settings, char *webkit_pref = data; char *value = NULL; + char *schema = NULL; + g_object_get (settings, "schema", &schema, NULL); + + /* If we are changing a GNOME font value and we are not using GNOME fonts in + * Epiphany, return. */ + if (g_strcmp0 (schema, EPHY_PREFS_WEB_SCHEMA) != 0 && + g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE) + { + g_free (schema); + return; + } + g_free (schema); + value = g_settings_get_string (settings, key); if (value) { @@ -323,13 +349,62 @@ webkit_pref_callback_cookie_accept_policy (GSettings *settings, g_free (value); } +static void +webkit_pref_callback_gnome_fonts (GSettings *ephy_settings, + char *key, + gpointer data) +{ + GSettings *settings; + + if (g_settings_get_boolean (ephy_settings, key)) { + settings = ephy_settings_get ("org.gnome.desktop.interface"); + + webkit_pref_callback_font_size (settings, "font-name", + "default-font-size"); + webkit_pref_callback_font_size (settings, "monospace-font-name", + "default-monospace-font-size"); + + webkit_pref_callback_font_family (settings, "font-name", + "default-font-family"); + webkit_pref_callback_font_family (settings, "font-name", + "sans-serif-font-family"); + + webkit_pref_callback_font_family (settings, "monospace-font-name", + "monospace-font-family"); + } else { + /* Sync with Epiphany values */ + settings = ephy_settings; + + webkit_pref_callback_font_size (settings, EPHY_PREFS_WEB_SANS_SERIF_FONT, + "default-font-size"); + webkit_pref_callback_font_size (settings, EPHY_PREFS_WEB_MONOSPACE_FONT, + "default-monospace-font-size"); + + webkit_pref_callback_font_family (settings, EPHY_PREFS_WEB_SANS_SERIF_FONT, + "default-font-family"); + webkit_pref_callback_font_family (settings, EPHY_PREFS_WEB_SANS_SERIF_FONT, + "sans-serif-font-family"); + + webkit_pref_callback_font_family (settings, EPHY_PREFS_WEB_MONOSPACE_FONT, + "monospace-font-family"); + + webkit_pref_callback_font_family (settings, EPHY_PREFS_WEB_SERIF_FONT, + "serif-font-family"); + } +} + static const PrefData webkit_pref_entries[] = { + /* GNOME font settings */ { "org.gnome.desktop.interface", "font-name", "default-font-size", webkit_pref_callback_font_size }, { "org.gnome.desktop.interface", + "monospace-font-name", + "default-monospace-font-size", + webkit_pref_callback_font_size }, + { "org.gnome.desktop.interface", "font-name", "default-font-family", webkit_pref_callback_font_family }, @@ -339,13 +414,41 @@ static const PrefData webkit_pref_entries[] = webkit_pref_callback_font_family }, { "org.gnome.desktop.interface", "monospace-font-name", + "monospace-font-family", + webkit_pref_callback_font_family }, + + /* Epiphany font settings */ + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_SANS_SERIF_FONT, + "default-font-size", + webkit_pref_callback_font_size }, + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_MONOSPACE_FONT, "default-monospace-font-size", webkit_pref_callback_font_size }, - { "org.gnome.desktop.interface", - "monospace-font-name", + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_SANS_SERIF_FONT, + "default-font-family", + webkit_pref_callback_font_family }, + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_SANS_SERIF_FONT, + "sans-serif-font-family", + webkit_pref_callback_font_family }, + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_MONOSPACE_FONT, "monospace-font-family", webkit_pref_callback_font_family }, { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_SERIF_FONT, + "serif-font-family", + webkit_pref_callback_font_family }, + + { EPHY_PREFS_WEB_SCHEMA, + EPHY_PREFS_WEB_USE_GNOME_FONTS, + NULL, + webkit_pref_callback_gnome_fonts }, + + { EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_USER_CSS, "user-stylesheet-uri", webkit_pref_callback_user_stylesheet }, |