From: Jose Dapena Paz Date: Thu, 3 Dec 2009 15:44:05 +0000 (+0100) Subject: Find more wisely the current toplevel. X-Git-Tag: jdapena-ppa-3.90.4-modest0~121 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=ba63f3554be8830e0b73c7bf440ff1e24939e8f6 Find more wisely the current toplevel. --- diff --git a/src/gtk/modest-shell-banner.c b/src/gtk/modest-shell-banner.c index f352156..59193c2 100644 --- a/src/gtk/modest-shell-banner.c +++ b/src/gtk/modest-shell-banner.c @@ -159,9 +159,24 @@ modest_shell_banner_new_with_timeout (GtkWidget *parent, gint timeout) if (toplevel == NULL) { GtkWidget *shell; + GList *toplevels; + shell = modest_gtk_window_mgr_get_shell (MODEST_GTK_WINDOW_MGR (modest_runtime_get_window_mgr ())); - modest_shell_add_banner (MODEST_SHELL (shell), MODEST_SHELL_BANNER (self)); - } else if (MODEST_IS_SHELL (toplevel)) { + + toplevels = gtk_window_list_toplevels (); + while (toplevels) { + if (gtk_window_has_toplevel_focus (GTK_WINDOW (toplevels->data))) { + toplevel = toplevels->data; + break; + } + toplevels = g_list_next (toplevels); + } + + if (toplevel == NULL) + toplevel = shell; + } + + if (MODEST_IS_SHELL (toplevel)) { modest_shell_add_banner (MODEST_SHELL (toplevel), MODEST_SHELL_BANNER (self)); } else if (GTK_IS_DIALOG (toplevel)) { gtk_container_add (GTK_CONTAINER (GTK_DIALOG (toplevel)->vbox), self);