1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
#include <gnome.h>
#include <libgnorba/gnorba.h>
#include <bonobo.h>
#include <glade/glade.h>
#include <camel/camel-data-wrapper.h>
#include <camel/camel-stream-fs.h>
#include <camel/camel-stream.h>
#include "e-msg-composer.h"
static void
send_cb (EMsgComposer *composer,
gpointer data)
{
CamelMimeMessage *message;
CamelStream *stream;
gint stdout_dup;
message = e_msg_composer_get_message (composer);
stdout_dup = dup (1);
stream = camel_stream_fs_new_with_fd (stdout_dup);
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
stream);
camel_stream_close (stream);
gtk_object_unref (GTK_OBJECT (message));
#if 0
gtk_widget_destroy (GTK_WIDGET (composer));
gtk_main_quit ();
#endif
}
static guint
create_composer (void)
{
GtkWidget *composer;
composer = e_msg_composer_new ();
gtk_widget_show (composer);
gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (send_cb), NULL);
return FALSE;
}
int
main (int argc, char **argv)
{
CORBA_Environment ev;
CORBA_ORB orb;
CORBA_exception_init (&ev);
gnome_CORBA_init ("evolution-test-msg-composer", "0.0", &argc, argv, 0, &ev);
CORBA_exception_free (&ev);
orb = gnome_CORBA_ORB ();
glade_gnome_init ();
if (bonobo_init (orb, NULL, NULL) == FALSE)
g_error ("Could not initialize Bonobo\n");
/* We can't make any CORBA calls unless we're in the main loop. So we
delay creating the container here. */
gtk_idle_add ((GtkFunction) create_composer, NULL);
bonobo_main ();
return 0;
}
|