diff options
author | Diego Escalante Urrelo <diegoe@igalia.com> | 2012-12-11 00:24:45 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <diegoe@igalia.com> | 2012-12-11 01:08:40 +0800 |
commit | e65754da16f9af433cd90279b60855705855253a (patch) | |
tree | 1e9229965f9a2ff0552e202e2df91bee59dba928 | |
parent | 43587a75794e27225c71d485620f875b12338ac1 (diff) | |
download | gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar.gz gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar.bz2 gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar.lz gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar.xz gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.tar.zst gsoc2013-epiphany-e65754da16f9af433cd90279b60855705855253a.zip |
e-embed-shell: remove the embed_shell global
https://bugzilla.gnome.org/show_bug.cgi?id=683614
-rw-r--r-- | embed/ephy-download.c | 10 | ||||
-rw-r--r-- | embed/ephy-embed-shell.h | 2 | ||||
-rw-r--r-- | embed/ephy-embed.c | 2 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 20 | ||||
-rw-r--r-- | src/ephy-completion-model.c | 2 | ||||
-rw-r--r-- | src/ephy-navigation-history-action.c | 2 | ||||
-rw-r--r-- | src/ephy-session.c | 4 | ||||
-rw-r--r-- | src/ephy-shell.c | 6 | ||||
-rw-r--r-- | src/ephy-window.c | 21 | ||||
-rw-r--r-- | src/pdm-dialog.c | 4 | ||||
-rw-r--r-- | src/window-commands.c | 2 | ||||
-rw-r--r-- | tests/ephy-embed-single-test.c | 1 | ||||
-rw-r--r-- | tests/ephy-encodings-test.c | 1 | ||||
-rw-r--r-- | tests/ephy-web-view-test.c | 1 |
14 files changed, 44 insertions, 34 deletions
diff --git a/embed/ephy-download.c b/embed/ephy-download.c index dc19b4589..792f5c1c7 100644 --- a/embed/ephy-download.c +++ b/embed/ephy-download.c @@ -715,7 +715,7 @@ ephy_download_dispose (GObject *object) priv->widget = NULL; } - ephy_embed_shell_remove_download (embed_shell, download); + ephy_embed_shell_remove_download (ephy_embed_shell_get_default (), download); G_OBJECT_CLASS (ephy_download_parent_class)->dispose (object); } @@ -955,7 +955,7 @@ download_finished_cb (WebKitDownload *wk_download, else ephy_download_do_download_action (download, priv->action); - ephy_embed_shell_remove_download (embed_shell, download); + ephy_embed_shell_remove_download (ephy_embed_shell_get_default (), download); } #else static void @@ -980,11 +980,11 @@ download_status_changed_cb (GObject *object, ephy_download_do_download_action (download, priv->action); } - ephy_embed_shell_remove_download (embed_shell, download); + ephy_embed_shell_remove_download (ephy_embed_shell_get_default (), download); } else if (status == WEBKIT_DOWNLOAD_STATUS_CANCELLED || status == WEBKIT_DOWNLOAD_STATUS_ERROR) { } else if (status == WEBKIT_DOWNLOAD_STATUS_STARTED) { - ephy_embed_shell_add_download (embed_shell, download); + ephy_embed_shell_add_download (ephy_embed_shell_get_default (), download); } } #endif @@ -1090,7 +1090,7 @@ ephy_download_new_for_download (WebKitDownload *download) #ifdef HAVE_WEBKIT2 /* In WebKit2 the download has already started */ - ephy_embed_shell_add_download (embed_shell, ephy_download); + ephy_embed_shell_add_download (ephy_embed_shell_get_default (), ephy_download); #endif return ephy_download; diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h index 2daee5fe8..7432e1133 100644 --- a/embed/ephy-embed-shell.h +++ b/embed/ephy-embed-shell.h @@ -43,8 +43,6 @@ typedef struct _EphyEmbedShellClass EphyEmbedShellClass; typedef struct _EphyEmbedShell EphyEmbedShell; typedef struct _EphyEmbedShellPrivate EphyEmbedShellPrivate; -extern EphyEmbedShell *embed_shell; - typedef enum { EPHY_EMBED_SHELL_MODE_BROWSER, diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 52a218087..7752f0497 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -249,7 +249,7 @@ resource_request_starting_cb (WebKitWebView *web_view, WebKitNetworkResponse *response, EphyEmbed *embed) { - EphyAdBlockManager *adblock_manager = EPHY_ADBLOCK_MANAGER (ephy_embed_shell_get_adblock_manager (embed_shell)); + EphyAdBlockManager *adblock_manager = EPHY_ADBLOCK_MANAGER (ephy_embed_shell_get_adblock_manager (ephy_embed_shell_get_default ())); const char *uri = webkit_network_request_get_uri (request); /* FIXME: How do we implement the other CHECK_TYPEs? Perhaps we diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 72f7b5ecd..09d23a4ac 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -165,7 +165,7 @@ popups_manager_show (PopupInfo *popup, /* Only show popup with non NULL url */ if (popup->url != NULL) { single = EPHY_EMBED_SINGLE - (ephy_embed_shell_get_embed_single (embed_shell)); + (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())); ephy_embed_single_open_window (single, EPHY_EMBED (view), popup->url, popup->name, popup->features); @@ -292,7 +292,7 @@ ephy_web_view_set_popups_allowed (EphyWebView *view, EphyPermission permission; manager = EPHY_PERMISSION_MANAGER - (ephy_embed_shell_get_embed_single (embed_shell)); + (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())); g_return_if_fail (EPHY_IS_PERMISSION_MANAGER (manager)); permission = allowed ? EPHY_PERMISSION_ALLOWED @@ -321,7 +321,7 @@ ephy_web_view_get_popups_allowed (EphyWebView *view) gboolean allow; permission_manager = EPHY_PERMISSION_MANAGER - (ephy_embed_shell_get_embed_single (embed_shell)); + (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())); g_return_val_if_fail (EPHY_IS_PERMISSION_MANAGER (permission_manager), FALSE); @@ -709,7 +709,7 @@ store_password (GtkInfoBar *info_bar, gint response_id, gpointer data) /* Update internal caching */ host = ephy_string_get_host_name (uri); - ephy_embed_single_add_form_auth (EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)), + ephy_embed_single_add_form_auth (EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())), host, name_field_name, password_field_name, @@ -861,6 +861,7 @@ pre_fill_form (WebKitDOMNode *username_node, GSList *p = NULL; GSList *l = NULL; SoupURI *uri = NULL; + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); uri = soup_uri_new (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view))); if (uri) @@ -1807,7 +1808,7 @@ decide_policy_cb (WebKitWebView *web_view, if (g_strcmp0 (webkit_web_resource_get_uri (main_resource), request_uri) != 0) return FALSE; - single = ephy_embed_shell_get_embed_single (embed_shell); + single = ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ()); g_signal_emit_by_name (single, "handle-content", mime_type, request_uri, &handled); if (handled) @@ -1883,7 +1884,7 @@ mime_type_policy_decision_requested_cb (WebKitWebView *web_view, const char *uri; gboolean handled = FALSE; - single = ephy_embed_shell_get_embed_single (embed_shell); + single = ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ()); uri = webkit_network_request_get_uri (request); g_signal_emit_by_name (single, "handle-content", mime_type, uri, &handled); @@ -2102,6 +2103,7 @@ web_view_check_snapshot (WebKitWebView *web_view) EphyOverviewStore *store; GtkTreeIter iter; cairo_surface_t *surface; + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); store = EPHY_OVERVIEW_STORE (ephy_embed_shell_get_frecent_store (embed_shell)); if (ephy_overview_store_find_url (store, webkit_web_view_get_uri (web_view), &iter) && @@ -2212,7 +2214,7 @@ load_changed_cb (WebKitWebView *web_view, #if 0 /* TODO: DOM bindings */ - if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_PRIVATE && + if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_PRIVATE && g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_REMEMBER_PASSWORDS)) _ephy_web_view_hook_into_forms (view); @@ -2368,7 +2370,7 @@ load_status_cb (WebKitWebView *web_view, if (priv->is_blank) ephy_web_view_set_title (view, NULL); - if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_PRIVATE && + if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_PRIVATE && g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_REMEMBER_PASSWORDS)) _ephy_web_view_hook_into_forms (view); @@ -2759,7 +2761,7 @@ ephy_web_view_init (EphyWebView *web_view) priv->domain_regex = g_regex_new (EPHY_WEB_VIEW_DOMAIN_REGEX, G_REGEX_OPTIMIZE, G_REGEX_MATCH_NOTEMPTY, NULL); - priv->history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); + priv->history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())); priv->history_service_cancellable = g_cancellable_new (); g_signal_connect (priv->history_service, diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c index 87980c71b..0a858c1d9 100644 --- a/src/ephy-completion-model.c +++ b/src/ephy-completion-model.c @@ -101,7 +101,7 @@ ephy_completion_model_init (EphyCompletionModel *model) model->priv = priv = EPHY_COMPLETION_MODEL_GET_PRIVATE (model); - priv->history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); + 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); priv->bookmarks = ephy_bookmarks_get_bookmarks (bookmarks_service); diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c index d48127da4..ebb86e4cb 100644 --- a/src/ephy-navigation-history-action.c +++ b/src/ephy-navigation-history-action.c @@ -159,7 +159,7 @@ ephy_navigation_history_action_init (EphyNavigationHistoryAction *action) { action->priv = EPHY_NAVIGATION_HISTORY_ACTION_GET_PRIVATE (action); - action->priv->history = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); + action->priv->history = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ())); action->priv->menu_timeout = 0; diff --git a/src/ephy-session.c b/src/ephy-session.c index 024895ae4..962fbf675 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -531,7 +531,7 @@ ephy_session_close (EphySession *session) session_command_queue_clear (session); - ephy_embed_shell_prepare_close (embed_shell); + ephy_embed_shell_prepare_close (ephy_embed_shell_get_default ()); } } @@ -961,7 +961,7 @@ ephy_session_load_from_string (EphySession *session, } } - if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_TEST) + if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_TEST) { active_child = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); gtk_widget_grab_focus (GTK_WIDGET (active_child)); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 29dcd90c3..eb9789166 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -720,6 +720,7 @@ ephy_shell_new_tab_full (EphyShell *shell, gboolean is_popup, guint32 user_time) { + EphyEmbedShell *embed_shell; EphyWindow *window; EphyEmbed *embed = NULL; gboolean fullscreen_lockdown = FALSE; @@ -731,6 +732,8 @@ ephy_shell_new_tab_full (EphyShell *shell, gboolean is_empty = FALSE; int position = -1; + embed_shell = ephy_embed_shell_get_default (); + if (flags & EPHY_NEW_TAB_OPEN_PAGE) open_page = TRUE; if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE; if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE; @@ -951,8 +954,11 @@ ephy_shell_get_bookmarks_editor (EphyShell *shell) GtkWidget * ephy_shell_get_history_window (EphyShell *shell) { + EphyEmbedShell *embed_shell; EphyHistoryService *service; + embed_shell = ephy_embed_shell_get_default (); + if (shell->priv->history_window == NULL) { service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (embed_shell)); diff --git a/src/ephy-window.c b/src/ephy-window.c index e749fb5fe..6c263ed9a 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -697,7 +697,7 @@ get_chromes_visibility (EphyWindow *window, EphyWindowPrivate *priv = window->priv; EphyWebViewChrome flags = priv->chrome; - if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) + if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) { *show_toolbar = FALSE; *show_tabsbar = FALSE; @@ -1033,7 +1033,7 @@ update_popup_actions_visibility (EphyWindow *window, action_group = window->priv->popups_action_group; - if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) + if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) { action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); gtk_action_set_visible (action, FALSE); @@ -1893,7 +1893,7 @@ populate_context_menu (WebKitWebView *web_view, _ephy_window_set_context_event (window, embed_event); g_object_unref (embed_event); - app_mode = ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION; + app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION; update_edit_actions_sensitivity (window, FALSE); @@ -2505,7 +2505,7 @@ decide_policy_cb (WebKitWebView *web_view, navigation_type = webkit_navigation_policy_decision_get_navigation_type (navigation_decision); if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED && - ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) + ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) { /* The only thing we allow here is to either navigate * in the same window and tab to the current domain, @@ -2643,7 +2643,7 @@ policy_decision_required_cb (WebKitWebView *web_view, } if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED && - ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION) + ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) { /* The only thing we allow here is to either navigate * in the same window and tab to the current domain, @@ -3463,14 +3463,15 @@ ephy_window_dispose (GObject *object) ephy_bookmarks_ui_detach_window (window); g_signal_handlers_disconnect_by_func - (embed_shell, download_added_cb, window); + (ephy_embed_shell_get_default (), + download_added_cb, window); /* Deactivate menus */ popups = gtk_ui_manager_get_toplevels (window->priv->manager, GTK_UI_MANAGER_POPUP); g_slist_foreach (popups, (GFunc) gtk_menu_shell_deactivate, NULL); g_slist_free (popups); - single = ephy_embed_shell_get_embed_single (embed_shell); + single = ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ()); g_signal_handlers_disconnect_by_func (single, G_CALLBACK (sync_network_status), window); @@ -3952,7 +3953,7 @@ ephy_window_constructor (GType type, G_CALLBACK (show_toolbars_setting_cb), window); /* network status */ - single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())); sync_network_status (single, NULL, window); g_signal_connect (single, "notify::network-status", G_CALLBACK (sync_network_status), window); @@ -3968,7 +3969,7 @@ ephy_window_constructor (GType type, priv->is_popup); /* Disabled actions not needed for application mode. */ - mode = ephy_embed_shell_get_mode (embed_shell); + mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()); if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION) { /* FileNewTab and FileNewWindow are sort of special. */ @@ -4116,7 +4117,7 @@ ephy_window_init (EphyWindow *window) window->priv = EPHY_WINDOW_GET_PRIVATE (window); - g_signal_connect (embed_shell, + g_signal_connect (ephy_embed_shell_get_default (), "download-added", G_CALLBACK (download_added_cb), window); diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 22b92d566..7e3336467 100644 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -1611,7 +1611,7 @@ pdm_dialog_init (PdmDialog *dialog) PdmActionInfo *cookies, *passwords; GtkWidget *window; gboolean has_private_profile = - ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_PRIVATE; + ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_PRIVATE; priv = dialog->priv = EPHY_PDM_DIALOG_GET_PRIVATE (dialog); @@ -1690,7 +1690,7 @@ pdm_dialog_finalize (GObject *object) PdmDialog *dialog = EPHY_PDM_DIALOG (object); GObject *single; - single = ephy_embed_shell_get_embed_single (embed_shell); + single = ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ()); g_signal_handlers_disconnect_matched (single, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); diff --git a/src/window-commands.c b/src/window-commands.c index a38557d72..2641ccca8 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -690,7 +690,7 @@ window_cmd_file_work_offline (GtkAction *action, EphyEmbedSingle *single; gboolean offline; - single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (ephy_embed_shell_get_default ())); offline = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); ephy_embed_single_set_network_status (single, !offline); #endif diff --git a/tests/ephy-embed-single-test.c b/tests/ephy-embed-single-test.c index 0bd9a3047..a7f1583d9 100644 --- a/tests/ephy-embed-single-test.c +++ b/tests/ephy-embed-single-test.c @@ -45,6 +45,7 @@ test_embed_single_new (void) static void test_embed_single_get_from_shell (void) { + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); EphyEmbedSingle *single; single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); diff --git a/tests/ephy-encodings-test.c b/tests/ephy-encodings-test.c index fa743dd51..ec085bbe7 100644 --- a/tests/ephy-encodings-test.c +++ b/tests/ephy-encodings-test.c @@ -52,6 +52,7 @@ test_ephy_encodings_create (void) static void test_ephy_encodings_get (void) { + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); EphyEncodings *encodings; GList *all, *p; diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c index d00189087..c26fa407d 100644 --- a/tests/ephy-web-view-test.c +++ b/tests/ephy-web-view-test.c @@ -407,6 +407,7 @@ test_ephy_web_view_error_pages_not_stored_in_history (void) EphyWebView *view; const char *bad_url; EphyHistoryService *history_service; + EphyEmbedShell *embed_shell = ephy_embed_shell_get_default (); view = EPHY_WEB_VIEW (ephy_web_view_new ()); loop = g_main_loop_new (NULL, FALSE); |