1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
---|
2 | /* evolution-shell-component.h |
---|
3 | * |
---|
4 | * Copyright (C) 2000, 2001 Ximian, Inc. |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of version 2 of the GNU General Public |
---|
8 | * License as published by the Free Software Foundation. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | * General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU General Public |
---|
16 | * License along with this program; if not, write to the |
---|
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
18 | * Boston, MA 02111-1307, USA. |
---|
19 | * |
---|
20 | * Author: Ettore Perazzoli |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef EVOLUTION_SHELL_COMPONENT_H |
---|
24 | #define EVOLUTION_SHELL_COMPONENT_H |
---|
25 | |
---|
26 | #include "Evolution.h" |
---|
27 | |
---|
28 | #include "evolution-shell-client.h" |
---|
29 | |
---|
30 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
31 | |
---|
32 | #include <bonobo/bonobo-xobject.h> |
---|
33 | #include <bonobo/bonobo-control.h> |
---|
34 | |
---|
35 | #ifdef cplusplus |
---|
36 | extern "C" { |
---|
37 | #pragma } |
---|
38 | #endif /* cplusplus */ |
---|
39 | |
---|
40 | #define EVOLUTION_TYPE_SHELL_COMPONENT (evolution_shell_component_get_type ()) |
---|
41 | #define EVOLUTION_SHELL_COMPONENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponent)) |
---|
42 | #define EVOLUTION_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponentClass)) |
---|
43 | #define EVOLUTION_IS_SHELL_COMPONENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) |
---|
44 | #define EVOLUTION_IS_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) |
---|
45 | |
---|
46 | #define EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER "/popups/FolderPopup/ComponentPlaceholder/Items" |
---|
47 | |
---|
48 | |
---|
49 | typedef struct _EvolutionShellComponent EvolutionShellComponent; |
---|
50 | typedef struct _EvolutionShellComponentPrivate EvolutionShellComponentPrivate; |
---|
51 | typedef struct _EvolutionShellComponentClass EvolutionShellComponentClass; |
---|
52 | |
---|
53 | enum _EvolutionShellComponentResult { |
---|
54 | EVOLUTION_SHELL_COMPONENT_OK, |
---|
55 | EVOLUTION_SHELL_COMPONENT_CANCEL, |
---|
56 | EVOLUTION_SHELL_COMPONENT_CORBAERROR, |
---|
57 | EVOLUTION_SHELL_COMPONENT_INTERRUPTED, |
---|
58 | EVOLUTION_SHELL_COMPONENT_INVALIDARG, |
---|
59 | EVOLUTION_SHELL_COMPONENT_ALREADYOWNED, |
---|
60 | EVOLUTION_SHELL_COMPONENT_NOTOWNED, |
---|
61 | EVOLUTION_SHELL_COMPONENT_NOTFOUND, |
---|
62 | EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE, |
---|
63 | EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDSCHEMA, |
---|
64 | EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION, |
---|
65 | EVOLUTION_SHELL_COMPONENT_INTERNALERROR, |
---|
66 | EVOLUTION_SHELL_COMPONENT_BUSY, |
---|
67 | EVOLUTION_SHELL_COMPONENT_EXISTS, |
---|
68 | EVOLUTION_SHELL_COMPONENT_INVALIDURI, |
---|
69 | EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED, |
---|
70 | EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS, |
---|
71 | EVOLUTION_SHELL_COMPONENT_NOSPACE, |
---|
72 | EVOLUTION_SHELL_COMPONENT_OLDOWNERHASDIED, |
---|
73 | EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR |
---|
74 | }; |
---|
75 | typedef enum _EvolutionShellComponentResult EvolutionShellComponentResult; |
---|
76 | |
---|
77 | typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateViewFn) |
---|
78 | (EvolutionShellComponent *shell_component, |
---|
79 | const char *physical_uri, |
---|
80 | const char *type, |
---|
81 | const char *view_info, |
---|
82 | BonoboControl **control_return, |
---|
83 | void *closure); |
---|
84 | typedef void (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent *shell_component, |
---|
85 | const char *physical_uri, |
---|
86 | const char *type, |
---|
87 | const GNOME_Evolution_ShellComponentListener listener, |
---|
88 | void *closure); |
---|
89 | typedef void (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component, |
---|
90 | const char *physical_uri, |
---|
91 | const char *type, |
---|
92 | const GNOME_Evolution_ShellComponentListener listener, |
---|
93 | void *closure); |
---|
94 | typedef void (* EvolutionShellComponentXferFolderFn) (EvolutionShellComponent *shell_component, |
---|
95 | const char *source_physical_uri, |
---|
96 | const char *destination_physical_uri, |
---|
97 | const char *type, |
---|
98 | gboolean remove_source, |
---|
99 | const GNOME_Evolution_ShellComponentListener listener, |
---|
100 | void *closure); |
---|
101 | typedef void (* EvolutionShellComponentPopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, |
---|
102 | BonoboUIComponent *uic, |
---|
103 | const char *physical_uri, |
---|
104 | const char *type, |
---|
105 | void *closure); |
---|
106 | typedef void (* EvolutionShellComponentUnpopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, |
---|
107 | BonoboUIComponent *uic, |
---|
108 | const char *physical_uri, |
---|
109 | const char *type, |
---|
110 | void *closure); |
---|
111 | typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellComponent *shell_component, |
---|
112 | const char *physical_uri, |
---|
113 | int type, |
---|
114 | int *format_return, |
---|
115 | const char **selection_return, |
---|
116 | int *selection_length_return, |
---|
117 | void *closure); |
---|
118 | |
---|
119 | typedef gboolean (* EvolutionShellComponentRequestQuitFn) (EvolutionShellComponent *shell_component, |
---|
120 | void *closure); |
---|
121 | |
---|
122 | struct _EvolutionShellComponentFolderType { |
---|
123 | char *name; |
---|
124 | char *icon_name; |
---|
125 | char *display_name; |
---|
126 | char *description; |
---|
127 | |
---|
128 | gboolean user_creatable; |
---|
129 | |
---|
130 | /* The following are NULL-terminated arrays. */ |
---|
131 | char **accepted_dnd_types; |
---|
132 | char **exported_dnd_types; |
---|
133 | }; |
---|
134 | typedef struct _EvolutionShellComponentFolderType EvolutionShellComponentFolderType; |
---|
135 | |
---|
136 | struct _EvolutionShellComponent { |
---|
137 | BonoboXObject parent; |
---|
138 | |
---|
139 | EvolutionShellComponentPrivate *priv; |
---|
140 | }; |
---|
141 | |
---|
142 | struct _EvolutionShellComponentClass { |
---|
143 | BonoboXObjectClass parent_class; |
---|
144 | |
---|
145 | POA_GNOME_Evolution_ShellComponent__epv epv; |
---|
146 | |
---|
147 | /* Signals. */ |
---|
148 | |
---|
149 | void (* owner_set) (EvolutionShellComponent *shell_component, |
---|
150 | EvolutionShellClient *shell_client, |
---|
151 | const char *evolution_homedir); |
---|
152 | void (* owner_unset) (EvolutionShellComponent *shell_component); |
---|
153 | void (* owner_died) (EvolutionShellComponent *shell_component); |
---|
154 | |
---|
155 | void (* debug) (EvolutionShellComponent *shell_component); |
---|
156 | |
---|
157 | void (* interactive) (EvolutionShellComponent *shell_component, |
---|
158 | gboolean is_interactive); |
---|
159 | |
---|
160 | void (* handle_external_uri) (EvolutionShellComponent *shell_component, |
---|
161 | const char *uri); |
---|
162 | |
---|
163 | void (* user_create_new_item) (EvolutionShellComponent *shell_component, |
---|
164 | const char *id, |
---|
165 | const char *parent_folder_physical_uri, |
---|
166 | const char *parent_folder_type); |
---|
167 | |
---|
168 | void (* send_receive) (EvolutionShellComponent *shell_component, |
---|
169 | gboolean show_dialog); |
---|
170 | }; |
---|
171 | |
---|
172 | |
---|
173 | GtkType evolution_shell_component_get_type (void); |
---|
174 | void evolution_shell_component_construct (EvolutionShellComponent *shell_component, |
---|
175 | const EvolutionShellComponentFolderType folder_types[], |
---|
176 | const char *external_uri_schemas[], |
---|
177 | EvolutionShellComponentCreateViewFn create_view_fn, |
---|
178 | EvolutionShellComponentCreateFolderFn create_folder_fn, |
---|
179 | EvolutionShellComponentRemoveFolderFn remove_folder_fn, |
---|
180 | EvolutionShellComponentXferFolderFn xfer_folder_fn, |
---|
181 | EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, |
---|
182 | EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, |
---|
183 | EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, |
---|
184 | EvolutionShellComponentRequestQuitFn request_quit_fn, |
---|
185 | void *closure); |
---|
186 | EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], |
---|
187 | const char *external_uri_schemas[], |
---|
188 | EvolutionShellComponentCreateViewFn create_view_fn, |
---|
189 | EvolutionShellComponentCreateFolderFn create_folder_fn, |
---|
190 | EvolutionShellComponentRemoveFolderFn remove_folder_fn, |
---|
191 | EvolutionShellComponentXferFolderFn xfer_folder_fn, |
---|
192 | EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, |
---|
193 | EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, |
---|
194 | EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, |
---|
195 | EvolutionShellComponentRequestQuitFn request_quit_fn, |
---|
196 | void *closure); |
---|
197 | EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); |
---|
198 | |
---|
199 | void evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, |
---|
200 | const char *id, |
---|
201 | const char *description, |
---|
202 | const char *menu_description, |
---|
203 | const char *tooltip, |
---|
204 | const char *folder_type, |
---|
205 | char menu_shortcut, |
---|
206 | GdkPixbuf *icon); |
---|
207 | |
---|
208 | const char *evolution_shell_component_result_to_string (EvolutionShellComponentResult result); |
---|
209 | |
---|
210 | #ifdef cplusplus |
---|
211 | } |
---|
212 | #endif /* cplusplus */ |
---|
213 | |
---|
214 | #endif /* EVOLUTION_SHELL_COMPONENT_H */ |
---|