aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/gui/component/addressbook-component.c2
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/calendar-component.c1
-rw-r--r--calendar/gui/component-factory.c1
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/component-factory.c2
-rw-r--r--my-evolution/ChangeLog5
-rw-r--r--my-evolution/component-factory.c3
-rw-r--r--shell/ChangeLog20
-rw-r--r--shell/Evolution-ShellComponent.idl8
-rw-r--r--shell/e-shell-view-menu.c4
-rw-r--r--shell/e-shell.c64
-rw-r--r--shell/e-shell.h2
-rw-r--r--shell/evolution-shell-component-client.c42
-rw-r--r--shell/evolution-shell-component-client.h4
-rw-r--r--shell/evolution-shell-component.c34
-rw-r--r--shell/evolution-shell-component.h46
-rw-r--r--shell/evolution-test-component.c26
19 files changed, 254 insertions, 25 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index bc664491e8..2a04e24eb3 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * gui/component/addressbook-component.c (create_component): Pass
+ NULL as @request_quit_fn.
+
2002-05-13 Christopher James Lahey <clahey@ximian.com>
* backend/idl/addressbook.idl: Removed an incorrect comment here.
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 590cdd26bf..2979d211eb 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -549,7 +549,7 @@ create_component (void)
remove_folder, xfer_folder,
NULL,
get_dnd_selection,
- NULL);
+ NULL, NULL);
destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion,
destination_folder_handle_drop,
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 64748151dd..edb0a2087a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * gui/component-factory.c (create_object): Pass NULL as
+ @request_quit_fn.
+
2002-05-14 JP Rosevear <jpr@ximian.com>
* gui/dialogs/schedule-page.c (schedule_page_construct): set the
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index b4a2b3ab89..355da4c387 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -677,6 +677,7 @@ create_object (void)
xfer_folder,
NULL, /* populate_folder_context_menu_fn */
NULL, /* get_dnd_selection_fn */
+ NULL, /* request_quit */
NULL /* closure */);
/* Offline handler */
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index b4a2b3ab89..355da4c387 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -677,6 +677,7 @@ create_object (void)
xfer_folder,
NULL, /* populate_folder_context_menu_fn */
NULL, /* get_dnd_selection_fn */
+ NULL, /* request_quit */
NULL /* closure */);
/* Offline handler */
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 87e4a1a66a..2f682983a9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * component-factory.c (create_component): Pass NULL as
+ @request_quit_fn.
+
2002-05-15 Not Zed <NotZed@Ximian.com>
* mail-ops.c (prep_offline_do):
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 24e76cf6f5..439e11ccf5 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -952,7 +952,7 @@ create_component (void)
xfer_folder,
populate_folder_context_menu,
get_dnd_selection,
- NULL);
+ NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "send_receive",
GTK_SIGNAL_FUNC (send_receive_cb), NULL);
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 5e021f68ff..c01eb5670c 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * component-factory.c (create_component): Pass NULL as
+ @request_quit_fn.
+
2002-05-14 Christopher James Lahey <clahey@ximian.com>
* e-summary-mail.c (folder_gen_html): Use the uri stored in the
diff --git a/my-evolution/component-factory.c b/my-evolution/component-factory.c
index 30196985d9..7e033f8dce 100644
--- a/my-evolution/component-factory.c
+++ b/my-evolution/component-factory.c
@@ -143,7 +143,8 @@ create_component (BonoboGenericFactory *factory,
create_view,
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",
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 11701f170e..421bd64a6b 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,23 @@
+2002-05-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell-view-menu.c (command_quit): Check with
+ e_shell_prepare_for_quit() before quitting.
+
+ * e-shell.c (e_shell_prepare_for_quit): New.
+
+ * evolution-test-component.c (request_quit_fn): New function
+ asking for confirmation to quit.
+
+ * evolution-shell-component.c (evolution_shell_component_new): New
+ arg @request_quit_fn.
+ (impl_requestQuit): New, implementation for
+ EvolutionShellComponent::requestQuit.
+ (evolution_shell_component_result_to_string): Handle
+ EVOLUTION_SHELL_COMPONENT_CANCEL.
+ (evolution_shell_component_client_request_quit): New.
+
+ * Evolution-ShellComponent.idl (requestQuit): New.
+
2002-05-15 Iain <iain@ximian.com>
* e-corba-storage-registry.c (impl_StorageRegistry_addStorage): Remove
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 495553e8f7..e450aa719f 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -137,11 +137,19 @@ module Evolution {
@show_dialog is true, display a progress dialog for the
operation as well. */
void sendReceive (in boolean show_dialog);
+
+ /* Request the component to quit. The component should report
+ through the listener (through OK or CANCEL) whether the
+ shell can quit safely. (This is meant to be used for
+ confirmations before quitting.) */
+ oneway void requestQuit (in ShellComponentListener listener)
+ raises (Busy);
};
interface ShellComponentListener {
enum Result {
OK,
+ CANCEL,
UNSUPPORTED_OPERATION,
UNSUPPORTED_TYPE,
EXISTS,
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index eff7aa0817..efbb5898a5 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -147,7 +147,9 @@ command_quit (BonoboUIComponent *uih,
shell_view = E_SHELL_VIEW (data);
shell = e_shell_view_get_shell (shell_view);
- e_shell_destroy_all_views (shell);
+
+ if (e_shell_prepare_for_quit (shell))
+ e_shell_destroy_all_views (shell);
}
static void
diff --git a/shell/e-shell.c b/shell/e-shell.c
index ff227dbb23..6353a45f55 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -70,6 +70,7 @@
#include "e-splash.h"
#include "e-uri-schema-registry.h"
+#include "evolution-shell-component-client.h"
#include "evolution-shell-component-utils.h"
#include "evolution-storage-set-view-factory.h"
@@ -2145,6 +2146,69 @@ e_shell_construct_result_to_string (EShellConstructResult result)
}
+static void
+prepare_for_quit_callback (EvolutionShellComponentClient *client,
+ EvolutionShellComponentResult result,
+ void *data)
+{
+ GNOME_Evolution_ShellComponentListener_Result *result_return;
+
+ result_return = (GNOME_Evolution_ShellComponentListener_Result *) data;
+ *result_return = result;
+}
+
+gboolean
+e_shell_prepare_for_quit (EShell *shell)
+{
+ EShellPrivate *priv;
+ GList *component_ids;
+ GList *p;
+ gboolean retval;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ priv = shell->priv;
+
+ /* Make all the views insensitive so we have some modal-like
+ behavior. */
+ for (p = priv->views; p != NULL; p = p->next)
+ gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE);
+
+ component_ids = e_component_registry_get_id_list (priv->component_registry);
+
+ for (p = component_ids; p != NULL; p = p->next) {
+ EvolutionShellComponentClient *client;
+ const char *id;
+ GNOME_Evolution_ShellComponentListener_Result result;
+
+ id = (const char *) p->data;
+ client = e_component_registry_get_component_by_id (priv->component_registry, id);
+
+ result = (GNOME_Evolution_ShellComponentListener_Result) -1;
+
+ evolution_shell_component_client_request_quit (client, prepare_for_quit_callback, &result);
+
+ while (result == (GNOME_Evolution_ShellComponentListener_Result) -1)
+ gtk_main_iteration ();
+
+ if (result != GNOME_Evolution_ShellComponentListener_OK) {
+ retval = FALSE;
+ goto end;
+ }
+ }
+
+ retval = TRUE;
+
+ end:
+ /* Restore all the views to be sensitive. */
+ for (p = priv->views; p != NULL; p = p->next)
+ gtk_widget_set_sensitive (GTK_WIDGET (p->data), TRUE);
+
+ e_free_string_list (component_ids);
+ return retval;
+}
+
+
E_MAKE_X_TYPE (e_shell, "EShell", EShell,
class_init, init, PARENT_TYPE,
POA_GNOME_Evolution_Shell__init,
diff --git a/shell/e-shell.h b/shell/e-shell.h
index bf211f886b..119cb87b14 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -150,6 +150,8 @@ Bonobo_ConfigDatabase e_shell_get_config_db (EShe
EComponentRegistry *e_shell_get_component_registry (EShell *shell);
EShellUserCreatableItemsHandler *e_shell_get_user_creatable_items_handler (EShell *shell);
+gboolean e_shell_prepare_for_quit (EShell *shell);
+
const char *e_shell_construct_result_to_string (EShellConstructResult result);
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c
index 2a1b2e0a2d..7b8051e0c1 100644
--- a/shell/evolution-shell-component-client.c
+++ b/shell/evolution-shell-component-client.c
@@ -839,5 +839,47 @@ evolution_shell_component_client_populate_folder_context_menu (EvolutionShellCom
}
+void
+evolution_shell_component_client_request_quit (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentClientCallback callback,
+ void *data)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ GNOME_Evolution_ShellComponent corba_shell_component;
+ CORBA_Environment ev;
+
+ g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ g_return_if_fail (callback != NULL);
+
+ priv = shell_component_client->priv;
+
+ if (priv->callback != NULL) {
+ (* callback) (shell_component_client, EVOLUTION_SHELL_COMPONENT_BUSY, data);
+ return;
+ }
+
+ create_listener_interface (shell_component_client);
+
+ CORBA_exception_init (&ev);
+
+ corba_shell_component = BONOBO_OBJREF (shell_component_client);
+
+ priv->callback = callback;
+ priv->callback_data = data;
+
+ GNOME_Evolution_ShellComponent_requestQuit (corba_shell_component, priv->listener_interface, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) {
+ (* callback) (shell_component_client,
+ shell_component_result_from_corba_exception (&ev),
+ data);
+ priv->callback = NULL;
+ priv->callback_data = NULL;
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+
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
index 9973f9a931..fdb3650432 100644
--- a/shell/evolution-shell-component-client.h
+++ b/shell/evolution-shell-component-client.h
@@ -124,6 +124,10 @@ void evolution_shell_component_client_populate_folder_context_menu (EvolutionS
const char *physical_uri,
const char *type);
+void evolution_shell_component_client_request_quit (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentClientCallback callback,
+ void *data);
+
#ifdef cplusplus
}
#endif /* cplusplus */
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index b1eab010de..b3383b742f 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -64,6 +64,7 @@ struct _EvolutionShellComponentPrivate {
EvolutionShellComponentXferFolderFn xfer_folder_fn;
EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn;
EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn;
+ EvolutionShellComponentRequestQuitFn request_quit_fn;
EvolutionShellClient *owner_client;
@@ -670,6 +671,32 @@ impl_sendReceive (PortableServer_Servant servant,
gtk_signal_emit (GTK_OBJECT (shell_component), signals[SEND_RECEIVE], show_dialog);
}
+static void
+impl_requestQuit (PortableServer_Servant servant,
+ const GNOME_Evolution_ShellComponentListener listener,
+ CORBA_Environment *ev)
+{
+ EvolutionShellComponent *shell_component;
+ gboolean allow_quit;
+
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant));
+
+ if (shell_component->priv->request_quit_fn == NULL)
+ allow_quit = TRUE;
+ else
+ allow_quit = (* shell_component->priv->request_quit_fn) (shell_component,
+ shell_component->priv->closure);
+
+ if (allow_quit)
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener,
+ GNOME_Evolution_ShellComponentListener_OK,
+ ev);
+ else
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener,
+ GNOME_Evolution_ShellComponentListener_CANCEL,
+ ev);
+}
+
/* GtkObject methods. */
@@ -872,6 +899,7 @@ class_init (EvolutionShellComponentClass *klass)
epv->populateFolderContextMenu = impl_populateFolderContextMenu;
epv->userCreateNewItem = impl_userCreateNewItem;
epv->sendReceive = impl_sendReceive;
+ epv->requestQuit = impl_requestQuit;
shell_component_class = EVOLUTION_SHELL_COMPONENT_CLASS (object_class);
shell_component_class->owner_died = impl_owner_died;
@@ -914,6 +942,7 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
EvolutionShellComponentXferFolderFn xfer_folder_fn,
EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn,
EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn,
+ EvolutionShellComponentRequestQuitFn request_quit_fn,
void *closure)
{
EvolutionShellComponentPrivate *priv;
@@ -931,6 +960,7 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
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->closure = closure;
@@ -976,6 +1006,7 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty
EvolutionShellComponentXferFolderFn xfer_folder_fn,
EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn,
EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn,
+ EvolutionShellComponentRequestQuitFn request_quit_fn,
void *closure)
{
EvolutionShellComponent *new;
@@ -993,6 +1024,7 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty
xfer_folder_fn,
populate_folder_context_menu_fn,
get_dnd_selection_fn,
+ request_quit_fn,
closure);
return new;
@@ -1041,6 +1073,8 @@ evolution_shell_component_result_to_string (EvolutionShellComponentResult result
switch (result) {
case EVOLUTION_SHELL_COMPONENT_OK:
return _("Success");
+ case EVOLUTION_SHELL_COMPONENT_CANCEL:
+ return _("Cancel");
case EVOLUTION_SHELL_COMPONENT_CORBAERROR:
return _("CORBA error");
case EVOLUTION_SHELL_COMPONENT_INTERRUPTED:
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index b10613cb34..8cd1f98d96 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -52,6 +52,7 @@ typedef struct _EvolutionShellComponentClass EvolutionShellComponentClass;
enum _EvolutionShellComponentResult {
EVOLUTION_SHELL_COMPONENT_OK,
+ EVOLUTION_SHELL_COMPONENT_CANCEL,
EVOLUTION_SHELL_COMPONENT_CORBAERROR,
EVOLUTION_SHELL_COMPONENT_INTERRUPTED,
EVOLUTION_SHELL_COMPONENT_INVALIDARG,
@@ -110,6 +111,9 @@ typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellCompo
int *selection_length_return,
void *closure);
+typedef gboolean (* EvolutionShellComponentRequestQuitFn) (EvolutionShellComponent *shell_component,
+ void *closure);
+
struct _EvolutionShellComponentFolderType {
char *name;
char *icon_name;
@@ -161,26 +165,28 @@ 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,
- 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,
- void *closure);
+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);
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 7dc991fcf3..5c2d36b16e 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -488,6 +488,28 @@ create_view_fn (EvolutionShellComponent *shell_component,
return EVOLUTION_SHELL_COMPONENT_OK;
}
+static gboolean
+request_quit_fn (EvolutionShellComponent *shell_component,
+ void *closure)
+{
+ GtkWidget *confirm_dialog;
+ GtkWidget *label;
+ int button;
+
+ confirm_dialog = gnome_dialog_new ("Quit?", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
+ label = gtk_label_new ("Please confirm that you want to quit now.");
+ gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (confirm_dialog)->vbox), label);
+ gtk_widget_show_all (confirm_dialog);
+
+ button = gnome_dialog_run (GNOME_DIALOG (confirm_dialog));
+ gtk_widget_destroy (confirm_dialog);
+
+ if (button == 0)
+ return TRUE; /* OK */
+ else
+ return FALSE; /* Cancel */
+}
+
/* Callbacks. */
@@ -547,7 +569,9 @@ 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);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_callback), NULL);