[epiphany] Require an EphyApplication parameter when creating an EphyShell



commit f939f5ce3406a77b500e821815352d22ff410ab7
Author: Xan Lopez <xlopez igalia com>
Date:   Tue Jun 28 22:56:08 2011 +0200

    Require an EphyApplication parameter when creating an EphyShell
    
    We'll want to create our own in main(), this prepares us for that.

 src/ephy-main.c           |    5 +++--
 src/ephy-shell.c          |    9 ++++++---
 src/ephy-shell.h          |    2 +-
 tests/ephy-download.c     |    2 +-
 tests/ephy-embed-single.c |    2 +-
 5 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 86d1f21..98bde4f 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -417,9 +417,10 @@ main (int argc,
   g_setenv ("XLIB_SKIP_ARGB_VISUALS", "1", FALSE);
 
   /* Now create the shell */
-  _ephy_shell_create_instance ();
+  application = ephy_application_new ();
+  _ephy_shell_create_instance (application);
+  g_object_unref (application);
 
-  application = ephy_shell_get_application (ephy_shell_get_default());
   if (private_instance) {
     GApplicationFlags flags;
 
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 1de265b..5ebd1f2 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -202,8 +202,6 @@ ephy_shell_init (EphyShell *shell)
 	ephy_shell = shell;
 	g_object_add_weak_pointer (G_OBJECT(ephy_shell),
 				   (gpointer *)ptr);
-
-	shell->priv->application = ephy_application_new ();
 }
 
 static void
@@ -815,7 +813,7 @@ ephy_shell_get_application (EphyShell *shell)
 }
 
 void
-_ephy_shell_create_instance (void)
+_ephy_shell_create_instance (EphyApplication *application)
 {
 	g_assert (ephy_shell == NULL);
 
@@ -823,4 +821,9 @@ _ephy_shell_create_instance (void)
 	/* FIXME weak ref */
 
 	g_assert (ephy_shell != NULL);
+
+	if (application)
+		ephy_shell->priv->application = g_object_ref (application);
+	else
+		ephy_shell->priv->application = ephy_application_new ();
 }
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 18d6aab..1003564 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -130,7 +130,7 @@ GObject        *ephy_shell_get_prefs_dialog		(EphyShell *shell);
 EphyApplication *ephy_shell_get_application             (EphyShell *shell);
 
 /* private API */
-void	       _ephy_shell_create_instance		(void);
+void	       _ephy_shell_create_instance		(EphyApplication *application);
 
 G_END_DECLS
 
diff --git a/tests/ephy-download.c b/tests/ephy-download.c
index 14fe81a..ed9144e 100644
--- a/tests/ephy-download.c
+++ b/tests/ephy-download.c
@@ -173,7 +173,7 @@ main (int argc, char *argv[])
 
   ephy_debug_init ();
   ephy_embed_prefs_init ();
-  _ephy_shell_create_instance ();
+  _ephy_shell_create_instance (NULL);
 
   if (!ephy_file_helpers_init (NULL, TRUE, FALSE, NULL)) {
     g_debug ("Something wrong happened with ephy_file_helpers_init()");
diff --git a/tests/ephy-embed-single.c b/tests/ephy-embed-single.c
index 200a2fd..9e15e9a 100644
--- a/tests/ephy-embed-single.c
+++ b/tests/ephy-embed-single.c
@@ -101,7 +101,7 @@ main (int argc, char *argv[])
 
   ephy_debug_init ();
   ephy_embed_prefs_init ();
-  _ephy_shell_create_instance ();
+  _ephy_shell_create_instance (NULL);
 
   if (!ephy_file_helpers_init (NULL, TRUE, FALSE, NULL)) {
     g_debug ("Something wrong happened with ephy_file_helpers_init()");



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