[epiphany/wip/ephy-sync: 107/116] ephy-shell: Fix get_global_sync_service() function
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/ephy-sync: 107/116] ephy-shell: Fix get_global_sync_service() function
- Date: Thu, 28 Jul 2016 09:34:50 +0000 (UTC)
commit a7b213990bbc1800215dc649dd9c4e16befd3be9
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Sat Jul 23 01:12:59 2016 +0300
ephy-shell: Fix get_global_sync_service() function
src/ephy-shell.c | 9 ++++++---
src/ephy-shell.h | 2 +-
src/ephy-sync-service.c | 3 +--
src/prefs-dialog.c | 4 ++--
4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 7b4f401..0865492 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -561,8 +561,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,8 +612,13 @@ 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)
{
+ g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
+
+ if (shell->sync_service == NULL)
+ shell->sync_service = ephy_sync_service_new ();
+
return ephy_shell->sync_service;
}
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 77079ac..6dafee6 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -106,7 +106,7 @@ GtkWidget *ephy_shell_get_bookmarks_editor (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 dbb988f..b7146e4 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -243,7 +243,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");
@@ -349,7 +349,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]