aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-shell-component.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-05-16 05:41:51 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-05-16 05:41:51 +0800
commit3d386b57d1682ad0f5fb0b9a60f0d65906f578b7 (patch)
tree67f79ba63a89ee7f5e1e463b8b4e082bfca83620 /shell/evolution-shell-component.c
parentc1ce3633db69de57b4a589587627fa088f9a3e5f (diff)
downloadgsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.gz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.bz2
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.lz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.xz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.zst
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.zip
Check with e_shell_prepare_for_quit() before quitting.
* 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. * component-factory.c (create_component): Pass NULL as @request_quit_fn. * component-factory.c (create_component): Pass NULL as @request_quit_fn. * gui/component-factory.c (create_object): Pass NULL as @request_quit_fn. * gui/component/addressbook-component.c (create_component): Pass NULL as @request_quit_fn. svn path=/trunk/; revision=16925
Diffstat (limited to 'shell/evolution-shell-component.c')
-rw-r--r--shell/evolution-shell-component.c34
1 files changed, 34 insertions, 0 deletions
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: