diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 26 | ||||
-rw-r--r-- | shell/Evolution-ShellComponent.idl | 9 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 69 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 5 | ||||
-rw-r--r-- | shell/evolution-test-component.c | 1 |
5 files changed, 108 insertions, 2 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 7629e71c7e..501036b244 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,29 @@ +2001-06-27 Ettore Perazzoli <ettore@ximian.com> + + * evolution-test-component.c (factory_fn): Pass NULL as the + @external_uri_schemas arg to `evolution_shell_component_new'. + + * evolution-shell-component.c: New enum value + `HANDLE_EXTERNAL_URI'. New member `external_uri_schemas' in + `EvolutionShellComponentPrivate'. + (init): Initialize `external_uri_schemas' to NULL. + (destroy): Free it. + (destroy): + (class_init): Add the "handler_external_uri" signal. + (evolution_shell_component_new): Added precondition on + @folder_types. New arg @external_uri_schemas. + (evolution_shell_component_construct): Added preconditions. New + arg @external_uri_schemas. Initialize the `external_uri_schemas' + member in the EvolutionShellComponentPrivate part. + (impl_ShellComponent__get_external_uri_schemas): New, + implementation for reading the `external_uri_schemas' attribute. + (class_init): Install it in the EPV. + + * evolution-shell-component.h: New signal `handle_external_uri'. + + * Evolution-ShellComponent.idl: New attribute `extra_uri_schemas'. + (handleExternalURI): New method. + 2001-06-26 Ettore Perazzoli <ettore@ximian.com> * e-storage-set-view.c (etree_value_at): Don't strdup "My diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index 33d52e8145..ed62d8812c 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -21,13 +21,16 @@ module Evolution { sequence<string> accepted_dnd_types; sequence<string> exported_dnd_types; }; - typedef sequence<FolderType> FolderTypeList; - + + typedef string URISchema; + typedef sequence<URISchema> URISchemaList; + interface ShellComponentListener; interface ShellComponent : Bonobo::Unknown { readonly attribute FolderTypeList supported_types; + readonly attribute URISchemaList external_uri_schemas; /* FIXME: Can we use an attribute here? */ exception AlreadyOwned {}; @@ -51,6 +54,8 @@ module Evolution { in string type) raises (NotFound, UnsupportedType, InternalError); + void handleExternalURI (in string external_uri); + exception Busy {}; void createFolderAsync (in ShellComponentListener listener, diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index 3e13a80ea2..9432797dac 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -44,6 +44,7 @@ static GtkObjectClass *parent_class = NULL; struct _EvolutionShellComponentPrivate { GList *folder_types; /* EvolutionShellComponentFolderType */ + GList *external_uri_schemas; /* char * */ EvolutionShellComponentCreateViewFn create_view_fn; EvolutionShellComponentCreateFolderFn create_folder_fn; @@ -61,6 +62,7 @@ enum { OWNER_SET, OWNER_UNSET, DEBUG, + HANDLE_EXTERNAL_URI, LAST_SIGNAL }; @@ -166,6 +168,46 @@ impl_ShellComponent__get_supported_types (PortableServer_Servant servant, return folder_type_list; } +static GNOME_Evolution_URISchemaList * +impl_ShellComponent__get_external_uri_schemas (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + EvolutionShellComponent *shell_component; + EvolutionShellComponentPrivate *priv; + GNOME_Evolution_URISchemaList *uri_schema_list; + GList *p; + int i; + + shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); + priv = shell_component->priv; + + uri_schema_list = GNOME_Evolution_URISchemaList__alloc (); + + /* FIXME: We could probably keep this to FALSE and avoid + CORBA_string_duplicating. */ + CORBA_sequence_set_release (uri_schema_list, TRUE); + + if (priv->external_uri_schemas == NULL) { + uri_schema_list->_length = 0; + uri_schema_list->_maximum = 0; + uri_schema_list->_buffer = NULL; + return uri_schema_list; + } + + uri_schema_list->_length = g_list_length (priv->external_uri_schemas); + uri_schema_list->_maximum = uri_schema_list->_length; + uri_schema_list->_buffer = CORBA_sequence_GNOME_Evolution_URISchema_allocbuf (uri_schema_list->_maximum); + + for (p = priv->external_uri_schemas, i = 0; p != NULL; p = p->next, i++) { + const char *schema; + + schema = (const char *) p->data; + uri_schema_list->_buffer[i] = CORBA_string_dup (schema); + } + + return uri_schema_list; +} + static void impl_ShellComponent_set_owner (PortableServer_Servant servant, const GNOME_Evolution_Shell shell, @@ -429,6 +471,8 @@ destroy (GtkObject *object) } g_list_free (priv->folder_types); + e_free_string_list (priv->external_uri_schemas); + g_free (priv); parent_class->destroy (object); @@ -471,11 +515,21 @@ class_init (EvolutionShellComponentClass *klass) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + signals[HANDLE_EXTERNAL_URI] + = gtk_signal_new ("handle_external_uri", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, handle_external_uri), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); parent_class = gtk_type_class (PARENT_TYPE); epv->_get_supported_types = impl_ShellComponent__get_supported_types; + epv->_get_external_uri_schemas = impl_ShellComponent__get_external_uri_schemas; epv->setOwner = impl_ShellComponent_set_owner; epv->unsetOwner = impl_ShellComponent_unset_owner; epv->debug = impl_ShellComponent_debug; @@ -494,6 +548,8 @@ init (EvolutionShellComponent *shell_component) priv = g_new (EvolutionShellComponentPrivate, 1); priv->folder_types = NULL; + priv->external_uri_schemas = NULL; + priv->create_view_fn = NULL; priv->create_folder_fn = NULL; priv->remove_folder_fn = NULL; @@ -510,6 +566,7 @@ init (EvolutionShellComponent *shell_component) void evolution_shell_component_construct (EvolutionShellComponent *shell_component, const EvolutionShellComponentFolderType folder_types[], + const char *external_uri_schemas[], EvolutionShellComponentCreateViewFn create_view_fn, EvolutionShellComponentCreateFolderFn create_folder_fn, EvolutionShellComponentRemoveFolderFn remove_folder_fn, @@ -522,6 +579,8 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component, int i; g_return_if_fail (shell_component != NULL); + g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component)); + g_return_if_fail (folder_types != NULL); priv = shell_component->priv; @@ -553,10 +612,17 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component, if (priv->folder_types == NULL) g_warning ("No valid folder types constructing EShellComponent %p", shell_component); + + if (external_uri_schemas != NULL) { + for (i = 0; external_uri_schemas[i] != NULL; i++) + priv->external_uri_schemas = g_list_prepend (priv->external_uri_schemas, + g_strdup (external_uri_schemas[i])); + } } EvolutionShellComponent * evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], + const char *external_uri_schemas[], EvolutionShellComponentCreateViewFn create_view_fn, EvolutionShellComponentCreateFolderFn create_folder_fn, EvolutionShellComponentRemoveFolderFn remove_folder_fn, @@ -567,10 +633,13 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty { EvolutionShellComponent *new; + g_return_val_if_fail (folder_types != NULL, NULL); + new = gtk_type_new (evolution_shell_component_get_type ()); evolution_shell_component_construct (new, folder_types, + external_uri_schemas, create_view_fn, create_folder_fn, remove_folder_fn, diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index b364d3dadd..c465650f57 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -131,12 +131,16 @@ struct _EvolutionShellComponentClass { const char *evolution_homedir); void (* owner_unset) (EvolutionShellComponent *shell_component); void (* debug) (EvolutionShellComponent *shell_component); + + void (* handle_external_uri) (EvolutionShellComponent *shell_component, + const char *uri); }; GtkType evolution_shell_component_get_type (void); void evolution_shell_component_construct (EvolutionShellComponent *shell_component, const EvolutionShellComponentFolderType folder_types[], + const char *external_uri_schemas[], EvolutionShellComponentCreateViewFn create_view_fn, EvolutionShellComponentCreateFolderFn create_folder_fn, EvolutionShellComponentRemoveFolderFn remove_folder_fn, @@ -145,6 +149,7 @@ void evolution_shell_component_construct (EvolutionShellCom EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, void *closure); EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], + const char *external_uri_schemas[], EvolutionShellComponentCreateViewFn create_view_fn, EvolutionShellComponentCreateFolderFn create_folder_fn, EvolutionShellComponentRemoveFolderFn remove_folder_fn, diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c index aed0d9089d..16286d11f0 100644 --- a/shell/evolution-test-component.c +++ b/shell/evolution-test-component.c @@ -211,6 +211,7 @@ factory_fn (BonoboGenericFactory *factory, EvolutionShellComponent *shell_component; shell_component = evolution_shell_component_new (folder_types, + NULL, create_view_fn, NULL, NULL, NULL, NULL, NULL, NULL); |