[epiphany] Use GNOME settings for default font sizes.



commit b7f534ac95a7d1fce61884286f0da067e67627e4
Author: Xan Lopez <xan gnome org>
Date:   Tue Apr 21 19:31:33 2009 +0300

    Use GNOME settings for default font sizes.
    
    We were using WebKitGTK+ defaults now.
---
 embed/ephy-embed-prefs.h          |    6 +---
 embed/webkit/webkit-embed-prefs.c |   38 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
index 79c3818..c78fe2f 100644
--- a/embed/ephy-embed-prefs.h
+++ b/embed/ephy-embed-prefs.h
@@ -1,7 +1,5 @@
 #define CONF_NETWORK_CACHE_SIZE "/apps/epiphany/web/cache_size"
 #define CONF_RENDERING_FONT "/apps/epiphany/web/font"
-#define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/web/variable_font_size"
-#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/web/fixed_font_size"
 #define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/minimum_font_size"
 #define CONF_RENDERING_LANGUAGE "/apps/epiphany/web/language"
 #define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/web/use_own_colors"
@@ -31,8 +29,8 @@
 #define CONF_NETWORK_SOCKS_PROXY_PORT "/system/proxy/socks_port"
 #define CONF_NETWORK_PROXY_AUTO_URL "/system/proxy/autoconfig_url"
 #define CONF_NETWORK_PROXY_IGNORE_HOSTS "/system/http_proxy/ignore_hosts"
-#define CONF_DESKTOP_FONT_VARIABLE "/desktop/gnome/interface/document_font_name"
-#define CONF_DESKTOP_FONT_MONOSPACE "/desktop/gnome/interface/monospace_font_name"
+#define CONF_DESKTOP_FONT_VAR_SIZE "/desktop/gnome/interface/font_name"
+#define CONF_DESKTOP_FONT_FIXED_SIZE "/desktop/gnome/interface/monospace_font_name"
 
 /* DEPRECATED, we migrate them */
 #define CONF_RENDERING_FONT_VAR_SIZE_OLD "/apps/epiphany/web/font_var_size"
diff --git a/embed/webkit/webkit-embed-prefs.c b/embed/webkit/webkit-embed-prefs.c
index a0cc23d..e9193be 100644
--- a/embed/webkit/webkit-embed-prefs.c
+++ b/embed/webkit/webkit-embed-prefs.c
@@ -134,11 +134,49 @@ webkit_pref_callback_user_stylesheet (GConfClient *client,
   g_free (uri);
 }
 
+static void
+webkit_pref_callback_font_size (GConfClient *client,
+                                guint cnxn_id,
+                                GConfEntry *entry,
+                                gpointer data)
+{
+  GConfValue *gcvalue;
+  char *webkit_pref = data;
+  const char *value = NULL;
+  int size = 9; /* FIXME: What to use here? */
+
+  gcvalue = gconf_entry_get_value (entry);
+
+  /* happens on initial notify if the key doesn't exist */
+  if (gcvalue != NULL &&
+      gcvalue->type == GCONF_VALUE_STRING) {
+      value = gconf_value_get_string (gcvalue);
+  }
+
+  if (value) {
+    PangoFontDescription* desc;
+
+    desc = pango_font_description_from_string (value);
+    size = pango_font_description_get_size (desc);
+    if (pango_font_description_get_size_is_absolute (desc) == FALSE)
+      size /= PANGO_SCALE;
+    pango_font_description_free (desc);
+  }
+
+  g_object_set (settings, webkit_pref, size, NULL);
+}
+
 static const PrefData webkit_pref_entries[] =
   {
     { CONF_RENDERING_FONT_MIN_SIZE,
       "minimum-font-size",
       webkit_pref_callback_int },
+    { CONF_DESKTOP_FONT_VAR_SIZE,
+      "default-font-size",
+      webkit_pref_callback_font_size },
+    { CONF_DESKTOP_FONT_FIXED_SIZE,
+      "default-monospace-font-size",
+      webkit_pref_callback_font_size },
     { CONF_SECURITY_JAVASCRIPT_ENABLED,
       "enable-scripts",
       webkit_pref_callback_boolean },



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