diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-08 02:23:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-08 02:23:46 +0800 |
commit | 8d8e4ac1c23905892a42b779188c852fdead7f5f (patch) | |
tree | 01609ceef7151d75f81fdc8762ac6c25215e8a51 /shell/e-shell-window.c | |
parent | 13a0edc3d27cce65a0f720e98516f7ab902ad0fc (diff) | |
download | gsoc2013-evolution-8d8e4ac1c23905892a42b779188c852fdead7f5f.tar.gz gsoc2013-evolution-8d8e4ac1c23905892a42b779188c852fdead7f5f.tar.zst gsoc2013-evolution-8d8e4ac1c23905892a42b779188c852fdead7f5f.zip |
Tweak the EShell API.
Disable File -> Close Window when there's only one window.
Replace EMMessageBrowser with EMailBrowser.
svn path=/branches/kill-bonobo/; revision=37009
Diffstat (limited to 'shell/e-shell-window.c')
-rw-r--r-- | shell/e-shell-window.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index a110bad82f..ef36b0e9c9 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -129,17 +129,57 @@ shell_window_online_mode_notify_cb (EShell *shell, } static void +shell_window_update_close_action_cb (EShellWindow *shell_window) +{ + EShell *shell; + GList *shell_windows; + gboolean sensitive; + + shell = e_shell_window_get_shell (shell_window); + shell_windows = e_shell_get_shell_windows (shell); + g_return_if_fail (shell_windows != NULL); + + /* Disable Close Window if there's only one window. + * Helps prevent users from accidentally quitting. */ + sensitive = (g_list_length (shell_windows) > 1); + gtk_action_set_sensitive (ACTION (CLOSE), sensitive); +} + +static void shell_window_set_shell (EShellWindow *shell_window, EShell *shell) { + GArray *array; + gulong handler_id; + g_return_if_fail (shell_window->priv->shell == NULL); shell_window->priv->shell = g_object_ref (shell); - g_signal_connect ( + /* Need to disconnect these when the window is closing. */ + + array = shell_window->priv->signal_handler_ids; + + handler_id = g_signal_connect ( shell, "notify::online-mode", G_CALLBACK (shell_window_online_mode_notify_cb), shell_window); + g_array_append_val (array, handler_id); + + handler_id = g_signal_connect_swapped ( + shell, "window-created", + G_CALLBACK (shell_window_update_close_action_cb), + shell_window); + + g_array_append_val (array, handler_id); + + handler_id = g_signal_connect_swapped ( + shell, "window-destroyed", + G_CALLBACK (shell_window_update_close_action_cb), + shell_window); + + g_array_append_val (array, handler_id); + g_object_notify (G_OBJECT (shell), "online-mode"); } |