diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-05 00:05:35 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-05 00:05:35 +0800 |
commit | ddaa0af2ceba5de217424eeddfa3f650049ddfa1 (patch) | |
tree | dde4bded2ee16494bb4862632df9e346269631af /shell | |
parent | a52720a9213d760bb8a9c21b354ab46de7b763dd (diff) | |
download | gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar.gz gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar.bz2 gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar.lz gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar.xz gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.tar.zst gsoc2013-evolution-ddaa0af2ceba5de217424eeddfa3f650049ddfa1.zip |
Pass NULL as @unpopulate_folder_context_menu_fn to
* gui/component/addressbook-component.c (create_component): Pass
NULL as @unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
* gui/component-factory.c (create_object): Pass NULL as
@unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
* mail-account-gui.c (mail_account_gui_save): Remove unused
variable.
* component-factory.c (unpopulate_folder_context_menu): New.
(create_component): Pass it to evolution_shell_component_new().
* component-factory.c (create_component): Pass NULL as
@unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
* e-storage-set-view.c (popup_folder_menu): Remove the context
menu items using
evolution_shell_component_client_unpopulate_folder_context_menu()
instead of doing it ourself, since BonoboUI sucks.
* evolution-shell-component-client.c
(evolution_shell_component_client_unpopulate_folder_context_menu):
New.
* evolution-test-component.c (register_component): Pass NULL as
@unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
* evolution-shell-component.c: New member
unpopulate_folder_context_menu_fn in
EvolutionShellComponentPrivate. New member uic in
EvolutionShellComponentPrivate.
(init): Init new members to NULL.
(destroy): bonobo_object_unref() priv->uic if not NULL.
(evolution_shell_component_new): New arg
@unpopulate_folder_context_menu_fn.
(evolution_shell_component_construct): Likewise.
(impl_populateFolderContextMenu): Set priv->uic to the newly
created UIComponent.
(impl_unpopulateFolderContextMenu): New, implementation for the
::unpopulateFolderContextMenu CORBA method.
(class_init): Install.
* Evolution-ShellComponent.idl (unpopulateFolderContextMenu): New
method.
(AlreadyPopulated): New exception.
(populateFolderContextMenu): Can raise it.
(NotPopulated): New exception.
svn path=/trunk/; revision=17963
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 36 | ||||
-rw-r--r-- | shell/Evolution-ShellComponent.idl | 13 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 6 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.c | 32 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.h | 12 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 93 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 49 | ||||
-rw-r--r-- | shell/evolution-test-component.c | 2 |
8 files changed, 194 insertions, 49 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 6d4f8262cd..5fb29e2c3c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,39 @@ +2002-09-04 Ettore Perazzoli <ettore@ximian.com> + + * e-storage-set-view.c (popup_folder_menu): Remove the context + menu items using + evolution_shell_component_client_unpopulate_folder_context_menu() + instead of doing it ourself, since BonoboUI sucks. + + * evolution-shell-component-client.c + (evolution_shell_component_client_unpopulate_folder_context_menu): + New. + + * evolution-test-component.c (register_component): Pass NULL as + @unpopulate_folder_context_menu_fn to + evolution_shell_component_new(). + + * evolution-shell-component.c: New member + unpopulate_folder_context_menu_fn in + EvolutionShellComponentPrivate. New member uic in + EvolutionShellComponentPrivate. + (init): Init new members to NULL. + (destroy): bonobo_object_unref() priv->uic if not NULL. + (evolution_shell_component_new): New arg + @unpopulate_folder_context_menu_fn. + (evolution_shell_component_construct): Likewise. + (impl_populateFolderContextMenu): Set priv->uic to the newly + created UIComponent. + (impl_unpopulateFolderContextMenu): New, implementation for the + ::unpopulateFolderContextMenu CORBA method. + (class_init): Install. + + * Evolution-ShellComponent.idl (unpopulateFolderContextMenu): New + method. + (AlreadyPopulated): New exception. + (populateFolderContextMenu): Can raise it. + (NotPopulated): New exception. + 2002-09-03 Ettore Perazzoli <ettore@ximian.com> * e-storage-set-view.c (popup_folder_menu): Create an Items diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index 96557353b9..9441b73b79 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -62,6 +62,8 @@ module Evolution { exception OldOwnerHasDied {}; exception UnsupportedSchema {}; exception UnsupportedType {}; + exception AlreadyPopulated {}; + exception NotPopulated {}; /* List of folders that the component supports. */ readonly attribute FolderTypeList supportedTypes; @@ -129,7 +131,16 @@ module Evolution { @physical_uri. */ void populateFolderContextMenu (in Bonobo::UIContainer uih, in string physical_uri, - in string type); + in string type) + raises (AlreadyPopulated); + + /* After you are done, you have to remove the items. This is + because of BonoboUI sucking and not allowing the shell to + remove the items itself. */ + void unpopulateFolderContextMenu (in Bonobo::UIContainer uih, + in string physical_uri, + in string type) + raises (NotPopulated); /* Make the component create a new item of the specify @id in the folder specified by @parent_folder_physical_uri. This diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 872da97eba..0b8b7642a9 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -804,7 +804,11 @@ popup_folder_menu (EStorageSetView *storage_set_view, if (folder_property_items_data != NULL) remove_property_items (storage_set_view, folder_property_items_data); - bonobo_ui_component_rm (priv->ui_component, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, NULL); + if (handler != NULL) + evolution_shell_component_client_unpopulate_folder_context_menu (handler, + priv->ui_container, + e_folder_get_physical_uri (folder), + e_folder_get_type_string (folder)); gtk_widget_destroy (GTK_WIDGET (menu)); diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index 6d97c6e241..9276c6fa0f 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -840,6 +840,38 @@ evolution_shell_component_client_populate_folder_context_menu (EvolutionShellCom CORBA_exception_free (&ev); } +void +evolution_shell_component_client_unpopulate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, + BonoboUIContainer *container, + const char *physical_uri, + const char *type) +{ + Bonobo_UIContainer corba_container; + EvolutionShellComponentClientPrivate *priv; + GNOME_Evolution_ShellComponent corba_shell_component; + CORBA_Environment ev; + + g_return_if_fail (shell_component_client != NULL); + g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); + g_return_if_fail (physical_uri != NULL); + g_return_if_fail (type != NULL); + + priv = shell_component_client->priv; + + CORBA_exception_init (&ev); + + corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); + corba_container = bonobo_object_corba_objref (BONOBO_OBJECT (container)); + + GNOME_Evolution_ShellComponent_unpopulateFolderContextMenu (corba_shell_component, + corba_container, + physical_uri, + type, + &ev); + + CORBA_exception_free (&ev); +} + void evolution_shell_component_client_request_quit (EvolutionShellComponentClient *shell_component_client, diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h index fdb3650432..0c302b38e5 100644 --- a/shell/evolution-shell-component-client.h +++ b/shell/evolution-shell-component-client.h @@ -119,10 +119,14 @@ void evolution_shell_component_client_async_xfer_folder (EvolutionShellCompo EvolutionShellComponentClientCallback callback, void *data); -void evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, - BonoboUIContainer *container, - const char *physical_uri, - const char *type); +void evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, + BonoboUIContainer *container, + const char *physical_uri, + const char *type); +void evolution_shell_component_client_unpopulate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, + BonoboUIContainer *container, + const char *physical_uri, + const char *type); void evolution_shell_component_client_request_quit (EvolutionShellComponentClient *shell_component_client, EvolutionShellComponentClientCallback callback, diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index cfe318b610..44f7e42c3d 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -65,6 +65,7 @@ struct _EvolutionShellComponentPrivate { EvolutionShellComponentRemoveFolderFn remove_folder_fn; EvolutionShellComponentXferFolderFn xfer_folder_fn; EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn; + EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn; EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn; EvolutionShellComponentRequestQuitFn request_quit_fn; @@ -72,6 +73,10 @@ struct _EvolutionShellComponentPrivate { GSList *user_creatable_item_types; /* UserCreatableItemType */ + /* This is used for + populateFolderContextMenu/unpopulateFolderContextMenu. */ + BonoboUIComponent *uic; + int ping_timeout_id; void *closure; @@ -637,7 +642,6 @@ impl_populateFolderContextMenu (PortableServer_Servant servant, BonoboObject *bonobo_object; EvolutionShellComponent *shell_component; EvolutionShellComponentPrivate *priv; - BonoboUIComponent *uic; bonobo_object = bonobo_object_from_servant (servant); shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); @@ -646,13 +650,49 @@ impl_populateFolderContextMenu (PortableServer_Servant servant, if (priv->populate_folder_context_menu_fn == NULL) return; - uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (uic, corba_uih); + if (priv->uic != NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_ShellComponent_AlreadyPopulated, + NULL); + return; + } + + priv->uic = bonobo_ui_component_new_default (); + bonobo_ui_component_set_container (priv->uic, corba_uih); bonobo_object_release_unref (corba_uih, NULL); - (* priv->populate_folder_context_menu_fn) (shell_component, uic, physical_uri, type, priv->closure); + (* priv->populate_folder_context_menu_fn) (shell_component, priv->uic, physical_uri, type, priv->closure); +} + +static void +impl_unpopulateFolderContextMenu (PortableServer_Servant servant, + const Bonobo_UIContainer corba_uih, + 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->unpopulate_folder_context_menu_fn == NULL) + return; + + if (priv->uic == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_ShellComponent_NotPopulated, + NULL); + return; + } - bonobo_object_unref (BONOBO_OBJECT (uic)); + (* priv->unpopulate_folder_context_menu_fn) (shell_component, priv->uic, physical_uri, type, priv->closure); + + bonobo_object_unref (BONOBO_OBJECT (priv->uic)); + priv->uic = NULL; } static void @@ -763,6 +803,9 @@ destroy (GtkObject *object) user_creatable_item_type_free ((UserCreatableItemType *) sp->data); g_slist_free (priv->user_creatable_item_types); + if (priv->uic != NULL) + bonobo_object_unref (BONOBO_OBJECT (priv->uic)); + g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -910,6 +953,7 @@ class_init (EvolutionShellComponentClass *klass) epv->removeFolderAsync = impl_removeFolderAsync; epv->xferFolderAsync = impl_xferFolderAsync; epv->populateFolderContextMenu = impl_populateFolderContextMenu; + epv->unpopulateFolderContextMenu = impl_unpopulateFolderContextMenu; epv->userCreateNewItem = impl_userCreateNewItem; epv->sendReceive = impl_sendReceive; epv->requestQuit = impl_requestQuit; @@ -929,17 +973,20 @@ init (EvolutionShellComponent *shell_component) priv->folder_types = NULL; priv->external_uri_schemas = NULL; - priv->create_view_fn = NULL; - priv->create_folder_fn = NULL; - priv->remove_folder_fn = NULL; - priv->xfer_folder_fn = NULL; - priv->populate_folder_context_menu_fn = NULL; + priv->create_view_fn = NULL; + priv->create_folder_fn = NULL; + priv->remove_folder_fn = NULL; + priv->xfer_folder_fn = NULL; + priv->populate_folder_context_menu_fn = NULL; + priv->unpopulate_folder_context_menu_fn = NULL; + + priv->owner_client = NULL; + priv->user_creatable_item_types = NULL; + priv->closure = NULL; - priv->owner_client = NULL; - priv->user_creatable_item_types = NULL; - priv->closure = NULL; + priv->ping_timeout_id = -1; - priv->ping_timeout_id = -1; + priv->uic = NULL; shell_component->priv = priv; } @@ -954,6 +1001,7 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component, EvolutionShellComponentRemoveFolderFn remove_folder_fn, EvolutionShellComponentXferFolderFn xfer_folder_fn, EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, + EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, EvolutionShellComponentRequestQuitFn request_quit_fn, void *closure) @@ -967,13 +1015,14 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component, priv = shell_component->priv; - priv->create_view_fn = create_view_fn; - priv->create_folder_fn = create_folder_fn; - priv->remove_folder_fn = remove_folder_fn; - priv->xfer_folder_fn = xfer_folder_fn; - priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn; - priv->get_dnd_selection_fn = get_dnd_selection_fn; - priv->request_quit_fn = request_quit_fn; + priv->create_view_fn = create_view_fn; + priv->create_folder_fn = create_folder_fn; + priv->remove_folder_fn = remove_folder_fn; + priv->xfer_folder_fn = xfer_folder_fn; + priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn; + priv->unpopulate_folder_context_menu_fn = unpopulate_folder_context_menu_fn; + priv->get_dnd_selection_fn = get_dnd_selection_fn; + priv->request_quit_fn = request_quit_fn; priv->closure = closure; @@ -1018,6 +1067,7 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty EvolutionShellComponentRemoveFolderFn remove_folder_fn, EvolutionShellComponentXferFolderFn xfer_folder_fn, EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, + EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, EvolutionShellComponentRequestQuitFn request_quit_fn, void *closure) @@ -1036,6 +1086,7 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty remove_folder_fn, xfer_folder_fn, populate_folder_context_menu_fn, + unpopulate_folder_context_menu_fn, get_dnd_selection_fn, request_quit_fn, closure); diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index 1689c59822..c162e1e8a6 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -103,6 +103,11 @@ typedef void (* EvolutionShellComponentPopulateFolderContextMenuFn) (EvolutionSh const char *physical_uri, const char *type, void *closure); +typedef void (* EvolutionShellComponentUnpopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, + BonoboUIComponent *uic, + const char *physical_uri, + const char *type, + void *closure); typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellComponent *shell_component, const char *physical_uri, int type, @@ -166,27 +171,29 @@ struct _EvolutionShellComponentClass { 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, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_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, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - EvolutionShellComponentRequestQuitFn request_quit_fn, - void *closure); +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, + EvolutionShellComponentXferFolderFn xfer_folder_fn, + EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, + EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, + EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, + EvolutionShellComponentRequestQuitFn request_quit_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, + EvolutionShellComponentXferFolderFn xfer_folder_fn, + EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, + EvolutionShellComponentUnpopulateFolderContextMenuFn unpopulate_folder_context_menu_fn, + EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, + EvolutionShellComponentRequestQuitFn request_quit_fn, + void *closure); EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); void evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c index bdc59073b8..18e11e65e7 100644 --- a/shell/evolution-test-component.c +++ b/shell/evolution-test-component.c @@ -595,7 +595,7 @@ register_component (void) shell_component = evolution_shell_component_new (folder_types, NULL, create_view_fn, - NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, request_quit_fn, NULL); |