[epiphany/wip/sync: 19/22] Remove --enable-firefox-sync flag



commit 551a8cdefe62c0c27e44cc73e4e2a0e42ae5408d
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Tue Apr 25 15:44:35 2017 +0300

    Remove --enable-firefox-sync flag

 configure.ac                                  |   17 +----------
 src/Makefile.am                               |    6 +---
 src/bookmarks/ephy-bookmark-properties-grid.c |    9 +-----
 src/bookmarks/ephy-bookmark.c                 |   31 +-------------------
 src/bookmarks/ephy-bookmark.h                 |    2 -
 src/ephy-shell.c                              |   15 +---------
 src/ephy-shell.h                              |    7 +----
 src/prefs-dialog.c                            |   38 +++---------------------
 8 files changed, 13 insertions(+), 112 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 674fc23..cc4ffe1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,12 +108,14 @@ PKG_CHECK_MODULES([GNOME_DESKTOP], [gnome-desktop-3.0 >= 2.91.2])
 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQUIRED])
 PKG_CHECK_MODULES([GTK_UNIX_PRINT], [gtk+-unix-print-3.0 >= $GTK_REQUIRED])
 PKG_CHECK_MODULES([ICU_UC], [icu-uc >= 4.6])
+PKG_CHECK_MODULES([HOGWEED], [hogweed >= 3.2])
 PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0 >= 1.2.0])
 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= 0.5.1])
 PKG_CHECK_MODULES([LIBSECRET], [libsecret-1 >= 0.14])
 PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.48.0])
 PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.12])
 PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.1.7])
+PKG_CHECK_MODULES([NETTLE], [nettle >= 3.2])
 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.0])
 PKG_CHECK_MODULES([WEBKIT2GTK], [webkit2gtk-4.0 >= $WEBKITGTK_REQUIRED])
 PKG_CHECK_MODULES([WEBKIT2GTK_WEB_EXTENSION], [webkit2gtk-web-extension-4.0 >= $WEBKITGTK_REQUIRED])
@@ -133,20 +135,6 @@ AS_IF([test "x$with_libhttpseverywhere" = "xyes"],
         AC_DEFINE([HAVE_LIBHTTPSEVERYWHERE], [1], [Define if libhttpseverywhere is available])]
 )
 
-# Firefox sync is not quite ready yet either.
-AC_ARG_ENABLE([firefox-sync],
-       [AS_HELP_STRING([--enable-firefox-sync], [Enable experimental Firefox Sync support])],
-       [],
-       [enable_firefox_sync=no]
-)
-AS_IF([test "x$enable_firefox_sync" = "xyes"],
-       [PKG_CHECK_MODULES([HOGWEED], [hogweed >= 3.2])
-        PKG_CHECK_MODULES([NETTLE], [nettle >= 3.2])
-        AC_DEFINE([ENABLE_SYNC], [1], [Define if Firefox Sync support is enabled])]
-)
-
-AM_CONDITIONAL([ENABLE_SYNC], [test "x$enable_firefox_sync" = "xyes"])
-
 # ******************
 # Portability checks
 # ******************
@@ -248,5 +236,4 @@ Epiphany was configured with the following options:
        Build tests                : $enable_tests
        Code coverage              : $enable_code_coverage
        HTTPS Everywhere (unstable): $with_libhttpseverywhere
-       Firefox Sync (unstable)    : $enable_firefox_sync
 "
diff --git a/src/Makefile.am b/src/Makefile.am
index aab514a..8cafe93 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,10 +72,7 @@ libephymain_la_SOURCES = \
        prefs-dialog.c                          \
        prefs-dialog.h                          \
        window-commands.c                       \
-       window-commands.h
-
-if ENABLE_SYNC
-libephymain_la_SOURCES += \
+       window-commands.h                       \
        sync/ephy-sync-crypto.c                 \
        sync/ephy-sync-crypto.h                 \
        sync/ephy-sync-secret.c                 \
@@ -84,7 +81,6 @@ libephymain_la_SOURCES += \
        sync/ephy-sync-service.h                \
        sync/ephy-sync-utils.c                  \
        sync/ephy-sync-utils.h
-endif
 
 nodist_libephymain_la_SOURCES = \
        $(TYPES_SOURCE)
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties-grid.c
index a7b5c7a..8b6b7cb 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.c
+++ b/src/bookmarks/ephy-bookmark-properties-grid.c
@@ -25,6 +25,7 @@
 #include "ephy-bookmarks-manager.h"
 #include "ephy-debug.h"
 #include "ephy-shell.h"
