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
This commit is contained in:
Ettore Perazzoli
2002-09-04 16:05:35 +00:00
parent a52720a921
commit ddaa0af2ce
18 changed files with 247 additions and 52 deletions

View File

@ -1,3 +1,9 @@
2002-09-04 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c (create_component): Pass
NULL as @unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
2002-09-03 Mike Kestner <mkestner@ximian.com>
* gui/component/select-names/e-select-names.c (e_select_names_destroy):

View File

@ -558,7 +558,7 @@ create_component (void)
shell_component = evolution_shell_component_new (folder_types, NULL,
create_view, create_folder,
remove_folder, xfer_folder,
NULL,
NULL, NULL,
get_dnd_selection,
request_quit,
NULL);

View File

@ -1,3 +1,9 @@
2002-09-04 Ettore Perazzoli <ettore@ximian.com>
* gui/component-factory.c (create_object): Pass NULL as
@unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
2002-09-03 JP Rosevear <jpr@ximian.com>
* gui/itip-utils.c (comp_compliant): don't make the reply

View File

@ -688,6 +688,7 @@ create_object (void)
remove_folder,
xfer_folder,
NULL, /* populate_folder_context_menu_fn */
NULL, /* unpopulate_folder_context_menu_fn */
NULL, /* get_dnd_selection_fn */
request_quit,
NULL /* closure */);

View File

@ -688,6 +688,7 @@ create_object (void)
remove_folder,
xfer_folder,
NULL, /* populate_folder_context_menu_fn */
NULL, /* unpopulate_folder_context_menu_fn */
NULL, /* get_dnd_selection_fn */
request_quit,
NULL /* closure */);

View File

@ -1,3 +1,11 @@
2002-09-04 Ettore Perazzoli <ettore@ximian.com>
* 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().
2002-09-03 Jeffrey Stedfast <fejj@ximian.com>
* folder-browser.c (mark_as_seen_cb):

View File

@ -422,6 +422,28 @@ populate_folder_context_menu (EvolutionShellComponent *shell_component,
bonobo_ui_component_set_translate (uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, popup_xml, NULL);
}
static void
unpopulate_folder_context_menu (EvolutionShellComponent *shell_component,
BonoboUIComponent *uic,
const char *physical_uri,
const char *type,
void *closure)
{
if (strcmp (type, "mail") != 0)
return;
/* FIXME: handle other types */
/* the unmatched test is a bit of a hack but it works */
if (strncmp(physical_uri, "vfolder:", 8) != 0
|| strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) != NULL)
return;
bonobo_ui_component_rm (uic,
EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER "/ChangeFolderPropertiesPopUp",
NULL);
}
static char *
get_dnd_selection (EvolutionShellComponent *shell_component,
const char *physical_uri,
@ -976,6 +998,7 @@ create_component (void)
remove_folder,
xfer_folder,
populate_folder_context_menu,
unpopulate_folder_context_menu,
get_dnd_selection,
request_quit,
NULL);

View File

@ -1824,7 +1824,6 @@ mail_account_gui_save (MailAccountGui *gui)
MailConfigAccount *old_account;
CamelProvider *provider = NULL;
CamelURL *source_url = NULL, *url;
CamelStore *store = NULL;
gboolean is_storage;
gboolean enabled;
char *new_name;

View File

@ -1,3 +1,9 @@
2002-09-04 Ettore Perazzoli <ettore@ximian.com>
* component-factory.c (create_component): Pass NULL as
@unpopulate_folder_context_menu_fn to
evolution_shell_component_new().
2002-08-29 Dan Winship <danw@ximian.com>
* GNOME_Evolution_Summary.oaf.in.in: Oops. Take two.

View File

@ -144,7 +144,7 @@ create_component (BonoboGenericFactory *factory,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL);
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
GTK_SIGNAL_FUNC (component_destroy), NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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,

View File

@ -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,

View File

@ -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);
}
bonobo_object_unref (BONOBO_OBJECT (uic));
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;
}
(* 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);

View File

@ -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,

View File

@ -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);