[epiphany] Use gtk_application_get_active_window instead of rolling our own



commit a60eb7cad58e17985e8a7908d5e90bab5fff6186
Author: Xan Lopez <xan igalia com>
Date:   Sun Nov 25 20:04:24 2012 +0100

    Use gtk_application_get_active_window instead of rolling our own

 src/bookmarks/ephy-bookmarks-editor.c |    2 +-
 src/ephy-history-window.c             |    2 +-
 src/ephy-session.c                    |    2 +-
 src/ephy-session.h                    |    2 --
 src/ephy-shell.c                      |   21 ++-------------------
 src/ephy-shell.h                      |    2 --
 6 files changed, 5 insertions(+), 26 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 8dc057b..d74e060 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -291,7 +291,7 @@ get_target_window (EphyBookmarksEditor *editor)
 	}
 	else
 	{
-                return GTK_WIDGET (ephy_shell_get_active_window (ephy_shell));
+		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell)));
 	}
 }
 
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index a344060..c657275 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -304,7 +304,7 @@ get_target_window (EphyHistoryWindow *editor)
 	}
 	else
 	{
-		return GTK_WIDGET (ephy_shell_get_active_window (ephy_shell));
+		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell)));
 	}
 }
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 70fc234..f29c21f 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -291,7 +291,7 @@ session_command_open_uris (EphySession *session,
 
 	g_object_ref (shell);
 
-	window = ephy_shell_get_active_window (shell);
+	window = gtk_application_get_active_window (GTK_APPLICATION (shell));
 
 	new_windows_in_tabs = g_settings_get_boolean (EPHY_SETTINGS_MAIN,
 						      EPHY_PREFS_NEW_WINDOWS_IN_TABS);
diff --git a/src/ephy-session.h b/src/ephy-session.h
index fc75412..30363bf 100644
--- a/src/ephy-session.h
+++ b/src/ephy-session.h
@@ -70,8 +70,6 @@ struct _EphySessionClass
 
 GType		 ephy_session_get_type		(void);
 
-EphyWindow	*ephy_session_get_active_window	(EphySession *session);
-
 gboolean	 ephy_session_save		(EphySession *session,
 						 const char *filename);
 
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index e38b6ae..ca1fbec 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -207,7 +207,7 @@ show_about (GSimpleAction *action,
 {
   EphyWindow *window;
 
-  window = ephy_shell_get_active_window (ephy_shell);
+  window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
 
   window_cmd_help_about (NULL, GTK_WIDGET (window));
 }
@@ -600,7 +600,7 @@ download_started_cb (WebKitWebContext *web_context,
     return;
   }
 
-  window = ephy_shell_get_active_window (shell);
+  window = gtk_application_get_active_window (GTK_APPLICATION (shell));
 
   ed = ephy_download_new_for_download (download);
   ephy_download_set_window (ed, GTK_WIDGET (window));
@@ -1041,23 +1041,6 @@ ephy_shell_get_n_windows (EphyShell *shell)
   return g_list_length (shell->priv->windows);
 }
 
-EphyWindow *
-ephy_shell_get_active_window (EphyShell *shell)
-{
-  GList *l;
-
-  g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
-
-  for (l = shell->priv->windows; l != NULL; l = l->next) {
-    EphyEmbedContainer *window = EPHY_EMBED_CONTAINER (l->data);
-
-    if (!ephy_embed_container_get_is_popup (window))
-      return EPHY_WINDOW (window);
-  }
-
-  return NULL;
-}
-
 gboolean
 ephy_shell_close_all_windows (EphyShell *shell)
 {
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index e9402e1..4e42d00 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -179,8 +179,6 @@ GList          *ephy_shell_get_windows                  (EphyShell *shell);
 
 guint           ephy_shell_get_n_windows                (EphyShell *shell);
 
-EphyWindow     *ephy_shell_get_active_window            (EphyShell *shell);
-
 gboolean        ephy_shell_close_all_windows            (EphyShell *shell);
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]