+#include "ephy-sync-service.h"
 #include "ephy-type-builtins.h"
 #include "ephy-uri-helpers.h"
 
@@ -32,10 +33,6 @@
 #include <libsoup/soup.h>
 #include <string.h>
 
-#ifdef ENABLE_SYNC
-#include "ephy-sync-service.h"
-#endif
-
 struct _EphyBookmarkPropertiesGrid {
   GtkGrid                         parent_instance;
 
@@ -245,17 +242,13 @@ ephy_bookmarks_properties_grid_actions_remove_bookmark (GSimpleAction *action,
                                                         GVariant      *value,
                                                         gpointer       user_data)
 {
-#ifdef ENABLE_SYNC
   EphySyncService *service;
-#endif
   EphyBookmarkPropertiesGrid *self = user_data;
 
   g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
 
-#ifdef ENABLE_SYNC
   service = ephy_shell_get_sync_service (ephy_shell_get_default ());
   ephy_sync_service_delete_bookmark (service, self->bookmark, FALSE);
-#endif
   ephy_bookmarks_manager_remove_bookmark (self->manager,  self->bookmark);
 
   if (self->type == EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG)
diff --git a/src/bookmarks/ephy-bookmark.c b/src/bookmarks/ephy-bookmark.c
index ff0239b..6b19dae 100644
--- a/src/bookmarks/ephy-bookmark.c
+++ b/src/bookmarks/ephy-bookmark.c
@@ -23,13 +23,10 @@
 #include "ephy-bookmark.h"
 
 #include "ephy-shell.h"
-
-#include <string.h>
-
-#ifdef ENABLE_SYNC
 #include "ephy-sync-crypto.h"
 #include "ephy-sync-utils.h"
-#endif
+
+#include <string.h>
 
 #define ID_LEN 32
 
@@ -204,30 +201,8 @@ ephy_bookmark_class_init (EphyBookmarkClass *klass)
 static void
 ephy_bookmark_init (EphyBookmark *self)
 {
-#ifdef ENABLE_SYNC
   self->id = g_malloc0 (ID_LEN + 1);
   ephy_sync_crypto_random_hex_gen (NULL, ID_LEN, (guint8 *)self->id);
-#else
-  static const char hex_digits[] = "0123456789abcdef";
-  FILE *fp;
-  gsize num_bytes;
-  guint8 *bytes;
-
-  num_bytes = (ID_LEN + 1) / 2;
-  bytes = g_malloc (num_bytes);
-
-  fp = fopen ("/dev/urandom", "r");
-  fread (bytes, sizeof (guint8), num_bytes, fp);
-
-  self->id = g_malloc0 (ID_LEN + 1);
-  for (gsize i = 0; i < num_bytes; i++) {
-    self->id[2 * i] = hex_digits[bytes[i] >> 4];
-    self->id[2 * i + 1] = hex_digits[bytes[i] & 0xf];
-  }
-
-  g_free (bytes);
-  fclose (fp);
-#endif
 }
 
 static JsonNode *
@@ -542,7 +517,6 @@ ephy_bookmark_tags_compare (const char *tag1, const char *tag2)
   return result;
 }
 
-#ifdef ENABLE_SYNC
 char *
 ephy_bookmark_to_bso (EphyBookmark *self)
 {
@@ -630,4 +604,3 @@ out:
 
   return bookmark;
 }
-#endif
diff --git a/src/bookmarks/ephy-bookmark.h b/src/bookmarks/ephy-bookmark.h
index 1f49f04..9e950d9 100644
--- a/src/bookmarks/ephy-bookmark.h
+++ b/src/bookmarks/ephy-bookmark.h
@@ -70,9 +70,7 @@ int                  ephy_bookmark_bookmarks_compare_func   (EphyBookmark *bookm
 int                  ephy_bookmark_tags_compare          (const char *tag1,
                                                           const char *tag2);
 
-#ifdef ENABLE_SYNC
 char                *ephy_bookmark_to_bso                (EphyBookmark *self);
 EphyBookmark        *ephy_bookmark_from_bso              (JsonObject *bso);
-#endif
 
 G_END_DECLS
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index decc08b..0b40e4b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -32,6 +32,7 @@
 #include "ephy-header-bar.h"
 #include "ephy-history-dialog.h"
 #include "ephy-lockdown.h"
+#include "ephy-notification.h"
 #include "ephy-prefs.h"
 #include "ephy-session.h"
 #include "ephy-settings.h"
@@ -47,17 +48,11 @@
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
-#ifdef ENABLE_SYNC
-#include "ephy-notification.h"
-#endif
-
 struct _EphyShell {
   EphyEmbedShell parent_instance;
 
   EphySession *session;
-#ifdef ENABLE_SYNC
   EphySyncService *sync_service;
-#endif
   GList *windows;
   GObject *lockdown;
   EphyBookmarksManager *bookmarks_manager;
@@ -312,7 +307,6 @@ download_started_cb (WebKitWebContext *web_context,
   g_object_unref (ephy_download);
 }
 
-#ifdef ENABLE_SYNC
 static void
 sync_tokens_load_finished_cb (EphySyncService *service,
                               GError          *error,
@@ -333,7 +327,6 @@ sync_tokens_load_finished_cb (EphySyncService *service,
     ephy_notification_show (notification);
   }
 }
-#endif
 
 static void
 ephy_shell_startup (GApplication *application)
@@ -373,13 +366,11 @@ ephy_shell_startup (GApplication *application)
                               G_BINDING_SYNC_CREATE);
     }
 
-#ifdef ENABLE_SYNC
     /* Create the sync service. */
     ephy_shell->sync_service = ephy_sync_service_new ();
     g_signal_connect (ephy_shell->sync_service,
                       "sync-tokens-load-finished",
                       G_CALLBACK (sync_tokens_load_finished_cb), NULL);
-#endif
 
     gtk_application_set_app_menu (GTK_APPLICATION (application),
                                   G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
@@ -647,9 +638,7 @@ ephy_shell_dispose (GObject *object)
   g_clear_pointer (&shell->history_dialog, gtk_widget_destroy);
   g_clear_object (&shell->prefs_dialog);
   g_clear_object (&shell->network_monitor);
-#ifdef ENABLE_SYNC
   g_clear_object (&shell->sync_service);
-#endif
   g_clear_object (&shell->bookmarks_manager);
 
   g_slist_free_full (shell->open_uris_idle_ids, remove_open_uris_idle_cb);
@@ -802,7 +791,6 @@ ephy_shell_get_session (EphyShell *shell)
   return shell->session;
 }
 
-#ifdef ENABLE_SYNC
 /**
  * ephy_shell_get_sync_service:
  * @shell: the #EphyShell
@@ -818,7 +806,6 @@ ephy_shell_get_sync_service (EphyShell *shell)
 
   return shell->sync_service;
 }
-#endif
 
 /**
  * ephy_shell_get_bookmarks_manager:
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 9e86fa6..bd79449 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -26,16 +26,13 @@
 #include "ephy-embed-shell.h"
 #include "ephy-embed.h"
 #include "ephy-session.h"
+#include "ephy-sync-service.h"
 #include "ephy-window.h"
 
 #include <webkit2/webkit2.h>
 #include <glib-object.h>
 #include <glib.h>
 
-#ifdef ENABLE_SYNC
-#include "ephy-sync-service.h"
-#endif
-
 G_BEGIN_DECLS
 
 #define EPHY_TYPE_SHELL (ephy_shell_get_type ())
@@ -105,9 +102,7 @@ GNetworkMonitor *ephy_shell_get_net_monitor              (EphyShell *shell);
 
 EphyBookmarksManager *ephy_shell_get_bookmarks_manager   (EphyShell *shell);
 
-#ifdef ENABLE_SYNC
 EphySyncService *ephy_shell_get_sync_service             (EphyShell *shell);
-#endif
 
 GtkWidget       *ephy_shell_get_history_dialog           (EphyShell *shell);
 
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 6151d70..e9d5410 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -38,6 +38,9 @@
 #include "ephy-settings.h"
 #include "ephy-shell.h"
 #include "ephy-string.h"
+#include "ephy-sync-crypto.h"
+#include "ephy-sync-secret.h"
+#include "ephy-sync-service.h"
 #include "ephy-uri-tester-shared.h"
 #include "clear-data-dialog.h"
 #include "cookies-dialog.h"
@@ -50,12 +53,6 @@
 #include <json-glib/json-glib.h>
 #include <string.h>
 
-#ifdef ENABLE_SYNC
-#include "ephy-sync-crypto.h"
-#include "ephy-sync-secret.h"
-#include "ephy-sync-service.h"
-#endif
-
 #define DOWNLOAD_BUTTON_WIDTH   8
 #define FXA_IFRAME_URL "https://accounts.firefox.com/signin?service=sync&context=fx_ios_v1";
 
@@ -115,7 +112,6 @@ struct _PrefsDialog {
   GHashTable *iso_639_table;
   GHashTable *iso_3166_table;
 
-#ifdef ENABLE_SYNC
   /* sync */
   GtkWidget *sync_authenticate_box;
   GtkWidget *sync_sign_in_box;
@@ -128,11 +124,8 @@ struct _PrefsDialog {
   WebKitUserContentManager *fxa_manager;
   WebKitUserScript *fxa_script;
   guint fxa_id;
-#endif
-  GtkWidget *notebook;
 };
 
-#ifdef ENABLE_SYNC
 typedef struct {
   PrefsDialog *dialog;
   char        *email;
@@ -145,7 +138,6 @@ typedef struct {
   guint8      *respHMACkey;
   guint8      *respXORkey;
 } FxACallbackData;
-#endif
 
 enum {
   COL_TITLE_ELIDED,
@@ -155,7 +147,6 @@ enum {
 
 G_DEFINE_TYPE (PrefsDialog, prefs_dialog, GTK_TYPE_DIALOG)
 
-#ifdef ENABLE_SYNC
 static FxACallbackData *
 fxa_callback_data_new (PrefsDialog *dialog,
                        const char  *email,
@@ -206,7 +197,6 @@ fxa_callback_data_free (FxACallbackData *data)
 
   g_slice_free (FxACallbackData, data);
 }
-#endif
 
 static void
 prefs_dialog_finalize (GObject *object)
@@ -224,7 +214,6 @@ prefs_dialog_finalize (GObject *object)
   g_hash_table_destroy (dialog->iso_639_table);
   g_hash_table_destroy (dialog->iso_3166_table);
 
-#ifdef ENABLE_SYNC
   if (dialog->fxa_web_view != NULL) {
     webkit_user_content_manager_unregister_script_message_handler (dialog->fxa_manager,
                                                                    "accountsCommandHandler");
@@ -236,12 +225,10 @@ prefs_dialog_finalize (GObject *object)
     g_source_remove (dialog->fxa_id);
     dialog->fxa_id = 0;
   }
-#endif
 
   G_OBJECT_CLASS (prefs_dialog_parent_class)->finalize (object);
 }
 
-#ifdef ENABLE_SYNC
 static void
 hide_fxa_iframe (PrefsDialog *dialog,
                  const char  *email)
@@ -546,7 +533,6 @@ on_sync_sign_out_button_clicked (GtkWidget   *button,
                       TRUE, TRUE, 0);
   gtk_widget_set_visible (dialog->sync_sign_in_details, FALSE);
 }
-#endif
 
 static void
 on_manage_cookies_button_clicked (GtkWidget   *button,
@@ -638,7 +624,6 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, lang_down_button);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_spell_checking_checkbutton);
 
-#ifdef ENABLE_SYNC
   /* sync */
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_authenticate_box);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_sign_in_box);
@@ -646,12 +631,11 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_sign_out_box);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_sign_out_details);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_sign_out_button);
-#endif
-  gtk_widget_class_bind_template_child (widget_class, PrefsDialog, notebook);
 
   gtk_widget_class_bind_template_callback (widget_class, on_manage_cookies_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, on_manage_passwords_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, on_search_engine_dialog_button_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, on_sync_sign_out_button_clicked);
 }
 
 static void
