[epiphany/wip/sync-rebase: 20/74] ephy-sync: Fix ephy_shell_get_global_sync_service()
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync-rebase: 20/74] ephy-sync: Fix ephy_shell_get_global_sync_service()
- Date: Thu, 29 Sep 2016 17:44:29 +0000 (UTC)
commit 307eb06667942142cdaba9b3418ce5ab1f987316
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Sat Jul 23 01:12:59 2016 +0300
ephy-sync: Fix ephy_shell_get_global_sync_service()
src/ephy-shell.c | 11 +++++++----
src/ephy-shell.h | 2 +-
src/ephy-sync-service.c | 3 +--
src/prefs-dialog.c | 4 ++--
4 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 6fb35bd..6f4e7e7 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -563,8 +563,6 @@ ephy_shell_init (EphyShell *shell)
ephy_shell = shell;
g_object_add_weak_pointer (G_OBJECT (ephy_shell),
(gpointer *)ptr);
-
- shell->sync_service = ephy_sync_service_new ();
}
static void
@@ -614,9 +612,14 @@ ephy_shell_finalize (GObject *object)
* Return value: (transfer none):
**/
EphySyncService *
-ephy_shell_get_global_sync_service (void)
+ephy_shell_get_global_sync_service (EphyShell *shell)
{
- return ephy_shell->sync_service;
+ g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
+
+ if (shell->sync_service == NULL)
+ shell->sync_service = ephy_sync_service_new ();
+
+ return shell->sync_service;
}
/**
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 7c5f5b8..23dfe89 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -100,7 +100,7 @@ GNetworkMonitor *ephy_shell_get_net_monitor (EphyShell *shell);
EphyBookmarksManager *ephy_shell_get_bookmarks_manager (EphyShell *shell);
-EphySyncService *ephy_shell_get_global_sync_service (void);
+EphySyncService *ephy_shell_get_global_sync_service (EphyShell *shell);
GtkWidget *ephy_shell_get_history_window (EphyShell *shell);
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index e3523b8..7384800 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -475,8 +475,7 @@ ephy_sync_service_init (EphySyncService *self)
EphySyncService *
ephy_sync_service_new (void)
{
- return EPHY_SYNC_SERVICE (g_object_new (EPHY_TYPE_SYNC_SERVICE,
- NULL));
+ return EPHY_SYNC_SERVICE (g_object_new (EPHY_TYPE_SYNC_SERVICE, NULL));
}
const gchar *
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 4cdd482..de393f5 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -242,7 +242,7 @@ server_message_received_cb (WebKitUserContentManager *manager,
inject_data_to_server (dialog, "message", "login", NULL);
gtk_widget_set_visible (dialog->sync_sign_in_details, FALSE);
- service = ephy_shell_get_global_sync_service ();
+ service = ephy_shell_get_global_sync_service (ephy_shell_get_default ());
/* Extract tokens. */
data = json_object_get_object_member (detail, "data");
@@ -348,7 +348,7 @@ on_sync_sign_out_button_clicked (GtkWidget *button,
EphySyncService *service;
gchar *sessionToken;
- service = ephy_shell_get_global_sync_service ();
+ service = ephy_shell_get_global_sync_service (ephy_shell_get_default ());
sessionToken = ephy_sync_service_get_token (service, TOKEN_SESSIONTOKEN);
/* Destroy session and delete tokens. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]