From e06b88c4fda627599d7c1a33ddec0a35a4374e4f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 13 Oct 2009 16:24:10 +0200 Subject: Bug #594471 - Shouldn't call e_error_new/run with NULL 'parent' --- shell/e-shell.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index bf664649fc..924441fa56 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1347,6 +1347,33 @@ e_shell_get_watched_windows (EShell *shell) return shell->priv->watched_windows; } +/** + * e_shell_get_active_window: + * @shell: an #EShell; can be NULL, in that case is used + * result of @e_shell_get_default + * + * Returns: an active, the most recently focused, window. + **/ +GtkWindow * +e_shell_get_active_window (EShell *shell) +{ + GList *w; + GtkWindow *window = NULL; + + if (!shell) + shell = e_shell_get_default (); + + g_return_val_if_fail (shell != NULL, NULL); + + for (w = e_shell_get_watched_windows (shell); w && !window; w = w->next) { + window = GTK_WINDOW (w->data); + } + + g_return_val_if_fail (window != NULL, NULL); + + return window; +} + /** * e_shell_send_receive: * @shell: an #EShell -- cgit