aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
blob: 805d207406737a920e1588857aec2a3ad3c32df3 (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
/*
 * E-shell.c: Shell object for Evolution
 *
 * Authors:
 *   Miguel de Icaza (miguel@helixcode.com)
 *
 * (C) 1999 Miguel de Icaza
 * (C) 2000 Helix Code, Inc.
 */
#include <config.h>
#include "Shell.h"
#include "e-util/e-util.h"
#include "e-shell.h"

#define PARENT_TYPE (gnome_object_get_type ())

static GnomeObjectClass *e_shell_parent_class;
POA_GNOME_Evolution_Shell__vepv eshell_vepv;

GtkType e_shell_get_type (void);

static POA_GNOME_Evolution_Shell__epv *
e_shell_get_epv (void)
{
    POA_GNOME_Evolution_Shell__epv *epv;

    epv = g_new0 (POA_GNOME_Evolution_Shell__epv, 1);

    return epv;
}

static void
init_e_shell_corba_class (void)
{
    eshell_vepv.GNOME_Unknown_epv = gnome_object_get_epv ();
    eshell_vepv.GNOME_Evolution_Shell_epv = e_shell_get_epv ();
}

static void
e_shell_destroy (GtkObject *object)
{
    EShell *eshell = E_SHELL (object);

    if (eshell->base_uri)
        g_free (eshell->base_uri);

    GTK_OBJECT_CLASS (e_shell_parent_class)->destroy (object);
}

static void
e_shell_class_init (GtkObjectClass *object_class)
{
    e_shell_parent_class = gtk_type_class (PARENT_TYPE);
    init_e_shell_corba_class ();

    object_class->destroy = e_shell_destroy;
}

static void
e_shell_init (GtkObject *object)
{
}

void
e_shell_set_base_uri (EShell *eshell, const char *base_uri)
{
    g_return_if_fail (eshell != NULL);
    g_return_if_fail (!E_IS_SHELL (eshell));
    g_return_if_fail (base_uri != NULL);

    if (eshell->base_uri)
        g_free (eshell->base_uri);
    
    eshell->base_uri = g_strdup (base_uri);
}

const char *
e_shell_get_base_uri (EShell *eshell)
{
    g_return_val_if_fail (eshell != NULL, NULL);
    g_return_val_if_fail (!E_IS_SHELL (eshell), NULL);

    return eshell->base_uri;
}

EShell *
e_shell_new (const char *base_uri)
{
    EShell *eshell;

    g_return_val_if_fail (base_uri  != NULL, NULL);
    
    eshell = gtk_type_new (e_shell_get_type ());
    e_shell_set_base_uri (eshell, base_uri);

    return eshell;
}

E_MAKE_TYPE (e_shell, "EShell", EShell, e_shell_class_init, e_shell_init, PARENT_TYPE);