aboutsummaryrefslogtreecommitdiffstats
path: root/importers/evolution-gnomecard-importer.c
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 /importers/evolution-gnomecard-importer.c
parent838d0849f248ed5e1b7793c3a5968c678749c81b (diff)
downloadgsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.gz
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.bz2
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.lz
gsoc2013-evolution-b7dede1a279b72d74cf52d2e194525426e6d144d.tar.xz
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
Diffstat (limited to 'importers/evolution-gnomecard-importer.c')
-rw-r--r--importers/evolution-gnomecard-importer.c88
1 files changed, 42 insertions, 46 deletions
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);