[epiphany/wip/ephy-sync: 20/86] Have a global sync service
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/ephy-sync: 20/86] Have a global sync service
- Date: Sat, 30 Jul 2016 17:31:44 +0000 (UTC)
commit 8c89db6ceb7d02c0e3466dcb6659edc0b12863e5
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Mon Jun 20 13:09:45 2016 +0300
Have a global sync service
src/ephy-shell.c | 33 +++++++++++++++++++++++++--------
src/ephy-shell.h | 2 ++
src/ephy-sync-crypto.h | 4 ++--
src/ephy-sync-window.c | 1 -
src/window-commands.c | 2 +-
5 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 1ff420f..14c7c8c 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -50,6 +50,7 @@ struct _EphyShell {
EphyEmbedShell parent_instance;
EphySession *session;
+ EphySyncService *global_sync_service;
GList *windows;
GObject *lockdown;
EphyBookmarks *bookmarks;
@@ -191,7 +192,7 @@ show_sync (GSimpleAction *action,
{
GtkWindow *window;
- printf ("[%s:%d, %s]\n", __FILE__, __LINE__, __func__);
+LOG ("%s:%d", __func__, __LINE__);
window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
@@ -814,6 +815,26 @@ ephy_shell_get_bookmarks_editor (EphyShell *shell)
}
/**
+ * ephy_shell_get_global_sync_service:
+ *
+ * Return value: (transfer none):
+ **/
+GObject *
+ephy_shell_get_global_sync_service (EphyShell *shell)
+{
+ g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
+
+ if (shell->global_sync_service == NULL) {
+LOG ("%s:%d", __func__, __LINE__);
+ shell->global_sync_service = ephy_sync_service_new ();
+ g_return_val_if_fail (shell->global_sync_service, NULL);
+ }
+
+LOG ("%s:%d", __func__, __LINE__);
+ return G_OBJECT (shell->global_sync_service);
+}
+
+/**
* ephy_shell_get_history_window:
*
* Return value: (transfer none):
@@ -842,16 +863,11 @@ ephy_shell_get_history_window (EphyShell *shell)
GtkWidget *
ephy_shell_get_sync_window (EphyShell *shell)
{
- EphyEmbedShell *embed_shell;
EphySyncService *sync_service;
- printf ("[%s:%d, %s]\n", __FILE__, __LINE__, __func__);
-
- embed_shell = ephy_embed_shell_get_default ();
- embed_shell = embed_shell; // suppress warnings
-
if (shell->sync_window == NULL) {
- sync_service = ephy_sync_service_new ();
+LOG ("%s:%d", __func__, __LINE__);
+ sync_service = EPHY_SYNC_SERVICE (ephy_shell_get_global_sync_service (shell));
shell->sync_window = ephy_sync_window_new (sync_service);
g_signal_connect (shell->sync_window,
"destroy",
@@ -859,6 +875,7 @@ ephy_shell_get_sync_window (EphyShell *shell)
&shell->sync_window);
}
+LOG ("%s:%d", __func__, __LINE__);
return shell->sync_window;
}
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index b0fe6fa..7c6b4f2 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -105,6 +105,8 @@ GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *shell);
EphyBookmarksManager *ephy_shell_get_bookmarks_manager (EphyShell *shell);
+GObject *ephy_shell_get_global_sync_service (EphyShell *shell);
+
GtkWidget *ephy_shell_get_history_window (EphyShell *shell);
GtkWidget *ephy_shell_get_sync_window (EphyShell *shell);
diff --git a/src/ephy-sync-crypto.h b/src/ephy-sync-crypto.h
index 7b4cb06..cb83395 100644
--- a/src/ephy-sync-crypto.h
+++ b/src/ephy-sync-crypto.h
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef EPHY_EMBED_UTILS_H
-#define EPHY_EMBED_UTILS_H
+#ifndef EPHY_SYNC_CRYPTO_H
+#define EPHY_SYNC_CRYPTO_H
#include <glib-object.h>
diff --git a/src/ephy-sync-window.c b/src/ephy-sync-window.c
index 7c6a257..51dc2be 100644
--- a/src/ephy-sync-window.c
+++ b/src/ephy-sync-window.c
@@ -19,7 +19,6 @@
#include "ephy-debug.h"
#include "ephy-gui.h"
#include "ephy-sync-crypto.h"
-#include "ephy-sync-service.h"
#include "ephy-sync-window.h"
#include <gtk/gtk.h>
diff --git a/src/window-commands.c b/src/window-commands.c
index 447d734..cf16fcc 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1339,7 +1339,7 @@ window_cmd_edit_sync (GtkAction *action,
{
GtkWidget *swindow;
- printf ("[%s:%d, %s]\n", __FILE__, __LINE__, __func__);
+LOG ("%s:%d", __func__, __LINE__);
swindow = ephy_shell_get_sync_window (ephy_shell_get_default ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]