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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
/*
* e-folder.c: Abstract class for Evolution folders
*
* Author:
* Miguel de Icaza (miguel@helixcode.com)
*
* (C) 2000 Helix Code, Inc.
*/
#include <config.h>
#include <gtk/gtksignal.h>
#include "e-util/e-util.h"
#include "e-folder.h"
#define PARENT_TYPE gtk_object_get_type ()
static GtkObjectClass *parent_class;
#define EFC(o) E_FOLDER_CLASS (GTK_OBJECT (o)->klass)
enum {
VIEW_CHANGED,
LAST_SIGNAL
};
static guint efolder_signals [LAST_SIGNAL] = { 0, };
static void
e_folder_destroy (GtkObject *object)
{
EFolder *efolder = E_FOLDER (object);
if (efolder->uri)
g_free (efolder->uri);
if (efolder->desc)
g_free (efolder->desc);
if (efolder->home_page)
g_free (efolder->home_page);
parent_class->destroy (object);
}
static void
e_folder_class_init (GtkObjectClass *object_class)
{
parent_class = gtk_type_class (PARENT_TYPE);
object_class->destroy = e_folder_destroy;
efolder_signals [VIEW_CHANGED] =
gtk_signal_new ("view_changed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (EFolderClass, view_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
/* Register our signals */
gtk_object_class_add_signals (
object_class, efolder_signals, LAST_SIGNAL);
}
E_MAKE_TYPE (e_folder, "EFolder", EFolder, e_folder_class_init, NULL, PARENT_TYPE)
void
e_folder_set_uri (EFolder *efolder, const char *uri)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
g_return_if_fail (uri != NULL);
if (efolder->uri)
g_free (efolder->uri);
efolder->uri = g_strdup (uri);
}
const char *
e_folder_get_uri (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return efolder->uri;
}
void
e_folder_set_description (EFolder *efolder, const char *desc)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
g_return_if_fail (desc != NULL);
if (efolder->desc)
g_free (efolder->desc);
efolder->desc = g_strdup (desc);
}
const char *
e_folder_get_description (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return efolder->desc;
}
void
e_folder_set_home_page (EFolder *efolder, const char *home_page)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
g_return_if_fail (home_page != NULL);
if (efolder->home_page)
g_free (efolder->home_page);
efolder->home_page = g_strdup (home_page);
}
const char *
e_folder_get_home_page (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return efolder->home_page;
}
const char *
e_folder_get_type_name (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return EFC (efolder)->get_type_name (efolder);
}
void
e_folder_construct (EFolder *efolder,
const char *uri, const char *name,
const char *desc, const char *home_page,
const char *view_name)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
if (uri)
efolder->uri = g_strdup (uri);
if (name)
efolder->name = g_strdup (name);
if (desc)
efolder->desc = g_strdup (desc);
if (home_page)
efolder->home_page = g_strdup (home_page);
if (view_name)
efolder->view_name = g_strdup (view_name);
}
const char *
e_folder_get_name (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return efolder->name;
}
void
e_folder_set_name (EFolder *efolder, const char *name)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
if (efolder->name)
g_free (efolder->name);
efolder->name = g_strdup (name);
}
const char *
e_folder_get_view_name (EFolder *efolder)
{
g_return_val_if_fail (efolder != NULL, NULL);
g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
return efolder->view_name;
}
void
e_folder_set_view_name (EFolder *efolder, const char *view_name)
{
g_return_if_fail (efolder != NULL);
g_return_if_fail (E_IS_FOLDER (efolder));
if (efolder->view_name)
g_free (efolder->view_name);
efolder->view_name = g_strdup (view_name);
gtk_signal_emit (GTK_OBJECT (efolder),
efolder_signals [VIEW_CHANGED]);
}
|