From 92ec933b198f15789e028cd3c3dc144ba00bb862 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 23 Sep 2002 21:30:57 +0000 Subject: Use e_shell_request_close_view(). * e-shell-view-menu.c (command_close): Use e_shell_request_close_view(). * e-shell.c (e_shell_request_close_view): New, code moved out of view_delete_event_cb(). (view_delete_event_cb): Use it. svn path=/trunk/; revision=18183 --- shell/ChangeLog | 24 +++++++++++++++++++++ shell/e-shell-view-menu.c | 10 ++------- shell/e-shell.c | 53 ++++++++++++++++++++++++++++++++--------------- shell/e-shell.h | 18 ++++++++++------ 4 files changed, 74 insertions(+), 31 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 8b299bf31c..960e434443 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,27 @@ +2002-09-23 Ettore Perazzoli + + [#28317] + + * e-shell-view-menu.c (command_close): Use + e_shell_request_close_view(). + + * e-shell.c (e_shell_request_close_view): New, code moved out of + view_delete_event_cb(). + (view_delete_event_cb): Use it. + +2002-09-23 Ettore Perazzoli + + [Fix #16556.] + + * e-shell.c (e_shell_construct): Pass self to + e_shell_startup_wizard_create. + + * e-shell-startup-wizard.c (e_shell_startup_wizard_create): Get a + shell argument. Set the shell interactive when doing the start-up + wizard thing. + + * e-shell.c (e_shell_set_interactive): New. + 2002-09-23 Ettore Perazzoli * e-shell-folder-creation-dialog.c (get_type_from_parent_path): diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index e8761ff349..b4f66baeb6 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -130,17 +130,11 @@ command_close (BonoboUIComponent *uih, const char *path) { EShellView *shell_view; - GdkEvent delete_event; shell_view = E_SHELL_VIEW (data); - /* Send a delete_event to the window. This way we make sure that the - behaviors for delete_event and the menu item are the same. */ - - delete_event.any.type = GDK_DELETE; - delete_event.any.window = GTK_WIDGET (shell_view)->window; - delete_event.any.send_event = 0; - gtk_widget_event (GTK_WIDGET (shell_view), &delete_event); + if (e_shell_request_close_view (e_shell_view_get_shell (shell_view), shell_view)) + gtk_widget_destroy (GTK_WIDGET (shell_view)); } static void diff --git a/shell/e-shell.c b/shell/e-shell.c index 839d77263c..115201f982 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -651,6 +651,16 @@ impl_Shell_setLineStatus (PortableServer_Servant servant, e_shell_go_offline (shell, NULL); } + +void +e_shell_set_interactive (EShell *shell, + gboolean interactive) +{ + g_return_if_fail (E_IS_SHELL (shell)); + + set_interactive (shell, interactive); +} + /* Set up the ::Activity interface. */ @@ -916,24 +926,9 @@ view_delete_event_cb (GtkWidget *widget, EShell *shell; g_assert (E_IS_SHELL_VIEW (widget)); - shell = E_SHELL (data); - e_shell_save_settings (shell); - - if (g_list_length (shell->priv->views) != 1) { - /* If it's not the last view, just destroy it. */ - return FALSE; - } - - if (shell->priv->preparing_to_quit) - return TRUE; - /* If it's the last view, ask for confirm before actually destroying - this view. */ - if (e_shell_prepare_for_quit (shell)) - return FALSE; - else - return TRUE; + return ! e_shell_request_close_view (shell, E_SHELL_VIEW (widget)); } static void @@ -1307,7 +1302,7 @@ e_shell_construct (EShell *shell, if (show_splash) gtk_widget_destroy (splash); - if (e_shell_startup_wizard_create () == FALSE) { + if (e_shell_startup_wizard_create (shell) == FALSE) { e_shell_unregister_all (shell); bonobo_object_unref (BONOBO_OBJECT (shell)); @@ -1444,6 +1439,30 @@ e_shell_create_view_from_uri_and_settings (EShell *shell, return view; } +gboolean +e_shell_request_close_view (EShell *shell, + EShellView *shell_view) +{ + g_return_val_if_fail (E_IS_SHELL (shell), FALSE); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); + + e_shell_save_settings (shell); + + if (g_list_length (shell->priv->views) != 1) { + /* Not the last view. */ + return TRUE; + } + + if (shell->priv->preparing_to_quit) + return FALSE; + + /* If it's the last view, ask for confirm. */ + if (e_shell_prepare_for_quit (shell)) + return TRUE; + else + return FALSE; +} + /** * e_shell_get_local_directory: diff --git a/shell/e-shell.h b/shell/e-shell.h index 8713a0b06e..5e1cb6590e 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -111,12 +111,15 @@ EShell *e_shell_new (const char *local_director EShellStartupLineMode startup_line_mode, EShellConstructResult *construct_result_return); -EShellView *e_shell_create_view (EShell *shell, - const char *uri, - EShellView *template_view); -EShellView *e_shell_create_view_from_uri_and_settings (EShell *shell, - const char *uri, - int view_num); +EShellView *e_shell_create_view (EShell *shell, + const char *uri, + EShellView *template_view); +EShellView *e_shell_create_view_from_uri_and_settings (EShell *shell, + const char *uri, + int view_num); +gboolean e_shell_request_close_view (EShell *shell, + EShellView *view); + const char *e_shell_get_local_directory (EShell *shell); EShortcuts *e_shell_get_shortcuts (EShell *shell); @@ -145,6 +148,9 @@ void e_shell_go_offline (EShell *shell, void e_shell_go_online (EShell *shell, EShellView *action_view); +void e_shell_set_interactive (EShell *shell, + gboolean interactive); + void e_shell_send_receive (EShell *shell); void e_shell_show_settings (EShell *shell, const char *type, -- cgit v1.2.3