[epiphany] ephy-shell: remove the ephy_shell global



commit 533c34899f09a1fa0e80aa198bd72ec2a90b1689
Author: Diego Escalante Urrelo <diegoe igalia com>
Date:   Mon Dec 10 11:48:36 2012 -0500

    ephy-shell: remove the ephy_shell global
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683614

 src/bookmarks/ephy-bookmark-action-group.c |    2 +-
 src/bookmarks/ephy-bookmark-action.c       |    2 +-
 src/bookmarks/ephy-bookmarks-editor.c      |   17 +++++++++++------
 src/bookmarks/ephy-bookmarks-menu.c        |    2 +-
 src/bookmarks/ephy-bookmarks-ui.c          |    4 ++--
 src/ephy-completion-model.c                |    2 +-
 src/ephy-encoding-dialog.c                 |    2 +-
 src/ephy-encoding-menu.c                   |    2 +-
 src/ephy-history-window.c                  |   17 +++++++++++------
 src/ephy-location-controller.c             |    2 +-
 src/ephy-main.c                            |    2 ++
 src/ephy-session.c                         |    6 ++++--
 src/ephy-shell.h                           |    2 --
 src/ephy-window.c                          |   12 ++++++------
 src/popup-commands.c                       |    9 ++++++---
 src/prefs-dialog.c                         |    2 +-
 src/window-commands.c                      |   16 +++++++++-------
 tests/ephy-download-test.c                 |    2 +-
 tests/ephy-embed-single-test.c             |    2 +-
 tests/ephy-encodings-test.c                |    4 ++--
 tests/ephy-session-test.c                  |   26 +++++++++++++-------------
 tests/ephy-shell-test.c                    |   17 +++++++++++++++--
 tests/ephy-web-view-test.c                 |    2 +-
 23 files changed, 92 insertions(+), 62 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmark-action-group.c b/src/bookmarks/ephy-bookmark-action-group.c
index 3a68200..f2c55cb 100644
--- a/src/bookmarks/ephy-bookmark-action-group.c
+++ b/src/bookmarks/ephy-bookmark-action-group.c
@@ -140,7 +140,7 @@ ephy_bookmark_group_new (EphyNode *node)
 	GtkActionGroup *action_group;
 	guint i;
 	
-	bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+	bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 	smart = ephy_bookmarks_get_smart_bookmarks (bookmarks);
 
 	action_group = (GtkActionGroup *) ephy_link_action_group_new ("BA");
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 0e832c5..639d780 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -319,7 +319,7 @@ void
 ephy_bookmark_action_updated (EphyBookmarkAction *action)
 {
 	GValue value = { 0, };
-	EphyBookmarks *bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+	EphyBookmarks *bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 	EphyNode *smart = ephy_bookmarks_get_smart_bookmarks (bookmarks);
 	EphyNode *node = action->priv->node;
 	const char *title;
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 0cd9e12..19151c1 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -290,7 +290,7 @@ get_target_window (EphyBookmarksEditor *editor)
 	}
 	else
 	{
-		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell)));
+		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell_get_default ())));
 	}
 }
 
@@ -314,7 +314,8 @@ cmd_open_bookmarks_in_tabs (GtkAction *action,
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_BMK_PROP_LOCATION);
 
