aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDietmar Maurer <dietmar@ximian.com>2001-07-04 02:15:31 +0800
committerDietmar Maurer <dietmar@src.gnome.org>2001-07-04 02:15:31 +0800
commitb7dede1a279b72d74cf52d2e194525426e6d144d (patch)
tree201a2dc644a3a52550b6a3310b205e90bd27ed2e
parent838d0849f248ed5e1b7793c3a5968c678749c81b (diff)
downloadgsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.gz
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.zst
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.zip
use bonobo-conf everywhere
2001-07-03 Dietmar Maurer <dietmar@ximian.com> * *: use bonobo-conf everywhere svn path=/trunk/; revision=10760
-rw-r--r--ChangeLog4
-rw-r--r--calendar/gui/calendar-config.c243
-rw-r--r--composer/Makefile.am1
-rw-r--r--composer/e-msg-composer.c116
-rw-r--r--composer/e-msg-composer.h3
-rw-r--r--configure.in6
-rw-r--r--importers/Makefile.am1
-rw-r--r--importers/elm-importer.c110
-rw-r--r--importers/evolution-gnomecard-importer.c88
-rw-r--r--importers/netscape-importer.c124
-rw-r--r--importers/pine-importer.c110
-rw-r--r--mail/mail-config.c750
-rw-r--r--shell/Makefile.am1
-rw-r--r--shell/e-shell-view.c188
-rw-r--r--shell/e-shell.c52
-rw-r--r--shell/e-shell.h3
-rw-r--r--wombat/Makefile.am1
-rw-r--r--wombat/wombat-moniker.c2
18 files changed, 942 insertions, 861 deletions
diff --git a/ChangeLog b/ChangeLog
index 10799d455f..6d3e1fd9b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * *: use bonobo-conf everywhere
+
2001-07-03 Damon Chaplin <damon@ximian.com>
* configure.in (MAILER_LIBS):
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 41c55ab91c..7b133075f4 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -36,7 +36,9 @@
#include "calendar-commands.h"
#include "e-tasks.h"
#include "calendar-config.h"
-
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
typedef struct
{
@@ -88,137 +90,178 @@ calendar_config_init (void)
static void
config_read (void)
{
- gchar *prefix;
- gboolean is_default;
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
- /* 'Display' settings. */
- prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
- evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return;
+ }
- config->timezone = gnome_config_get_string ("Timezone");
- config->working_days = gnome_config_get_int_with_default ("WorkingDays", &is_default);
- if (is_default) {
- config->working_days = CAL_MONDAY | CAL_TUESDAY
- | CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY;
- }
- config->use_24_hour_format = gnome_config_get_bool ("Use24HourFormat=0");
- config->week_start_day = gnome_config_get_int ("WeekStartDay=1");
- config->day_start_hour = gnome_config_get_int ("DayStartHour=9");
- config->day_start_minute = gnome_config_get_int ("DayStartMinute=0");
- config->day_end_hour = gnome_config_get_int ("DayEndHour=17");
- config->day_end_minute = gnome_config_get_int ("DayEndMinute=0");
- config->time_divisions = gnome_config_get_int ("TimeDivisions=30");
- config->view = gnome_config_get_int ("View=0");
- config->hpane_pos = gnome_config_get_float ("HPanePosition=1");
- config->vpane_pos = gnome_config_get_float ("VPanePosition=1");
- config->month_hpane_pos = gnome_config_get_float ("MonthHPanePosition=0");
- config->month_vpane_pos = gnome_config_get_float ("MonthVPanePosition=1");
- config->compress_weekend = gnome_config_get_bool ("CompressWeekend=1");
- config->show_event_end = gnome_config_get_bool ("ShowEventEndTime=1");
-
- gnome_config_pop_prefix ();
+ CORBA_exception_free (&ev);
- /* 'DateNavigator' settings. */
- prefix = g_strdup_printf ("=%s/config/Calendar=/DateNavigator/",
- evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
+ config->timezone = bonobo_config_get_string (db,
+ "/Calendar/Display/Timezone", NULL);
- config->dnav_show_week_no = gnome_config_get_bool ("ShowWeekNumbers=0");
+ config->working_days = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/WorkingDays", CAL_MONDAY | CAL_TUESDAY |
+ CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY, NULL);
+
+ config->week_start_day = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/WeekStartDay", 1, NULL);
+
+ config->use_24_hour_format = bonobo_config_get_boolean_with_default (
+ db, "/Calendar/Display/Use24HourFormat", FALSE, NULL);
- gnome_config_pop_prefix ();
+ config->week_start_day = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/WeekStartDay", 1, NULL);
+
+ config->day_start_hour = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/DayStartHour", 9, NULL);
+
+ config->day_start_minute = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/DayStartMinute", 0, NULL);
+
+ config->day_end_hour = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/DayEndHour", 17, NULL);
- /* Task list settings */
+ config->day_end_minute = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/DayEndMinute", 0, NULL);
- prefix = g_strdup_printf ("=%s/config/Tasks=/Colors/", evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
+ config->time_divisions = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/TimeDivisions", 30, NULL);
- config->tasks_due_today_color = gnome_config_get_string ("TasksDueToday=blue");
- config->tasks_overdue_color = gnome_config_get_string ("TasksOverdue=red");
+ config->view = bonobo_config_get_long_with_default (db,
+ "/Calendar/Display/View", 0, NULL);
- gnome_config_pop_prefix ();
+ config->hpane_pos = bonobo_config_get_float_with_default (db,
+ "/Calendar/Display/HPanePosition", 1.0, NULL);
- /* Done */
- gnome_config_sync ();
-}
+ config->vpane_pos = bonobo_config_get_float_with_default (db,
+ "/Calendar/Display/VPanePosition", 1.0, NULL);
+ config->month_hpane_pos = bonobo_config_get_float_with_default (db,
+ "/Calendar/Display/MonthHPanePosition", 0.0, NULL);
-void
-calendar_config_write (void)
-{
- gchar *prefix;
+ config->month_vpane_pos = bonobo_config_get_float_with_default (db,
+ "/Calendar/Display/MonthVPanePosition", 1.0, NULL);
- /* 'Display' settings. */
- prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
- evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
+ config->compress_weekend = bonobo_config_get_boolean_with_default (db,
+ "/Calendar/Display/CompressWeekend", TRUE, NULL);
- if (config->timezone)
- gnome_config_set_string ("Timezone", config->timezone);
- gnome_config_set_int ("WorkingDays", config->working_days);
- gnome_config_set_bool ("Use24HourFormat", config->use_24_hour_format);
- gnome_config_set_int ("WeekStartDay", config->week_start_day);
- gnome_config_set_int ("DayStartHour", config->day_start_hour);
- gnome_config_set_int ("DayStartMinute", config->day_start_minute);
- gnome_config_set_int ("DayEndHour", config->day_end_hour);
- gnome_config_set_int ("DayEndMinute", config->day_end_minute);
- gnome_config_set_bool ("CompressWeekend", config->compress_weekend);
- gnome_config_set_bool ("ShowEventEndTime", config->show_event_end);
-
- gnome_config_pop_prefix ();
+ config->show_event_end = bonobo_config_get_boolean_with_default (db,
+ "/Calendar/Display/ShowEventEndTime", TRUE, NULL);
/* 'DateNavigator' settings. */
- prefix = g_strdup_printf ("=%s/config/Calendar=/DateNavigator/",
- evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
-
- gnome_config_set_bool ("ShowWeekNumbers", config->dnav_show_week_no);
- gnome_config_pop_prefix ();
+ config->dnav_show_week_no = bonobo_config_get_boolean_with_default (db,
+ "/Calendar/DateNavigator/ShowWeekNumbers", FALSE, NULL);
/* Task list settings */
- prefix = g_strdup_printf ("=%s/config/Tasks=/Colors/", evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
+ config->tasks_due_today_color = bonobo_config_get_string_with_default (
+ db, "/Calendar/Tasks/Colors/TasksDueToday", "blue", NULL);
- gnome_config_set_string ("TasksDueToday", config->tasks_due_today_color);
- gnome_config_set_string ("TasksOverdue", config->tasks_overdue_color);
+ config->tasks_overdue_color = bonobo_config_get_string_with_default (
+ db, "/Calendar/Tasks/Colors/TasksOverdue", "red", NULL);
- gnome_config_pop_prefix ();
-
- /* Done */
- gnome_config_sync ();
+ bonobo_object_release_unref (db, NULL);
}
void
-calendar_config_write_on_exit (void)
+calendar_config_write (void)
{
- gchar *prefix;
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
- /* 'Display' settings. */
- prefix = g_strdup_printf ("=%s/config/Calendar=/Display/",
- evolution_dir);
- gnome_config_push_prefix (prefix);
- g_free (prefix);
- gnome_config_set_int ("View", config->view);
- gnome_config_set_int ("TimeDivisions", config->time_divisions);
- gnome_config_set_float ("HPanePosition", config->hpane_pos);
- gnome_config_set_float ("VPanePosition", config->vpane_pos);
- gnome_config_set_float ("MonthHPanePosition", config->month_hpane_pos);
- gnome_config_set_float ("MonthVPanePosition", config->month_vpane_pos);
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return;
+ }
- gnome_config_pop_prefix ();
+ if (config->timezone)
+ bonobo_config_set_string (db, "/Calendar/Display/Timezone",
+ config->timezone, NULL);
+
+ bonobo_config_set_long (db, "/Calendar/Display/WorkingDays",
+ config->working_days, NULL);
+ bonobo_config_set_boolean (db, "/Calendar/Display/Use24HourFormat",
+ config->use_24_hour_format, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/WeekStartDay",
+ config->week_start_day, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/DayStartHour",
+ config->day_start_hour, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/DayStartMinute",
+ config->day_start_minute, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/DayEndHour",
+ config->day_end_hour, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/DayEndMinute",
+ config->day_end_minute, NULL);
+ bonobo_config_set_boolean (db, "/Calendar/Display/CompressWeekend",
+ config->compress_weekend, NULL);
+ bonobo_config_set_boolean (db, "/Calendar/Display/ShowEventEndTime",
+ config->show_event_end, NULL);
+
+ bonobo_config_set_boolean (db,
+ "/Calendar/DateNavigator/ShowWeekNumbers",
+ config->dnav_show_week_no, NULL);
+
+ bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksDueToday",
+ config->tasks_due_today_color, NULL);
+
+ bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksOverdue",
+ config->tasks_overdue_color, NULL);
+
+ Bonobo_ConfigDatabase_sync (db, &ev);
+
+ bonobo_object_release_unref (db, NULL);
+
+ CORBA_exception_free (&ev);
+}
+void
+calendar_config_write_on_exit (void)
+{
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
- gnome_config_sync ();
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ bonobo_config_set_long (db, "/Calendar/Display/View",
+ config->view, NULL);
+ bonobo_config_set_long (db, "/Calendar/Display/TimeDivisions",
+ config->time_divisions, NULL);
+ bonobo_config_set_float (db, "/Calendar/Display/HPanePosition",
+ config->hpane_pos, NULL);
+ bonobo_config_set_float (db, "/Calendar/Display/VPanePosition",
+ config->vpane_pos, NULL);
+ bonobo_config_set_float (db, "/Calendar/Display/MonthHPanePosition",
+ config->month_hpane_pos, NULL);
+ bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition",
+ config->month_vpane_pos, NULL);
+
+ Bonobo_ConfigDatabase_sync (db, &ev);
+
+ bonobo_object_release_unref (db, NULL);
+
+ CORBA_exception_free (&ev);
}
diff --git a/composer/Makefile.am b/composer/Makefile.am
index aa38b9ea18..22b80e24e0 100644
--- a/composer/Makefile.am
+++ b/composer/Makefile.am
@@ -56,6 +56,7 @@ INCLUDES = \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
$(GTKHTML_CFLAGS) \
$(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_DATADIR=\"$(datadir)\" \
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 4e72852fd2..917c5c4ba3 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -43,7 +43,6 @@
#include <errno.h>
#include <ctype.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-config.h>
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
@@ -807,21 +806,16 @@ set_editor_text (EMsgComposer *composer, const char *text)
static void
set_config (EMsgComposer *composer, char *key, int val)
{
- if (composer->property_bag){
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
-
- bonobo_property_bag_client_set_value_gint (
- composer->property_bag, key, val, &ev);
- CORBA_exception_free (&ev);
+ char *full_key;
+
+ if (composer->config_db == CORBA_OBJECT_NIL)
return;
- } else {
- char *full_key;
-
- full_key = g_strconcat ("Evolution/Composer/", key, NULL);
- gnome_config_set_int (full_key, val);
- g_free (full_key);
- }
+
+ full_key = g_strconcat ("/Mail/Composer/", key, NULL);
+
+ bonobo_config_set_long (composer->config_db, full_key, val, NULL);
+
+ g_free (full_key);
}
@@ -1609,9 +1603,15 @@ destroy (GtkObject *object)
CORBA_Environment ev;
composer = E_MSG_COMPOSER (object);
-
- gnome_config_sync ();
-
+
+ CORBA_exception_init (&ev);
+
+ if (composer->config_db) {
+ Bonobo_ConfigDatabase_sync (composer->config_db, &ev);
+ bonobo_object_release_unref (composer->config_db, NULL);
+ }
+ composer->config_db = NULL;
+
if (composer->uic)
bonobo_object_unref (BONOBO_OBJECT (composer->uic));
composer->uic = NULL;
@@ -1641,7 +1641,7 @@ destroy (GtkObject *object)
g_free (composer->charset);
CORBA_exception_init (&ev);
-
+
if (composer->persist_stream_interface != CORBA_OBJECT_NIL) {
Bonobo_Unknown_unref (composer->persist_stream_interface, &ev);
CORBA_Object_release (composer->persist_stream_interface, &ev);
@@ -1852,71 +1852,39 @@ e_msg_composer_get_type (void)
return type;
}
-static int
-get_config_value (const char *key)
-{
- char *full_key = g_strconcat ("/Evolution/Composer/", key, NULL);
- int v;
-
- v = gnome_config_get_int (full_key);
- g_free (full_key);
- return v;
-}
-
-static gint
-load_with_failue_control (Bonobo_PropertyBag bag, char *key, gint default_if_fails)
-{
- CORBA_Environment ev;
- gint v;
-
- CORBA_exception_init (&ev);
- v = bonobo_property_bag_client_get_value_gint (bag, key, &ev);
- if (ev._major == CORBA_NO_EXCEPTION)
- return v;
- CORBA_exception_free (&ev);
-
- return default_if_fails;
-}
-
static void
-load_from_property_bag (EMsgComposer *composer)
+load_from_config_db (EMsgComposer *composer)
{
- Bonobo_PropertyBag bag = composer->property_bag;
+ Bonobo_ConfigDatabase db = composer->config_db;
- composer->view_from = load_with_failue_control (bag, "ViewFrom", 1);
- composer->view_replyto = load_with_failue_control (bag, "ViewReplyTo", 0);
- composer->view_bcc = load_with_failue_control (bag, "ViewBCC", 0);
- composer->view_cc = load_with_failue_control (bag, "ViewCC", 1);
- composer->view_subject = load_with_failue_control (bag, "ViewSubject", 1);
-}
-
-static void
-load_from_gnome_config (EMsgComposer *composer)
-{
- composer->view_from = get_config_value ("ViewFrom=1");
- composer->view_replyto = get_config_value ("ViewReplyTo=0");
- composer->view_bcc = get_config_value ("ViewBCC=0");
- composer->view_cc = get_config_value ("ViewCC=1");
- composer->view_subject = get_config_value ("ViewSubject=1");
+ composer->view_from = bonobo_config_get_long_with_default (db,
+ "Mail/Composer/ViewFrom", 1, NULL);
+ composer->view_replyto = bonobo_config_get_long_with_default (db,
+ "Mail/Composer/ViewReplyTo", 0, NULL);
+ composer->view_bcc = bonobo_config_get_long_with_default (db,
+ "Mail/Composer/ViewBCC", 0, NULL);
+ composer->view_cc = bonobo_config_get_long_with_default (db,
+ "Mail/Composer/ViewCC", 1, NULL);
+ composer->view_subject = bonobo_config_get_long_with_default (db,
+ "Mail/Composer/ViewSubject", 1, NULL);
}
static void
e_msg_composer_load_config (EMsgComposer *composer)
{
- Bonobo_PropertyBag pbag;
+ Bonobo_ConfigDatabase db;
CORBA_Environment ev;
-
+
CORBA_exception_init (&ev);
- pbag = bonobo_get_object (
- "config:/Evolution/Mail/Composer", "IDL:Bonobo/PropertyBag:1.0",
- &ev);
- if (ev._major == CORBA_NO_EXCEPTION && pbag != CORBA_OBJECT_NIL){
- composer->property_bag = pbag;
- load_from_property_bag (composer);
- } else {
- composer->property_bag = CORBA_OBJECT_NIL;
- load_from_gnome_config (composer);
- }
+
+ db = bonobo_get_object ( "wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (ev._major == CORBA_NO_EXCEPTION && db != CORBA_OBJECT_NIL){
+ composer->config_db = db;
+ load_from_config_db (composer);
+ } else
+ composer->config_db = CORBA_OBJECT_NIL;
+
CORBA_exception_free (&ev);
}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index ba587e28c2..ce73e1eea7 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -29,6 +29,7 @@ typedef struct _EMsgComposerClass EMsgComposerClass;
#include <bonobo/bonobo-win.h>
#include <bonobo/bonobo-ui-component.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include "e-msg-composer-attachment-bar.h"
#include "e-msg-composer-hdrs.h"
@@ -71,7 +72,7 @@ struct _EMsgComposer {
BonoboObject *editor_listener;
GHashTable *inline_images;
- Bonobo_PropertyBag property_bag;
+ Bonobo_ConfigDatabase config_db;
char *charset;
diff --git a/configure.in b/configure.in
index fdbd8b2b14..664b2e1dee 100644
--- a/configure.in
+++ b/configure.in
@@ -503,6 +503,7 @@ EVO_CHECK_LIB(GAL, gal, 0.8.99.7)
EVO_CHECK_LIB(GtkHTML, gtkhtml, 0.9.99.1)
EVO_CHECK_LIB(GNOME-VFS, vfs, 1.0)
EVO_CHECK_LIB(libxml, xml, 1.8.10, 2.0)
+EVO_CHECK_LIB(bonobo-conf, bonobo_conf, 0.6)
dnl *************************
dnl CFLAGS and LIBS and stuff
@@ -543,6 +544,11 @@ GNOME_PRINT_CFLAGS=`gnome-config --cflags print`
AC_SUBST(GNOME_PRINT_LIBS)
AC_SUBST(GNOME_PRINT_CFLAGS)
+BONOBO_CONF_CFLAGS="`gnome-config --cflags bonobo_conf`"
+BONOBO_CONF_LIBS="`gnome-config --libs bonobo_conf`"
+AC_SUBST(BONOBO_CONF_CFLAGS)
+AC_SUBST(BONOBO_CONF_LIBS)
+
GTKHTML_CFLAGS="`gnome-config --cflags gtkhtml`"
GTKHTML_LIBS="`gnome-config --libs gtkhtml`"
GTKHTML_DATADIR=`gnome-config --moddatadir gtkhtml`
diff --git a/importers/Makefile.am b/importers/Makefile.am
index a4e8a0e3c8..ca23b7b210 100644
--- a/importers/Makefile.am
+++ b/importers/Makefile.am
@@ -11,6 +11,7 @@ INCLUDES = \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/addressbook/backend/ebook \
$(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
$(EXTRA_GNOME_CFLAGS)
IDLS = \
diff --git a/importers/elm-importer.c b/importers/elm-importer.c
index 9692c2500c..d2341a012d 100644
--- a/importers/elm-importer.c
+++ b/importers/elm-importer.c
@@ -41,6 +41,9 @@
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <importer/evolution-intelligent-importer.h>
#include <importer/evolution-importer-client.h>
@@ -72,6 +75,8 @@ typedef struct {
GtkWidget *ask;
gboolean ask_again;
+
+ Bonobo_ConfigDatabase db;
} ElmImporter;
typedef struct {
@@ -87,41 +92,25 @@ static void import_next (ElmImporter *importer);
static void
elm_store_settings (ElmImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Elm-Importer=/settings/",
- evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
- gnome_config_set_bool ("mail", importer->do_mail);
- gnome_config_set_bool ("alias", importer->do_alias);
-
- gnome_config_set_bool ("ask-again", importer->ask_again);
- gnome_config_pop_prefix ();
+ bonobo_config_set_boolean (importer->db, "/Importer/Elm/mail",
+ importer->do_mail, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Elm/alias",
+ importer->do_alias, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Elm/ask-again",
+ importer->ask_again, NULL);
}
static void
elm_restore_settings (ElmImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Elm-Importer=/settings/",
- evolution_dir);
- g_free (evolution_dir);
+ importer->do_mail = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Elm/mail", TRUE, NULL);
- gnome_config_push_prefix (key);
- g_free (key);
+ importer->do_alias = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Elm/alias", TRUE, NULL);
- importer->do_mail = gnome_config_get_bool ("mail=True");
- importer->do_alias = gnome_config_get_bool ("alias=True");
-
- importer->ask_again = gnome_config_get_bool ("ask-again=False");
- gnome_config_pop_prefix ();
+ importer->ask_again = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Elm/ask-again", FALSE, NULL);
}
static void
@@ -269,28 +258,20 @@ elm_can_import (EvolutionIntelligentImporter *ii,
void *closure)
{
ElmImporter *importer = closure;
- char *key, *elmdir, *maildir, *evolution_dir, *aliasfile;
+ char *elmdir, *maildir, *aliasfile;
char *elmrc;
gboolean exists, mailexists, aliasexists;
gboolean mail, alias;
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- /* Already imported */
- key = g_strdup_printf ("=%s/config/Importers=/elm-importers/", evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
+ mail = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Elm/mail-imported", FALSE, NULL);
- mail = gnome_config_get_bool ("mail-imported");
- alias = gnome_config_get_bool ("alias-importer");
+ alias = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Elm/alias-imported", FALSE, NULL);
- if (alias && mail) {
- gnome_config_pop_prefix ();
+ if (alias && mail)
return FALSE;
- }
- gnome_config_pop_prefix ();
-
+
importer->do_mail = !mail;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (importer->mail),
importer->do_mail);
@@ -428,19 +409,15 @@ static void
elm_create_structure (EvolutionIntelligentImporter *ii,
void *closure)
{
+ CORBA_Environment ev;
ElmImporter *importer = closure;
- char *maildir, *key, *evolution_dir;
+ char *maildir;
/* Reference our object so when the shell release_unrefs us
we will still exist and not go byebye */
bonobo_object_ref (BONOBO_OBJECT (ii));
elm_store_settings (importer);
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Importers=/elm-importers/", evolution_dir);
- g_free (evolution_dir);
- gnome_config_push_prefix (key);
- g_free (key);
if (importer->do_alias == TRUE) {
/* Do the aliases */
@@ -448,7 +425,9 @@ elm_create_structure (EvolutionIntelligentImporter *ii,
if (importer->do_mail == TRUE) {
char *elmdir;
- gnome_config_set_bool ("mail-importer", TRUE);
+
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Elm/mail-imported", TRUE, NULL);
maildir = elm_get_rc_value ("maildir");
if (maildir == NULL) {
@@ -472,10 +451,9 @@ elm_create_structure (EvolutionIntelligentImporter *ii,
import_next (importer);
}
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
if (importer->do_mail == FALSE) {
bonobo_object_unref (BONOBO_OBJECT (ii));
@@ -486,11 +464,22 @@ static void
elm_destroy_cb (GtkObject *object,
ElmImporter *importer)
{
+ CORBA_Environment ev;
+
g_print ("\n----------Settings-------\n");
g_print ("Mail - %s\n", importer->do_mail ? "Yes" : "No");
g_print ("Alias - %s\n", importer->do_alias ? "Yes" : "No");
elm_store_settings (importer);
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
+
+ if (importer->db != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (importer->db, NULL);
+ importer->db = CORBA_OBJECT_NIL;
+
gtk_main_quit ();
}
@@ -562,11 +551,22 @@ factory_fn (BonoboGenericFactory *_factory,
"Would you like to import them into Evolution?");
elm = g_new0 (ElmImporter, 1);
- elm_restore_settings (elm);
CORBA_exception_init (&ev);
+
+ elm->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || elm->db == CORBA_OBJECT_NIL) {
+ g_free (elm);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ elm_restore_settings (elm);
+
elm->importer = oaf_activate_from_id (MBOX_IMPORTER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
+ g_free (elm);
g_warning ("Could not start MBox importer\n%s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
diff --git a/importers/evolution-gnomecard-importer.c b/importers/evolution-gnomecard-importer.c
index 13e7683647..20385a79b6 100644
--- a/importers/evolution-gnomecard-importer.c
+++ b/importers/evolution-gnomecard-importer.c
@@ -31,6 +31,9 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <e-book.h>
@@ -50,44 +53,29 @@ typedef struct {
GtkWidget *ask;
gboolean ask_again;
+
+ Bonobo_ConfigDatabase db;
} GnomeCardImporter;
static void
gnomecard_store_settings (GnomeCardImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Gnomecard-Importer=/settings/",
- evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
- gnome_config_set_bool ("address", importer->do_addresses);
-
- gnome_config_set_bool ("ask-again", importer->ask_again);
- gnome_config_pop_prefix ();
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Gnomecard/address",
+ importer->do_addresses, NULL);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Gnomecard/ask-again",
+ importer->ask_again, NULL);
}
static void
gnomecard_restore_settings (GnomeCardImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Gnomecard-Importer=/settings/",
- evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
- importer->do_addresses = gnome_config_get_bool ("address=True");
+ importer->do_addresses = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Gnomecard/address", TRUE, NULL);
- importer->ask_again = gnome_config_get_bool ("ask-again=False");
- gnome_config_pop_prefix ();
+ importer->ask_again = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Gnomecard/ask-again", FALSE, NULL);
}
static gboolean
@@ -95,28 +83,14 @@ gnomecard_can_import (EvolutionIntelligentImporter *ii,
void *closure)
{
GnomeCardImporter *importer = closure;
- char *evolution_dir;
char *gnomecard;
- char *key;
gboolean result, address;
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Importers=/gnomecard-importers/", evolution_dir);
- g_free (evolution_dir);
+ address = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Gnomecard/address-imported", FALSE, NULL);
- gnome_config_push_prefix (key);
- g_free (key);
-
- address = gnome_config_get_bool ("address-imported");
- if (address == TRUE) {
- gnome_config_pop_prefix ();
+ if (address == TRUE || importer->ask_again == TRUE)
return FALSE;
- }
- gnome_config_pop_prefix ();
-
- if (importer->ask_again == TRUE) {
- return FALSE;
- }
gnomecard = gnome_util_home_file ("GnomeCard.gcrd");
result = g_file_exists (gnomecard);
@@ -177,6 +151,7 @@ gnomecard_import (EvolutionIntelligentImporter *ii,
bonobo_object_ref (BONOBO_OBJECT (ii));
gnomecard_store_settings (gci);
+
if (gci->do_addresses == TRUE) {
CORBA_exception_init (&ev);
@@ -213,11 +188,22 @@ static void
gnomecard_destroy_cb (GtkObject *object,
GnomeCardImporter *importer)
{
+ CORBA_Environment ev;
+
/* save the state of the checkboxes */
g_print ("\n---------Settings-------\n");
g_print ("Addressbook - %s\n", importer->do_addresses? "Yes" : "No");
gnomecard_store_settings (importer);
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
+
+ if (importer->db != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (importer->db, NULL);
+ importer->db = CORBA_OBJECT_NIL;
+
gtk_main_quit ();
}
@@ -278,9 +264,19 @@ factory_fn (BonoboGenericFactory *_factory,
BonoboControl *control;
gci = g_new (GnomeCardImporter, 1);
- gnomecard_restore_settings (gci);
CORBA_exception_init (&ev);
+
+ gci->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || gci->db == CORBA_OBJECT_NIL) {
+ g_free (gci);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ gnomecard_restore_settings (gci);
+
gci->importer = oaf_activate_from_id (VCARD_IMPORTER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Could not start VCard importer: %s",
@@ -308,7 +304,7 @@ factory_fn (BonoboGenericFactory *_factory,
static void
importer_init (void)
{
- BonoboObject *factory;
+ BonoboGenericFactory *factory;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
factory_fn, NULL);
diff --git a/importers/netscape-importer.c b/importers/netscape-importer.c
index 424ef1dca2..e2093c8a0c 100644
--- a/importers/netscape-importer.c
+++ b/importers/netscape-importer.c
@@ -41,6 +41,9 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-context.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <importer/evolution-intelligent-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
@@ -84,6 +87,8 @@ typedef struct {
GtkWidget *ask;
gboolean ask_again;
+
+ Bonobo_ConfigDatabase db;
} NetscapeImporter;
static void import_next (NetscapeImporter *importer);
@@ -91,44 +96,36 @@ static void import_next (NetscapeImporter *importer);
static void
netscape_store_settings (NetscapeImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Netscape-Importer=/settings/",
- evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
- gnome_config_set_bool ("mail", importer->do_mail);
- gnome_config_set_bool ("address", importer->do_addrs);
- gnome_config_set_bool ("filters", importer->do_filters);
- gnome_config_set_bool ("settings", importer->do_settings);
-
- gnome_config_set_bool ("ask-again", importer->ask_again);
- gnome_config_pop_prefix ();
+ bonobo_config_set_boolean (importer->db, "/Importer/Netscape/mail",
+ importer->do_mail, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Netscape/address",
+ importer->do_addrs, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Netscape/filters",
+ importer->do_filters, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Netscape/settings",
+ importer->do_settings, NULL);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Netscape/ask-again",
+ importer->ask_again, NULL);
}
static void
netscape_restore_settings (NetscapeImporter *importer)
{
- char *evolution_dir, *key;
+ importer->do_mail = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Netscape/mail", TRUE, NULL);
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Netscape-Importer=/settings/", evolution_dir);
- g_free (evolution_dir);
+ importer->do_addrs = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Netscape/address", TRUE, NULL);
- gnome_config_push_prefix (key);
- g_free (key);
+ importer->do_filters = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Netscape/filters", TRUE, NULL);
- importer->do_mail = gnome_config_get_bool ("mail=True");
- importer->do_addrs = gnome_config_get_bool ("address=True");
- importer->do_filters = gnome_config_get_bool ("filters=True");
- importer->do_settings = gnome_config_get_bool ("setting=True");
+ importer->do_settings = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Netscape/settings", TRUE, NULL);
- importer->ask_again = gnome_config_get_bool ("ask-again=False");
- gnome_config_pop_prefix ();
+ importer->ask_again = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Netscape/ask-again", FALSE, NULL);
}
static const char *
@@ -458,27 +455,14 @@ netscape_can_import (EvolutionIntelligentImporter *ii,
{
NetscapeImporter *importer = closure;
gboolean mail, settings;
- char *evolution_dir;
- char *key;
-
- /* Probably shouldn't hard code this, but there's no way yet to change
- the home dir. FIXME */
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- /* Already imported */
- key = g_strdup_printf ("=%s/config/Importers=/netscape-importers/", evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
- mail = gnome_config_get_bool ("mail-imported");
- settings = gnome_config_get_bool ("settings-imported");
+ mail = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Netscape/mail-imported", FALSE, NULL);
+ settings = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Netscape/settings-imported", FALSE, NULL);
- if (settings && mail) {
- gnome_config_pop_prefix ();
+ if (settings && mail)
return FALSE;
- }
- gnome_config_pop_prefix ();
importer->do_mail = !mail;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (importer->mail),
@@ -700,8 +684,8 @@ static void
netscape_create_structure (EvolutionIntelligentImporter *ii,
void *closure)
{
+ CORBA_Environment ev;
NetscapeImporter *importer = closure;
- char *key, *evolution_dir;
g_return_if_fail (nsmail_dir != NULL);
@@ -710,21 +694,16 @@ netscape_create_structure (EvolutionIntelligentImporter *ii,
bonobo_object_ref (BONOBO_OBJECT (ii));
netscape_store_settings (importer);
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- /* Set that we've imported the folders so we won't import them again */
- key = g_strdup_printf ("=%s/config/Importers=/netscape-importers/", evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
if (importer->do_settings == TRUE) {
- gnome_config_set_bool ("settings-imported", TRUE);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Netscape/settings-imported", TRUE, NULL);
netscape_import_accounts (importer);
}
if (importer->do_mail == TRUE) {
- gnome_config_set_bool ("mail-imported", TRUE);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Netscape/mail-imported", TRUE, NULL);
/* Scan the nsmail folder and find out what folders
need to be imported */
scan_dir (importer, "/", nsmail_dir);
@@ -733,10 +712,9 @@ netscape_create_structure (EvolutionIntelligentImporter *ii,
import_next (importer);
}
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
if (importer->do_mail == FALSE) {
/* Destroy it here if we weren't importing mail
@@ -750,6 +728,8 @@ static void
netscape_destroy_cb (GtkObject *object,
NetscapeImporter *importer)
{
+ CORBA_Environment ev;
+
/* Save the state of the checkboxes */
g_print ("\n-------Settings-------\n");
g_print ("Mail - %s\n", importer->do_mail ? "Yes" : "No");
@@ -758,6 +738,15 @@ netscape_destroy_cb (GtkObject *object,
g_print ("Settings - %s\n", importer->do_settings ? "Yes" : "No");
netscape_store_settings (importer);
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
+
+ if (importer->db != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (importer->db, NULL);
+ importer->db = CORBA_OBJECT_NIL;
+
gtk_main_quit ();
}
@@ -848,9 +837,20 @@ factory_fn (BonoboGenericFactory *_factory,
"Would you like them to be imported into Evolution?");
netscape = g_new0 (NetscapeImporter, 1);
- netscape_restore_settings (netscape);
CORBA_exception_init (&ev);
+
+ netscape->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase",
+ &ev);
+
+ if (BONOBO_EX (&ev) || netscape->db == CORBA_OBJECT_NIL) {
+ g_free (netscape);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ netscape_restore_settings (netscape);
+
netscape->importer = oaf_activate_from_id (MBOX_IMPORTER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Could not start MBox importer\n%s", CORBA_exception_id (&ev));
diff --git a/importers/pine-importer.c b/importers/pine-importer.c
index 858d9adbff..10124408cf 100644
--- a/importers/pine-importer.c
+++ b/importers/pine-importer.c
@@ -40,6 +40,9 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <importer/evolution-intelligent-importer.h>
#include <importer/evolution-importer-client.h>
@@ -76,6 +79,8 @@ typedef struct {
gboolean ask_again;
EBook *book;
+
+ Bonobo_ConfigDatabase db;
} PineImporter;
typedef struct {
@@ -89,41 +94,30 @@ static void import_next (PineImporter *importer);
static void
pine_store_settings (PineImporter *importer)
{
- char *evolution_dir, *key;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Pine-Importer=/settings/", evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
- gnome_config_set_bool ("mail", importer->do_mail);
- gnome_config_set_bool ("settings", importer->do_settings);
- gnome_config_set_bool ("address", importer->do_address);
-
- gnome_config_set_bool ("ask-again", importer->ask_again);
- gnome_config_pop_prefix ();
+ bonobo_config_set_boolean (importer->db, "/Importer/Pine/mail",
+ importer->do_mail, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Pine/settings",
+ importer->do_settings, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Pine/address",
+ importer->do_address, NULL);
+ bonobo_config_set_boolean (importer->db, "/Importer/Pine/ask-again",
+ importer->ask_again, NULL);
}
static void
pine_restore_settings (PineImporter *importer)
{
- char *evolution_dir, *key;
+ importer->do_mail = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Pine/mail", TRUE, NULL);
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Pine-Importer=/settings/", evolution_dir);
- g_free (evolution_dir);
+ importer->do_settings = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Pine/settings", TRUE, NULL);
- gnome_config_push_prefix (key);
- g_free (key);
-
- importer->do_mail = gnome_config_get_bool ("mail=True");
- importer->do_settings = gnome_config_get_bool ("settings=True");
- importer->do_address = gnome_config_get_bool ("address=True");
+ importer->do_address = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Pine/address", TRUE, NULL);
- importer->ask_again = gnome_config_get_bool ("ask-again=False");
- gnome_config_pop_prefix ();
+ importer->ask_again = bonobo_config_get_boolean_with_default (
+ importer->db, "/Importer/Pine/ask-again", FALSE, NULL);
}
/* Pass in handle so we can get the next line if we need to */
@@ -419,25 +413,17 @@ pine_can_import (EvolutionIntelligentImporter *ii,
void *closure)
{
PineImporter *importer = closure;
- char *key, *maildir, *evolution_dir, *addrfile;
+ char *maildir, *addrfile;
gboolean mail;
gboolean md_exists, addr_exists;
/* Already imported */
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Importers=/pine-importer/", evolution_dir);
- g_free (evolution_dir);
- gnome_config_push_prefix (key);
- g_free (key);
+ mail = bonobo_config_get_boolean_with_default (importer->db,
+ "/Importer/Pine/mail-imported", FALSE, NULL);
- mail = gnome_config_get_bool ("mail-imported");
-
- if (mail) {
- gnome_config_pop_prefix ();
+ if (mail)
return FALSE;
- }
- gnome_config_pop_prefix ();
importer->do_mail = !mail;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (importer->mail),
@@ -569,27 +555,23 @@ static void
pine_create_structure (EvolutionIntelligentImporter *ii,
void *closure)
{
+ CORBA_Environment ev;
PineImporter *importer = closure;
- char *maildir, *key, *evolution_dir;
+ char *maildir;
bonobo_object_ref (BONOBO_OBJECT (ii));
pine_store_settings (importer);
- evolution_dir = gnome_util_prepend_user_home ("evolution");
- key = g_strdup_printf ("=%s/config/Importers=/pine-importer/", evolution_dir);
- g_free (evolution_dir);
-
- gnome_config_push_prefix (key);
- g_free (key);
-
if (importer->do_address == TRUE) {
- gnome_config_set_bool ("address-imported", TRUE);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Pine/address-imported", TRUE, NULL);
import_addressbook (importer);
}
if (importer->do_mail == TRUE) {
- gnome_config_set_bool ("mail-imported", TRUE);
+ bonobo_config_set_boolean (importer->db,
+ "/Importer/Pine/mail-imported", TRUE, NULL);
maildir = gnome_util_prepend_user_home ("mail");
scan_dir (importer, maildir, "/");
@@ -599,10 +581,9 @@ pine_create_structure (EvolutionIntelligentImporter *ii,
import_next (importer);
}
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
if (importer->do_mail == FALSE && importer->do_address == FALSE) {
/* Destroy it here if we weren't importing mail
@@ -618,12 +599,23 @@ static void
pine_destroy_cb (GtkObject *object,
PineImporter *importer)
{
+ CORBA_Environment ev;
+
g_print ("\n-------Settings-------\n");
g_print ("Mail - %s\n", importer->do_mail ? "Yes" : "No");
g_print ("Settings - %s\n", importer->do_settings ? "Yes" : "No");
g_print ("Address - %s\n", importer->do_address ? "Yes" : "No");
pine_store_settings (importer);
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (importer->db, &ev);
+ CORBA_exception_free (&ev);
+
+ if (importer->db != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (importer->db, NULL);
+ importer->db = CORBA_OBJECT_NIL;
+
gtk_main_quit ();
}
@@ -706,9 +698,19 @@ factory_fn (BonoboGenericFactory *_factory,
"Would you like to import them into Evolution?");
pine = g_new0 (PineImporter, 1);
- pine_restore_settings (pine);
CORBA_exception_init (&ev);
+
+ pine->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || pine->db == CORBA_OBJECT_NIL) {
+ g_free (pine);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ pine_restore_settings (pine);
+
pine->importer = oaf_activate_from_id (MBOX_IMPORTER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Could not start MBox importer\n%s",
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 0a7fb4fbb5..913c4ca940 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -38,6 +38,9 @@
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-context.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <gal/util/e-util.h>
#include <gal/unicode/gunicode.h>
@@ -51,6 +54,8 @@
#include "Mail.h"
typedef struct {
+ Bonobo_ConfigDatabase db;
+
gboolean show_preview;
gboolean thread_list;
gboolean hide_deleted;
@@ -78,7 +83,6 @@ typedef struct {
GHashTable *preview_hash;
} MailConfig;
-static const char GCONFPATH[] = "/apps/Evolution/Mail";
static MailConfig *config = NULL;
#define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig_Factory"
@@ -219,10 +223,28 @@ account_destroy_each (gpointer item, gpointer data)
void
mail_config_init (void)
{
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
+
if (config)
return;
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ CORBA_exception_free (&ev);
+
config = g_new0 (MailConfig, 1);
+
+ config->db = db;
+
config_read ();
}
@@ -248,19 +270,14 @@ mail_config_clear (void)
static void
config_read (void)
{
- gchar *str;
gint len, i;
gboolean have_default = FALSE;
- gboolean def;
mail_config_clear ();
-
- /* Accounts */
- str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
- len = gnome_config_get_int ("num");
+
+ len = bonobo_config_get_long_with_default (config->db,
+ "/Mail/Accounts/num", 0, NULL);
+
for (i = 0; i < len; i++) {
MailConfigAccount *account;
MailConfigIdentity *id;
@@ -269,41 +286,44 @@ config_read (void)
gchar *path, *val;
account = g_new0 (MailConfigAccount, 1);
- path = g_strdup_printf ("account_name_%d", i);
- account->name = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i);
+ account->name = bonobo_config_get_string (config->db, path,
+ NULL);
g_free (path);
- path = g_strdup_printf ("account_is_default_%d", i);
- account->default_account = gnome_config_get_bool (path) && !have_default;
+ path = g_strdup_printf ("/Mail/Accounts/account_is_default_%d", i);
+ account->default_account = bonobo_config_get_boolean
+ (config->db, path, NULL) && !have_default;
+
if (account->default_account)
have_default = TRUE;
g_free (path);
- path = g_strdup_printf ("account_drafts_folder_name_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->drafts_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("account_drafts_folder_uri_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->drafts_folder_uri = val;
else
g_free (val);
- path = g_strdup_printf ("account_sent_folder_name_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->sent_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("account_sent_folder_uri_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->sent_folder_uri = val;
@@ -311,48 +331,49 @@ config_read (void)
g_free (val);
/* get the pgp info */
- path = g_strdup_printf ("account_pgp_key_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->pgp_key = val;
else
g_free (val);
- path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i);
- account->pgp_encrypt_to_self = gnome_config_get_bool_with_default (path, &def);
- if (def)
- account->pgp_encrypt_to_self = TRUE;
+ path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i);
+ account->pgp_encrypt_to_self = bonobo_config_get_boolean_with_default (
+ config->db, path, TRUE, NULL);
g_free (path);
/* get the s/mime info */
- path = g_strdup_printf ("account_smime_key_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
account->smime_key = val;
else
g_free (val);
- path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i);
- account->smime_encrypt_to_self = gnome_config_get_bool_with_default (path, &def);
- if (def)
- account->smime_encrypt_to_self = TRUE;
+ path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i);
+ account->smime_encrypt_to_self = bonobo_config_get_boolean_with_default (
+ config->db, path, TRUE, NULL);
g_free (path);
/* get the identity info */
id = g_new0 (MailConfigIdentity, 1);
- path = g_strdup_printf ("identity_name_%d", i);
- id->name = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i);
+ id->name = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("identity_address_%d", i);
- id->address = gnome_config_get_string (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i);
+ id->address = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("identity_organization_%d", i);
- id->organization = gnome_config_get_string (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
+ id->organization = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("identity_signature_%d", i);
- id->signature = gnome_config_get_string (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ id->signature = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
path = g_strdup_printf ("identity_html_signature_%d", i);
id->html_signature = gnome_config_get_string (path);
@@ -363,48 +384,59 @@ config_read (void)
/* get the source */
source = g_new0 (MailConfigService, 1);
- path = g_strdup_printf ("source_url_%d", i);
- val = gnome_config_get_string (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
source->url = val;
else
g_free (val);
- path = g_strdup_printf ("source_keep_on_server_%d", i);
- source->keep_on_server = gnome_config_get_bool (path);
+ path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i);
+ source->keep_on_server = bonobo_config_get_boolean (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("source_auto_check_%d", i);
- source->auto_check = gnome_config_get_bool_with_default (path, &def);
- if (def)
- source->auto_check = FALSE;
+
+ path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i);
+ source->auto_check = bonobo_config_get_boolean_with_default (
+ config->db, path, FALSE, NULL);
g_free (path);
- path = g_strdup_printf ("source_auto_check_time_%d", i);
- source->auto_check_time = gnome_config_get_int_with_default (path, &def);
- if (source->auto_check && def)
+
+ path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i);
+ source->auto_check_time = bonobo_config_get_long_with_default (
+ config->db, path, -1, NULL);
+
+ if (source->auto_check && source->auto_check_time <= 0) {
+ source->auto_check_time = 5;
source->auto_check = FALSE;
+ }
+
g_free (path);
- path = g_strdup_printf ("source_enabled_%d", i);
- source->enabled = gnome_config_get_bool_with_default (path, &def);
- if (def)
- source->enabled = TRUE;
+
+ path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i);
+ source->enabled = bonobo_config_get_boolean_with_default (
+ config->db, path, TRUE, NULL);
g_free (path);
- path = g_strdup_printf ("source_save_passwd_%d", i);
- source->save_passwd = gnome_config_get_bool (path);
+
+ path = g_strdup_printf
+ ("/Mail/Accounts/source_save_passwd_%d", i);
+ source->save_passwd = bonobo_config_get_boolean_with_default (
+ config->db, path, TRUE, NULL);
g_free (path);
/* get the transport */
transport = g_new0 (MailConfigService, 1);
- path = g_strdup_printf ("transport_url_%d", i);
- val = gnome_config_get_string (path);
+ path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
transport->url = val;
else
g_free (val);
- path = g_strdup_printf ("transport_save_passwd_%d", i);
- transport->save_passwd = gnome_config_get_bool (path);
+ path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i);
+ transport->save_passwd = bonobo_config_get_boolean
+ (config->db, path, NULL);
g_free (path);
account->id = id;
@@ -413,148 +445,93 @@ config_read (void)
config->accounts = g_slist_append (config->accounts, account);
}
- gnome_config_pop_prefix ();
#ifdef ENABLE_NNTP
/* News */
- str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
- len = gnome_config_get_int ("num");
+ len = bonobo_config_get_long_with_default (config->db,
+ "/News/Sources/num", 0, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- gchar *path;
+ gchar *path, *r;
- n = g_new0 (MailConfigService, 1);
-
- path = g_strdup_printf ("url_%d", i);
- n->url = gnome_config_get_string (path);
+ path = g_strdup_printf ("/News/Sources/url_%d", i);
+
+ if ((r = bonobo_config_get_string (config->db, path, NULL))) {
+
+ n = g_new0 (MailConfigService, 1);
+ n->url = r;
+ config->news = g_slist_append (config->news, n);
+ }
+
g_free (path);
- config->news = g_slist_append (config->news, n);
}
- gnome_config_pop_prefix ();
#endif
/* Format */
- str = g_strdup_printf ("=%s/config/Mail=/Format/send_html",
- evolution_dir);
- config->send_html = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->send_html = FALSE;
- g_free (str);
-
+ config->send_html = bonobo_config_get_boolean_with_default (config->db,
+ "/Mail/Format/send_html", FALSE, NULL);
+
/* Citation */
- str = g_strdup_printf ("=%s/config/Mail=/Display/citation_highlight",
- evolution_dir);
- config->citation_highlight = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->citation_highlight = TRUE;
- g_free (str);
- str = g_strdup_printf ("=%s/config/Mail=/Display/citation_color",
- evolution_dir);
- config->citation_color = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->citation_color = 0x737373;
- g_free (str);
+ config->citation_highlight = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Display/citation_highlight", TRUE, NULL);
+
+ config->citation_color = bonobo_config_get_long_with_default (
+ config->db, "/Mail/Display/citation_color", 0x737373, NULL);
/* Mark as seen timeout */
- str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout",
- evolution_dir);
- config->seen_timeout = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->seen_timeout = 1500;
- g_free (str);
+ config->seen_timeout = bonobo_config_get_long_with_default (config->db,
+ "/Mail/Display/seen_timeout", 1500, NULL);
/* Show Messages Threaded */
- str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list",
- evolution_dir);
- config->thread_list = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->thread_list = FALSE;
- g_free (str);
+ config->thread_list = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Display/thread_list", FALSE, NULL);
- /* Show Message Preview */
- str = g_strdup_printf ("=%s/config/Mail=/Display/preview_pane",
- evolution_dir);
- config->show_preview = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->show_preview = TRUE;
- g_free (str);
+ config->show_preview = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Display/preview_pane", TRUE, NULL);
/* Hide deleted automatically */
- str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted",
- evolution_dir);
- config->hide_deleted = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->hide_deleted = FALSE;
- g_free (str);
+ config->hide_deleted = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Display/hide_deleted", FALSE, NULL);
/* Size of vpaned in mail view */
- str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size",
- evolution_dir);
- config->paned_size = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->paned_size = 200;
- g_free (str);
-
+ config->paned_size = bonobo_config_get_long_with_default (config->db,
+ "/Mail/Display/paned_size", 200, NULL);
+
/* Empty Subject */
- str = g_strdup_printf ("=%s/config/Mail=/Prompts/empty_subject",
- evolution_dir);
- config->prompt_empty_subject = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->prompt_empty_subject = TRUE;
- g_free (str);
+ config->prompt_empty_subject = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Prompts/empty_subject", TRUE, NULL);
/* Only Bcc */
- str = g_strdup_printf ("=%s/config/Mail=/Prompts/only_bcc",
- evolution_dir);
- config->prompt_only_bcc = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->prompt_only_bcc = TRUE;
- g_free (str);
-
+ config->prompt_only_bcc = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Prompts/only_bcc", TRUE, NULL);
+
/* PGP/GPG */
- str = g_strdup_printf ("=%s/config/Mail=/PGP/path",
- evolution_dir);
- config->pgp_path = gnome_config_get_string (str);
- g_free (str);
- str = g_strdup_printf ("=%s/config/Mail=/PGP/type",
- evolution_dir);
- config->pgp_type = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->pgp_type = CAMEL_PGP_TYPE_NONE;
- g_free (str);
-
+ config->pgp_path = bonobo_config_get_string (config->db,
+ "/Mail/PGP/path", NULL);
+
+ config->pgp_type = bonobo_config_get_long_with_default (config->db,
+ "/Mail/PGP/type", CAMEL_PGP_TYPE_NONE, NULL);
+
/* HTTP images */
- str = g_strdup_printf ("=%s/config/Mail=/Display/http_images",
- evolution_dir);
- config->http_mode = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->http_mode = MAIL_CONFIG_HTTP_SOMETIMES;
- g_free (str);
+ config->http_mode = bonobo_config_get_long_with_default (config->db,
+ "/Mail/Display/http_images", MAIL_CONFIG_HTTP_SOMETIMES, NULL);
/* Forwarding */
- str = g_strdup_printf ("=%s/config/Mail=/Format/default_forward_style",
- evolution_dir);
- config->default_forward_style = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->default_forward_style = MAIL_CONFIG_FORWARD_ATTACHED;
- g_free (str);
+ config->default_forward_style = bonobo_config_get_long_with_default (
+ config->db, "/Mail/Format/default_forward_style",
+ MAIL_CONFIG_FORWARD_ATTACHED, NULL);
/* Message Display */
- str = g_strdup_printf ("=%s/config/Mail=/Format/message_display_style",
- evolution_dir);
- config->message_display_style = gnome_config_get_int_with_default (str, &def);
- if (def)
- config->message_display_style = MAIL_CONFIG_DISPLAY_NORMAL;
- g_free (str);
-
+ config->message_display_style = bonobo_config_get_long_with_default (
+ config->db, "/Mail/Format/message_display_style",
+ MAIL_CONFIG_DISPLAY_NORMAL, NULL);
+
/* Default charset */
- str = g_strdup_printf ("=%s/config/Mail=/Format/default_charset", evolution_dir);
- config->default_charset = gnome_config_get_string (str);
- g_free (str);
+ config->default_charset = bonobo_config_get_string (config->db,
+ "/Mail/Format/default_charset", NULL);
+
if (!config->default_charset) {
g_get_charset (&config->default_charset);
if (!config->default_charset ||
@@ -563,33 +540,32 @@ config_read (void)
else
config->default_charset = g_strdup (config->default_charset);
}
-
+
/* Trash folders */
- str = g_strdup_printf ("=%s/config/Mail=/Trash/empty_on_exit",
- evolution_dir);
- config->empty_trash_on_exit = gnome_config_get_bool_with_default (str, &def);
- if (def)
- config->empty_trash_on_exit = FALSE;
- g_free (str);
-
- gnome_config_sync ();
+ config->empty_trash_on_exit = bonobo_config_get_boolean_with_default (
+ config->db, "/Mail/Trash/empty_on_exit", FALSE, NULL);
}
void
mail_config_write (void)
{
- gchar *str;
+ CORBA_Environment ev;
gint len, i;
/* Accounts */
- str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir);
- gnome_config_clean_section (str);
- gnome_config_sync ();
- gnome_config_push_prefix (str);
- g_free (str);
+
+ if (!config)
+ return;
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_removeDir (config->db, "/Mail/Accounts", &ev);
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_removeDir (config->db, "/News/Sources", &ev);
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (config->db, &ev);
len = g_slist_length (config->accounts);
- gnome_config_set_int ("num", len);
+ bonobo_config_set_long (config->db, "/Mail/Accounts/num", len, NULL);
for (i = 0; i < len; i++) {
MailConfigAccount *account;
gchar *path;
@@ -597,53 +573,76 @@ mail_config_write (void)
account = g_slist_nth_data (config->accounts, i);
/* account info */
- path = g_strdup_printf ("account_name_%d", i);
- gnome_config_set_string (path, account->name);
+ path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i);
+ bonobo_config_set_string (config->db, path, account->name, NULL);
g_free (path);
- path = g_strdup_printf ("account_is_default_%d", i);
- gnome_config_set_bool (path, account->default_account);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_is_default_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->default_account, NULL);
g_free (path);
- path = g_strdup_printf ("account_drafts_folder_name_%d", i);
- gnome_config_set_string (path, account->drafts_folder_name);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->drafts_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("account_drafts_folder_uri_%d", i);
- gnome_config_set_string (path, account->drafts_folder_uri);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->drafts_folder_uri, NULL);
g_free (path);
- path = g_strdup_printf ("account_sent_folder_name_%d", i);
- gnome_config_set_string (path, account->sent_folder_name);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->sent_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("account_sent_folder_uri_%d", i);
- gnome_config_set_string (path, account->sent_folder_uri);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->sent_folder_uri, NULL);
g_free (path);
/* account pgp options */
- path = g_strdup_printf ("account_pgp_key_%d", i);
- gnome_config_set_string (path, account->pgp_key);
+ path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i);
+ bonobo_config_set_string (config->db, path, account->pgp_key, NULL);
g_free (path);
- path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i);
- gnome_config_set_bool (path, account->pgp_encrypt_to_self);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->pgp_encrypt_to_self, NULL);
g_free (path);
/* account s/mime options */
- path = g_strdup_printf ("account_smime_key_%d", i);
- gnome_config_set_string (path, account->smime_key);
+ path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->smime_key, NULL);
g_free (path);
- path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i);
- gnome_config_set_bool (path, account->smime_encrypt_to_self);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->smime_encrypt_to_self,
+ NULL);
g_free (path);
/* identity info */
- path = g_strdup_printf ("identity_name_%d", i);
- gnome_config_set_string (path, account->id->name);
+ path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i);
+ bonobo_config_set_string (config->db, path, account->id->name,
+ NULL);
g_free (path);
- path = g_strdup_printf ("identity_address_%d", i);
- gnome_config_set_string (path, account->id->address);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->id->address, NULL);
g_free (path);
- path = g_strdup_printf ("identity_organization_%d", i);
- gnome_config_set_string (path, account->id->organization);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->id->organization, NULL);
g_free (path);
- path = g_strdup_printf ("identity_signature_%d", i);
- gnome_config_set_string (path, account->id->signature);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->id->signature, NULL);
g_free (path);
path = g_strdup_printf ("identity_html_signature_%d", i);
gnome_config_set_string (path, account->id->html_signature);
@@ -653,66 +652,86 @@ mail_config_write (void)
g_free (path);
/* source info */
- path = g_strdup_printf ("source_url_%d", i);
- gnome_config_set_string (path, account->source->url ? account->source->url : "");
+ path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->source->url ? account->source->url : "",
+ NULL);
g_free (path);
- path = g_strdup_printf ("source_keep_on_server_%d", i);
- gnome_config_set_bool (path, account->source->keep_on_server);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->source->keep_on_server,
+ NULL);
g_free (path);
- path = g_strdup_printf ("source_auto_check_%d", i);
- gnome_config_set_bool (path, account->source->auto_check);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->source->auto_check, NULL);
g_free (path);
- path = g_strdup_printf ("source_auto_check_time_%d", i);
- gnome_config_set_int (path, account->source->auto_check_time);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i);
+ bonobo_config_set_long (config->db, path,
+ account->source->auto_check_time,
+ NULL);
g_free (path);
- path = g_strdup_printf ("source_enabled_%d", i);
- gnome_config_set_bool (path, account->source->enabled);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->source->enabled, NULL);
g_free (path);
- path = g_strdup_printf ("source_save_passwd_%d", i);
- gnome_config_set_bool (path, account->source->save_passwd);
+
+ path = g_strdup_printf ("/Mail/Accounts/source_save_passwd_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->source->save_passwd, NULL);
g_free (path);
/* transport info */
- path = g_strdup_printf ("transport_url_%d", i);
- gnome_config_set_string (path, account->transport->url ? account->transport->url : "");
+ path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i);
+ bonobo_config_set_string (config->db, path,
+ account->transport->url ? account->transport->url : "",
+ NULL);
g_free (path);
- path = g_strdup_printf ("transport_save_passwd_%d", i);
- gnome_config_set_bool (path, account->transport->save_passwd);
+ path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i);
+ bonobo_config_set_boolean (config->db, path,
+ account->transport->save_passwd,
+ NULL);
g_free (path);
}
- gnome_config_pop_prefix ();
#ifdef ENABLE_NNTP
/* News */
- str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
+
len = g_slist_length (config->news);
- gnome_config_set_int ("num", len);
+ bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
gchar *path;
n = g_slist_nth_data (config->news, i);
- path = g_strdup_printf ("url_%d", i);
- gnome_config_set_string (path, n->url);
+ path = g_strdup_printf ("/News/Sources/url_%d", i);
+ bonobo_config_set_string (config->db, path, n->url, NULL);
g_free (path);
}
- gnome_config_pop_prefix ();
+
#endif
- gnome_config_sync ();
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (config->db, &ev);
+ CORBA_exception_free (&ev);
}
static gboolean
hash_save_state (gpointer key, gpointer value, gpointer user_data)
{
+ char *path;
gboolean bool = GPOINTER_TO_INT (value);
- gnome_config_set_bool ((char *) key, bool);
+ path = g_strconcat ("/Mail/", (char *)user_data, "/", (char *)key,
+ NULL);
+ bonobo_config_set_boolean (config->db, path, bool, NULL);
+ g_free (path);
g_free (key);
return TRUE;
@@ -721,107 +740,92 @@ hash_save_state (gpointer key, gpointer value, gpointer user_data)
void
mail_config_write_on_exit (void)
{
- gchar *str;
+ CORBA_Environment ev;
GSList *sources;
MailConfigService *s;
/* Show Messages Threaded */
- str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list",
- evolution_dir);
- gnome_config_set_bool (str, config->thread_list);
- g_free (str);
+ bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list",
+ config->thread_list, NULL);
/* Show Message Preview */
- str = g_strdup_printf ("=%s/config/Mail=/Display/preview_pane",
- evolution_dir);
- gnome_config_set_bool (str, config->show_preview);
- g_free (str);
-
+ bonobo_config_set_boolean (config->db, "/Mail/Display/preview_pane",
+ config->show_preview, NULL);
+
/* Hide deleted automatically */
- str = g_strdup_printf ("=%s/config/Mail=/Display/hide_deleted",
- evolution_dir);
- gnome_config_set_bool (str, config->hide_deleted);
- g_free (str);
+ bonobo_config_set_boolean (config->db, "Mail/Display/hide_deleted",
+ config->hide_deleted, NULL);
/* Size of vpaned in mail view */
- str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size",
- evolution_dir);
- gnome_config_set_int (str, config->paned_size);
- g_free (str);
-
+ bonobo_config_set_long (config->db, "Mail/Display/paned_size",
+ config->paned_size, NULL);
+
/* Mark as seen timeout */
- str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout",
- evolution_dir);
- gnome_config_set_int (str, config->seen_timeout);
- g_free (str);
+ bonobo_config_set_long (config->db, "/Mail/Display/seen_timeout",
+ config->seen_timeout, NULL);
/* Format */
- str = g_strdup_printf ("=%s/config/Mail=/Format/send_html",
- evolution_dir);
- gnome_config_set_bool (str, config->send_html);
- g_free (str);
+ bonobo_config_set_boolean (config->db, "/Mail/Format/send_html",
+ config->send_html, NULL);
/* Citation */
- str = g_strdup_printf ("=%s/config/Mail=/Display/citation_highlight",
- evolution_dir);
- gnome_config_set_bool (str, config->citation_highlight);
- g_free (str);
- str = g_strdup_printf ("=%s/config/Mail=/Display/citation_color",
- evolution_dir);
- gnome_config_set_int (str, config->citation_color);
- g_free (str);
+ bonobo_config_set_boolean (config->db,
+ "/Mail/Display/citation_highlight",
+ config->citation_highlight, NULL);
+
+ bonobo_config_set_long (config->db, "/Mail/Display/citation_color",
+ config->citation_color, NULL);
/* Empty Subject */
- str = g_strdup_printf ("=%s/config/Mail=/Prompts/empty_subject",
- evolution_dir);
- gnome_config_set_bool (str, config->prompt_empty_subject);
- g_free (str);
+ bonobo_config_set_boolean (config->db, "/Mail/Prompts/empty_subject",
+ config->prompt_empty_subject, NULL);
/* Only Bcc */
- str = g_strdup_printf ("=%s/config/Mail=/Prompts/only_bcc",
- evolution_dir);
- gnome_config_set_bool (str, config->prompt_only_bcc);
- g_free (str);
-
+ bonobo_config_set_boolean (config->db, "/Mail/Prompts/only_bcc",
+ config->prompt_only_bcc, NULL);
+
/* PGP/GPG */
- str = g_strdup_printf ("=%s/config/Mail=/PGP/path",
- evolution_dir);
- gnome_config_set_string (str, config->pgp_path);
- g_free (str);
- str = g_strdup_printf ("=%s/config/Mail=/PGP/type",
- evolution_dir);
- gnome_config_set_int (str, config->pgp_type);
- g_free (str);
+ bonobo_config_set_string (config->db, "/Mail/PGP/path",
+ config->pgp_path, NULL);
+
+ bonobo_config_set_long (config->db, "/Mail/PGP/type",
+ config->pgp_type, NULL);
/* HTTP images */
- str = g_strdup_printf ("=%s/config/Mail=/Display/http_images",
- evolution_dir);
- gnome_config_set_int (str, config->http_mode);
- g_free (str);
-
+ bonobo_config_set_long (config->db, "/Mail/Display/http_images",
+ config->http_mode, NULL);
+
/* Forwarding */
- str = g_strdup_printf ("=%s/config/Mail=/Format/default_forward_style",
- evolution_dir);
- gnome_config_set_int (str, config->default_forward_style);
- g_free (str);
+ bonobo_config_set_long (config->db,
+ "/Mail/Format/default_forward_style",
+ config->default_forward_style, NULL);
/* Message Display */
- str = g_strdup_printf ("=%s/config/Mail=/Format/message_display_style",
- evolution_dir);
- gnome_config_set_int (str, config->message_display_style);
- g_free (str);
-
+ bonobo_config_set_long (config->db,
+ "/Mail/Format/message_display_style",
+ config->message_display_style, NULL);
+
/* Default charset */
- str = g_strdup_printf ("=%s/config/Mail=/Format/default_charset", evolution_dir);
- gnome_config_set_string (str, config->default_charset);
- g_free (str);
+ bonobo_config_set_string (config->db, "/Mail/Format/default_charset",
+ config->default_charset, NULL);
/* Trash folders */
- str = g_strdup_printf ("=%s/config/Mail=/Trash/empty_on_exit", evolution_dir);
- gnome_config_set_bool (str, config->empty_trash_on_exit);
- g_free (str);
-
+ bonobo_config_set_boolean (config->db, "/Mail/Trash/empty_on_exit",
+ config->empty_trash_on_exit, NULL);
+
+
+ g_hash_table_foreach_remove (config->threaded_hash,
+ hash_save_state, "Threads");
+
+ g_hash_table_foreach_remove (config->preview_hash,
+ hash_save_state, "Preview");
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (config->db, &ev);
+ CORBA_exception_free (&ev);
+
/* Passwords */
+ /* fixme: still depends on gnome-config */
gnome_config_private_clean_section ("/Evolution/Passwords");
sources = mail_config_get_sources ();
for ( ; sources; sources = sources->next) {
@@ -830,25 +834,8 @@ mail_config_write_on_exit (void)
mail_session_remember_password (s->url);
}
g_slist_free (sources);
-
- str = g_strdup_printf ("=%s/config/Mail=/Threads/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
- g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, NULL);
-
- gnome_config_pop_prefix ();
-
- str = g_strdup_printf ("=%s/config/Mail=/Preview/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
- g_hash_table_foreach_remove (config->preview_hash, hash_save_state, NULL);
-
- gnome_config_pop_prefix ();
-
gnome_config_sync ();
-
+
/* now do cleanup */
mail_config_clear ();
}
@@ -860,6 +847,28 @@ mail_config_is_configured (void)
return config->accounts != NULL;
}
+static char *
+uri_to_key (const char *uri)
+{
+ char *rval;
+ int i = 0;
+
+ if (!uri)
+ return NULL;
+
+ rval = g_strdup (uri);
+
+ while (rval [i]) {
+
+ if (rval [i] == '/' || rval [i] == ':')
+ rval [i] = '_';
+
+ i++;
+ }
+
+ return rval;
+}
+
gboolean
mail_config_get_empty_trash_on_exit (void)
{
@@ -872,31 +881,38 @@ mail_config_set_empty_trash_on_exit (gboolean value)
config->empty_trash_on_exit = value;
}
-gboolean
mail_config_get_show_preview (const char *uri)
{
if (uri) {
+ char *key;
gboolean value = FALSE;
+ key = uri_to_key (uri);
+
if (!config->preview_hash)
config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal);
else
- value = GPOINTER_TO_INT (g_hash_table_lookup (config->preview_hash, uri));
+ value = GPOINTER_TO_INT (g_hash_table_lookup (config->preview_hash, key));
if (!value) {
- /* add the preference to the hash table */
- gboolean def = FALSE;
+ CORBA_Environment ev;
char *str;
- str = g_strdup_printf ("=%s/config/Mail=/Preview/%s", evolution_dir, uri);
- value = gnome_config_get_bool_with_default (str, &def);
+ CORBA_exception_init (&ev);
+ str = g_strdup_printf ("/Mail/Preview/%s", key);
+ value = bonobo_config_get_boolean
+ (config->db, str, &ev);
g_free (str);
- if (!def) {
- g_hash_table_insert (config->preview_hash, g_strdup (uri),
+ if (!BONOBO_EX (&ev)) {
+ g_hash_table_insert (config->preview_hash,
+ g_strdup (key),
GINT_TO_POINTER (value));
- return value;
}
+
+ CORBA_exception_free (&ev);
+ g_free (key);
+ return value;
} else
return value;
}
@@ -910,17 +926,21 @@ void
mail_config_set_show_preview (const char *uri, gboolean value)
{
if (uri) {
+ char *dbkey = uri_to_key (uri);
gpointer key, val;
if (!config->preview_hash)
- config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ config->preview_hash = g_hash_table_new (g_str_hash,
+ g_str_equal);
- if (g_hash_table_lookup_extended (config->preview_hash, uri, &key, &val)) {
- g_hash_table_remove (config->preview_hash, uri);
+ if (g_hash_table_lookup_extended (config->preview_hash, dbkey,
+ &key, &val)) {
+ g_hash_table_remove (config->preview_hash, dbkey);
g_free (key);
}
- g_hash_table_insert (config->preview_hash, g_strdup (uri), GINT_TO_POINTER (value));
+ g_hash_table_insert (config->preview_hash, dbkey,
+ GINT_TO_POINTER (value));
} else
config->show_preview = value;
}
@@ -929,27 +949,35 @@ gboolean
mail_config_get_thread_list (const char *uri)
{
if (uri) {
+ char *key;
gboolean value = FALSE;
+ key = uri_to_key (uri);
+
if (!config->threaded_hash)
config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal);
else
- value = GPOINTER_TO_INT (g_hash_table_lookup (config->threaded_hash, uri));
+ value = GPOINTER_TO_INT (g_hash_table_lookup (config->threaded_hash, key));
if (!value) {
- /* add the preference to the hash table */
- gboolean def = FALSE;
+ CORBA_Environment ev;
char *str;
- str = g_strdup_printf ("=%s/config/Mail=/Threads/%s", evolution_dir, uri);
- value = gnome_config_get_bool_with_default (str, &def);
+ CORBA_exception_init (&ev);
+ str = g_strdup_printf ("/Mail/Threads/%s", key);
+ value = bonobo_config_get_boolean (config->db , str,
+ &ev);
g_free (str);
- if (!def) {
- g_hash_table_insert (config->threaded_hash, g_strdup (uri),
+ if (!BONOBO_EX (&ev)) {
+ g_hash_table_insert (config->threaded_hash,
+ g_strdup (key),
GINT_TO_POINTER (value));
- return value;
}
+
+ CORBA_exception_free (&ev);
+ g_free (key);
+ return value;
} else
return value;
}
@@ -963,17 +991,21 @@ void
mail_config_set_thread_list (const char *uri, gboolean value)
{
if (uri) {
+ char *dbkey = uri_to_key (uri);
gpointer key, val;
if (!config->threaded_hash)
- config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ config->threaded_hash = g_hash_table_new (g_str_hash,
+ g_str_equal);
- if (g_hash_table_lookup_extended (config->threaded_hash, uri, &key, &val)) {
- g_hash_table_remove (config->threaded_hash, uri);
+ if (g_hash_table_lookup_extended (config->threaded_hash, dbkey,
+ &key, &val)) {
+ g_hash_table_remove (config->threaded_hash, dbkey);
g_free (key);
}
- g_hash_table_insert (config->threaded_hash, g_strdup (uri), GINT_TO_POINTER (value));
+ g_hash_table_insert (config->threaded_hash, dbkey,
+ GINT_TO_POINTER (value));
} else
config->thread_list = value;
}
diff --git a/shell/Makefile.am b/shell/Makefile.am
index fc2d32e3e1..7aecad0ae3 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES = -O \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir) \
$(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
$(EXTRA_GNOME_CFLAGS) \
$(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 8bfd90a163..03906a20d3 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -30,7 +30,6 @@
#include <glib.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-config.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-window.h>
#include <libgnomeui/gnome-window-icon.h>
@@ -2132,71 +2131,6 @@ e_shell_view_get_current_path (EShellView *shell_view)
return current_path;
}
-static void
-save_shortcut_bar_icon_modes (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
- EShortcutBar *shortcut_bar;
- int num_groups;
- int group;
-
- priv = shell_view->priv;
- shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
-
- num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
-
- for (group = 0; group < num_groups; group++) {
- char *tmp;
-
- tmp = g_strdup_printf ("ShortcutBarGroup%dIconMode", group);
- gnome_config_set_int (tmp, e_shortcut_bar_get_view_type (shortcut_bar, group));
- g_free (tmp);
- }
-}
-
-static void
-load_shortcut_bar_icon_modes (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
- EShortcutBar *shortcut_bar;
- int num_groups;
- int group;
-
- priv = shell_view->priv;
- shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
-
- num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
-
- for (group = 0; group < num_groups; group++) {
- char *tmp;
- int iconmode;
-
- tmp = g_strdup_printf ("ShortcutBarGroup%dIconMode", group);
- iconmode = gnome_config_get_int (tmp);
- g_free (tmp);
-
- e_shortcut_bar_set_view_type (shortcut_bar, group, iconmode);
- }
-}
-
-static char *
-get_local_prefix_for_view (EShellView *shell_view,
- int view_num)
-{
- EShellViewPrivate *priv;
- char *prefix;
- const char *local_directory;
-
- priv = shell_view->priv;
-
- local_directory = e_shell_get_local_directory (priv->shell);
-
- prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/",
- local_directory, view_num);
-
- return prefix;
-}
-
/**
* e_shell_view_save_settings:
@@ -2211,36 +2145,75 @@ gboolean
e_shell_view_save_settings (EShellView *shell_view,
int view_num)
{
+ Bonobo_ConfigDatabase db;
EShellViewPrivate *priv;
+ EShortcutBar *shortcut_bar;
const char *uri;
- char *prefix;
+ char *prefix, *key;
char *filename;
+ int num_groups;
+ int group;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
priv = shell_view->priv;
+ shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
+
+ db = e_shell_get_config_db (priv->shell);
+
+ g_return_val_if_fail (db != CORBA_OBJECT_NIL, FALSE);
+
+ prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
+
+ key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL);
+ bonobo_config_set_long (db, key,
+ e_shell_view_get_current_shortcuts_group_num (shell_view),
+ NULL);
+ g_free (key);
- prefix = get_local_prefix_for_view (shell_view, view_num);
- g_return_val_if_fail (prefix != NULL, FALSE);
- gnome_config_push_prefix (prefix);
+ key = g_strconcat (prefix, "FolderBarMode", NULL);
+ bonobo_config_set_long (db, key,
+ e_shell_view_get_folder_bar_mode (shell_view), NULL);
+ g_free (key);
- gnome_config_set_int ("CurrentShortcutsGroupNum", e_shell_view_get_current_shortcuts_group_num (shell_view));
- gnome_config_set_int ("FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view));
- gnome_config_set_int ("ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view));
- gnome_config_set_int ("HPanedPosition", e_paned_get_position (E_PANED (priv->hpaned)));
- gnome_config_set_int ("ViewHPanedPosition", e_paned_get_position (E_PANED (priv->view_hpaned)));
+ key = g_strconcat (prefix, "ShortcutBarMode", NULL);
+ bonobo_config_set_long (db, key,
+ e_shell_view_get_shortcut_bar_mode (shell_view), NULL);
+ g_free (key);
+ key = g_strconcat (prefix, "HPanedPosition", NULL);
+ bonobo_config_set_long (db, key,
+ e_paned_get_position (E_PANED (priv->hpaned)), NULL);
+ g_free (key);
+
+ key = g_strconcat (prefix, "ViewHPanedPosition", NULL);
+ bonobo_config_set_long (db, key,
+ e_paned_get_position (E_PANED (priv->view_hpaned)), NULL);
+ g_free (key);
+
+
+ key = g_strconcat (prefix, "DisplayedURI", NULL);
uri = e_shell_view_get_current_uri (shell_view);
if (uri != NULL)
- gnome_config_set_string ("DisplayedURI", uri);
+ bonobo_config_set_string (db, key, uri, NULL);
else
- gnome_config_set_string ("DisplayedURI", DEFAULT_URI);
+ bonobo_config_set_string (db, key, DEFAULT_URI, NULL);
+ g_free (key);
+
+ num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
- save_shortcut_bar_icon_modes (shell_view);
+ for (group = 0; group < num_groups; group++) {
+ key = g_strdup_printf ("%sShortcutBarGroup%dIconMode", prefix,
+ group);
+ bonobo_config_set_long (db, key,
+ e_shortcut_bar_get_view_type (shortcut_bar, group),
+ NULL);
+ g_free (key);
+ }
- gnome_config_pop_prefix ();
+ g_free (prefix);
/* Save the expanded state for this ShellViews StorageSetView */
filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
@@ -2250,7 +2223,6 @@ e_shell_view_save_settings (EShellView *shell_view,
filename);
g_free (filename);
- g_free (prefix);
return TRUE;
}
@@ -2268,45 +2240,70 @@ gboolean
e_shell_view_load_settings (EShellView *shell_view,
int view_num)
{
+ Bonobo_ConfigDatabase db;
EShellViewPrivate *priv;
- int val;
- char *stringval;
- char *prefix;
- char *filename;
+ EShortcutBar *shortcut_bar;
+ int num_groups, group, val;
+ char *stringval, *prefix, *filename, *key;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
priv = shell_view->priv;
+ shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar);
- prefix = get_local_prefix_for_view (shell_view, view_num);
- g_return_val_if_fail (prefix != NULL, FALSE);
+ db = e_shell_get_config_db (priv->shell);
- gnome_config_push_prefix (prefix);
+ g_return_val_if_fail (db != CORBA_OBJECT_NIL, FALSE);
- val = gnome_config_get_int ("CurrentShortcutsGroupNum");
+ prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
+
+ key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL);
+ val = bonobo_config_get_long (db, key, NULL);
e_shell_view_set_current_shortcuts_group_num (shell_view, val);
+ g_free (key);
- val = gnome_config_get_int ("FolderBarMode");
+ key = g_strconcat (prefix, "FolderBarMode", NULL);
+ val = bonobo_config_get_long (db, key, NULL);
e_shell_view_set_folder_bar_mode (shell_view, val);
+ g_free (key);
- val = gnome_config_get_int ("ShortcutBarMode");
+ key = g_strconcat (prefix, "ShortcutBarMode", NULL);
+ val = bonobo_config_get_long (db, key, NULL);
e_shell_view_set_shortcut_bar_mode (shell_view, val);
+ g_free (key);
- val = gnome_config_get_int ("HPanedPosition");
+ key = g_strconcat (prefix, "HPanedPosition", NULL);
+ val = bonobo_config_get_long (db, key, NULL);
e_paned_set_position (E_PANED (priv->hpaned), val);
+ g_free (key);
- val = gnome_config_get_int ("ViewHPanedPosition");
+ key = g_strconcat (prefix, "ViewHPanedPosition", NULL);
+ val = bonobo_config_get_long (db, key, NULL);
e_paned_set_position (E_PANED (priv->view_hpaned), val);
+ g_free (key);
- stringval = gnome_config_get_string ("DisplayedURI");
+ key = g_strconcat (prefix, "DisplayedURI", NULL);
+ stringval = bonobo_config_get_string (db, key, NULL);
if (! e_shell_view_display_uri (shell_view, stringval))
e_shell_view_display_uri (shell_view, DEFAULT_URI);
g_free (stringval);
+ g_free (key);
- load_shortcut_bar_icon_modes (shell_view);
+ num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
- gnome_config_pop_prefix ();
+ for (group = 0; group < num_groups; group++) {
+ int iconmode;
+
+ key = g_strdup_printf ("%sShortcutBarGroup%dIconMode", prefix,
+ group);
+ iconmode = bonobo_config_get_long (db, key, NULL);
+ g_free (key);
+
+ e_shortcut_bar_set_view_type (shortcut_bar, group, iconmode);
+ }
+
+ g_free (prefix);
/* Load the expanded state for the ShellView's StorageSetView */
filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
@@ -2317,7 +2314,6 @@ e_shell_view_load_settings (EShellView *shell_view,
filename);
g_free (filename);
- g_free (prefix);
return TRUE;
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 02b3cde7b2..47e5622971 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -29,10 +29,12 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-config.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+
#include <gal/widgets/e-gui-utils.h>
#include <gal/util/e-util.h>
@@ -93,6 +95,9 @@ struct _EShellPrivate {
/* Line status. */
EShellLineStatus line_status;
+
+ /* Configuration Database */
+ Bonobo_ConfigDatabase db;
};
@@ -112,6 +117,14 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
+Bonobo_ConfigDatabase
+e_shell_get_config_db (EShell *shell)
+{
+ g_return_val_if_fail (shell != NULL, CORBA_OBJECT_NIL);
+
+ return shell->priv->db;
+}
+
/* Callback for the folder selection dialog. */
@@ -662,6 +675,10 @@ destroy (GtkObject *object)
g_list_free (priv->views);
+ if (shell->priv->db != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (shell->priv->db, NULL);
+ shell->priv->db = CORBA_OBJECT_NIL;
+
/* No unreffing for these as they are aggregate. */
/* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */
/* bonobo_object_unref (BONOBO_OBJECT (priv->activity_handler)); */
@@ -766,6 +783,7 @@ e_shell_construct (EShell *shell,
GtkWidget *splash;
EShellPrivate *priv;
CORBA_Object corba_object;
+ CORBA_Environment ev;
gchar *shortcut_path;
g_return_val_if_fail (shell != NULL, FALSE);
@@ -802,6 +820,17 @@ e_shell_construct (EShell *shell,
if (! setup_corba_storages (shell))
return FALSE;
+ CORBA_exception_init (&ev);
+
+ priv->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || priv->db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return FALSE;
+ }
+
+ CORBA_exception_free (&ev);
+
if (show_splash)
setup_components (shell, E_SPLASH (splash));
else
@@ -1024,10 +1053,10 @@ e_shell_get_local_storage (EShell *shell)
static gboolean
save_settings_for_views (EShell *shell)
{
+ CORBA_Environment ev;
EShellPrivate *priv;
GList *p;
gboolean retval;
- char *prefix;
int i;
priv = shell->priv;
@@ -1044,12 +1073,12 @@ save_settings_for_views (EShell *shell)
}
}
- prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews",
- priv->local_directory);
- gnome_config_set_int (prefix, g_list_length (priv->views));
- g_free (prefix);
-
- gnome_config_sync ();
+ bonobo_config_set_long (priv->db, "/Shell/Views/NumberOfViews",
+ g_list_length (priv->views), NULL);
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (priv->db, &ev);
+ CORBA_exception_free (&ev);
return TRUE;
}
@@ -1162,7 +1191,6 @@ e_shell_restore_from_settings (EShell *shell)
{
EShellPrivate *priv;
gboolean retval;
- char *prefix;
int num_views;
int i;
@@ -1172,10 +1200,8 @@ e_shell_restore_from_settings (EShell *shell)
priv = shell->priv;
- prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews",
- priv->local_directory);
- num_views = gnome_config_get_int (prefix);
- g_free (prefix);
+ num_views = bonobo_config_get_long_with_default (priv->db,
+ "/Shell/Views/NumberOfViews", 0, NULL);
if (num_views == 0)
return FALSE;
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 021dfbd1d2..1f9406bd83 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -26,6 +26,7 @@
#include <liboaf/liboaf.h> /* For the registration stuff. */
#include <bonobo/bonobo-xobject.h>
+#include <bonobo-conf/bonobo-config-database.h>
#ifdef __cplusplus
extern "C" {
@@ -114,6 +115,8 @@ void e_shell_go_offline (EShell *shell,
void e_shell_go_online (EShell *shell,
EShellView *action_view);
+Bonobo_ConfigDatabase e_shell_get_config_db (EShell *shell);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/wombat/Makefile.am b/wombat/Makefile.am
index 2b2faaa406..dd16f6ec1d 100644
--- a/wombat/Makefile.am
+++ b/wombat/Makefile.am
@@ -11,6 +11,7 @@ INCLUDES = \
-I$(top_builddir)/libical/src/libical \
$(GNOME_INCLUDEDIR) \
$(BONOBO_VFS_GNOME_CFLAGS) \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\"
bin_PROGRAMS = \
diff --git a/wombat/wombat-moniker.c b/wombat/wombat-moniker.c
index 8fb0234855..e53cb94758 100644
--- a/wombat/wombat-moniker.c
+++ b/wombat/wombat-moniker.c
@@ -6,7 +6,7 @@
#include <bonobo/bonobo-storage.h>
#include "wombat-moniker.h"
-#define DEFAULT_DB_URL "xmldb:/tmp/wombat-default-config.xmldb"
+#define DEFAULT_DB_URL "xmldb:" EVOLUTION_DATADIR "/evolution/config.xmldb"
#define USER_DB_URL "xmldb:~/evolution/config.xmldb"
#define DB_URL (DEFAULT_DB_URL "#" USER_DB_URL)