aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-03-10 14:35:54 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-03-10 14:35:54 +0800
commit4e9884119183fa0f869979b98b834680e7f092a2 (patch)
treec7de90bfccc87dc9a3da71b5cf976aaa6f4495c4 /composer
parentbc78d367b0f55fa2a3090cc32df91a5c91c5d9cc (diff)
downloadgsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar.gz
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar.bz2
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar.lz
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar.xz
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.tar.zst
gsoc2013-evolution-4e9884119183fa0f869979b98b834680e7f092a2.zip
add send_cb/save_draft_cb arguments. (impl_Composer_send): use the local
2003-03-11 Not Zed <NotZed@Ximian.com> * evolution-composer.c (evolution_composer_new): add send_cb/save_draft_cb arguments. (impl_Composer_send): use the local send_cb. (evolution_composer_init): dont init send, save-draft signals here. (evolution_composer_new): init signals here, fix params to composer_construct(). (evolution_composer_factory_init): remove, part of mailer now. (factory_fn): same. (finalise): disconnect from callbacks first. * evolution-composer.h: add send_cb/save_draft_cb to composer object. 2003-03-10 Not Zed <NotZed@Ximian.com> * evolution-composer.c (finalise): from destroy. (evolution_composer_class_init): gtkobject->gobject stuff. (evolution_composer_new): remove old redundant stuff. svn path=/trunk/; revision=20227
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog21
-rw-r--r--composer/evolution-composer.c101
-rw-r--r--composer/evolution-composer.h5
3 files changed, 55 insertions, 72 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 994b747d6d..4144d02cad 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,24 @@
+2003-03-11 Not Zed <NotZed@Ximian.com>
+
+ * evolution-composer.c (evolution_composer_new): add
+ send_cb/save_draft_cb arguments.
+ (impl_Composer_send): use the local send_cb.
+ (evolution_composer_init): dont init send, save-draft signals
+ here.
+ (evolution_composer_new): init signals here, fix params to
+ composer_construct().
+ (evolution_composer_factory_init): remove, part of mailer now.
+ (factory_fn): same.
+ (finalise): disconnect from callbacks first.
+
+ * evolution-composer.h: add send_cb/save_draft_cb to composer object.
+
+2003-03-10 Not Zed <NotZed@Ximian.com>
+
+ * evolution-composer.c (finalise): from destroy.
+ (evolution_composer_class_init): gtkobject->gobject stuff.
+ (evolution_composer_new): remove old redundant stuff.
+
2003-03-04 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (composer_get_default_charset_setting): Don't
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index 4e9280aef4..b5c7630de8 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -38,13 +38,15 @@
#define PARENT_TYPE BONOBO_OBJECT_TYPE
static BonoboObjectClass *parent_class = NULL;
-static void (*send_cb) (EMsgComposer *, gpointer);
-static void (*save_draft_cb) (EMsgComposer *, int, gpointer);
+struct _EvolutionComposerPrivate {
+ int send_id;
+ int save_draft_id;
-/* CORBA interface implementation. */
-
-static POA_GNOME_Evolution_Composer__vepv Composer_vepv;
+ void (*send_cb) (EMsgComposer *, gpointer);
+ void (*save_draft_cb) (EMsgComposer *, int, gpointer);
+};
+/* CORBA interface implementation. */
static EDestination **
corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl)
{
@@ -250,7 +252,7 @@ impl_Composer_send (PortableServer_Servant servant,
bonobo_object = bonobo_object_from_servant (servant);
composer = EVOLUTION_COMPOSER (bonobo_object);
- send_cb (composer->composer, NULL);
+ composer->priv->send_cb (composer->composer, NULL);
}
POA_GNOME_Evolution_Composer__epv *
@@ -271,29 +273,34 @@ evolution_composer_get_epv (void)
}
-/* GtkObject stuff */
+/* GObject stuff */
static void
-destroy (GtkObject *object)
+finalise (GObject *object)
{
EvolutionComposer *composer = EVOLUTION_COMPOSER (object);
+ struct _EvolutionComposerPrivate *p = composer->priv;
+
+ g_signal_handler_disconnect(composer->composer, p->send_id);
+ g_signal_handler_disconnect(composer->composer, p->save_draft_id);
+ g_free(p);
if (composer->composer) {
- g_object_unref((composer->composer));
+ g_object_unref(composer->composer);
composer->composer = NULL;
}
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
evolution_composer_class_init (EvolutionComposerClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
POA_GNOME_Evolution_Composer__epv *epv;
- object_class = GTK_OBJECT_CLASS (klass);
- object_class->destroy = destroy;
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = finalise;
parent_class = g_type_class_ref(bonobo_object_get_type ());
@@ -315,11 +322,7 @@ evolution_composer_init (EvolutionComposer *composer)
account = mail_config_get_default_account ();
composer->composer = e_msg_composer_new ();
-
- g_signal_connect (composer->composer, "send",
- G_CALLBACK (send_cb), NULL);
- g_signal_connect (composer->composer, "save-draft",
- G_CALLBACK (save_draft_cb), NULL);
+ composer->priv = g_malloc0(sizeof(*composer->priv));
}
#if 0
@@ -374,65 +377,21 @@ evolution_composer_construct (EvolutionComposer *composer,
}
EvolutionComposer *
-evolution_composer_new (void)
+evolution_composer_new (void (*send) (EMsgComposer *, gpointer),
+ void (*save_draft) (EMsgComposer *, int, gpointer))
{
EvolutionComposer *new;
-#if 0
- POA_GNOME_Evolution_Composer *servant;
- CORBA_Environment ev;
- GNOME_Evolution_Composer corba_object;
-
- servant = (POA_GNOME_Evolution_Composer *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &Composer_vepv;
-
- CORBA_exception_init (&ev);
- POA_GNOME_Evolution_Composer__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_free (servant);
- CORBA_exception_free (&ev);
- return NULL;
- }
- CORBA_exception_free (&ev);
+ struct _EvolutionComposerPrivate *p;
- new = gtk_type_new (evolution_composer_get_type ());
- corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new),
- servant);
-#endif
new = g_object_new(EVOLUTION_TYPE_COMPOSER, NULL);
- evolution_composer_construct (new, NULL);
+ evolution_composer_construct (new, bonobo_object_corba_objref((BonoboObject *)new));
+ p = new->priv;
+ p->send_cb = send;
+ p->save_draft_cb = save_draft;
+ p->send_id = g_signal_connect (new->composer, "send", G_CALLBACK (send), NULL);
+ p->save_draft_id = g_signal_connect (new->composer, "save-draft", G_CALLBACK (save_draft), NULL);
return new;
}
BONOBO_TYPE_FUNC_FULL(EvolutionComposer, GNOME_Evolution_Composer, BONOBO_TYPE_OBJECT, evolution_composer)
-
-
-#define GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ComposerFactory"
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *factory, const char *id, void *closure)
-{
- if (!mail_config_is_configured ()) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Could not create composer window, because you "
- "have not yet\nconfigured any identities in the "
- "mail component."));
- return NULL;
- }
- return BONOBO_OBJECT (evolution_composer_new ());
-}
-
-void
-evolution_composer_factory_init (void (*send) (EMsgComposer *, gpointer),
- void (*save_draft) (EMsgComposer *, int, gpointer))
-{
- if (bonobo_generic_factory_new (GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID,
- factory_fn, NULL) == NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Cannot initialize the Evolution composer."));
- exit (1);
- }
-
- send_cb = send;
- save_draft_cb = save_draft;
-}
diff --git a/composer/evolution-composer.h b/composer/evolution-composer.h
index 12da130221..8928801583 100644
--- a/composer/evolution-composer.h
+++ b/composer/evolution-composer.h
@@ -46,6 +46,8 @@ typedef struct _EvolutionComposerClass EvolutionComposerClass;
struct _EvolutionComposer {
BonoboObject parent;
+ struct _EvolutionComposerPrivate *priv;
+
EMsgComposer *composer;
};
@@ -60,7 +62,8 @@ POA_GNOME_Evolution_Composer__epv *evolution_composer_get_epv (void);
GtkType evolution_composer_get_type (void);
void evolution_composer_construct (EvolutionComposer *,
GNOME_Evolution_Composer);
-EvolutionComposer *evolution_composer_new (void);
+EvolutionComposer *evolution_composer_new (void (*send_cb) (EMsgComposer *, gpointer),
+ void (*save_draft_cb) (EMsgComposer *, int, gpointer));
void evolution_composer_factory_init (void (*send) (EMsgComposer *, gpointer),
void (*save_draft) (EMsgComposer *, int, gpointer));