aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/vee/camel-vee-store.c
blob: b62a6b9fabd399284f33a763f1a83f3391f5c9ef (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 *  Copyright (C) 2000 Helix Code Inc.
 *
 *  Authors: Michael Zucchi <notzed@helixcode.com>
 *
 *  This program is free software; you can redistribute it and/or 
 *  modify it under the terms of the GNU General Public License as 
 *  published by the Free Software Foundation; either version 2 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 *  USA
 */

#include "camel-vee-store.h"
#include "camel-vee-folder.h"

static CamelFolder *vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex);
static char *vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex);

struct _CamelVeeStorePrivate {
};

#define _PRIVATE(o) (((CamelVeeStore *)(o))->priv)

static void camel_vee_store_class_init (CamelVeeStoreClass *klass);
static void camel_vee_store_init       (CamelVeeStore *obj);
static void camel_vee_store_finalise   (GtkObject *obj);

static CamelStoreClass *camel_vee_store_parent;

enum SIGNALS {
    LAST_SIGNAL
};

static guint signals[LAST_SIGNAL] = { 0 };

guint
camel_vee_store_get_type (void)
{
    static guint type = 0;
    
    if (!type) {
        GtkTypeInfo type_info = {
            "CamelVeeStore",
            sizeof (CamelVeeStore),
            sizeof (CamelVeeStoreClass),
            (GtkClassInitFunc) camel_vee_store_class_init,
            (GtkObjectInitFunc) camel_vee_store_init,
            (GtkArgSetFunc) NULL,
            (GtkArgGetFunc) NULL
        };
        
        type = gtk_type_unique (camel_store_get_type (), &type_info);
    }
    
    return type;
}

static void

camel_vee_store_class_init (CamelVeeStoreClass *klass)
{
    GtkObjectClass *object_class = (GtkObjectClass *) klass;
    CamelStoreClass *store_class = (CamelStoreClass *) klass;
    
    camel_vee_store_parent = gtk_type_class (camel_store_get_type ());

    /* virtual method overload */
    store_class->get_folder = vee_get_folder;
    store_class->get_folder_name = vee_get_folder_name;

    object_class->finalize = camel_vee_store_finalise;

    gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}

static void
camel_vee_store_init (CamelVeeStore *obj)
{
    struct _CamelVeeStorePrivate *p;

    p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
}

static void
camel_vee_store_finalise (GtkObject *obj)
{
    ((GtkObjectClass *)(camel_vee_store_parent))->finalize((GtkObject *)obj);
}

/**
 * camel_vee_store_new:
 *
 * Create a new CamelVeeStore object.
 * 
 * Return value: A new CamelVeeStore widget.
 **/
CamelVeeStore *
camel_vee_store_new (void)
{
    CamelVeeStore *new = CAMEL_VEE_STORE ( gtk_type_new (camel_vee_store_get_type ()));
    return new;
}

static CamelFolder *
vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
{
    CamelFolder *folder;

    folder =  gtk_type_new (camel_vee_folder_get_type());

    printf("my type is: %s\n", gtk_type_name(((GtkObject *)folder)->klass->type));

    ((CamelFolderClass *)((GtkObject *)folder)->klass)->init (folder, store, NULL, folder_name, '/', ex);
    return folder;
}

static char *
vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex)
{
#warning "What purpose does this function serve?"
    return g_strdup(folder_name);
}