From: Carlos Garcia Campos Date: Mon, 12 Jul 2010 18:13:15 +0000 (+0200) Subject: [shell] Add ev_application_get_n_windows() X-Git-Tag: EVINCE_2_31_5~3 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=a945ec884efd6cd43f873b004ba17b9f7f8146e0;p=evince.git [shell] Add ev_application_get_n_windows() --- diff --git a/shell/ev-application.c b/shell/ev-application.c index 45dd9cdc..0bb7a393 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -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) { diff --git a/shell/ev-application.h b/shell/ev-application.h index 1623aebf..c00b554c 100644 --- a/shell/ev-application.h +++ b/shell/ev-application.h @@ -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);