aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-05 05:43:09 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-05 05:43:09 +0800
commit8180308e57e97c0c4e69331aac409e49e6a38876 (patch)
treef507f2923ead34164153f2825eea87f8199d3e5d
parentf077672b83507d7ae5dedad6c7d82105e5d5d42f (diff)
downloadgsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar.gz
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar.bz2
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar.lz
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar.xz
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.tar.zst
gsoc2013-epiphany-8180308e57e97c0c4e69331aac409e49e6a38876.zip
Resync with eel.
2003-11-04 Marco Pesenti Gritti <marco@gnome.org> * lib/eel-gconf-extensions.c: (global_client_free), (eel_gconf_client_get_global), (eel_gconf_handle_error), (eel_gconf_set_string), (eel_gconf_is_default), (eel_gconf_key_is_writable), (eel_gconf_monitor_add), (eel_gconf_monitor_remove), (eel_gconf_preload_cache), (eel_gconf_get_default_value), (eel_strcmp), (eel_str_is_equal), (simple_value_is_equal), (eel_gconf_value_is_equal), (eel_gconf_value_get_string_list), (eel_gconf_value_set_string_list), (eel_gconf_set_float), (eel_gconf_get_float): * lib/eel-gconf-extensions.h: Resync with eel. * lib/ephy-prefs.h: * lib/widgets/ephy-spinner.c: * embed/ephy-embed-prefs.h: * embed/mozilla/mozilla-notifiers.cpp: Migrate old font size settings. This will screw things for 1.1 users, not much we can do about it now.
-rw-r--r--ChangeLog24
-rw-r--r--embed/ephy-embed-prefs.h11
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp114
-rw-r--r--lib/eel-gconf-extensions.c413
-rw-r--r--lib/eel-gconf-extensions.h95
-rw-r--r--lib/ephy-prefs.h3
-rw-r--r--lib/widgets/ephy-spinner.c1
7 files changed, 459 insertions, 202 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bb3f1801..c75913f04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2003-11-04 Marco Pesenti Gritti <marco@gnome.org>
+ * lib/eel-gconf-extensions.c: (global_client_free),
+ (eel_gconf_client_get_global), (eel_gconf_handle_error),
+ (eel_gconf_set_string), (eel_gconf_is_default),
+ (eel_gconf_key_is_writable), (eel_gconf_monitor_add),
+ (eel_gconf_monitor_remove), (eel_gconf_preload_cache),
+ (eel_gconf_get_default_value), (eel_strcmp), (eel_str_is_equal),
+ (simple_value_is_equal), (eel_gconf_value_is_equal),
+ (eel_gconf_value_get_string_list),
+ (eel_gconf_value_set_string_list), (eel_gconf_set_float),
+ (eel_gconf_get_float):
+ * lib/eel-gconf-extensions.h:
+
+ Resync with eel.
+
+ * lib/ephy-prefs.h:
+ * lib/widgets/ephy-spinner.c:
+ * embed/ephy-embed-prefs.h:
+ * embed/mozilla/mozilla-notifiers.cpp:
+
+ Migrate old font size settings. This will screw things
+ for 1.1 users, not much we can do about it now.
+
+2003-11-04 Marco Pesenti Gritti <marco@gnome.org>
+
* embed/downloader-view.c:
* embed/mozilla/ExternalProtocolService.cpp:
* embed/mozilla/mozilla-embed-single.cpp:
diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
index 50e63bdb7..71cba6166 100644
--- a/embed/ephy-embed-prefs.h
+++ b/embed/ephy-embed-prefs.h
@@ -1,8 +1,8 @@
#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/font_var_size"
-#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/web/font_fixed_size"
-#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/font_min_size"
+#define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/web/font_var_size_pt"
+#define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/web/font_fixed_size_pt"
+#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/font_min_size_pt"
#define CONF_RENDERING_LANGUAGE "/apps/epiphany/web/language"
#define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/web/use_own_colors"
#define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/web/use_own_fonts"
@@ -26,3 +26,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"
+
+/* Deprecated, we migrate them */
+#define CONF_RENDERING_FONT_VAR_SIZE_OLD "/apps/epiphany/web/font_var_size"
+#define CONF_RENDERING_FONT_FIXED_SIZE_OLD "/apps/epiphany/web/font_fixed_size"
+#define CONF_RENDERING_FONT_MIN_SIZE_OLD "/apps/epiphany/web/font_min_size"
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 7dde69462..da68ebbc0 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -35,11 +35,13 @@
#include <locale.h>
#include <libgnome/gnome-i18n.h>
#include <stdlib.h>
-#include "nsCOMPtr.h"
-#include "nsIPrefService.h"
-#include "nsIServiceManager.h"
+#include <gdk/gdkx.h>
+#include <nsCOMPtr.h>
+#include <nsIPrefService.h>
+#include <nsIServiceManager.h>
#define MOZILLA_PREF_NO_PROXIES "network.proxy.no_proxies_on"
+#define MIGRATE_PIXEL_SIZE
static void
mozilla_cache_size_notifier (GConfClient *client,
@@ -382,14 +384,81 @@ add_notification_and_notify (GConfClient *client,
gconf_client_notify (client, key);
}
+#ifdef MIGRATE_PIXEL_SIZE
+
+#define INT_ROUND(a) gint((a) + 0.5f)
+
+/**
+ * This function gets the dpi in the same way that mozilla gets the dpi,
+ * this allows us to convert from pixels to points easily
+ */
+static gint
+mozilla_get_dpi ()
+{
+ GtkSettings* settings = gtk_settings_get_default ();
+ gint dpi = 0;
+
+ /* Use the gdk-xft-dpi setting if it is set */
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (settings)),
+ "gtk-xft-dpi"))
+ {
+ g_object_get (G_OBJECT (settings), "gtk-xft-dpi", &dpi, NULL);
+ if (dpi) return INT_ROUND (dpi / PANGO_SCALE);
+ }
+
+ /* Fall back to what xft thinks it is */
+ char *val = XGetDefault (GDK_DISPLAY (), "Xft", "dpi");
+ if (val)
+ {
+ char *e;
+ double d = strtod(val, &e);
+ if (e != val) return INT_ROUND (d);
+ }
+
+ /* Fall back to calculating manually from the gdk screen settings */
+ float screenWidthIn = float (gdk_screen_width_mm()) / 25.4f;
+ return INT_ROUND (gdk_screen_width() / screenWidthIn);
+}
+
+static void
+mozilla_migrate_font_gconf_key (const char *pixel_key, const char *point_key)
+{
+ int size;
+
+ size = eel_gconf_get_integer (pixel_key);
+
+ if (size > 0)
+ {
+ /* Use doubles to get more accurate arithmetic */
+ double dpi = (double)mozilla_get_dpi ();
+ double value = (double)eel_gconf_get_integer (pixel_key);
+ gint point = INT_ROUND ((value * 72) / dpi);
+
+ eel_gconf_set_integer (point_key, point);
+ }
+}
+
+#endif
+
void
-mozilla_notifiers_init(EphyEmbedSingle *single)
+mozilla_notifiers_init (EphyEmbedSingle *single)
{
GConfClient *client = eel_gconf_client_get_global ();
guint i;
const EphyFontsLanguageInfo *font_languages;
guint n_font_languages;
+#ifdef MIGRATE_PIXEL_SIZE
+ gboolean migrate_size;
+
+ migrate_size = (eel_gconf_get_integer (CONF_SCHEMA_VERSION)
+ < EPIPHANY_SCHEMA_VERSION);
+ if (migrate_size)
+ {
+ eel_gconf_set_integer (CONF_SCHEMA_VERSION, EPIPHANY_SCHEMA_VERSION);
+ }
+#endif
+
for (i = 0; conversion_table[i].gconf_key != NULL; i++)
{
GConfClientNotifyFunc func = NULL;
@@ -436,6 +505,9 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
char *types [] = { "variable", "monospace" };
char key[255];
char *info;
+#ifdef MIGRATE_PIXEL_SIZE
+ char old_key[255];
+#endif
for (k = 0; k < G_N_ELEMENTS (types); k++)
{
@@ -456,6 +528,15 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
info);
font_infos = g_list_prepend (font_infos, info);
+#ifdef MIGRATE_PIXEL_SIZE
+ if (migrate_size)
+ {
+ g_snprintf (old_key, 255, "%s_%s",
+ CONF_RENDERING_FONT_MIN_SIZE_OLD, code);
+ mozilla_migrate_font_gconf_key (old_key, key);
+ }
+#endif
+
g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_FIXED_SIZE, code);
info = g_strconcat ("size.fixed", ".", code, NULL);
add_notification_and_notify (client, key,
@@ -463,19 +544,40 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
info);
font_infos = g_list_prepend (font_infos, info);
+#ifdef MIGRATE_PIXEL_SIZE
+ if (migrate_size)
+ {
+ g_snprintf (old_key, 255, "%s_%s",
+ CONF_RENDERING_FONT_FIXED_SIZE_OLD, code);
+ mozilla_migrate_font_gconf_key (old_key, key);
+ }
+#endif
+
g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_VAR_SIZE, code);
info = g_strconcat ("size.variable", ".", code, NULL);
add_notification_and_notify (client, key,
(GConfClientNotifyFunc)mozilla_font_size_notifier,
info);
- font_infos = g_list_prepend (font_infos, info);
+ font_infos = g_list_prepend (font_infos, info);
+
+#ifdef MIGRATE_PIXEL_SIZE
+ if (migrate_size)
+ {
+ g_snprintf (old_key, 255, "%s_%s",
+ CONF_RENDERING_FONT_VAR_SIZE_OLD, code);
+ mozilla_migrate_font_gconf_key (old_key, key);
+ }
+#endif
}
}
void
mozilla_notifiers_free (void)
{
- ephy_notification_remove (&mozilla_notifiers);
+ g_list_foreach (mozilla_notifiers,
+ (GFunc)eel_gconf_notification_remove,
+ NULL);
+ g_list_free(mozilla_notifiers);
g_list_foreach (font_infos, (GFunc) g_free, NULL);
g_list_free (font_infos);
diff --git a/lib/eel-gconf-extensions.c b/lib/eel-gconf-extensions.c
index 564085704..ff016b5f5 100644
--- a/lib/eel-gconf-extensions.c
+++ b/lib/eel-gconf-extensions.c
@@ -22,15 +22,13 @@
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
-#include <stdlib.h>
#include <config.h>
#include "eel-gconf-extensions.h"
+#include <bonobo/bonobo-i18n.h>
#include <gconf/gconf-client.h>
#include <gconf/gconf.h>
-#include <gtk/gtkwidget.h>
-#include <bonobo/bonobo-i18n.h>
-#include <gtk/gtkmessagedialog.h>
+#include <string.h>
static GConfClient *global_gconf_client = NULL;
@@ -40,8 +38,8 @@ global_client_free (void)
if (global_gconf_client == NULL) {
return;
}
-
- g_object_unref (G_OBJECT (global_gconf_client));
+
+ g_object_unref (global_gconf_client);
global_gconf_client = NULL;
}
@@ -59,7 +57,6 @@ eel_gconf_client_get_global (void)
return NULL;
}
}
-
}
if (global_gconf_client == NULL) {
@@ -73,10 +70,23 @@ eel_gconf_client_get_global (void)
gboolean
eel_gconf_handle_error (GError **error)
{
+ char *message;
+ static gboolean shown_dialog = FALSE;
+
g_return_val_if_fail (error != NULL, FALSE);
if (*error != NULL) {
g_warning (_("GConf error:\n %s"), (*error)->message);
+ if (! shown_dialog) {
+ shown_dialog = TRUE;
+
+ message = g_strdup_printf (_("GConf error:\n %s\n"
+ "All further errors shown "
+ "only on terminal"),
+ (*error)->message);
+ g_error (message, _("GConf Error"), NULL);
+ g_free (message);
+ }
g_error_free (*error);
*error = NULL;
@@ -161,51 +171,13 @@ eel_gconf_get_integer (const char *key)
}
void
-eel_gconf_set_float (const char *key,
- gfloat float_value)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_float (client, key, float_value, &error);
- eel_gconf_handle_error (&error);
-}
-
-gfloat
-eel_gconf_get_float (const char *key)
-{
- gfloat result;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, 0);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, 0);
-
- result = gconf_client_get_float (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- result = 0;
- }
-
- return result;
-}
-
-void
eel_gconf_set_string (const char *key,
- const char *string_value)
+ const char *string_value)
{
GConfClient *client;
GError *error = NULL;
g_return_if_fail (key != NULL);
- g_return_if_fail (string_value != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
@@ -214,21 +186,6 @@ eel_gconf_set_string (const char *key,
eel_gconf_handle_error (&error);
}
-void
-eel_gconf_unset (const char *key)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_unset (client, key, &error);
- eel_gconf_handle_error (&error);
-}
-
char *
eel_gconf_get_string (const char *key)
{
@@ -291,49 +248,6 @@ eel_gconf_get_string_list (const char *key)
return slist;
}
-/* This code wasn't part of the original eel-gconf-extensions.c */
-void
-eel_gconf_set_integer_list (const char *key,
- const GSList *slist)
-{
- GConfClient *client;
- GError *error;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- error = NULL;
- gconf_client_set_list (client, key, GCONF_VALUE_INT,
- /* Need cast cause of GConf api bug */
- (GSList *) slist,
- &error);
- eel_gconf_handle_error (&error);
-}
-
-GSList *
-eel_gconf_get_integer_list (const char *key)
-{
- GSList *slist;
- GConfClient *client;
- GError *error;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- error = NULL;
- slist = gconf_client_get_list (client, key, GCONF_VALUE_INT, &error);
- if (eel_gconf_handle_error (&error)) {
- slist = NULL;
- }
-
- return slist;
-}
-/* End of added code */
-
gboolean
eel_gconf_is_default (const char *key)
{
@@ -353,12 +267,24 @@ eel_gconf_is_default (const char *key)
}
result = (value == NULL);
+ eel_gconf_value_free (value);
+ return result;
+}
+
+gboolean
+eel_gconf_key_is_writable (const char *key)
+{
+ gboolean result;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ result = gconf_client_key_is_writable (eel_gconf_client_get_global (), key, &error);
- if (value != NULL) {
- gconf_value_free (value);
+ if (eel_gconf_handle_error (&error)) {
+ return result;
}
-
return result;
}
@@ -370,7 +296,7 @@ eel_gconf_monitor_add (const char *directory)
g_return_val_if_fail (directory != NULL, FALSE);
- client = eel_gconf_client_get_global ();
+ client = gconf_client_get_default ();
g_return_val_if_fail (client != NULL, FALSE);
gconf_client_add_dir (client,
@@ -395,7 +321,7 @@ eel_gconf_monitor_remove (const char *directory)
return FALSE;
}
- client = eel_gconf_client_get_global ();
+ client = gconf_client_get_default ();
g_return_val_if_fail (client != NULL, FALSE);
gconf_client_remove_dir (client,
@@ -410,6 +336,28 @@ eel_gconf_monitor_remove (const char *directory)
}
void
+eel_gconf_preload_cache (const char *directory,
+ GConfClientPreloadType preload_type)
+{
+ GError *error = NULL;
+ GConfClient *client;
+
+ if (directory == NULL) {
+ return;
+ }
+
+ client = gconf_client_get_default ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_preload (client,
+ directory,
+ preload_type,
+ &error);
+
+ eel_gconf_handle_error (&error);
+}
+
+void
eel_gconf_suggest_sync (void)
{
GConfClient *client;
@@ -446,22 +394,150 @@ eel_gconf_get_value (const char *key)
return value;
}
-void
-eel_gconf_set_value (const char *key, GConfValue *value)
+GConfValue*
+eel_gconf_get_default_value (const char *key)
{
+ GConfValue *value = NULL;
GConfClient *client;
GError *error = NULL;
-
- g_return_if_fail (key != NULL);
+
+ g_return_val_if_fail (key != NULL, NULL);
client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
+ g_return_val_if_fail (client != NULL, NULL);
- gconf_client_set (client, key, value, &error);
+ value = gconf_client_get_default_from_schema (client, key, &error);
if (eel_gconf_handle_error (&error)) {
- return;
+ if (value != NULL) {
+ gconf_value_free (value);
+ value = NULL;
+ }
+ }
+
+ return value;
+}
+
+static int
+eel_strcmp (const char *string_a, const char *string_b)
+{
+ /* FIXME bugzilla.eazel.com 5450: Maybe we need to make this
+ * treat 'NULL < ""', or have a flavor that does that. If we
+ * didn't have code that already relies on 'NULL == ""', I
+ * would change it right now.
+ */
+ return strcmp (string_a == NULL ? "" : string_a,
+ string_b == NULL ? "" : string_b);
+}
+
+static gboolean
+eel_str_is_equal (const char *string_a, const char *string_b)
+{
+ /* FIXME bugzilla.eazel.com 5450: Maybe we need to make this
+ * treat 'NULL != ""', or have a flavor that does that. If we
+ * didn't have code that already relies on 'NULL == ""', I
+ * would change it right now.
+ */
+ return eel_strcmp (string_a, string_b) == 0;
+}
+
+static gboolean
+simple_value_is_equal (const GConfValue *a,
+ const GConfValue *b)
+{
+ g_return_val_if_fail (a != NULL, FALSE);
+ g_return_val_if_fail (b != NULL, FALSE);
+
+ switch (a->type) {
+ case GCONF_VALUE_STRING:
+ return eel_str_is_equal (gconf_value_get_string (a),
+ gconf_value_get_string (b));
+ break;
+
+ case GCONF_VALUE_INT:
+ return gconf_value_get_int (a) ==
+ gconf_value_get_int (b);
+ break;
+
+ case GCONF_VALUE_FLOAT:
+ return gconf_value_get_float (a) ==
+ gconf_value_get_float (b);
+ break;
+
+ case GCONF_VALUE_BOOL:
+ return gconf_value_get_bool (a) ==
+ gconf_value_get_bool (b);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return FALSE;
+}
+
+gboolean
+eel_gconf_value_is_equal (const GConfValue *a,
+ const GConfValue *b)
+{
+ GSList *node_a;
+ GSList *node_b;
+
+ if (a == NULL && b == NULL) {
+ return TRUE;
+ }
+
+ if (a == NULL || b == NULL) {
+ return FALSE;
+ }
+
+ if (a->type != b->type) {
+ return FALSE;
+ }
+
+ switch (a->type) {
+ case GCONF_VALUE_STRING:
+ case GCONF_VALUE_INT:
+ case GCONF_VALUE_FLOAT:
+ case GCONF_VALUE_BOOL:
+ return simple_value_is_equal (a, b);
+ break;
+
+ case GCONF_VALUE_LIST:
+ if (gconf_value_get_list_type (a) !=
+ gconf_value_get_list_type (b)) {
+ return FALSE;
+ }
+
+ node_a = gconf_value_get_list (a);
+ node_b = gconf_value_get_list (b);
+
+ if (node_a == NULL && node_b == NULL) {
+ return TRUE;
+ }
+
+ if (g_slist_length (node_a) !=
+ g_slist_length (node_b)) {
+ return FALSE;
+ }
+
+ for (;
+ node_a != NULL && node_b != NULL;
+ node_a = node_a->next, node_b = node_b->next) {
+ g_assert (node_a->data != NULL);
+ g_assert (node_b->data != NULL);
+ if (!simple_value_is_equal (node_a->data, node_b->data)) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ default:
+ /* FIXME: pair ? */
+ g_assert (0);
}
+
+ g_assert_not_reached ();
+ return FALSE;
}
void
@@ -521,36 +597,93 @@ eel_gconf_notification_remove (guint notification_id)
gconf_client_notify_remove (client, notification_id);
}
-/* Simple wrapper for eel_gconf_notifier_add which
- * adds the notifier id to the GList given as argument
- * so that a call to ephy_notification_free can remove the notifiers
- */
+GSList *
+eel_gconf_value_get_string_list (const GConfValue *value)
+{
+ GSList *result;
+ const GSList *slist;
+ const GSList *node;
+ const char *string;
+ const GConfValue *next_value;
+
+ if (value == NULL) {
+ return NULL;
+ }
+
+ g_return_val_if_fail (value->type == GCONF_VALUE_LIST, NULL);
+ g_return_val_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING, NULL);
+
+ slist = gconf_value_get_list (value);
+ result = NULL;
+ for (node = slist; node != NULL; node = node->next) {
+ next_value = node->data;
+ g_return_val_if_fail (next_value != NULL, NULL);
+ g_return_val_if_fail (next_value->type == GCONF_VALUE_STRING, NULL);
+ string = gconf_value_get_string (next_value);
+ result = g_slist_append (result, g_strdup (string));
+ }
+ return result;
+}
+
void
-ephy_notification_add (const char *key,
- GConfClientNotifyFunc notification_callback,
- gpointer callback_data,
- GList **notifiers)
+eel_gconf_value_set_string_list (GConfValue *value,
+ const GSList *string_list)
{
- guint id = 0;
-
- id = eel_gconf_notification_add(key,
- notification_callback,
- callback_data);
- if (notifiers != NULL) {
- *notifiers = g_list_append(*notifiers,
- GINT_TO_POINTER(id));
+ const GSList *node;
+ GConfValue *next_value;
+ GSList *value_list;
+
+ g_return_if_fail (value->type == GCONF_VALUE_LIST);
+ g_return_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING);
+
+ value_list = NULL;
+ for (node = string_list; node != NULL; node = node->next) {
+ next_value = gconf_value_new (GCONF_VALUE_STRING);
+ gconf_value_set_string (next_value, node->data);
+ value_list = g_slist_append (value_list, next_value);
}
+
+ gconf_value_set_list (value, value_list);
+
+ for (node = value_list; node != NULL; node = node->next) {
+ gconf_value_free (node->data);
+ }
+ g_slist_free (value_list);
}
-/* Removes all the notifiers listed in notifiers */
-/* Frees the notifiers list */
void
-ephy_notification_remove (GList **notifiers)
+eel_gconf_set_float (const char *key,
+ gfloat float_value)
{
- g_list_foreach(*notifiers,
- (GFunc)eel_gconf_notification_remove,
- NULL);
- g_list_free(*notifiers);
- *notifiers = NULL;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_if_fail (key != NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_set_float (client, key, float_value, &error);
+ eel_gconf_handle_error (&error);
}
+gfloat
+eel_gconf_get_float (const char *key)
+{
+ gfloat result;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, 0);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, 0);
+
+ result = gconf_client_get_float (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ result = 0;
+ }
+
+ return result;
+}
diff --git a/lib/eel-gconf-extensions.h b/lib/eel-gconf-extensions.h
index df51afaa1..13196d7ee 100644
--- a/lib/eel-gconf-extensions.h
+++ b/lib/eel-gconf-extensions.h
@@ -25,63 +25,54 @@
#ifndef EEL_GCONF_EXTENSIONS_H
#define EEL_GCONF_EXTENSIONS_H
-#include <glib/gerror.h>
+#include <glib.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define EEL_GCONF_UNDEFINED_CONNECTION 0
-GConfClient *eel_gconf_client_get_global (void);
-gboolean eel_gconf_handle_error (GError **error);
-void eel_gconf_set_boolean (const char *key,
- gboolean boolean_value);
-gboolean eel_gconf_get_boolean (const char *key);
-int eel_gconf_get_integer (const char *key);
-void eel_gconf_set_integer (const char *key,
- int int_value);
-gfloat eel_gconf_get_float (const char *key);
-void eel_gconf_set_float (const char *key,
- gfloat float_value);
-char * eel_gconf_get_string (const char *key);
-void eel_gconf_set_string (const char *key,
- const char *string_value);
-GSList * eel_gconf_get_string_list (const char *key);
-void eel_gconf_set_string_list (const char *key,
- const GSList *string_list_value);
-gboolean eel_gconf_is_default (const char *key);
-gboolean eel_gconf_monitor_add (const char *directory);
-gboolean eel_gconf_monitor_remove (const char *directory);
-void eel_gconf_suggest_sync (void);
-GConfValue* eel_gconf_get_value (const char *key);
-gboolean eel_gconf_value_is_equal (const GConfValue *a,
- const GConfValue *b);
-void eel_gconf_set_value (const char *key, GConfValue *value);
-void eel_gconf_value_free (GConfValue *value);
-void eel_gconf_unset (const char *key);
-
-/* Functions which weren't part of the eel-gconf-extensions.h file from eel */
-GSList *eel_gconf_get_integer_list (const char *key);
-void eel_gconf_set_integer_list (const char *key,
- const GSList *slist);
-guint eel_gconf_notification_add (const char *key,
- GConfClientNotifyFunc notification_callback,
- gpointer callback_data);
-void eel_gconf_notification_remove (guint notification_id);
-
-void ephy_notification_add (const char *key,
- GConfClientNotifyFunc notification_callback,
- gpointer callback_data,
- GList **notifiers);
-
-void ephy_notification_remove (GList **notifiers);
-
-
-#ifdef __cplusplus
-}
-#endif
+GConfClient *eel_gconf_client_get_global (void);
+gboolean eel_gconf_handle_error (GError **error);
+void eel_gconf_set_boolean (const char *key,
+ gboolean boolean_value);
+gboolean eel_gconf_get_boolean (const char *key);
+int eel_gconf_get_integer (const char *key);
+void eel_gconf_set_integer (const char *key,
+ int int_value);
+char * eel_gconf_get_string (const char *key);
+void eel_gconf_set_string (const char *key,
+ const char *string_value);
+GSList * eel_gconf_get_string_list (const char *key);
+void eel_gconf_set_string_list (const char *key,
+ const GSList *string_list_value);
+gboolean eel_gconf_key_is_writable (const char *key);
+gboolean eel_gconf_is_default (const char *key);
+gboolean eel_gconf_monitor_add (const char *directory);
+gboolean eel_gconf_monitor_remove (const char *directory);
+void eel_gconf_preload_cache (const char *directory,
+ GConfClientPreloadType preload_type);
+void eel_gconf_suggest_sync (void);
+GConfValue* eel_gconf_get_value (const char *key);
+GConfValue* eel_gconf_get_default_value (const char *key);
+gboolean eel_gconf_value_is_equal (const GConfValue *a,
+ const GConfValue *b);
+void eel_gconf_value_free (GConfValue *value);
+guint eel_gconf_notification_add (const char *key,
+ GConfClientNotifyFunc notification_callback,
+ gpointer callback_data);
+void eel_gconf_notification_remove (guint notification_id);
+GSList * eel_gconf_value_get_string_list (const GConfValue *value);
+void eel_gconf_value_set_string_list (GConfValue *value,
+ const GSList *string_list);
+
+/* These are ephy additions, not part of the eel code */
+
+void eel_gconf_set_float (const char *key,
+ gfloat float_value);
+gfloat eel_gconf_get_float (const char *key);
+
+G_END_DECLS
#endif /* EEL_GCONF_EXTENSIONS_H */
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index e23b9ad6b..53c07e5d8 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -21,6 +21,9 @@
G_BEGIN_DECLS
+#define EPIPHANY_SCHEMA_VERSION 1
+#define CONF_SCHEMA_VERSION "/apps/epiphany/schema_version"
+
/* General */
#define CONF_GENERAL_HOMEPAGE "/apps/epiphany/general/homepage"
#define CONF_ALWAYS_SHOW_TABS_BAR "/apps/epiphany/general/always_show_tabs_bar"
diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c
index c88d326d2..0443eb0de 100644
--- a/lib/widgets/ephy-spinner.c
+++ b/lib/widgets/ephy-spinner.c
@@ -31,7 +31,6 @@
#endif
#include "ephy-spinner.h"
-#include "eel-gconf-extensions.h"
#include "ephy-string.h"
#include "ephy-file-helpers.h"