@@ -1632,7 +1616,6 @@ setup_language_page (PrefsDialog *dialog)
   create_language_section (dialog);
 }
 
-#ifdef ENABLE_SYNC
 static void
 setup_sync_page (PrefsDialog *dialog)
 {
@@ -1663,7 +1646,6 @@ setup_sync_page (PrefsDialog *dialog)
                            G_CALLBACK (sync_tokens_store_finished_cb),
                            dialog, 0);
 }
-#endif
 
 static void
 prefs_dialog_init (PrefsDialog *dialog)
@@ -1688,19 +1670,9 @@ prefs_dialog_init (PrefsDialog *dialog)
   setup_fonts_page (dialog);
   setup_stored_data_page (dialog);
   setup_language_page (dialog);
-#ifdef ENABLE_SYNC
-  if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION) {
+  if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION)
     setup_sync_page (dialog);
 
-    /* TODO: Switch back to using a template callback in class_init once sync is unconditionally enabled. */
-    g_signal_connect (dialog->sync_sign_out_button, "clicked",
-                      G_CALLBACK (on_sync_sign_out_button_clicked), dialog);
-  } else
-    gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1);
-#else
-  gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1);
-#endif
-
   ephy_gui_ensure_window_group (GTK_WINDOW (dialog));
   g_signal_connect (dialog, "response",
                     G_CALLBACK (prefs_dialog_response_cb), dialog);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]