diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-10-21 12:02:08 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-10-21 12:02:08 +0800 |
commit | c15a8e695a4164ea0cb6c43dd8ae1370e772f1af (patch) | |
tree | dda6dab3f128bc95a2c89043f7412e2cc8dbf134 | |
parent | 72854d0bb831b5b4e0d36a9d3ecbe06cfa94a450 (diff) | |
download | gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar.gz gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar.bz2 gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar.lz gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar.xz gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.tar.zst gsoc2013-evolution-c15a8e695a4164ea0cb6c43dd8ae1370e772f1af.zip |
Clean up e_shell_get_active_window()
Clarify the documentation and simplify the logic.
-rw-r--r-- | shell/e-shell.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index 924441fa56..61ce8d7c02 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1349,29 +1349,33 @@ e_shell_get_watched_windows (EShell *shell) /** * e_shell_get_active_window: - * @shell: an #EShell; can be NULL, in that case is used - * result of @e_shell_get_default + * @shell: an #EShell or %NULL to use the default shell * - * Returns: an active, the most recently focused, window. + * Returns the most recently focused watched window, according to + * e_shell_get_watched_windows(). Convenient for finding a parent + * for a transient window. + * + * Note the returned window is not necessarily an #EShellWindow. + * + * Returns: the most recently focused watched window **/ GtkWindow * e_shell_get_active_window (EShell *shell) { - GList *w; - GtkWindow *window = NULL; + GList *watched_windows; - if (!shell) + if (shell == NULL) shell = e_shell_get_default (); - g_return_val_if_fail (shell != NULL, NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); - for (w = e_shell_get_watched_windows (shell); w && !window; w = w->next) { - window = GTK_WINDOW (w->data); - } + watched_windows = e_shell_get_watched_windows (shell); - g_return_val_if_fail (window != NULL, NULL); + /* Sanity checks */ + g_return_val_if_fail (watched_windows != NULL, NULL); + g_return_val_if_fail (GTK_IS_WINDOW (watched_windows->data), NULL); - return window; + return GTK_WINDOW (watched_windows->data); } /** |