[epiphany/wip/sync: 15/15] sync: Disable sync in app mode and incognito mode
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync: 15/15] sync: Disable sync in app mode and incognito mode
- Date: Fri, 2 Jun 2017 17:19:53 +0000 (UTC)
commit ab33223bbd8ed2650d2df17d81acea388b28c7c1
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Fri Jun 2 18:20:09 2017 +0300
sync: Disable sync in app mode and incognito mode
src/ephy-shell.c | 26 ++++++++++++++------------
src/prefs-dialog.c | 16 +++++++++++++---
src/resources/gtk/prefs-dialog.ui | 2 +-
3 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 894a017..121f527 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -345,19 +345,18 @@ ephy_shell_startup (GApplication *application)
"reopen-closed-tab"),
"enabled",
G_BINDING_SYNC_CREATE);
- }
- /* Create the sync service and register synchronizable managers. */
- ephy_shell->sync_service = ephy_sync_service_new (TRUE);
- if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_BOOKMARKS_ENABLED))
- ephy_sync_service_register_manager (ephy_shell->sync_service,
- EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_bookmarks_manager
(ephy_shell)));
- if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_PASSWORDS_ENABLED))
- ephy_sync_service_register_manager (ephy_shell->sync_service,
- EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_password_manager
(ephy_shell)));
- if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_HISTORY_ENABLED))
- ephy_sync_service_register_manager (ephy_shell->sync_service,
- EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_history_manager
(ephy_shell)));
+ /* Register the synchronizable managers. */
+ if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_BOOKMARKS_ENABLED))
+ ephy_sync_service_register_manager (ephy_shell_get_sync_service (ephy_shell),
+ EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_bookmarks_manager
(ephy_shell)));
+ if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_PASSWORDS_ENABLED))
+ ephy_sync_service_register_manager (ephy_shell_get_sync_service (ephy_shell),
+ EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_password_manager
(ephy_shell)));
+ if (g_settings_get_boolean (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_HISTORY_ENABLED))
+ ephy_sync_service_register_manager (ephy_shell_get_sync_service (ephy_shell),
+ EPHY_SYNCHRONIZABLE_MANAGER (ephy_shell_get_history_manager
(ephy_shell)));
+ }
gtk_application_set_app_menu (GTK_APPLICATION (application),
G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
@@ -793,6 +792,9 @@ ephy_shell_get_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 (TRUE);
+
return shell->sync_service;
}
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 1734790..b8802b7 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -62,6 +62,8 @@ enum {
struct _PrefsDialog {
GtkDialog parent_instance;
+ GtkWidget *notebook;
+
/* general */
GtkWidget *homepage_box;
GtkWidget *new_tab_homepage_radiobutton;
@@ -166,8 +168,10 @@ prefs_dialog_finalize (GObject *object)
g_object_unref (dialog->fxa_manager);
}
- if (ephy_sync_service_is_signed_in (dialog->sync_service) && !dialog->sync_was_signed_in)
- ephy_sync_service_start_periodical_sync (dialog->sync_service);
+ if (dialog->sync_service != NULL) {
+ if (ephy_sync_service_is_signed_in (dialog->sync_service) && !dialog->sync_was_signed_in)
+ ephy_sync_service_start_periodical_sync (dialog->sync_service);
+ }
G_OBJECT_CLASS (prefs_dialog_parent_class)->finalize (object);
}
@@ -597,6 +601,9 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/epiphany/gtk/prefs-dialog.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, PrefsDialog, notebook);
+
/* general */
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, homepage_box);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, new_tab_homepage_radiobutton);
@@ -1797,7 +1804,10 @@ prefs_dialog_init (PrefsDialog *dialog)
setup_fonts_page (dialog);
setup_stored_data_page (dialog);
setup_language_page (dialog);
- if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION)
+
+ if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION || mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+ gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1);
+ else
setup_sync_page (dialog);
ephy_gui_ensure_window_group (GTK_WINDOW (dialog));
diff --git a/src/resources/gtk/prefs-dialog.ui b/src/resources/gtk/prefs-dialog.ui
index db6911f..1db23d1 100644
--- a/src/resources/gtk/prefs-dialog.ui
+++ b/src/resources/gtk/prefs-dialog.ui
@@ -21,7 +21,7 @@
<property name="spacing">2</property>
<property name="border_width">0</property>
<child>
- <object class="GtkNotebook">
+ <object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="show_border">False</property>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]