aboutsummaryrefslogtreecommitdiffstats
path: root/composer
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 /composer
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 'composer')
-rw-r--r--composer/Makefile.am1
-rw-r--r--composer/e-msg-composer.c116
-rw-r--r--composer/e-msg-composer.h3
3 files changed, 45 insertions, 75 deletions
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;