aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/gui/component/addressbook-component.c13
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/calendar-component.c13
-rw-r--r--calendar/gui/component-factory.c13
-rw-r--r--configure.in2
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/component-factory.c13
-rw-r--r--shell/ChangeLog61
-rw-r--r--shell/Evolution-ShellComponent.idl40
-rw-r--r--shell/Makefile.am95
-rw-r--r--shell/e-component-registry.c13
-rw-r--r--shell/e-folder-type-registry.c37
-rw-r--r--shell/e-folder-type-registry.h32
-rw-r--r--shell/e-shell-folder-creation-dialog.c233
-rw-r--r--shell/e-shell-folder-creation-dialog.h35
-rw-r--r--shell/e-shell-view-menu.c46
-rw-r--r--shell/e-shell-view.c14
-rw-r--r--shell/e-shell-view.h1
-rw-r--r--shell/e-shell.c2
-rw-r--r--shell/evolution-shell-component-client.c507
-rw-r--r--shell/evolution-shell-component-client.h95
-rw-r--r--shell/evolution-shell-component.c106
-rw-r--r--shell/evolution-shell-component.h58
-rw-r--r--shell/glade/.cvsignore4
-rw-r--r--shell/glade/Makefile.am3
-rw-r--r--shell/glade/e-shell-folder-creation-dialog.glade168
-rw-r--r--shell/main.c3
29 files changed, 1515 insertions, 125 deletions
diff --git a/ChangeLog b/ChangeLog
index 3acf6fc077..c6bb809d28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-09 Ettore Perazzoli <ettore@helixcode.com>
+
+ * configure.in: Added new directory `shell/glade'.
+
2000-06-07 Christopher James Lahey <clahey@helixcode.com>
* widgets/e-paned/e-hpaned.c, widgets/e-paned/e-paned.c,
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index aa797e91bf..6e7786d6fc 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,15 @@
+2000-06-09 Ettore Perazzoli <ettore@helixcode.com>
+
+ * gui/component/addressbook-component.c (factory_fn): Pass NULL
+ for the new args @create_folder_fn and @remove_folder_fn.
+
+2000-06-08 Ettore Perazzoli <ettore@helixcode.com>
+
+ * gui/component/addressbook-component.c (create_view): Updated for
+ the new `EvolutionShellComponentCreateViewFn'. Return
+ `EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE' if @type is not
+ "contacts".
+
2000-06-08 Christopher James Lahey <clahey@helixcode.com>
* contact-editor/e-contact-editor.c: Bind Save As to save the
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index c3c7a14d60..793e168c18 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -50,17 +50,24 @@ static const EvolutionShellComponentFolderType folder_types[] = {
/* EvolutionShellComponent methods and signals. */
-static BonoboControl *
+static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
+ const char *type,
+ BonoboControl **control_return,
void *closure)
{
BonoboControl *control;
+ if (g_strcasecmp (type, "contacts") != 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+
control = addressbook_factory_new_control ();
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
- return control;
+ *control_return = control;
+
+ return EVOLUTION_SHELL_COMPONENT_OK;
}
static int owner_count = 0;
@@ -92,7 +99,7 @@ factory_fn (BonoboGenericFactory *factory,
{
EvolutionShellComponent *shell_component;
- shell_component = evolution_shell_component_new (folder_types, create_view, NULL);
+ shell_component = evolution_shell_component_new (folder_types, create_view, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ee24dbf58a..bae6a3c3cc 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-09 Ettore Perazzoli <ettore@helixcode.com>
+
+ * gui/component-factory.c (factory_fn): Pass NULL for the new args
+ @create_folder_fn and @remove_folder_fn.
+ (create_view): Updated to match the new
+ `EvolutionShellComponentCreateViewFn'. Return
+ `EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE' if type is not
+ "calendar".
+
2000-06-09 Federico Mena Quintero <federico@helixcode.com>
* idl/evolution-calendar.idl (Cal): Added a get_n_objects()
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 1509f70457..1b178cfdfc 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -47,17 +47,24 @@ static const EvolutionShellComponentFolderType folder_types[] = {
/* EvolutionShellComponent methods and signals. */
-static BonoboControl *
+static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
+ const char *type,
+ BonoboControl **control_return,
void *closure)
{
BonoboControl *control;
+ if (g_strcasecmp (type, "calendar") != 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+
control = control_factory_new_control ();
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
- return control;
+ *control_return = control;
+
+ return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
@@ -76,7 +83,7 @@ factory_fn (BonoboGenericFactory *factory,
{
EvolutionShellComponent *shell_component;
- shell_component = evolution_shell_component_new (folder_types, create_view, NULL);
+ shell_component = evolution_shell_component_new (folder_types, create_view, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index 1509f70457..1b178cfdfc 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -47,17 +47,24 @@ static const EvolutionShellComponentFolderType folder_types[] = {
/* EvolutionShellComponent methods and signals. */
-static BonoboControl *
+static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
+ const char *type,
+ BonoboControl **control_return,
void *closure)
{
BonoboControl *control;
+ if (g_strcasecmp (type, "calendar") != 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+
control = control_factory_new_control ();
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
- return control;
+ *control_return = control;
+
+ return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
@@ -76,7 +83,7 @@ factory_fn (BonoboGenericFactory *factory,
{
EvolutionShellComponent *shell_component;
- shell_component = evolution_shell_component_new (folder_types, create_view, NULL);
+ shell_component = evolution_shell_component_new (folder_types, create_view, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/configure.in b/configure.in
index 1c80bbfc84..15f0fc55f6 100644
--- a/configure.in
+++ b/configure.in
@@ -454,6 +454,7 @@ addressbook/gui/Makefile
addressbook/gui/minicard/Makefile
addressbook/gui/component/Makefile
shell/Makefile
+shell/glade/Makefile
mail/Makefile
data/Makefile
libversit/Makefile
@@ -467,6 +468,7 @@ calendar/cal-client/Makefile
calendar/pcs/Makefile
calendar/gui/Makefile
calendar/gui/dialogs/Makefile
+notes/Makefile
filter/Makefile
notes/Makefile
wombat/Makefile
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8c7a6daed5..28dbdbfa72 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2000-06-09 Ettore Perazzoli <ettore@helixcode.com>
+
+ * component-factory.c (create_view): Updated to match the changes
+ to the definition of `EvolutionShellComponentCreateFn'. If @type
+ is not "mail", return an "unsupported type" error.
+ (factory_fn): Pass NULL for the `remove_folder' and
+ `create_folder' functions.
+
2000-06-09 Dan Winship <danw@helixcode.com>
* mail-format.c: Redo things a bit so that whitespace-only
diff --git a/mail/component-factory.c b/mail/component-factory.c
index adc8380754..0452efb846 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -59,14 +59,19 @@ static GList *browsers;
/* EvolutionShellComponent methods and signals. */
-static BonoboControl *
+static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
+ const char *folder_type,
+ BonoboControl **control_return,
void *closure)
{
BonoboControl *control;
GtkWidget *folder_browser_widget;
+ if (g_strcasecmp (folder_type, "mail") != 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+
control = folder_browser_factory_new_control ();
folder_browser_widget = bonobo_control_get_widget (control);
@@ -83,7 +88,9 @@ create_view (EvolutionShellComponent *shell_component,
/* FIXME: This never fails. :-/ */
folder_browser_set_uri (FOLDER_BROWSER (folder_browser_widget), physical_uri);
- return control;
+ *control_return = control;
+
+ return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
@@ -123,7 +130,7 @@ factory_fn (BonoboGenericFactory *factory,
{
EvolutionShellComponent *shell_component;
- shell_component = evolution_shell_component_new (folder_types, create_view, NULL);
+ shell_component = evolution_shell_component_new (folder_types, create_view, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/shell/ChangeLog b/shell/ChangeLog
index cdf167aa1d..84edb7c42a 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,64 @@
+2000-06-09 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shell-view-menu.c: Removed folder menu and "save as..." command.
+
+ * main.c (main): Call `glade_gnome_init()'.
+
+ * e-shell-view-menu.c (command_new_folder): Implemented.
+
+ * e-shell-folder-creation-dialog.c: New.
+ * e-shell-folder-creation-dialog.h: New.
+
+ * glade/Makefile.am: New.
+ * glade/e-shell-folder-creation-dialog.glade: New.
+
+ * e-shell-view.c (e_shell_view_get_current_uri): New.
+
+ * e-folder-type-registry.c
+ (e_folder_type_registry_get_type_names): New.
+
+ * e-shell-view.c (get_control_for_uri): Updated to use
+ `EvolutionShellComponentClient'.
+
+ * e-folder-type-registry.c: Use `EvolutionShellComponentClient's
+ instead of `BonoboObjectClient's.
+
+ * e-component-registry.c: Use `EvolutionShellComponentClient'
+ instead of `BonoboObjectClient' in `Component'.
+ (component_new): Updated accordingly.
+ (register_component): Likewise.
+
+ * evolution-shell-component-client.h: New.
+ * evolution-shell-component-client.c: New.
+
+ * evolution-shell-component.c
+ (impl_ShellComponent_async_create_folder): New, implementation of
+ `::async_create_folder'.
+ (impl_ShellComponent_async_remove_folder): New, implementation of
+ `::async_remove_folder'.
+ (corba_class_init): Install them.
+ (evolution_shell_component_new): New args `create_folder_fn' and
+ `remove_folder_fn' for setting the handlers for these new methods.
+ (evolution_shell_component_construct): Likewise.
+
+ * Evolution-ShellComponent.idl
+ (ShellComponent::async_create_folder): New.
+ (ShellComponent::async_remove_folder): New.
+ (ShellComponentListener): New.
+
+ * evolution-shell-component.c (impl_ShellComponent_create_view):
+ New param @type. Use the new `EvolutionShellComponentCreateViewFn'.
+
+ * evolution-shell-component.h: New enum `EvolutionShellComponentResult'.
+ Changed `EvolutionShellComponentCreateViewFn' to return an
+ `EvolutionShellComponentResult'.
+
+ * e-shell-view.c (get_control_for_uri): Pass the folder type to
+ `ShellComponent::create_view'.
+
+ * Evolution-ShellComponent.idl: New param @type for
+ `ShellComponent::create_view'.
+
2000-06-08 Miguel de Icaza <miguel@helixcode.com>
* main.c (development_warning): Use version here. Add padding to
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 6f0e566d44..7c95489889 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -20,20 +20,54 @@ module Evolution {
typedef sequence<FolderType> FolderTypeList;
+ interface ShellComponentListener;
+
interface ShellComponent : Bonobo::Unknown {
readonly attribute FolderTypeList supported_types;
- /* FIXME can we use an attribute here? */
+ /* FIXME: Can we use an attribute here? */
exception AlreadyOwned {};
+
void set_owner (in Shell shell)
raises (AlreadyOwned);
exception NotOwned {};
+
void unset_owner ()
raises (NotOwned);
+ /* FIXME: We might want more exceptions here. */
exception NotFound {};
- Bonobo::Control create_view (in string physical_uri)
- raises (NotFound);
+ exception UnsupportedType {};
+ exception InternalError {};
+
+ Bonobo::Control create_view (in string physical_uri,
+ in string type)
+ raises (NotFound, UnsupportedType, InternalError);
+
+ exception Busy {};
+
+ void async_create_folder (in ShellComponentListener listener,
+ in string physical_uri,
+ in string type)
+ raises (Busy);
+ void async_remove_folder (in ShellComponentListener listener,
+ in string physical_uri)
+ raises (Busy);
+ };
+
+ interface ShellComponentListener {
+ enum Result {
+ OK,
+ UNSUPPORTED_OPERATION,
+ UNSUPPORTED_TYPE,
+ EXISTS,
+ INVALID_URI,
+ PERMISSION_DENIED,
+ HAS_SUBFOLDERS,
+ NO_SPACE
+ };
+
+ void report_result (in Result result);
};
};
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 6141f9ce69..7788803994 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = glade
+
imagesdir = $(datadir)/images/evolution
bin_PROGRAMS = evolution
@@ -27,49 +29,56 @@ IDLS = \
Evolution-ShellComponent.idl \
Evolution-Storage.idl
-evolution_SOURCES = \
- $(EVOLUTION_CORBA_GENERATED) \
- e-corba-storage.c \
- e-corba-storage.h \
- e-corba-storage-registry.c \
- e-corba-storage-registry.h \
- e-folder-type-registry.c \
- e-folder-type-registry.h \
- e-folder.c \
- e-folder.h \
- e-local-folder.c \
- e-local-folder.h \
- e-local-storage.c \
- e-local-storage.h \
- e-setup.c \
- e-setup.h \
- e-component-registry.h \
- e-component-registry.c \
- e-shell-constants.h \
- e-shell-folder-title-bar.c \
- e-shell-folder-title-bar.h \
- e-shell-utils.c \
- e-shell-utils.h \
- e-shell-view-menu.c \
- e-shell-view-menu.h \
- e-shell-view.c \
- e-shell-view.h \
- e-shell.c \
- e-shell.h \
- e-shortcuts-view.c \
- e-shortcuts-view.h \
- e-shortcuts.c \
- e-shortcuts.h \
- e-storage-set-view.c \
- e-storage-set-view.h \
- e-storage-set.c \
- e-storage-set.h \
- e-storage.c \
- e-storage.h \
- evolution-shell-component.c \
- evolution-shell-component.h \
- evolution-storage.c \
- evolution-storage.h \
+CPPFLAGS = \
+ -DE_GLADEDIR=\"$(datadir)/evolution/glade\"
+
+evolution_SOURCES = \
+ $(EVOLUTION_CORBA_GENERATED) \
+ e-component-registry.c \
+ e-component-registry.h \
+ e-corba-storage-registry.c \
+ e-corba-storage-registry.h \
+ e-corba-storage.c \
+ e-corba-storage.h \
+ e-folder-type-registry.c \
+ e-folder-type-registry.h \
+ e-folder.c \
+ e-folder.h \
+ e-local-folder.c \
+ e-local-folder.h \
+ e-local-storage.c \
+ e-local-storage.h \
+ e-setup.c \
+ e-setup.h \
+ e-shell-constants.h \
+ e-shell-folder-creation-dialog.c \
+ e-shell-folder-creation-dialog.h \
+ e-shell-folder-title-bar.c \
+ e-shell-folder-title-bar.h \
+ e-shell-utils.c \
+ e-shell-utils.h \
+ e-shell-view-menu.c \
+ e-shell-view-menu.h \
+ e-shell-view.c \
+ e-shell-view.h \
+ e-shell.c \
+ e-shell.h \
+ e-shortcuts-view.c \
+ e-shortcuts-view.h \
+ e-shortcuts.c \
+ e-shortcuts.h \
+ e-storage-set-view.c \
+ e-storage-set-view.h \
+ e-storage-set.c \
+ e-storage-set.h \
+ e-storage.c \
+ e-storage.h \
+ evolution-shell-component-client.c \
+ evolution-shell-component-client.h \
+ evolution-shell-component.c \
+ evolution-shell-component.h \
+ evolution-storage.c \
+ evolution-storage.h \
main.c
Evolution-impl.o: Evolution.h
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index a2fa72d182..944b5c150b 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -34,6 +34,8 @@
#include "Evolution.h"
+#include "evolution-shell-component-client.h"
+
#include "e-component-registry.h"
@@ -45,7 +47,7 @@ typedef struct _Component Component;
struct _Component {
char *id;
- BonoboObjectClient *client;
+ EvolutionShellComponentClient *client;
/* Names of the folder types we support (normal ASCII strings). */
GList *folder_type_names;
@@ -62,7 +64,7 @@ struct _EComponentRegistryPrivate {
static Component *
component_new (const char *id,
- BonoboObjectClient *client)
+ EvolutionShellComponentClient *client)
{
Component *new;
@@ -133,7 +135,7 @@ register_component (EComponentRegistry *component_registry,
Evolution_Shell shell_corba_interface;
Evolution_FolderTypeList *supported_types;
Component *component;
- BonoboObjectClient *client;
+ EvolutionShellComponentClient *client;
CORBA_Environment ev;
CORBA_unsigned_long i;
@@ -144,12 +146,15 @@ register_component (EComponentRegistry *component_registry,
return FALSE;
}
- client = bonobo_object_activate (id, 0);
+ client = evolution_shell_component_client_new (id);
if (client == NULL)
return FALSE;
CORBA_exception_init (&ev);
+ /* FIXME we could use the EvolutionShellComponentClient API here instead, but for
+ now we don't care. */
+
component_corba_interface = bonobo_object_corba_objref (BONOBO_OBJECT (client));
shell_corba_interface = bonobo_object_corba_objref (BONOBO_OBJECT (priv->shell));
diff --git a/shell/e-folder-type-registry.c b/shell/e-folder-type-registry.c
index e5447ca54d..8e3e87ed8b 100644
--- a/shell/e-folder-type-registry.c
+++ b/shell/e-folder-type-registry.c
@@ -42,7 +42,7 @@ struct _FolderType {
char *name;
char *icon_name;
- BonoboObjectClient *handler;
+ EvolutionShellComponentClient *handler;
/* The icon, standard (48x48) and mini (16x16) versions. */
GdkPixbuf *icon_pixbuf;
@@ -144,7 +144,7 @@ register_folder_type (EFolderTypeRegistry *folder_type_registry,
static gboolean
set_handler (EFolderTypeRegistry *folder_type_registry,
const char *name,
- BonoboObjectClient *handler)
+ EvolutionShellComponentClient *handler)
{
EFolderTypeRegistryPrivate *priv;
FolderType *folder_type;
@@ -258,7 +258,7 @@ e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
gboolean
e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
- BonoboObjectClient *handler)
+ EvolutionShellComponentClient *handler)
{
g_return_val_if_fail (folder_type_registry != NULL, FALSE);
g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), FALSE);
@@ -268,6 +268,35 @@ e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_r
return set_handler (folder_type_registry, type_name, handler);
}
+
+static void
+get_type_names_hash_forall (void *key,
+ void *value,
+ void *data)
+{
+ GList **type_name_list;
+
+ type_name_list = (GList **) data;
+
+ *type_name_list = g_list_prepend (*type_name_list, g_strdup ((const char *) key));
+}
+
+GList *
+e_folder_type_registry_get_type_names (EFolderTypeRegistry *folder_type_registry)
+{
+ GList *type_name_list;
+ EFolderTypeRegistryPrivate *priv;
+
+ g_return_val_if_fail (folder_type_registry != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL);
+
+ priv = folder_type_registry->priv;
+
+ type_name_list = NULL;
+ g_hash_table_foreach (priv->name_to_type, get_type_names_hash_forall, &type_name_list);
+
+ return type_name_list;
+}
const char *
@@ -312,7 +341,7 @@ e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_regis
return folder_type->icon_pixbuf;
}
-BonoboObjectClient *
+EvolutionShellComponentClient *
e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name)
{
diff --git a/shell/e-folder-type-registry.h b/shell/e-folder-type-registry.h
index 0297633007..6d832282aa 100644
--- a/shell/e-folder-type-registry.h
+++ b/shell/e-folder-type-registry.h
@@ -31,7 +31,7 @@
#include <gtk/gtkobject.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <bonobo/bonobo-object-client.h>
+#include "evolution-shell-component-client.h"
#ifdef __cplusplus
extern "C" {
@@ -64,20 +64,22 @@ GtkType e_folder_type_registry_get_type (void);
void e_folder_type_registry_construct (EFolderTypeRegistry *folder_type_registry);
EFolderTypeRegistry *e_folder_type_registry_new (void);
-gboolean e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name,
- const char *icon_name);
-gboolean e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name,
- BonoboObjectClient *handler);
-
-GdkPixbuf *e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name,
- gboolean mini);
-const char *e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name);
-BonoboObjectClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name);
+gboolean e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name,
+ const char *icon_name);
+gboolean e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name,
+ EvolutionShellComponentClient *handler);
+
+GList *e_folder_type_registry_get_type_names (EFolderTypeRegistry *folder_type_registry);
+
+GdkPixbuf *e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name,
+ gboolean mini);
+const char *e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
+EvolutionShellComponentClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
#ifdef __cplusplus
}
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
new file mode 100644
index 0000000000..6879922be1
--- /dev/null
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -0,0 +1,233 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gnome.h>
+#include <glade/glade-xml.h>
+
+#include "e-util/e-util.h"
+#include "widgets/misc/e-scroll-frame.h"
+
+#include "e-storage-set.h"
+#include "e-storage-set-view.h"
+
+#include "e-shell-folder-creation-dialog.h"
+
+
+#define GLADE_FILE_NAME E_GLADEDIR "/e-shell-folder-creation-dialog.glade"
+
+
+/* Dialog callbacks. */
+
+static void
+dialog_clicked_cb (GnomeDialog *dialog,
+ int button_number,
+ void *data)
+{
+ g_print ("Clicked -- %d\n", button_number);
+ gnome_dialog_close (dialog);
+}
+
+static void
+dialog_close_cb (GnomeDialog *dialog,
+ void *data)
+{
+ g_print ("Closed\n");
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+folder_name_entry_changed_cb (GtkEditable *editable,
+ void *data)
+{
+ GnomeDialog *dialog;
+ GtkEntry *entry;
+
+ entry = GTK_ENTRY (editable);
+ dialog = GNOME_DIALOG (data);
+
+ if (entry->text_length > 0)
+ gnome_dialog_set_sensitive (dialog, 0, TRUE);
+ else
+ gnome_dialog_set_sensitive (dialog, 0, FALSE);
+}
+
+
+/* Dialog setup. */
+
+static void
+setup_dialog (GtkWidget *dialog,
+ GladeXML *gui,
+ EShell *shell,
+ GtkWindow *parent)
+{
+ if (parent != NULL)
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution - Create new folder"));
+
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
+ GTK_SIGNAL_FUNC (dialog_clicked_cb), shell);
+ gtk_signal_connect (GTK_OBJECT (dialog), "close",
+ GTK_SIGNAL_FUNC (dialog_close_cb), shell);
+
+ gtk_widget_show (dialog);
+}
+
+static void
+setup_folder_name_entry (GtkWidget *dialog,
+ GladeXML *gui,
+ EShell *shell)
+{
+ GtkWidget *folder_name_entry;
+
+ folder_name_entry = glade_xml_get_widget (gui, "folder_name_entry");
+
+ gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE (folder_name_entry));
+
+ gtk_signal_connect (GTK_OBJECT (folder_name_entry), "changed",
+ GTK_SIGNAL_FUNC (folder_name_entry_changed_cb), dialog);
+}
+
+static void
+add_storage_set_view (GtkWidget *dialog,
+ GladeXML *gui,
+ EShell *shell,
+ const char *default_parent_folder)
+{
+ EStorageSet *storage_set;
+ GtkWidget *storage_set_view;
+ GtkWidget *scroll_frame;
+ GtkWidget *vbox;
+
+ storage_set = e_shell_get_storage_set (shell);
+ storage_set_view = e_storage_set_new_view (storage_set);
+
+ GTK_WIDGET_SET_FLAGS (storage_set_view, GTK_CAN_FOCUS);
+
+ if (default_parent_folder != NULL)
+ e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (storage_set_view),
+ default_parent_folder);
+
+ vbox = glade_xml_get_widget (gui, "main_vbox");
+
+ scroll_frame = e_scroll_frame_new (NULL, NULL);
+ e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_box_pack_start (GTK_BOX (vbox), scroll_frame, TRUE, TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (scroll_frame), storage_set_view);
+
+ gtk_widget_show (scroll_frame);
+ gtk_widget_show (storage_set_view);
+}
+
+static void
+add_folder_types (GtkWidget *dialog,
+ GladeXML *gui,
+ EShell *shell)
+{
+ EFolderTypeRegistry *folder_type_registry;
+ GtkWidget *folder_type_option_menu;
+ GtkWidget *menu;
+ GList *types;
+ GList *p;
+ int default_item;
+ int i;
+
+ folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu");
+
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (folder_type_option_menu));
+ g_assert (menu != NULL);
+ g_assert (GTK_IS_MENU (menu));
+
+ folder_type_registry = e_shell_get_folder_type_registry (shell);
+ g_assert (folder_type_registry != NULL);
+
+ types = e_folder_type_registry_get_type_names (folder_type_registry);
+ if (types == NULL)
+ return; /* Uh? */
+
+ types = g_list_sort (types, (GCompareFunc) g_strcasecmp);
+
+ /* FIXME: Use descriptive name (not in the registry's implementation yet). */
+ /* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */
+
+ default_item = 0;
+ for (p = types, i = 0; p != NULL; p = p->next, i++) {
+ const char *type_name;
+ GtkWidget *menu_item;
+
+ type_name = (const char *) p->data;
+
+ menu_item = gtk_menu_item_new_with_label (type_name);
+ gtk_menu_append (GTK_MENU (menu), menu_item);
+ gtk_widget_show (menu_item);
+
+ if (strcmp (type_name, "mail") == 0)
+ default_item = i;
+ }
+
+ e_free_string_list (types);
+
+ gtk_option_menu_set_history (GTK_OPTION_MENU (folder_type_option_menu), default_item);
+}
+
+
+/* FIXME: Currently this is modal. I think it's OK, but if people think it is
+ not, we should change it to non-modal and make sure only one of these is
+ open at once. Currently it relies on modality for this. */
+void
+e_shell_show_folder_creation_dialog (EShell *shell,
+ GtkWindow *parent,
+ const char *default_parent_folder)
+{
+ GladeXML *gui;
+ GtkWidget *dialog;
+
+ g_return_if_fail (shell != NULL);
+ g_return_if_fail (E_IS_SHELL (shell));
+
+ gui = glade_xml_new (GLADE_FILE_NAME, NULL);
+ if (gui == NULL) {
+ g_warning ("Cannot load Glade description file for the folder creation dialog -- %s",
+ GLADE_FILE_NAME);
+ return;
+ }
+
+ dialog = glade_xml_get_widget (gui, "create_folder_dialog");
+
+ setup_dialog (dialog, gui, shell, parent);
+ setup_folder_name_entry (dialog, gui, shell);
+
+ add_storage_set_view (dialog, gui, shell, default_parent_folder);
+ add_folder_types (dialog, gui, shell);
+
+ gtk_object_unref (GTK_OBJECT (gui));
+}
diff --git a/shell/e-shell-folder-creation-dialog.h b/shell/e-shell-folder-creation-dialog.h
new file mode 100644
index 0000000000..430898b6b0
--- /dev/null
+++ b/shell/e-shell-folder-creation-dialog.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifndef E_SHELL_FOLDER_CREATION_DIALOG_H
+#define E_SHELL_FOLDER_CREATION_DIALOG_H
+
+#include <gtk/gtkwidget.h>
+
+#include "e-shell.h"
+
+void e_shell_show_folder_creation_dialog (EShell *shell,
+ GtkWindow *parent,
+ const char *default_parent_folder);
+
+#endif /* E_SHELL_FOLDER_CREATION_DIALOG_H */
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index 9aef0d8a97..8dec015f8d 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -26,7 +26,9 @@
#include <config.h>
#include <gnome.h>
-#include "e-shell-view.h"
+#include "e-shell-folder-creation-dialog.h"
+#include "e-shell-constants.h"
+
#include "e-shell-view-menu.h"
@@ -218,6 +220,30 @@ command_toggle_shortcut_bar (BonoboUIHandler *uih,
}
+static void
+command_new_folder (BonoboUIHandler *uih,
+ void *data,
+ const char *path)
+{
+ EShellView *shell_view;
+ EShell *shell;
+ const char *current_uri;
+ const char *default_parent_folder;
+
+ shell_view = E_SHELL_VIEW (data);
+ shell = e_shell_view_get_shell (shell_view);
+ current_uri = e_shell_view_get_current_uri (shell_view);
+
+ if (strncmp (current_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0)
+ default_parent_folder = current_uri + E_SHELL_URI_PREFIX_LEN;
+ else
+ default_parent_folder = NULL;
+
+ e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
+ default_parent_folder);
+}
+
+
/* Unimplemented commands. */
#define DEFINE_UNIMPLEMENTED(func) \
@@ -227,7 +253,6 @@ func (GtkWidget *widget, gpointer data) \
g_warning ("EShellView: %s: not implemented.", __FUNCTION__); \
} \
-DEFINE_UNIMPLEMENTED (command_new_folder)
DEFINE_UNIMPLEMENTED (command_new_shortcut)
DEFINE_UNIMPLEMENTED (command_new_mail_message)
DEFINE_UNIMPLEMENTED (command_new_meeting_request)
@@ -237,7 +262,6 @@ DEFINE_UNIMPLEMENTED (command_new_task_request)
DEFINE_UNIMPLEMENTED (command_new_journal_entry)
DEFINE_UNIMPLEMENTED (command_new_note)
DEFINE_UNIMPLEMENTED (command_open_selected_items)
-DEFINE_UNIMPLEMENTED (command_save_as)
DEFINE_UNIMPLEMENTED (command_close_open_items)
@@ -299,28 +323,12 @@ static GnomeUIInfo menu_file_open [] = {
GNOMEUIINFO_END
};
-static GnomeUIInfo menu_folder [] = {
- { GNOME_APP_UI_ITEM, N_("_New Folder"), NULL,
- command_new_folder, NULL,
- NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK },
-
- GNOMEUIINFO_END
-};
-
static GnomeUIInfo menu_file [] = {
GNOMEUIINFO_SUBTREE_STOCK (N_("_New"), menu_file_new, GNOME_STOCK_MENU_NEW),
GNOMEUIINFO_SUBTREE_STOCK (N_("_Open"), menu_file_open, GNOME_STOCK_MENU_NEW),
GNOMEUIINFO_ITEM_NONE (N_("Clos_e All Items"), N_("Closes all the open items"), command_close_open_items),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_MENU_SAVE_AS_ITEM (command_save_as, NULL),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_SUBTREE (N_("_Folder"), menu_folder),
-
- GNOMEUIINFO_SEPARATOR,
-
GNOMEUIINFO_MENU_EXIT_ITEM(command_quit, NULL),
GNOMEUIINFO_END
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 80c5e1551b..e3b47c3d25 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -668,7 +668,7 @@ get_control_for_uri (EShellView *shell_view,
EStorageSet *storage_set;
EFolder *folder;
Bonobo_UIHandler corba_uih;
- BonoboObjectClient *handler_client;
+ EvolutionShellComponentClient *handler_client;
Bonobo_Control corba_control;
Evolution_ShellComponent handler;
const char *path;
@@ -707,7 +707,8 @@ get_control_for_uri (EShellView *shell_view,
CORBA_exception_init (&ev);
- corba_control = Evolution_ShellComponent_create_view (handler, e_folder_get_physical_uri (folder), &ev);
+ corba_control = Evolution_ShellComponent_create_view (handler, e_folder_get_physical_uri (folder),
+ folder_type, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
return NULL;
@@ -970,5 +971,14 @@ e_shell_view_get_appbar (EShellView *shell_view)
return shell_view->priv->appbar;
}
+const char *
+e_shell_view_get_current_uri (EShellView *shell_view)
+{
+ g_return_val_if_fail (shell_view != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->uri;
+}
+
E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 53ce8a59a7..db066dd62e 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -89,6 +89,7 @@ EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView
EShell *e_shell_view_get_shell (EShellView *shell_view);
BonoboUIHandler *e_shell_view_get_bonobo_ui_handler (EShellView *shell_view);
GtkWidget *e_shell_view_get_appbar (EShellView *shell_view);
+const char *e_shell_view_get_current_uri (EShellView *shell_view);
#ifdef __cplusplus
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 4fbb20dca1..03ae95c863 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -117,7 +117,7 @@ impl_Shell_get_component_for_type (PortableServer_Servant servant,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
- BonoboObjectClient *handler;
+ EvolutionShellComponentClient *handler;
EFolderTypeRegistry *folder_type_registry;
Evolution_ShellComponent corba_component;
EShell *shell;
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c
new file mode 100644
index 0000000000..53a4933142
--- /dev/null
+++ b/shell/evolution-shell-component-client.c
@@ -0,0 +1,507 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* evolution-shell-component-client.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtksignal.h>
+#include <gtk/gtktypeutils.h>
+
+#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-widget.h>
+
+#include "e-util/e-util.h"
+
+#include "evolution-shell-component-client.h"
+
+
+#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
+static BonoboObjectClass *parent_class = NULL;
+
+struct _EvolutionShellComponentClientPrivate {
+ EvolutionShellComponentClientCallback callback;
+ void *callback_data;
+
+ Evolution_ShellComponentListener listener_interface;
+ PortableServer_Servant listener_servant;
+};
+
+
+#define RETURN_ERROR_IF_FAIL(cond) \
+ g_return_val_if_fail ((cond), EVOLUTION_SHELL_COMPONENT_INVALIDARG)
+
+
+/* Object activation. */
+
+#ifdef USING_OAF
+
+#include <liboaf/liboaf.h>
+
+static CORBA_Object
+activate_object_from_id (const char *id)
+{
+ CORBA_Environment ev;
+ CORBA_Object corba_object;
+
+ CORBA_exception_init (&ev);
+
+ corba_object = oaf_activate_from_id ((char *) id, 0, NULL, &ev); /* Yuck. */
+ if (ev._major != CORBA_NO_EXCEPTION)
+ corba_object = CORBA_OBJECT_NIL;
+
+ CORBA_exception_free (&ev);
+
+ return corba_object;
+}
+
+#else
+
+#include <libgnorba/gnorba.h>
+
+static CORBA_Object
+activate_object_from_id (const char *id)
+{
+ return goad_server_activate_with_id (NULL, id, 0, NULL);
+}
+
+#endif
+
+
+/* Utility functions. */
+
+static EvolutionShellComponentResult
+corba_exception_to_result (const CORBA_Environment *ev)
+{
+ if (ev->_major == CORBA_NO_EXCEPTION)
+ return EVOLUTION_SHELL_COMPONENT_OK;
+
+ if (ev->_major == CORBA_USER_EXCEPTION) {
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_AlreadyOwned) == 0)
+ return EVOLUTION_SHELL_COMPONENT_ALREADYOWNED;
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_NotOwned) == 0)
+ return EVOLUTION_SHELL_COMPONENT_NOTOWNED;
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_NotFound) == 0)
+ return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_UnsupportedType) == 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_InternalError) == 0)
+ return EVOLUTION_SHELL_COMPONENT_INTERNALERROR;
+ if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_Busy) == 0)
+ return EVOLUTION_SHELL_COMPONENT_BUSY;
+
+ return EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR;
+ } else {
+ /* FIXME maybe we need something more specific here. */
+ return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ }
+}
+
+static void
+dispatch_callback (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentResult result)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ EvolutionShellComponentClientCallback callback;
+ PortableServer_ObjectId *oid;
+ void *callback_data;
+ CORBA_Environment ev;
+
+ priv = shell_component_client->priv;
+
+ g_return_if_fail (priv->callback != NULL);
+ g_return_if_fail (priv->listener_servant != NULL);
+
+ /* Notice that we destroy the interface and reset the callback information before
+ dispatching the callback so that the callback can generate another request. */
+
+ CORBA_exception_init (&ev);
+
+ CORBA_Object_release (priv->listener_interface, &ev);
+
+ oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev);
+ PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev);
+ POA_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev);
+ CORBA_free (oid);
+
+ CORBA_exception_free (&ev);
+
+ priv->listener_servant = NULL;
+ priv->listener_interface = CORBA_OBJECT_NIL;
+
+ callback = priv->callback;
+ callback_data = priv->callback_data;
+
+ priv->callback = NULL;
+ priv->callback_data = NULL;
+
+ (* callback) (shell_component_client, result, callback_data);
+}
+
+
+/* CORBA listener interface implementation. */
+
+static PortableServer_ServantBase__epv ShellComponentListener_base_epv;
+static POA_Evolution_ShellComponentListener__epv ShellComponentListener_epv;
+static POA_Evolution_ShellComponentListener__vepv ShellComponentListener_vepv;
+static gboolean ShellComponentListener_vepv_initialized = FALSE;
+
+struct _ShellComponentListenerServant {
+ POA_Evolution_ShellComponentListener servant;
+ EvolutionShellComponentClient *component_client;
+};
+typedef struct _ShellComponentListenerServant ShellComponentListenerServant;
+
+static EvolutionShellComponentClient *
+component_client_from_ShellComponentListener_servant (PortableServer_Servant servant)
+{
+ ShellComponentListenerServant *listener_servant;
+
+ listener_servant = (ShellComponentListenerServant *) servant;
+ return listener_servant->component_client;
+}
+
+static EvolutionShellComponentResult
+result_from_async_corba_result (Evolution_ShellComponentListener_Result async_corba_result)
+{
+ switch (async_corba_result) {
+ case Evolution_ShellComponentListener_OK:
+ return EVOLUTION_SHELL_COMPONENT_OK;
+ case Evolution_ShellComponentListener_UNSUPPORTED_OPERATION:
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION;
+ case Evolution_ShellComponentListener_EXISTS:
+ return EVOLUTION_SHELL_COMPONENT_EXISTS;
+ case Evolution_ShellComponentListener_INVALID_URI:
+ return EVOLUTION_SHELL_COMPONENT_INVALIDURI;
+ case Evolution_ShellComponentListener_PERMISSION_DENIED:
+ return EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED;
+ case Evolution_ShellComponentListener_HAS_SUBFOLDERS:
+ return EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS;
+ case Evolution_ShellComponentListener_NO_SPACE:
+ return EVOLUTION_SHELL_COMPONENT_NOSPACE;
+ default:
+ return EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR;
+ }
+}
+
+static void
+impl_ShellComponentListener_report_result (PortableServer_Servant servant,
+ const Evolution_ShellComponentListener_Result result,
+ CORBA_Environment *ev)
+{
+ EvolutionShellComponentClient *component_client;
+
+ component_client = component_client_from_ShellComponentListener_servant (servant);
+ dispatch_callback (component_client, result_from_async_corba_result (result));
+}
+
+static void
+ShellComponentListener_vepv_initialize (void)
+{
+ ShellComponentListener_base_epv._private = NULL;
+ ShellComponentListener_base_epv.finalize = NULL;
+ ShellComponentListener_base_epv.default_POA = NULL;
+
+ ShellComponentListener_epv.report_result = impl_ShellComponentListener_report_result;
+
+ ShellComponentListener_vepv._base_epv = & ShellComponentListener_base_epv;
+ ShellComponentListener_vepv.Evolution_ShellComponentListener_epv = & ShellComponentListener_epv;
+
+ ShellComponentListener_vepv_initialized = TRUE;
+}
+
+static PortableServer_Servant *
+create_ShellComponentListener_servant (EvolutionShellComponentClient *component_client)
+{
+ ShellComponentListenerServant *servant;
+
+ if (! ShellComponentListener_vepv_initialized)
+ ShellComponentListener_vepv_initialize ();
+
+ servant = g_new0 (ShellComponentListenerServant, 1);
+ servant->servant.vepv = &ShellComponentListener_vepv;
+ servant->component_client = component_client;
+
+ return (PortableServer_Servant) servant;
+}
+
+static void
+free_ShellComponentListener_servant (PortableServer_Servant servant)
+{
+ g_free (servant);
+}
+
+static CORBA_Object
+create_listener_interface (EvolutionShellComponentClient *shell_component_client)
+{
+ PortableServer_Servant servant;
+ Evolution_ShellComponentListener corba_interface;
+ CORBA_Environment ev;
+
+ servant = create_ShellComponentListener_servant (shell_component_client);
+
+ CORBA_exception_init (&ev);
+
+ POA_Evolution_ShellComponentListener__init (servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ free_ShellComponentListener_servant (servant);
+ return CORBA_OBJECT_NIL;
+ }
+
+ CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev));
+
+ corba_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ corba_interface = CORBA_OBJECT_NIL;
+ free_ShellComponentListener_servant (servant);
+ }
+
+ CORBA_exception_free (&ev);
+
+ return corba_interface;
+}
+
+
+/* GtkObject methods. */
+
+static void
+impl_destroy (GtkObject *object)
+{
+ EvolutionShellComponentClient *shell_component_client;
+ EvolutionShellComponentClientPrivate *priv;
+
+ shell_component_client = EVOLUTION_SHELL_COMPONENT_CLIENT (object);
+ priv = shell_component_client->priv;
+
+ if (priv->callback != NULL)
+ dispatch_callback (shell_component_client, EVOLUTION_SHELL_COMPONENT_INTERRUPTED);
+
+ g_free (priv);
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+static void
+class_init (EvolutionShellComponentClientClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ object_class->destroy = impl_destroy;
+}
+
+static void
+init (EvolutionShellComponentClient *shell_component_client)
+{
+ EvolutionShellComponentClientPrivate *priv;
+
+ priv = g_new (EvolutionShellComponentClientPrivate, 1);
+ priv->callback = NULL;
+ priv->callback_data = NULL;
+
+ shell_component_client->priv = priv;
+}
+
+
+/* Construction. */
+
+void
+evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client,
+ CORBA_Object corba_object)
+{
+ g_return_if_fail (shell_component_client != NULL);
+ g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (shell_component_client),
+ corba_object);
+}
+
+EvolutionShellComponentClient *
+evolution_shell_component_client_new (const char *id)
+{
+ EvolutionShellComponentClient *new;
+ CORBA_Object corba_object;
+
+ g_return_val_if_fail (id != NULL, NULL);
+
+ new = gtk_type_new (evolution_shell_component_client_get_type ());
+
+ corba_object = activate_object_from_id (id);
+
+ if (corba_object == CORBA_OBJECT_NIL) {
+ bonobo_object_unref (BONOBO_OBJECT (new));
+ return NULL;
+ }
+
+ evolution_shell_component_client_construct (new, corba_object);
+
+ return new;
+}
+
+
+/* Synchronous operations. */
+
+EvolutionShellComponentResult
+evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client,
+ Evolution_Shell shell)
+{
+ EvolutionShellComponentResult result;
+ CORBA_Environment ev;
+
+ RETURN_ERROR_IF_FAIL (shell_component_client != NULL);
+ RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ RETURN_ERROR_IF_FAIL (shell != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+
+ Evolution_ShellComponent_set_owner (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)),
+ shell, &ev);
+
+ result = corba_exception_to_result (&ev);
+
+ CORBA_exception_free (&ev);
+
+ return result;
+}
+
+EvolutionShellComponentResult
+evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client,
+ Evolution_Shell shell)
+{
+ EvolutionShellComponentResult result;
+ Evolution_ShellComponent corba_component;
+ CORBA_Environment ev;
+
+ RETURN_ERROR_IF_FAIL (shell_component_client != NULL);
+ RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ RETURN_ERROR_IF_FAIL (shell != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+
+ corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client));
+
+ Evolution_ShellComponent_unset_owner (corba_component, &ev);
+
+ result = corba_exception_to_result (&ev);
+
+ CORBA_exception_free (&ev);
+
+ return result;
+}
+
+EvolutionShellComponentResult
+evolution_shell_component_client_create_view (EvolutionShellComponentClient *shell_component_client,
+ BonoboUIHandler *uih,
+ const char *physical_uri,
+ const char *type_string,
+ BonoboControl **control_return)
+{
+ EvolutionShellComponentResult result;
+ CORBA_Environment ev;
+ Evolution_ShellComponent corba_component;
+ Bonobo_Control corba_control;
+
+ RETURN_ERROR_IF_FAIL (shell_component_client != NULL);
+ RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ RETURN_ERROR_IF_FAIL (uih != NULL);
+ RETURN_ERROR_IF_FAIL (BONOBO_IS_UI_HANDLER (uih));
+ RETURN_ERROR_IF_FAIL (physical_uri != NULL);
+ RETURN_ERROR_IF_FAIL (type_string != NULL);
+ RETURN_ERROR_IF_FAIL (control_return != NULL);
+
+ CORBA_exception_init (&ev);
+
+ corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client));
+ corba_control = Evolution_ShellComponent_create_view (corba_component, physical_uri, type_string, &ev);
+
+ result = corba_exception_to_result (&ev);
+
+ if (result != EVOLUTION_SHELL_COMPONENT_OK) {
+ *control_return = NULL;
+ } else {
+ Bonobo_UIHandler corba_uih;
+
+ corba_uih = bonobo_object_corba_objref (BONOBO_OBJECT (uih));
+ *control_return = BONOBO_CONTROL (bonobo_widget_new_control_from_objref (corba_control,
+ corba_uih));
+ }
+
+ CORBA_exception_free (&ev);
+
+ return result;
+}
+
+
+/* Asyncronous operations. */
+
+void
+evolution_shell_component_client_async_create_folder (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ const char *type,
+ EvolutionShellComponentClientCallback callback,
+ void *data)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ Evolution_ShellComponent corba_shell_component;
+ CORBA_Environment ev;
+
+ priv = shell_component_client->priv;
+
+ if (priv->callback != NULL) {
+ (* callback) (shell_component_client, EVOLUTION_SHELL_COMPONENT_BUSY, data);
+ return;
+ }
+
+ priv->listener_interface = create_listener_interface (shell_component_client);
+
+ CORBA_exception_init (&ev);
+
+ corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client));
+
+ Evolution_ShellComponent_async_create_folder (corba_shell_component,
+ priv->listener_interface,
+ physical_uri, type,
+ &ev);
+
+ /* FIXME merge with create_listener_interface into separate init_for_callback() func. */
+ priv->callback = callback;
+ priv->callback_data = data;
+
+ CORBA_exception_free (&ev);
+}
+
+void
+evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ EvolutionShellComponentClientCallback callback,
+ void *data)
+{
+}
+
+
+E_MAKE_TYPE (evolution_shell_component_client, "EvolutionShellComponentClient",
+ EvolutionShellComponentClient, class_init, init, PARENT_TYPE)
diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h
new file mode 100644
index 0000000000..d128ee54ab
--- /dev/null
+++ b/shell/evolution-shell-component-client.h
@@ -0,0 +1,95 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* evolution-shell-component-client.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifndef EVOLUTION_SHELL_COMPONENT_CLIENT_H
+#define EVOLUTION_SHELL_COMPONENT_CLIENT_H
+
+#include <bonobo/bonobo-object-client.h>
+#include <bonobo/bonobo-ui-handler.h>
+
+#include "evolution-shell-component.h"
+
+#ifdef cplusplus
+extern "C" {
+#pragma }
+#endif /* cplusplus */
+
+#define EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT (evolution_shell_component_client_get_type ())
+#define EVOLUTION_SHELL_COMPONENT_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT, EvolutionShellComponentClient))
+#define EVOLUTION_SHELL_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT, EvolutionShellComponentClientClass))
+#define EVOLUTION_IS_SHELL_COMPONENT_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT))
+#define EVOLUTION_IS_SHELL_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT))
+
+
+typedef struct _EvolutionShellComponentClient EvolutionShellComponentClient;
+typedef struct _EvolutionShellComponentClientPrivate EvolutionShellComponentClientPrivate;
+typedef struct _EvolutionShellComponentClientClass EvolutionShellComponentClientClass;
+
+struct _EvolutionShellComponentClient {
+ BonoboObjectClient parent;
+
+ EvolutionShellComponentClientPrivate *priv;
+};
+
+struct _EvolutionShellComponentClientClass {
+ BonoboObjectClientClass parent_class;
+};
+
+typedef void (* EvolutionShellComponentClientCallback) (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentResult result,
+ void *data);
+
+
+/* Construction. */
+GtkType evolution_shell_component_client_get_type (void);
+void evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client,
+ CORBA_Object corba_object);
+EvolutionShellComponentClient *evolution_shell_component_client_new (const char *id);
+
+/* Synchronous operations. */
+EvolutionShellComponentResult evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client,
+ Evolution_Shell shell);
+EvolutionShellComponentResult evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client,
+ Evolution_Shell shell);
+EvolutionShellComponentResult evolution_shell_component_client_create_view (EvolutionShellComponentClient *shell_component_client,
+ BonoboUIHandler *uih,
+ const char *physical_uri,
+ const char *type_string,
+ BonoboControl **control_return);
+
+/* Asyncronous operations. */
+void evolution_shell_component_client_async_create_folder (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ const char *type,
+ EvolutionShellComponentClientCallback callback,
+ void *data);
+void evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ EvolutionShellComponentClientCallback callback,
+ void *data);
+
+#ifdef cplusplus
+}
+#endif /* cplusplus */
+
+#endif /* EVOLUTION_SHELL_COMPONENT_CLIENT_H */
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index d00db7c9d9..89a9866b38 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -40,7 +40,10 @@ static BonoboObjectClass *parent_class = NULL;
struct _EvolutionShellComponentPrivate {
GList *folder_types; /* EvolutionShellComponentFolderType */
- EvolutionShellComponentCreateViewFn create_view_fn;
+ EvolutionShellComponentCreateViewFn create_view_fn;
+ EvolutionShellComponentCreateFolderFn create_folder_fn;
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn;
+
Evolution_Shell corba_owner;
void *closure;
};
@@ -167,29 +170,95 @@ impl_ShellComponent_unset_owner (PortableServer_Servant servant,
static Bonobo_Control
impl_ShellComponent_create_view (PortableServer_Servant servant,
const CORBA_char *physical_uri,
+ const CORBA_char *type,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EvolutionShellComponent *shell_component;
EvolutionShellComponentPrivate *priv;
+ EvolutionShellComponentResult result;
BonoboControl *control;
bonobo_object = bonobo_object_from_servant (servant);
shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
priv = shell_component->priv;
- control = (* priv->create_view_fn) (shell_component, physical_uri, priv->closure);
+ result = (* priv->create_view_fn) (shell_component, physical_uri, type,
+ &control, priv->closure);
+
+ if (result != EVOLUTION_SHELL_COMPONENT_OK) {
+ switch (result) {
+ case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE:
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Evolution_ShellComponent_UnsupportedType,
+ NULL);
+ break;
+ case EVOLUTION_SHELL_COMPONENT_INTERNALERROR:
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Evolution_ShellComponent_InternalError,
+ NULL);
+ break;
+ default:
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Evolution_ShellComponent_NotFound,
+ NULL);
+ }
- if (control == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Evolution_ShellComponent_NotFound,
- NULL);
return CORBA_OBJECT_NIL;
}
return bonobo_object_corba_objref (BONOBO_OBJECT (control));
}
+static void
+impl_ShellComponent_async_create_folder (PortableServer_Servant servant,
+ const Evolution_ShellComponentListener listener,
+ const CORBA_char *physical_uri,
+ const CORBA_char *type,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionShellComponent *shell_component;
+ EvolutionShellComponentPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
+ priv = shell_component->priv;
+
+ if (priv->create_folder_fn == NULL) {
+ Evolution_ShellComponentListener_report_result (listener,
+ Evolution_ShellComponentListener_UNSUPPORTED_OPERATION,
+ ev);
+ return;
+ }
+
+ (* priv->create_folder_fn) (shell_component, physical_uri, type, listener, priv->closure);
+}
+
+static void
+impl_ShellComponent_async_remove_folder (PortableServer_Servant servant,
+ const Evolution_ShellComponentListener listener,
+ const CORBA_char *physical_uri,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionShellComponent *shell_component;
+ EvolutionShellComponentPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
+ priv = shell_component->priv;
+
+ if (priv->remove_folder_fn == NULL) {
+ Evolution_ShellComponentListener_report_result (listener,
+ Evolution_ShellComponentListener_UNSUPPORTED_OPERATION,
+ ev);
+ return;
+ }
+
+ (* priv->remove_folder_fn) (shell_component, physical_uri, listener, priv->closure);
+}
+
/* GtkObject methods. */
@@ -248,6 +317,8 @@ corba_class_init (void)
epv->set_owner = impl_ShellComponent_set_owner;
epv->unset_owner = impl_ShellComponent_unset_owner;
epv->create_view = impl_ShellComponent_create_view;
+ epv->async_create_folder = impl_ShellComponent_async_create_folder;
+ epv->async_remove_folder = impl_ShellComponent_async_remove_folder;
vepv = &ShellComponent_vepv;
vepv->_base_epv = base_epv;
@@ -294,10 +365,12 @@ init (EvolutionShellComponent *shell_component)
priv = g_new (EvolutionShellComponentPrivate, 1);
- priv->folder_types = NULL;
- priv->create_view_fn = NULL;
- priv->closure = NULL;
- priv->corba_owner = CORBA_OBJECT_NIL;
+ priv->folder_types = NULL;
+ priv->create_view_fn = NULL;
+ priv->create_folder_fn = NULL;
+ priv->remove_folder_fn = NULL;
+ priv->corba_owner = CORBA_OBJECT_NIL;
+ priv->closure = NULL;
shell_component->priv = priv;
}
@@ -308,6 +381,8 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
const EvolutionShellComponentFolderType folder_types[],
Evolution_ShellComponent corba_object,
EvolutionShellComponentCreateViewFn create_view_fn,
+ EvolutionShellComponentCreateFolderFn create_folder_fn,
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn,
void *closure)
{
EvolutionShellComponentPrivate *priv;
@@ -320,7 +395,10 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
priv = shell_component->priv;
- priv->create_view_fn = create_view_fn;
+ priv->create_view_fn = create_view_fn;
+ priv->create_folder_fn = create_folder_fn;
+ priv->remove_folder_fn = remove_folder_fn;
+
priv->closure = closure;
for (i = 0; folder_types[i].name != NULL; i++) {
@@ -345,6 +423,8 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
EvolutionShellComponent *
evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[],
EvolutionShellComponentCreateViewFn create_view_fn,
+ EvolutionShellComponentCreateFolderFn create_folder_fn,
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn,
void *closure)
{
EvolutionShellComponent *new;
@@ -358,7 +438,9 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty
new = gtk_type_new (evolution_shell_component_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant);
- evolution_shell_component_construct (new, folder_types, corba_object, create_view_fn, closure);
+ evolution_shell_component_construct (new, folder_types, corba_object,
+ create_view_fn, create_folder_fn, remove_folder_fn,
+ closure);
return new;
}
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index f60f89f93d..ec049fbd94 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -21,20 +21,22 @@
* Author: Ettore Perazzoli
*/
-#ifndef __EVOLUTION_SHELL_COMPONENT_H__
-#define __EVOLUTION_SHELL_COMPONENT_H__
+#ifndef EVOLUTION_SHELL_COMPONENT_H
+#define EVOLUTION_SHELL_COMPONENT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-control.h>
+
#include "Evolution.h"
-#ifdef __cplusplus
+#ifdef cplusplus
extern "C" {
#pragma }
-#endif /* __cplusplus */
+#endif /* cplusplus */
#define EVOLUTION_TYPE_SHELL_COMPONENT (evolution_shell_component_get_type ())
#define EVOLUTION_SHELL_COMPONENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponent))
@@ -47,9 +49,41 @@ typedef struct _EvolutionShellComponent EvolutionShellComponent;
typedef struct _EvolutionShellComponentPrivate EvolutionShellComponentPrivate;
typedef struct _EvolutionShellComponentClass EvolutionShellComponentClass;
-typedef BonoboControl * (* EvolutionShellComponentCreateViewFn) (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- void *closure);
+enum _EvolutionShellComponentResult {
+ EVOLUTION_SHELL_COMPONENT_OK,
+ EVOLUTION_SHELL_COMPONENT_CORBAERROR,
+ EVOLUTION_SHELL_COMPONENT_INTERRUPTED,
+ EVOLUTION_SHELL_COMPONENT_INVALIDARG,
+ EVOLUTION_SHELL_COMPONENT_ALREADYOWNED,
+ EVOLUTION_SHELL_COMPONENT_NOTOWNED,
+ EVOLUTION_SHELL_COMPONENT_NOTFOUND,
+ EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE,
+ EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION,
+ EVOLUTION_SHELL_COMPONENT_INTERNALERROR,
+ EVOLUTION_SHELL_COMPONENT_BUSY,
+ EVOLUTION_SHELL_COMPONENT_EXISTS,
+ EVOLUTION_SHELL_COMPONENT_INVALIDURI,
+ EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED,
+ EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS,
+ EVOLUTION_SHELL_COMPONENT_NOSPACE,
+ EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR
+};
+typedef enum _EvolutionShellComponentResult EvolutionShellComponentResult;
+
+typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateViewFn) (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ const char *type,
+ BonoboControl **control_return,
+ void *closure);
+typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ const char *type,
+ const Evolution_ShellComponentListener listener,
+ void *closure);
+typedef EvolutionShellComponentResult (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ const Evolution_ShellComponentListener listener,
+ void *closure);
struct _EvolutionShellComponentFolderType {
char *name;
@@ -79,14 +113,18 @@ void evolution_shell_component_construct (EvolutionShellCom
const EvolutionShellComponentFolderType folder_types[],
Evolution_ShellComponent corba_object,
EvolutionShellComponentCreateViewFn create_view_fn,
+ EvolutionShellComponentCreateFolderFn create_folder_fn,
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn,
void *closure);
EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[],
EvolutionShellComponentCreateViewFn create_view_fn,
+ EvolutionShellComponentCreateFolderFn create_folder_fn,
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn,
void *closure);
Evolution_Shell evolution_shell_component_get_owner (EvolutionShellComponent *shell_component);
-#ifdef __cplusplus
+#ifdef cplusplus
}
-#endif /* __cplusplus */
+#endif /* cplusplus */
-#endif /* __EVOLUTION_SHELL_COMPONENT_H__ */
+#endif /* EVOLUTION_SHELL_COMPONENT_H */
diff --git a/shell/glade/.cvsignore b/shell/glade/.cvsignore
new file mode 100644
index 0000000000..3045c518dc
--- /dev/null
+++ b/shell/glade/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.libs
+Makefile.in
+Makefile
diff --git a/shell/glade/Makefile.am b/shell/glade/Makefile.am
new file mode 100644
index 0000000000..538726884e
--- /dev/null
+++ b/shell/glade/Makefile.am
@@ -0,0 +1,3 @@
+gladedir = $(datadir)/evolution/glade
+
+glade_DATA = e-shell-folder-creation-dialog.glade
diff --git a/shell/glade/e-shell-folder-creation-dialog.glade b/shell/glade/e-shell-folder-creation-dialog.glade
new file mode 100644
index 0000000000..d5f732e707
--- /dev/null
+++ b/shell/glade/e-shell-folder-creation-dialog.glade
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>Shell</name>
+ <program_name>shell</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>create_folder_dialog</name>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <default_width>250</default_width>
+ <default_height>350</default_height>
+ <allow_shrink>True</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>ok_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>cancel_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>main_vbox</name>
+ <homogeneous>False</homogeneous>
+ <spacing>6</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>folder_name_label</name>
+ <label>Folder name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>folder_name_entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>folder_type_label</name>
+ <label>Folder type:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>folder_type_option_menu</name>
+ <can_focus>True</can_focus>
+ <items></items>
+ <initial_choice>0</initial_choice>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>creation_position_label</name>
+ <label>Specify where to create the folder:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/shell/main.c b/shell/main.c
index f42260d143..c398ce9835 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -25,6 +25,7 @@
#include <gnome.h>
#include <bonobo.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <glade/glade.h>
#include "e-util/e-gui-utils.h"
#include "e-setup.h"
@@ -194,6 +195,8 @@ main (int argc, char **argv)
init_corba (&argc, argv);
+ glade_gnome_init ();
+
gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png");