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

index 45dd9cdcf51618d695076a238d7d87044d02585a..0bb7a3939a12cad193ae0cc9a87b9a84c5cf4eba 100644 (file)
@@ -1051,6 +1051,24 @@ ev_application_has_window (EvApplication *application)
        return retval;
 }
 
+guint
+ev_application_get_n_windows (EvApplication *application)
+{
+       GList *l, *toplevels;
+       guint  retval = 0;
+
+       toplevels = gtk_window_list_toplevels ();
+
+       for (l = toplevels; l != NULL; l = l->next) {
+               if (EV_IS_WINDOW (l->data))
+                       retval++;
+       }
+
+       g_list_free (toplevels);
+
+       return retval;
+}
+
 const gchar *
 ev_application_get_uri (EvApplication *application)
 {
index 1623aebf4d17ae319b9468754c6ecb3b9849526e..c00b554c34b7831f0132b5f605861e4edfbab97d 100644 (file)
@@ -67,6 +67,7 @@ void            ev_application_open_uri_list       (EvApplication   *application,
                                                      guint32          timestamp);
 GDBusConnection  *ev_application_get_dbus_connection (EvApplication   *application);
 gboolean         ev_application_has_window          (EvApplication   *application);
+guint             ev_application_get_n_windows       (EvApplication   *application);
 const gchar *     ev_application_get_uri             (EvApplication   *application);
 GObject                 *ev_application_get_media_keys      (EvApplication   *application);