-		new_embed = ephy_shell_new_tab (ephy_shell, window, NULL, location,
+		new_embed = ephy_shell_new_tab (ephy_shell_get_default (),
+						window, NULL, location,
 				 	        EPHY_NEW_TAB_OPEN_PAGE |
 					        EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 		/* if there was no target window, a new one was opened. Get it
@@ -350,8 +351,10 @@ cmd_open_bookmarks_in_browser (GtkAction *action,
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_BMK_PROP_LOCATION);
 
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
-				    EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_NEW_WINDOW);
+		ephy_shell_new_tab (ephy_shell_get_default (),
+				    window, NULL, location,
+				    EPHY_NEW_TAB_OPEN_PAGE |
+				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
 
 	g_list_free (selection);
@@ -1043,7 +1046,8 @@ ephy_bookmarks_editor_node_activated_cb (GtkWidget *view,
 		(node, EPHY_NODE_BMK_PROP_LOCATION);
 	g_return_if_fail (location != NULL);
 
-	ephy_shell_new_tab (ephy_shell, NULL, NULL, location,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    NULL, NULL, location,
 			    EPHY_NEW_TAB_OPEN_PAGE);
 }
 
@@ -1061,7 +1065,8 @@ ephy_bookmarks_editor_node_middle_clicked_cb (GtkWidget *view,
 		(node, EPHY_NODE_BMK_PROP_LOCATION);
 	g_return_if_fail (location != NULL);
 
-	ephy_shell_new_tab (ephy_shell, window, NULL, location,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    window, NULL, location,
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 }
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
index f22cdbe..dd3bf99 100644
--- a/src/bookmarks/ephy-bookmarks-menu.c
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -199,7 +199,7 @@ ephy_bookmarks_menu_build (GString *string, EphyNode *parent)
 	gint priority;
 	guint flags, id, i;
 	
-	eb = ephy_shell_get_bookmarks (ephy_shell);
+	eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 
 	children = ephy_node_get_children (ephy_bookmarks_get_keywords (eb));        
 	topics = g_ptr_array_sized_new (children->len);
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 02c264d..4e41638 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -169,7 +169,7 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 	GtkActionGroup *actions;
 	GtkAction *action;
 
-	eb = ephy_shell_get_bookmarks (ephy_shell);
+	eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 	bookmarks = ephy_bookmarks_get_bookmarks (eb);
 	topics = ephy_bookmarks_get_keywords (eb);
 	data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
@@ -238,7 +238,7 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 void
 ephy_bookmarks_ui_detach_window (EphyWindow *window)
 {
-	EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell);
+	EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 	EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb);
 	EphyNode *topics = ephy_bookmarks_get_keywords (eb);
 
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 0a858c1..33d84bb 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -103,7 +103,7 @@ ephy_completion_model_init (EphyCompletionModel *model)
 
   priv->history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ()));
 
-  bookmarks_service = ephy_shell_get_bookmarks (ephy_shell);
+  bookmarks_service = ephy_shell_get_bookmarks (ephy_shell_get_default ());
   priv->bookmarks = ephy_bookmarks_get_bookmarks (bookmarks_service);
 }
 
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 58e03f5..de15cba 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -364,7 +364,7 @@ ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
 
 	dialog->priv->encodings =
 		EPHY_ENCODINGS (ephy_embed_shell_get_encodings
-				(EPHY_EMBED_SHELL (ephy_shell)));
+				(EPHY_EMBED_SHELL (ephy_shell_get_default ())));
 
 	ephy_dialog_construct (EPHY_DIALOG (dialog),
 			       "/org/gnome/epiphany/epiphany.ui",
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index e276f4a..ff23305 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -75,7 +75,7 @@ ephy_encoding_menu_init (EphyEncodingMenu *menu)
 
 	menu->priv->encodings =
 		EPHY_ENCODINGS (ephy_embed_shell_get_encodings
-				(EPHY_EMBED_SHELL (ephy_shell)));
+				(EPHY_EMBED_SHELL (ephy_shell_get_default ())));
 }
 
 static int
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 70daa10..1d8df41 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -302,7 +302,7 @@ get_target_window (EphyHistoryWindow *editor)
 	}
 	else
 	{
-		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell)));
+		return GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (ephy_shell_get_default ())));
 	}
 }
 
@@ -320,8 +320,10 @@ cmd_open_bookmarks_in_tabs (GtkAction *action,
 	for (l = selection; l; l = l->next)
 	{
 		EphyHistoryURL *url = l->data;
-		ephy_shell_new_tab (ephy_shell, window, NULL, url->url,
-			EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+		ephy_shell_new_tab (ephy_shell_get_default (),
+				    window, NULL, url->url,
+				    EPHY_NEW_TAB_OPEN_PAGE |
+				    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 	}
 
 	g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
@@ -341,7 +343,8 @@ cmd_open_bookmarks_in_browser (GtkAction *action,
 	for (l = selection; l; l = l->next)
 	{
 		EphyHistoryURL *url = l->data;
-		ephy_shell_new_tab (ephy_shell, window, NULL, url->url,
+		ephy_shell_new_tab (ephy_shell_get_default (),
+				    window, NULL, url->url,
 				    EPHY_NEW_TAB_OPEN_PAGE |
 				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
@@ -566,7 +569,8 @@ ephy_history_window_row_activated_cb (GtkTreeView *view,
 						 path);
 	g_return_if_fail (url != NULL);
 
-	ephy_shell_new_tab (ephy_shell, NULL, NULL, url->url,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    NULL, NULL, url->url,
 			    EPHY_NEW_TAB_OPEN_PAGE);
 	ephy_history_url_free (url);
 }
@@ -583,7 +587,8 @@ ephy_history_window_row_middle_clicked_cb (EphyHistoryView *view,
 	url = ephy_urls_store_get_url_from_path (editor->priv->urls_store, path);
 	g_return_if_fail (url != NULL);
 
-	ephy_shell_new_tab (ephy_shell, window, NULL, url->url,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    window, NULL, url->url,
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 	ephy_history_url_free (url);
diff --git a/src/ephy-location-controller.c b/src/ephy-location-controller.c
index 463606e..0ff9e4d 100644
--- a/src/ephy-location-controller.c
+++ b/src/ephy-location-controller.c
@@ -757,7 +757,7 @@ ephy_location_controller_init (EphyLocationController *controller)
 
 	priv->address = g_strdup ("");
 	priv->editable = TRUE;
-	priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+	priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
 	priv->smart_bmks = ephy_bookmarks_get_smart_bookmarks
 		(controller->priv->bookmarks);
 	priv->sync_address_is_blocked = FALSE;
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 1281b1d..10450d7 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -235,6 +235,7 @@ main (int argc,
   EphyShellStartupContext *ctx;
   EphyStartupFlags startup_flags;
   EphyEmbedShellMode mode;
+  EphyShell *ephy_shell;
   int status;
   EphyFileHelpersFlags flags;
 
@@ -476,6 +477,7 @@ main (int argc,
                                         arguments,
                                         user_time);
   g_strfreev (arguments);
+  ephy_shell = ephy_shell_get_default ();
   ephy_shell_set_startup_context (ephy_shell, ctx);
   status = g_application_run (G_APPLICATION (ephy_shell), argc, argv);
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 962fbf6..d761d9d 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -764,7 +764,8 @@ confirm_before_recover (EphyWindow* window, char* url, char* title)
 {
 	EphyEmbed *embed;
 
-	embed = ephy_shell_new_tab (ephy_shell, window, NULL, NULL,
+	embed = ephy_shell_new_tab (ephy_shell_get_default (),
+				    window, NULL, NULL,
 				    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
 				    EPHY_NEW_TAB_APPEND_LAST);
 
@@ -807,7 +808,8 @@ parse_embed (xmlNodePtr child,
 			{
 				recover_url = (char *) url;
 				
-				ephy_shell_new_tab (ephy_shell, window, NULL, recover_url,
+				ephy_shell_new_tab (ephy_shell_get_default (),
+						    window, NULL, recover_url,
 						    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
 						    EPHY_NEW_TAB_OPEN_PAGE |
 						    EPHY_NEW_TAB_APPEND_LAST);
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index ca1d4e2..3cf8b18 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -53,8 +53,6 @@ typedef struct _EphyShell   EphyShell;
 typedef struct _EphyShellClass    EphyShellClass;
 typedef struct _EphyShellPrivate  EphyShellPrivate;
 
-extern EphyShell *ephy_shell;
-
 /**
  * EphyNewTabFlags:
  * @EPHY_NEW_TAB_HOME_PAGE: loads the home page in the new tab.
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6c263ed..64c7be8 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -606,7 +606,7 @@ ephy_window_open_link (EphyLink *link,
 		}
 
 		new_embed = ephy_shell_new_tab
-				(ephy_shell,
+				(ephy_shell_get_default (),
 				 EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
 				 embed, address, ntflags);
 	}
@@ -1724,7 +1724,7 @@ sync_network_status (EphyEmbedSingle *single,
 	GtkAction *action;
 	gboolean is_online;
 
-	GNetworkMonitor *monitor = G_NETWORK_MONITOR (ephy_shell_get_net_monitor (ephy_shell));
+	GNetworkMonitor *monitor = G_NETWORK_MONITOR (ephy_shell_get_net_monitor (ephy_shell_get_default ()));
 	is_online = g_network_monitor_get_network_available (monitor);
 
 	action = gtk_action_group_get_action (priv->action_group,
@@ -4137,7 +4137,7 @@ EphyWindow *
 ephy_window_new (void)
 {
 	return g_object_new (EPHY_TYPE_WINDOW,
-			     "application", GTK_APPLICATION (ephy_shell),
+			     "application", GTK_APPLICATION (ephy_shell_get_default ()),
 			     NULL);
 }
 
@@ -4157,7 +4157,7 @@ ephy_window_new_with_chrome (EphyWebViewChrome chrome,
 	return g_object_new (EPHY_TYPE_WINDOW,
 			     "chrome", chrome,
 			     "is-popup", is_popup,
-			     "application", GTK_APPLICATION (ephy_shell),
+			     "application", GTK_APPLICATION (ephy_shell_get_default ()),
 			     NULL);
 }
 
@@ -4448,9 +4448,9 @@ ephy_window_close (EphyWindow *window)
 	}
 
 	/* If this is the last window, save its state in the session. */
-	if (ephy_shell_get_n_windows (ephy_shell) == 1)
+	if (ephy_shell_get_n_windows (ephy_shell_get_default ()) == 1)
 	{
-		ephy_session_close (EPHY_SESSION (ephy_shell_get_session (ephy_shell)));
+		ephy_session_close (EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ())));
 	}
 
 	/* See bug #114689 */
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 03494a1..e010c26 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -58,7 +58,8 @@ popup_cmd_link_in_new_window (GtkAction *action,
 
 	ephy_embed_event_get_property (event, "link-uri", &value);
 
-	ephy_shell_new_tab (ephy_shell, NULL, embed,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    NULL, embed,
 			    g_value_get_string (&value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_NEW_WINDOW);
@@ -81,7 +82,8 @@ popup_cmd_link_in_new_tab (GtkAction *action,
 
 	ephy_embed_event_get_property (event, "link-uri", &value);
 
-	ephy_shell_new_tab (ephy_shell, window, embed,
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    window, embed,
 			    g_value_get_string (&value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
@@ -398,7 +400,8 @@ image_open_uri (GFile *file,
 
 	if (!success)
 	{
-		ephy_shell_new_tab (ephy_shell, NULL, NULL, remote_address,
+		ephy_shell_new_tab (ephy_shell_get_default (),
+				    NULL, NULL, remote_address,
 				    EPHY_NEW_TAB_OPEN_PAGE |
 				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index ac067f4..8910cd7 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -1087,7 +1087,7 @@ prefs_dialog_init (PrefsDialog *pd)
 			  G_CALLBACK (clear_cache_button_clicked_cb), dialog);
 
 	encodings = EPHY_ENCODINGS (ephy_embed_shell_get_encodings
-					(EPHY_EMBED_SHELL (ephy_shell)));
+					(EPHY_EMBED_SHELL (ephy_shell_get_default ())));
 
 	create_node_combo (dialog, encodings, "ISO-8859-1");
 
diff --git a/src/window-commands.c b/src/window-commands.c
index 2641ccc..a0e013f 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -722,7 +722,7 @@ void
 window_cmd_file_quit (GtkAction *action,
 		      EphyWindow *window)
 {
-	if (ephy_shell_close_all_windows (ephy_shell))
+	if (ephy_shell_close_all_windows (ephy_shell_get_default ()))
 		g_application_quit (g_application_get_default ());
 }
 
@@ -730,8 +730,10 @@ void
 window_cmd_file_new_window (GtkAction *action,
 			    EphyWindow *window)
 {
-	ephy_shell_new_tab (ephy_shell, NULL, NULL, NULL,
-			    EPHY_NEW_TAB_IN_NEW_WINDOW | EPHY_NEW_TAB_HOME_PAGE);
+	ephy_shell_new_tab (ephy_shell_get_default (),
+			    NULL, NULL, NULL,
+			    EPHY_NEW_TAB_IN_NEW_WINDOW |
+			    EPHY_NEW_TAB_HOME_PAGE);
 }
 
 void
@@ -952,7 +954,7 @@ window_cmd_edit_bookmarks (GtkAction *action,
 {
 	GtkWidget *bwindow;
 	
-	bwindow = ephy_shell_get_bookmarks_editor (ephy_shell);
+	bwindow = ephy_shell_get_bookmarks_editor (ephy_shell_get_default ());
 	gtk_window_present (GTK_WINDOW (bwindow));
 }
 
@@ -962,7 +964,7 @@ window_cmd_edit_history (GtkAction *action,
 {
 	GtkWidget *hwindow;
 	
-	hwindow = ephy_shell_get_history_window (ephy_shell);
+	hwindow = ephy_shell_get_history_window (ephy_shell_get_default ());
 	gtk_window_present (GTK_WINDOW (hwindow));
 }
 
@@ -972,7 +974,7 @@ window_cmd_edit_preferences (GtkAction *action,
 {
 	EphyDialog *dialog;
 	
-	dialog = EPHY_DIALOG (ephy_shell_get_prefs_dialog (ephy_shell));
+	dialog = EPHY_DIALOG (ephy_shell_get_prefs_dialog (ephy_shell_get_default ()));
 	
 	ephy_dialog_show (dialog);
 }
@@ -983,7 +985,7 @@ window_cmd_edit_personal_data (GtkAction *action,
 {
 	PdmDialog *dialog;
 	
-	dialog = EPHY_PDM_DIALOG (ephy_shell_get_pdm_dialog (ephy_shell));
+	dialog = EPHY_PDM_DIALOG (ephy_shell_get_pdm_dialog (ephy_shell_get_default ()));
 	/* FIXME?: pdm_dialog_open is supposed to scroll to the host passed
 	 * as second parameters in the cookies tab. Honestly I think this
 	 * has been broken for a while. In any case it's probably not
diff --git a/tests/ephy-download-test.c b/tests/ephy-download-test.c
index f92c7d0..475aa03 100644
--- a/tests/ephy-download-test.c
+++ b/tests/ephy-download-test.c
@@ -194,7 +194,7 @@ main (int argc, char *argv[])
 
   ret = g_test_run ();
 
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
   ephy_file_helpers_shutdown ();
 
   return ret;
diff --git a/tests/ephy-embed-single-test.c b/tests/ephy-embed-single-test.c
index a7f1583..80a54bc 100644
--- a/tests/ephy-embed-single-test.c
+++ b/tests/ephy-embed-single-test.c
@@ -104,7 +104,7 @@ main (int argc, char *argv[])
 
   ret = g_test_run ();
 
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
   ephy_file_helpers_shutdown ();
 
   return ret;
diff --git a/tests/ephy-encodings-test.c b/tests/ephy-encodings-test.c
index ec085bb..ffa88e5 100644
--- a/tests/ephy-encodings-test.c
+++ b/tests/ephy-encodings-test.c
@@ -90,7 +90,7 @@ main (int argc, char *argv[])
   }
 
   _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
-  g_assert (ephy_shell);
+  g_assert (ephy_shell_get_default ());
 
   g_test_add_func ("/src/ephy-encodings/create",
                    test_ephy_encodings_create);
@@ -101,7 +101,7 @@ main (int argc, char *argv[])
   ret = g_test_run ();
 
   ephy_file_helpers_shutdown ();
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
 
   return ret;
 }
diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c
index 6295be4..4923f27 100644
--- a/tests/ephy-session-test.c
+++ b/tests/ephy-session-test.c
@@ -51,13 +51,13 @@ test_ephy_session_load (void)
     EphyEmbed *embed;
     EphyWebView *view;
 
-    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
     g_assert (session);
 
     ret = ephy_session_load_from_string (session, session_data, -1, 0);
     g_assert (ret);
 
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 1);
 
@@ -86,7 +86,7 @@ test_ephy_session_load_empty_session (void)
     EphyEmbed *embed;
     EphyWebView *view;
 
-    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
     g_assert (session);
 
     ret = ephy_session_load_from_string (session, session_data_empty, -1, 0);
@@ -99,7 +99,7 @@ test_ephy_session_load_empty_session (void)
     while (g_main_context_pending (NULL))
       g_main_context_iteration (NULL, FALSE);
 
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 1);
 
@@ -136,13 +136,13 @@ test_ephy_session_load_many_windows (void)
     EphyEmbed *embed;
     EphyWebView *view;
 
-    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
     g_assert (session);
 
     ret = ephy_session_load_from_string (session, session_data_many_windows, -1, 0);
     g_assert (ret);
 
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 2);
 
@@ -170,7 +170,7 @@ test_ephy_session_open_uri_after_loading_session (void)
     guint32 user_time;
     const char* uris[] = { "ephy-about:epiphany", NULL };
 
-    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+    session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
     g_assert (session);
 
     user_time = gdk_x11_display_get_user_time (gdk_display_get_default ());
@@ -178,7 +178,7 @@ test_ephy_session_open_uri_after_loading_session (void)
     ret = ephy_session_load_from_string (session, session_data_many_windows, -1, 0);
     g_assert (ret);
 
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 2);
 
@@ -206,7 +206,7 @@ test_ephy_session_open_uri_after_loading_session (void)
     while (gtk_events_pending ())
         gtk_main_iteration_do (FALSE);
 
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 2);
 
@@ -227,7 +227,7 @@ test_ephy_session_open_uri_after_loading_session (void)
     /* We should still have 2 windows here, since the new URI should be
      * in a new tab of an existing window.
      */
-    l = ephy_shell_get_windows (ephy_shell);
+    l = ephy_shell_get_windows (ephy_shell_get_default ());
     g_assert (l);
     g_assert_cmpint (g_list_length (l), ==, 2);
 }
@@ -250,9 +250,9 @@ main (int argc, char *argv[])
   }
 
   _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
-  g_assert (ephy_shell);
+  g_assert (ephy_shell_get_default ());
 
-  g_application_register (G_APPLICATION (ephy_shell), NULL, NULL);
+  g_application_register (G_APPLICATION (ephy_shell_get_default ()), NULL, NULL);
 
   g_test_add_func ("/src/ephy-session/load",
                    test_ephy_session_load);
@@ -268,7 +268,7 @@ main (int argc, char *argv[])
 
   ret = g_test_run ();
 
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
   ephy_file_helpers_shutdown ();
 
   return ret;
diff --git a/tests/ephy-shell-test.c b/tests/ephy-shell-test.c
index 1f4a65a..a0b0c41 100644
--- a/tests/ephy-shell-test.c
+++ b/tests/ephy-shell-test.c
@@ -40,6 +40,7 @@
 static void
 test_ephy_shell_basic_embeds (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
 
   EphyEmbed *embed1;
@@ -47,6 +48,8 @@ test_ephy_shell_basic_embeds (void)
 
   GList *children;
 
+  ephy_shell = ephy_shell_get_default ();
+
   /* Both embed and window should be created. */
   embed1 = ephy_shell_new_tab_full
                   (ephy_shell,
@@ -89,10 +92,12 @@ test_ephy_shell_basic_embeds (void)
 static void
 test_ephy_shell_parent_windows (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
   GtkWidget *window2;
   EphyEmbed *embed;
 
+  ephy_shell = ephy_shell_get_default ();
   window = GTK_WIDGET (ephy_window_new ());
 
   /* parent-window provided */
@@ -134,10 +139,12 @@ test_ephy_shell_parent_windows (void)
 static void
 test_ephy_shell_tab_load (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
   EphyEmbed *embed;
   EphyWebView *view;
 
+  ephy_shell = ephy_shell_get_default ();
   window = GTK_WIDGET (ephy_window_new ());
 
   /* homepage is "about:blank" for now, see embed/ephy-web-view.c */
@@ -174,6 +181,7 @@ get_notebook_page_num (GtkWidget *notebook, EphyEmbed *embed)
 static void
 test_ephy_shell_tab_append (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
   GtkWidget *notebook;
 
@@ -183,6 +191,7 @@ test_ephy_shell_tab_append (void)
   EphyEmbed *embed4;
   EphyEmbed *embed5;
 
+  ephy_shell = ephy_shell_get_default ();
   window = GTK_WIDGET (ephy_window_new ());
   notebook = ephy_window_get_notebook (EPHY_WINDOW (window));
 
@@ -222,6 +231,7 @@ test_ephy_shell_tab_append (void)
 static void
 test_ephy_shell_tab_from_external (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
   GtkWidget *notebook;
 
@@ -231,6 +241,7 @@ test_ephy_shell_tab_from_external (void)
   EphyEmbed *embed4;
   EphyEmbed *embed5;
 
+  ephy_shell = ephy_shell_get_default ();
   embed = ephy_shell_new_tab (ephy_shell, NULL, NULL, "about:epiphany",
                                EPHY_NEW_TAB_DONT_SHOW_WINDOW | EPHY_NEW_TAB_OPEN_PAGE);
   window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
@@ -285,6 +296,7 @@ test_ephy_shell_tab_from_external (void)
 static void
 test_ephy_shell_tab_no_history (void)
 {
+  EphyShell *ephy_shell;
   GtkWidget *window;
 
   EphyEmbed *embed;
@@ -297,6 +309,7 @@ test_ephy_shell_tab_no_history (void)
   WebKitWebBackForwardList *bflist;
   WebKitWebHistoryItem *item;
 
+  ephy_shell = ephy_shell_get_default ();
   embed = ephy_shell_new_tab (ephy_shell, NULL, NULL, NULL,
                                EPHY_NEW_TAB_DONT_SHOW_WINDOW);
   window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
@@ -345,7 +358,7 @@ main (int argc, char *argv[])
   }
 
   _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
-  g_application_register (G_APPLICATION (ephy_shell), NULL, NULL);
+  g_application_register (G_APPLICATION (ephy_shell_get_default ()), NULL, NULL);
 
   g_test_add_func ("/src/ephy-shell/basic_embeds",
                    test_ephy_shell_basic_embeds);
@@ -367,7 +380,7 @@ main (int argc, char *argv[])
 
   ret = g_test_run ();
 
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
   ephy_file_helpers_shutdown ();
 
   return ret;
diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c
index c26fa40..b95aac0 100644
--- a/tests/ephy-web-view-test.c
+++ b/tests/ephy-web-view-test.c
@@ -475,7 +475,7 @@ main (int argc, char *argv[])
   ret = g_test_run ();
 
   g_object_unref (server);
-  g_object_unref (ephy_shell);
+  g_object_unref (ephy_shell_get_default ());
   ephy_file_helpers_shutdown ();
 
   return ret;



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