From 224f26b84d9c12b0dd1d337f51c14b6ebb901007 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 4 Sep 2011 09:48:24 -0400 Subject: GtkApplication has some new EShell-like features. I pushed a few EShell features up to GtkApplication for GTK+ 3.2, so we can now trim off the redundancies in EShell. 1) GtkApplication has a new "window-added" signal which replaces EShell's own "window-created" signal. 2) GtkApplication has a new "window-removed" signal which replaces EShell's own "window-destroyed" signal. 3) gtk_application_get_windows() now returns a list of windows sorted by most recently focused, replacing e_shell_get_watched_windows(). 4) GtkApplication now provides enough hooks to subclasses that we can remove e_shell_watch_window() and call gtk_application_add_window() directly. --- composer/e-msg-composer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'composer') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index e58fd6fdf4..7790cbb2ea 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1902,6 +1902,8 @@ static gboolean msg_composer_delete_event_cb (EMsgComposer *composer) { EShell *shell; + GtkApplication *application; + GList *windows; shell = e_msg_composer_get_shell (composer); @@ -1910,7 +1912,10 @@ msg_composer_delete_event_cb (EMsgComposer *composer) if (!gtk_action_group_get_sensitive (composer->priv->async_actions)) return TRUE; - if (g_list_length (e_shell_get_watched_windows (shell)) == 1) { + application = GTK_APPLICATION (shell); + windows = gtk_application_get_windows (application); + + if (g_list_length (windows) == 1) { /* This is the last watched window, use the quit * mechanism to have a draft saved properly */ e_shell_quit (shell, E_SHELL_QUIT_ACTION); @@ -2092,8 +2097,10 @@ msg_composer_constructed (GObject *object) object, "delete-event", G_CALLBACK (msg_composer_delete_event_cb), NULL); - e_shell_adapt_window_size (shell, GTK_WINDOW (composer)); - e_shell_watch_window (shell, GTK_WINDOW (object)); + e_shell_adapt_window_size (shell, GTK_WINDOW (object)); + + gtk_application_add_window ( + GTK_APPLICATION (shell), GTK_WINDOW (object)); g_signal_connect ( shell, "quit-requested", -- cgit v1.2.3