From 83387a7fddc83a28a04c7a649762474ac591b961 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 30 Jun 2000 19:04:42 +0000 Subject: add "cancel" to FolderSelectionListener. * Evolution-Shell.idl: add "cancel" to FolderSelectionListener. * evolution-shell-client.c (impl_FolderSelectionListener_cancel): Implement cancel (set *uri and *physical_uri to NULL). (evolution_shell_client_user_select_folder): document %NULL uri and physical_uri return values. * e-shell.c (folder_selection_dialog_clicked_cb): If the user clicked "Cancel" or used the wm to close the dialog, call _cancel instead of _selected. svn path=/trunk/; revision=3831 --- shell/ChangeLog | 13 +++++++++++++ shell/Evolution-Shell.idl | 1 + shell/e-shell.c | 27 ++++++++++++++------------- shell/evolution-shell-client.c | 24 +++++++++++++++++++++--- 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index d7f70b0d15..f2fdbc8ef2 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2000-06-30 Dan Winship + + * Evolution-Shell.idl: add "cancel" to FolderSelectionListener. + + * evolution-shell-client.c (impl_FolderSelectionListener_cancel): + Implement cancel (set *uri and *physical_uri to NULL). + (evolution_shell_client_user_select_folder): document %NULL uri + and physical_uri return values. + + * e-shell.c (folder_selection_dialog_clicked_cb): If the user + clicked "Cancel" or used the wm to close the dialog, call _cancel + instead of _selected. + 2000-06-30 Ettore Perazzoli * evolution-shell-component.c (impl_ShellComponent_set_owner): diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl index 9d1542ec26..b1cfaefcc6 100644 --- a/shell/Evolution-Shell.idl +++ b/shell/Evolution-Shell.idl @@ -31,5 +31,6 @@ module Evolution { interface FolderSelectionListener { void selected (in string uri, in string physical_uri); + void cancel (); }; }; diff --git a/shell/e-shell.c b/shell/e-shell.c index 3cf7043183..46cfcab5e9 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -112,27 +112,28 @@ folder_selection_dialog_clicked_cb (GnomeDialog *dialog, shell = E_SHELL (data); listener = gtk_object_get_data (GTK_OBJECT (dialog), "corba_listener"); - storage_set = e_shell_get_storage_set (shell); - path = e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog), - folder = e_storage_set_get_folder (storage_set, path); + CORBA_exception_init (&ev); - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); + if (button_number == 0) { + storage_set = e_shell_get_storage_set (shell); + path = e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog), + folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL || button_number == 1) /* Uh? */ - physical_uri = ""; - else - physical_uri = e_folder_get_physical_uri (folder); + uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - CORBA_exception_init (&ev); + if (folder == NULL || button_number == 1) /* Uh? */ + physical_uri = ""; + else + physical_uri = e_folder_get_physical_uri (folder); - Evolution_FolderSelectionListener_selected (listener, uri, physical_uri, &ev); + Evolution_FolderSelectionListener_selected (listener, uri, physical_uri, &ev); + g_free (uri); + } else + Evolution_FolderSelectionListener_cancel (listener, &ev); CORBA_Object_release (listener, &ev); - CORBA_exception_free (&ev); - g_free (uri); - if (button_number != -1) gnome_dialog_close(dialog); } diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c index bf46e65eab..10ba9ced93 100644 --- a/shell/evolution-shell-client.c +++ b/shell/evolution-shell-client.c @@ -74,6 +74,23 @@ impl_FolderSelectionListener_selected (PortableServer_Servant servant, g_main_quit (listener_servant->main_loop); } +static void +impl_FolderSelectionListener_cancel (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + FolderSelectionListenerServant *listener_servant; + + listener_servant = (FolderSelectionListenerServant *) servant; + + if (listener_servant->uri_return != NULL) + * (listener_servant->uri_return) = NULL; + + if (listener_servant->physical_uri_return != NULL) + * (listener_servant->physical_uri_return) = NULL; + + g_main_quit (listener_servant->main_loop); +} + static void init_FolderSelectionListener_vtables (void) { @@ -82,6 +99,7 @@ init_FolderSelectionListener_vtables (void) FolderSelectionListener_base_epv.default_POA = NULL; FolderSelectionListener_epv.selected = impl_FolderSelectionListener_selected; + FolderSelectionListener_epv.cancel = impl_FolderSelectionListener_cancel; FolderSelectionListener_vepv._base_epv = &FolderSelectionListener_base_epv; FolderSelectionListener_vepv.Evolution_FolderSelectionListener_epv = &FolderSelectionListener_epv; @@ -274,10 +292,10 @@ evolution_shell_client_new (Evolution_Shell corba_shell) * @uri_return: * @physical_uri_return: * - * Pop up the shell's folder selection dialog with the specified @title and * - * *@default_folder as the initially selected folder. On return, set *@uri and + * Pop up the shell's folder selection dialog with the specified @title and + * @default_folder as the initially selected folder. On return, set *@uri and * *@physical_uri to the evolution: URI and the physical URI of the selected - * *folder. (The dialog is modal.) + * folder (or %NULL if the user cancelled the dialog). (The dialog is modal.) **/ void evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client, -- cgit v1.2.3