aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-09 11:45:48 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-09 11:45:48 +0800
commit0a9f51518502e55b1172429609969287437b25e0 (patch)
treeda158de3f652ae8f6ce0082c520a75644a2f8fe0
parent93e3a5b7a26de02fd34045c4b127e3349d89add4 (diff)
downloadgsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar.gz
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar.bz2
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar.lz
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar.xz
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.tar.zst
gsoc2013-evolution-0a9f51518502e55b1172429609969287437b25e0.zip
add e-categories-config.h and e-categories-master-list-wombat.h
2002-11-08 Chris Toshok <toshok@ximian.com> * Makefile.am (eutilinclude_HEADERS): add e-categories-config.h and e-categories-master-list-wombat.h (libeutil_la_SOURCES): add e-categories-master-list-wombat.c * e-categories-master-list-wombat.[ch]: port work. svn path=/trunk/; revision=18683
-rw-r--r--e-util/ChangeLog8
-rw-r--r--e-util/Makefile.am5
-rw-r--r--e-util/e-categories-master-list-wombat.c118
-rw-r--r--e-util/e-categories-master-list-wombat.h20
4 files changed, 66 insertions, 85 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 5dfc05413d..9875f70212 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-08 Chris Toshok <toshok@ximian.com>
+
+ * Makefile.am (eutilinclude_HEADERS): add e-categories-config.h
+ and e-categories-master-list-wombat.h
+ (libeutil_la_SOURCES): add e-categories-master-list-wombat.c
+
+ * e-categories-master-list-wombat.[ch]: port work.
+
2002-11-07 JP Rosevear <jpr@ximian.com>
* e-categories-config.c (e_categories_config_get_icon_for): pass
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 69d582522a..17dc41ea6c 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -19,6 +19,8 @@ privlib_LTLIBRARIES = libeutil.la libedb3util.la libeconduit.la
noinst_LTLIBRARIES = libeutil-static.la libeconduit-static.la
eutilinclude_HEADERS = \
+ e-categories-config.h \
+ e-categories-master-list-wombat.h \
e-component-listener.h \
e-config-listener.h \
e-corba-utils.h \
@@ -44,6 +46,7 @@ eutilinclude_HEADERS = \
libeutil_la_SOURCES = \
$(eutilinclude_HEADERS) \
e-categories-config.c \
+ e-categories-master-list-wombat.c \
e-component-listener.c \
e-config-listener.c \
e-corba-utils.c \
@@ -84,8 +87,6 @@ MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h
# FIXME TODO
-# e-categories-config.c
-# e-categories-master-list-wombat.[ch]
# e-passwords.c
# e-proxy.c
# bonobo-factory-util.[ch]
diff --git a/e-util/e-categories-master-list-wombat.c b/e-util/e-categories-master-list-wombat.c
index 74fd1047bd..2c7571b63a 100644
--- a/e-util/e-categories-master-list-wombat.c
+++ b/e-util/e-categories-master-list-wombat.c
@@ -11,24 +11,18 @@
#include "e-categories-master-list-wombat.h"
#include "e-categories-config.h"
+#include "e-config-listener.h"
-#include <tree.h>
-#include <parser.h>
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-xml-utils.h>
-
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-listener.h>
-#include <bonobo/bonobo-event-source.h>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
#define PARENT_TYPE e_categories_master_list_array_get_type ()
#define d(x)
struct _ECategoriesMasterListWombatPriv {
- Bonobo_ConfigDatabase db;
- Bonobo_EventSource_ListenerId listener_id;
+ EConfigListener *listener;
+ guint listener_id;
};
static ECategoriesMasterListArrayClass *parent_class;
@@ -39,12 +33,10 @@ ecmlw_load (ECategoriesMasterListWombat *ecmlw)
char *string;
gboolean def;
- string = bonobo_config_get_string_with_default
- (ecmlw->priv->db,
- "General/CategoryMasterList",
- NULL,
- &def);
-
+ string = e_config_listener_get_string_with_default (ecmlw->priv->listener,
+ "/apps/Evolution/General/CategoryMasterList",
+ NULL,
+ &def);
/* parse the XML string */
if (!def) {
e_categories_master_list_array_from_string (E_CATEGORIES_MASTER_LIST_ARRAY (ecmlw),
@@ -60,20 +52,14 @@ static void
ecmlw_save (ECategoriesMasterListWombat *ecmlw)
{
char *string;
- CORBA_Environment ev;
string = e_categories_master_list_array_to_string (E_CATEGORIES_MASTER_LIST_ARRAY (ecmlw));
d(g_print ("save: %s\n", string));
- CORBA_exception_init (&ev);
-
- bonobo_config_set_string (ecmlw->priv->db,
- "General/CategoryMasterList",
- string,
- &ev);
-
- CORBA_exception_free (&ev);
+ e_config_listener_set_string (ecmlw->priv->listener,
+ "/apps/Evolution/General/CategoryMasterList",
+ string);
g_free (string);
}
@@ -108,46 +94,43 @@ ecmlw_reset (ECategoriesMasterList *ecml)
}
static void
-ecmlw_destroy (GtkObject *object)
+ecmlw_dispose (GObject *object)
{
ECategoriesMasterListWombat *ecmlw = E_CATEGORIES_MASTER_LIST_WOMBAT (object);
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
+ if (ecmlw->priv) {
+ /* remove the listener */
+ g_signal_handler_disconnect (ecmlw->priv->listener,
+ ecmlw->priv->listener_id);
- /* remove the listener */
+ g_object_unref (ecmlw->priv->listener);
- bonobo_event_source_client_remove_listener (ecmlw->priv->db,
- ecmlw->priv->listener_id,
- &ev);
- bonobo_object_release_unref (ecmlw->priv->db, &ev);
-
- CORBA_exception_free (&ev);
+ g_free (ecmlw->priv);
+ ecmlw->priv = NULL;
+ }
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
-ecmlw_class_init (GtkObjectClass *object_class)
+ecmlw_class_init (GObjectClass *object_class)
{
ECategoriesMasterListClass *ecml_class = E_CATEGORIES_MASTER_LIST_CLASS(object_class);
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_ref (PARENT_TYPE);
ecml_class->commit = ecmlw_commit;
ecml_class->reset = ecmlw_reset ;
- object_class->destroy = ecmlw_destroy;
+ object_class->dispose = ecmlw_dispose;
}
static void
-property_change_cb (BonoboListener *listener,
- char *event_name,
- CORBA_any *any,
- CORBA_Environment *ev,
+property_change_cb (EConfigListener *listener,
+ char *key,
gpointer user_data)
{
ecmlw_load (user_data);
@@ -156,45 +139,38 @@ property_change_cb (BonoboListener *listener,
static void
ecmlw_init (ECategoriesMasterListWombat *ecmlw)
{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
ecmlw->priv = g_new (ECategoriesMasterListWombatPriv, 1);
- ecmlw->priv->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+ ecmlw->priv->listener = e_config_listener_new ();
/* add a listener */
ecmlw->priv->listener_id =
- bonobo_event_source_client_add_listener (ecmlw->priv->db, property_change_cb,
- NULL, &ev, ecmlw);
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
+ g_signal_connect (ecmlw->priv->listener,
+ "key_changed",
+ G_CALLBACK (property_change_cb),
+ ecmlw);
ecmlw_load (ecmlw);
}
-guint
+GType
e_categories_master_list_wombat_get_type (void)
{
- static guint type = 0;
-
+ static GType type = 0;
+
if (!type) {
- GtkTypeInfo info = {
- "ECategoriesMasterListWombat",
- sizeof (ECategoriesMasterListWombat),
+ static const GTypeInfo info = {
sizeof (ECategoriesMasterListWombatClass),
- (GtkClassInitFunc) ecmlw_class_init,
- (GtkObjectInitFunc) ecmlw_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ecmlw_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (ECategoriesMasterListWombat),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ecmlw_init,
};
- type = gtk_type_unique (PARENT_TYPE, &info);
+ type = g_type_register_static (PARENT_TYPE, "ECategoriesMasterListWombat", &info, 0);
}
return type;
@@ -203,5 +179,5 @@ e_categories_master_list_wombat_get_type (void)
ECategoriesMasterList *
e_categories_master_list_wombat_new (void)
{
- return E_CATEGORIES_MASTER_LIST (gtk_type_new (e_categories_master_list_wombat_get_type ()));
+ return E_CATEGORIES_MASTER_LIST (g_object_new (E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, NULL));
}
diff --git a/e-util/e-categories-master-list-wombat.h b/e-util/e-categories-master-list-wombat.h
index a6fe2a04ff..024d7644e7 100644
--- a/e-util/e-categories-master-list-wombat.h
+++ b/e-util/e-categories-master-list-wombat.h
@@ -4,15 +4,13 @@
#include <gal/widgets/e-categories-master-list-array.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-#define E_CATEGORIES_MASTER_LIST_WOMBAT_TYPE (e_categories_master_list_wombat_get_type ())
-#define E_CATEGORIES_MASTER_LIST_WOMBAT(o) (GTK_CHECK_CAST ((o), E_CATEGORIES_MASTER_LIST_WOMBAT_TYPE, ECategoriesMasterListWombat))
-#define E_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CATEGORIES_MASTER_LIST_WOMBAT_TYPE, ECategoriesMasterListWombatClass))
-#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT(o) (GTK_CHECK_TYPE ((o), E_CATEGORIES_MASTER_LIST_WOMBAT_TYPE))
-#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CATEGORIES_MASTER_LIST_WOMBAT_TYPE))
+#define E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT (e_categories_master_list_wombat_get_type ())
+#define E_CATEGORIES_MASTER_LIST_WOMBAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, ECategoriesMasterListWombat))
+#define E_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, ECategoriesMasterListWombatClass))
+#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT))
+#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT))
typedef struct _ECategoriesMasterListWombatPriv ECategoriesMasterListWombatPriv;
@@ -25,11 +23,9 @@ typedef struct {
ECategoriesMasterListArrayClass parent_class;
} ECategoriesMasterListWombatClass;
-GtkType e_categories_master_list_wombat_get_type (void);
+GType e_categories_master_list_wombat_get_type (void);
ECategoriesMasterList *e_categories_master_list_wombat_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_CATEGORIES_MASTER_LIST_WOMBAT_H_ */