aboutsummaryrefslogtreecommitdiffstats
path: root/mail/test-mail.c
blob: f2a39bf1042a0dc8f74a66405b485251ac181922 (plain) (blame)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 * Tests the mail summary display bonobo component
 *
 * Author:
 *   Miguel de Icaza (miguel@kernel.org)
 *
 * (C) 2000 Helix Code, Inc.
 */

#include <config.h>

#include <gnome.h>
#include <bonobo.h>

#ifdef USING_OAF

#include <liboaf/liboaf.h>

static void
init_corba (int *argc, char *argv[])
{
    gnome_init ("sample-control-container", "1.0", *argc, argv);
    oaf_init (*argc, argv);
}

#else  /* USING_OAF */

#include <libgnorba/gnorba.h>

static void
init_corba (int *argc, char *argv [])
{
    CORBA_Environment ev;

    CORBA_exception_init (&ev);

    gnome_CORBA_init ("sample-control-container", "1.0", argc, argv, 0, &ev);

    CORBA_exception_free (&ev);
}

#endif /* USING_OAF */

static guint
create_container (void)
{
    GtkWidget *window, *control;
    BonoboUIHandler *uih;

    gdk_rgb_init ();

    gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
    gtk_widget_set_default_visual (gdk_rgb_get_visual ());

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_usize (GTK_WIDGET (window), 640, 480);
    gtk_widget_show (GTK_WIDGET (window));

    uih = bonobo_ui_handler_new ();

#ifdef USING_OAF
    control = bonobo_widget_new_control ("OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45",
                         bonobo_object_corba_objref (BONOBO_OBJECT (uih)));
#else
    control = bonobo_widget_new_control ("control:evolution-mail",
                     bonobo_object_corba_objref (BONOBO_OBJECT (uih)));
#endif
    
    if (control == NULL){
        printf ("Could not launch mail control\n");
        exit (1);
    }
    gtk_container_add (GTK_CONTAINER (window), control);

    gtk_widget_show (window);
    gtk_widget_show (control);


    return FALSE;
}

int
main (int argc, char *argv [])
{
    init_corba (&argc, argv);

    if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
        g_error ("Could not initialize Bonobo\n");
    
    gtk_idle_add ((GtkFunction) create_container, NULL);

    /*
     * Main loop
     */
    bonobo_main ();
    
    return 0;
}