]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] Optimize ev_application_has_window()
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 12 Jul 2010 18:12:30 +0000 (20:12 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 12 Jul 2010 18:12:30 +0000 (20:12 +0200)
shell/ev-application.c

index ed4fb194d58083feea7aab656c953cde6d7e8a94..45dd9cdcf51618d695076a238d7d87044d02585a 100644 (file)
@@ -1036,10 +1036,17 @@ ev_application_get_dbus_connection (EvApplication *application)
 gboolean
 ev_application_has_window (EvApplication *application)
 {
-       GList   *windows = ev_application_get_windows (application);
-       gboolean retval = windows != NULL;
+       GList    *l, *toplevels;
+       gboolean  retval = FALSE;
 
-       g_list_free (windows);
+       toplevels = gtk_window_list_toplevels ();
+
+       for (l = toplevels; l != NULL && !retval; l = l->next) {
+               if (EV_IS_WINDOW (l->data))
+                       retval = TRUE;
+       }
+
+       g_list_free (toplevels);
 
        return retval;
 }