diff options
Diffstat (limited to 'embed/ephy-embed-prefs.c')
-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 }, |