aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-04-30 22:56:58 +0800
committerMilan Crha <mcrha@redhat.com>2009-04-30 22:56:58 +0800
commit8f2b4f9c6554698af19a39223acc33f965e2dfca (patch)
tree4a66ec23024087aa1b7dc54a63ccb115f0e91509 /calendar
parenta4bc46297551d65f2fbffb853b773f857e14edf2 (diff)
downloadgsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar.gz
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar.bz2
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar.lz
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar.xz
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.tar.zst
gsoc2013-evolution-8f2b4f9c6554698af19a39223acc33f965e2dfca.zip
Bug #570730 - Get rid of gnome-config in Evolution
Diffstat (limited to 'calendar')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c27
-rw-r--r--calendar/conduits/common/libecalendar-common-conduit.c166
-rw-r--r--calendar/conduits/common/libecalendar-common-conduit.h6
-rw-r--r--calendar/conduits/memo/memo-conduit.c28
-rw-r--r--calendar/conduits/todo/todo-conduit.c28
5 files changed, 197 insertions, 58 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index f936e33fe7..e7e5f57506 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -28,7 +28,6 @@
#define G_LOG_DOMAIN "ecalconduit"
#include <glib/gi18n.h>
-#include <libgnome/gnome-config.h>
#include <libecal/e-cal-types.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
@@ -134,8 +133,7 @@ calconduit_load_configuration (guint32 pilot_id)
g_object_unref (management);
/* Custom settings */
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", pilot_id);
- gnome_config_push_prefix (prefix);
+ g_snprintf (prefix, 255, "e-calendar-conduit/Pilot_%u", pilot_id);
if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_EVENT, NULL))
c->source_list = NULL;
@@ -150,9 +148,9 @@ calconduit_load_configuration (guint32 pilot_id)
c->source_list = NULL;
}
}
- c->secret = gnome_config_get_bool ("secret=FALSE");
- c->multi_day_split = gnome_config_get_bool ("multi_day_split=TRUE");
- if ((c->last_uri = gnome_config_get_string ("last_uri")) && !strncmp (c->last_uri, "file://", 7)) {
+ c->secret = e_pilot_setup_get_bool (prefix, "secret", FALSE);
+ c->multi_day_split = e_pilot_setup_get_bool (prefix, "multi_day_split", TRUE);
+ if ((c->last_uri = e_pilot_setup_get_string (prefix, "last_uri", NULL)) && !strncmp (c->last_uri, "file://", 7)) {
char *filename = g_filename_from_uri (c->last_uri, NULL, NULL);
const char *path = filename;
const char *home;
@@ -178,8 +176,6 @@ calconduit_load_configuration (guint32 pilot_id)
g_free (filename);
}
- gnome_config_pop_prefix ();
-
return c;
}
@@ -188,18 +184,13 @@ calconduit_save_configuration (ECalConduitCfg *c)
{
gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", c->pilot_id);
- gnome_config_push_prefix (prefix);
+ g_snprintf (prefix, 255, "e-calendar-conduit/Pilot_%u", c->pilot_id);
e_pilot_set_sync_source (c->source_list, c->source);
- gnome_config_set_bool ("secret", c->secret);
- gnome_config_set_bool ("multi_day_split", c->multi_day_split);
- gnome_config_set_string ("last_uri", c->last_uri);
-
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+
+ e_pilot_setup_set_bool (prefix, "secret", c->secret);
+ e_pilot_setup_set_bool (prefix, "multi_day_split", c->multi_day_split);
+ e_pilot_setup_set_string (prefix, "last_uri", c->last_uri ? c->last_uri : "");
}
static ECalConduitCfg*
diff --git a/calendar/conduits/common/libecalendar-common-conduit.c b/calendar/conduits/common/libecalendar-common-conduit.c
index 1b7013bb0a..fbbe0278b1 100644
--- a/calendar/conduits/common/libecalendar-common-conduit.c
+++ b/calendar/conduits/common/libecalendar-common-conduit.c
@@ -29,6 +29,7 @@
#include <e-pilot-util.h>
#include <pi-appinfo.h>
#include <glib.h>
+#include <gconf/gconf-client.h>
#include "libecalendar-common-conduit.h"
@@ -204,3 +205,168 @@ void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, st
e_cal_component_free_categories_list(c_list);
}
}
+
+static char *
+build_setup_path (const char *path, const char *key)
+{
+ return g_strconcat ("/apps/evolution/conduit", "/", path, "/", key, NULL);
+}
+
+gboolean
+e_pilot_setup_get_bool (const char *path, const char *key, gboolean def)
+{
+ gboolean res = def;
+ char *full_path;
+ GConfValue *value;
+ GConfClient *gconf;
+
+ g_return_val_if_fail (path != NULL, res);
+ g_return_val_if_fail (key != NULL, res);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ value = gconf_client_get (gconf, full_path, NULL);
+ if (value) {
+ if (value->type == GCONF_VALUE_BOOL)
+ res = gconf_value_get_bool (value);
+
+ gconf_value_free (value);
+ }
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ return res;
+}
+
+void
+e_pilot_setup_set_bool (const char *path, const char *key, gboolean value)
+{
+ GError *error = NULL;
+ char *full_path;
+ GConfClient *gconf;
+
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (key != NULL);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ gconf_client_set_bool (gconf, full_path, value, &error);
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ if (error) {
+ g_message ("%s: Failed to write: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+}
+
+int
+e_pilot_setup_get_int (const char *path, const char *key, int def)
+{
+ int res = def;
+ char *full_path;
+ GConfValue *value;
+ GConfClient *gconf;
+
+ g_return_val_if_fail (path != NULL, res);
+ g_return_val_if_fail (key != NULL, res);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ value = gconf_client_get (gconf, full_path, NULL);
+ if (value) {
+ if (value->type == GCONF_VALUE_INT)
+ res = gconf_value_get_int (value);
+
+ gconf_value_free (value);
+ }
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ return res;
+}
+
+void
+e_pilot_setup_set_int (const char *path, const char *key, int value)
+{
+ GError *error = NULL;
+ char *full_path;
+ GConfClient *gconf;
+
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (key != NULL);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ gconf_client_set_int (gconf, full_path, value, &error);
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ if (error) {
+ g_message ("%s: Failed to write: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+}
+
+char *
+e_pilot_setup_get_string (const char *path, const char *key, const char *def)
+{
+ char *res = g_strdup (def);
+ char *full_path;
+ GConfValue *value;
+ GConfClient *gconf;
+
+ g_return_val_if_fail (path != NULL, res);
+ g_return_val_if_fail (key != NULL, res);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ value = gconf_client_get (gconf, full_path, NULL);
+ if (value) {
+ if (value->type == GCONF_VALUE_STRING) {
+ g_free (res);
+ res = g_strdup (gconf_value_get_string (value));
+ }
+
+ gconf_value_free (value);
+ }
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ return res;
+}
+
+void
+e_pilot_setup_set_string (const char *path, const char *key, const char *value)
+{
+ GError *error = NULL;
+ char *full_path;
+ GConfClient *gconf;
+
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (value != NULL);
+
+ gconf = gconf_client_get_default ();
+ full_path = build_setup_path (path, key);
+
+ gconf_client_set_string (gconf, full_path, value, &error);
+
+ g_free (full_path);
+ g_object_unref (gconf);
+
+ if (error) {
+ g_message ("%s: Failed to write: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+}
diff --git a/calendar/conduits/common/libecalendar-common-conduit.h b/calendar/conduits/common/libecalendar-common-conduit.h
index e168e001eb..0641ec3e88 100644
--- a/calendar/conduits/common/libecalendar-common-conduit.h
+++ b/calendar/conduits/common/libecalendar-common-conduit.h
@@ -29,3 +29,9 @@ int e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *c
void e_pilot_local_category_to_remote(int * pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category);
void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category);
+gboolean e_pilot_setup_get_bool (const char *path, const char *key, gboolean def);
+void e_pilot_setup_set_bool (const char *path, const char *key, gboolean value);
+int e_pilot_setup_get_int (const char *path, const char *key, int def);
+void e_pilot_setup_set_int (const char *path, const char *key, int value);
+char *e_pilot_setup_get_string (const char *path, const char *key, const char *def);
+void e_pilot_setup_set_string (const char *path, const char *key, const char *value);
diff --git a/calendar/conduits/memo/memo-conduit.c b/calendar/conduits/memo/memo-conduit.c
index ecaa07fa48..4d599a6924 100644
--- a/calendar/conduits/memo/memo-conduit.c
+++ b/calendar/conduits/memo/memo-conduit.c
@@ -30,7 +30,6 @@
#define G_LOG_DOMAIN "ememoconduit"
#include <glib/gi18n.h>
-#include <libgnome/gnome-config.h>
#include <libecal/e-cal-types.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
@@ -120,8 +119,7 @@ memoconduit_load_configuration (guint32 pilot_id)
gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-memo-conduit/Pilot_%u/",
- pilot_id);
+ g_snprintf (prefix, 255, "e-memo-conduit/Pilot_%u", pilot_id);
c = g_new0 (EMemoConduitCfg,1);
g_assert (c != NULL);
@@ -138,8 +136,6 @@ memoconduit_load_configuration (guint32 pilot_id)
g_object_unref (management);
/* Custom settings */
- gnome_config_push_prefix (prefix);
-
if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL))
c->source_list = NULL;
if (c->source_list) {
@@ -154,11 +150,9 @@ memoconduit_load_configuration (guint32 pilot_id)
}
}
- c->secret = gnome_config_get_bool ("secret=FALSE");
- c->priority = gnome_config_get_int ("priority=3");
- c->last_uri = gnome_config_get_string ("last_uri");
-
- gnome_config_pop_prefix ();
+ c->secret = e_pilot_setup_get_bool (prefix, "secret", FALSE);
+ c->priority = e_pilot_setup_get_int (prefix, "priority", 3);
+ c->last_uri = e_pilot_setup_get_string (prefix, "last_uri", NULL);
return c;
}
@@ -168,18 +162,12 @@ memoconduit_save_configuration (EMemoConduitCfg *c)
{
gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-memo-conduit/Pilot_%u/",
- c->pilot_id);
+ g_snprintf (prefix, 255, "e-memo-conduit/Pilot_%u", c->pilot_id);
- gnome_config_push_prefix (prefix);
e_pilot_set_sync_source (c->source_list, c->source);
- gnome_config_set_bool ("secret", c->secret);
- gnome_config_set_int ("priority", c->priority);
- gnome_config_set_string ("last_uri", c->last_uri);
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ e_pilot_setup_set_bool (prefix, "secret", c->secret);
+ e_pilot_setup_set_int (prefix, "priority", c->priority);
+ e_pilot_setup_set_string (prefix, "last_uri", c->last_uri ? c->last_uri : "");
}
static EMemoConduitCfg*
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 620e9ec6f0..f40bc82eab 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -30,7 +30,6 @@
#define G_LOG_DOMAIN "etodoconduit"
#include <glib/gi18n.h>
-#include <libgnome/gnome-config.h>
#include <libecal/e-cal-types.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
@@ -122,8 +121,7 @@ todoconduit_load_configuration (guint32 pilot_id)
gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- pilot_id);
+ g_snprintf (prefix, 255, "e-todo-conduit/Pilot_%u", pilot_id);
c = g_new0 (EToDoConduitCfg,1);
g_assert (c != NULL);
@@ -140,8 +138,6 @@ todoconduit_load_configuration (guint32 pilot_id)
g_object_unref (management);
/* Custom settings */
- gnome_config_push_prefix (prefix);
-
if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_TODO, NULL))
c->source_list = NULL;
if (c->source_list) {
@@ -156,11 +152,9 @@ todoconduit_load_configuration (guint32 pilot_id)
}
}
- c->secret = gnome_config_get_bool ("secret=FALSE");
- c->priority = gnome_config_get_int ("priority=3");
- c->last_uri = gnome_config_get_string ("last_uri");
-
- gnome_config_pop_prefix ();
+ c->secret = e_pilot_setup_get_bool (prefix, "secret", FALSE);
+ c->priority = e_pilot_setup_get_int (prefix, "priority", 3);
+ c->last_uri = e_pilot_setup_get_string (prefix, "last_uri", NULL);
return c;
}
@@ -170,18 +164,12 @@ todoconduit_save_configuration (EToDoConduitCfg *c)
{
gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- c->pilot_id);
+ g_snprintf (prefix, 255, "e-todo-conduit/Pilot_%u", c->pilot_id);
- gnome_config_push_prefix (prefix);
e_pilot_set_sync_source (c->source_list, c->source);
- gnome_config_set_bool ("secret", c->secret);
- gnome_config_set_int ("priority", c->priority);
- gnome_config_set_string ("last_uri", c->last_uri);
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ e_pilot_setup_set_bool (prefix, "secret", c->secret);
+ e_pilot_setup_set_int (prefix, "priority", c->priority);
+ e_pilot_setup_set_string (prefix, "last_uri", c->last_uri ? c->last_uri : "");
}
static EToDoConduitCfg*