[epiphany/wip/sync: 3/13] meson: Remove enable_firefox_sync option
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync: 3/13] meson: Remove enable_firefox_sync option
- Date: Tue, 30 May 2017 19:30:24 +0000 (UTC)
commit 58749b87219ba186f3e9c0478fe5ac8e6a15f484
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Sat Apr 29 16:04:30 2017 +0300
meson: Remove enable_firefox_sync option
meson.build | 12 ++-----
meson_options.txt | 6 ----
src/bookmarks/ephy-bookmark-properties-grid.c | 8 +----
src/bookmarks/ephy-bookmark.c | 31 +-------------------
src/bookmarks/ephy-bookmark.h | 2 -
src/ephy-shell.c | 14 +--------
src/ephy-shell.h | 7 +----
src/meson.build | 24 +++++----------
src/prefs-dialog.c | 38 +++---------------------
9 files changed, 22 insertions(+), 120 deletions(-)
---
diff --git a/meson.build b/meson.build
index a522ea5..a100d03 100644
--- a/meson.build
+++ b/meson.build
@@ -34,7 +34,6 @@ conf.set_quoted('SOURCE_ROOT', meson.source_root())
conf.set_quoted('VERSION', meson.project_version())
conf.set10('ENABLE_NLS', true)
-conf.set10('ENABLE_FIREFOX_SYNC', get_option('enable_firefox_sync'))
conf.set10('ENABLE_HTTPS_EVERYWHERE', get_option('enable_https_everywhere'))
configure_file(
@@ -44,6 +43,7 @@ configure_file(
glib_requirement = '>= 2.46.0'
gtk_requirement = '>= 3.22.13'
+nettle_requirement = '>= 3.2'
webkitgtk_requirement = '>= 2.17.3'
cairo_dep = dependency('cairo', version: '>= 1.2')
@@ -56,6 +56,7 @@ glib_dep = dependency('glib-2.0', version: glib_requirement)
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 2.91.2')
gtk_dep = dependency('gtk+-3.0', version: gtk_requirement)
gtk_unix_print_dep = dependency('gtk+-unix-print-3.0', version: gtk_requirement)
+hogweed_dep = dependency('hogweed', version: nettle_requirement)
icu_uc_dep = dependency('icu-uc', version: '>= 4.6')
iso_codes_dep = dependency('iso-codes', version: '>= 0.35')
json_glib_dep = dependency('json-glib-1.0', version: '>= 1.2.0')
@@ -64,20 +65,15 @@ libsecret_dep = dependency('libsecret-1', version: '>= 0.14')
libsoup_dep = dependency('libsoup-2.4', version: '>= 2.48.0')
libxml_dep = dependency('libxml-2.0', version: '>= 2.6.12')
libxslt_dep = dependency('libxslt', version: '>= 1.1.7')
+nettle_dep = dependency('nettle', version: nettle_requirement)
sqlite3_dep = dependency('sqlite3', version: '>= 3.0')
webkit2gtk_dep = dependency('webkit2gtk-4.0', version: webkitgtk_requirement)
webkit2gtk_web_extension_dep = dependency('webkit2gtk-web-extension-4.0', version: webkitgtk_requirement)
cc = meson.get_compiler('c')
+gmp_dep = cc.find_library('gmp')
m_dep = cc.find_library('m', required: false)
-if get_option('enable_firefox_sync')
- nettle_requirement = '>= 3.2'
- hogweed_dep = dependency('hogweed', version: nettle_requirement)
- nettle_dep = dependency('nettle', version: nettle_requirement)
- gmp_dep = cc.find_library('gmp')
-endif
-
if get_option('enable_https_everywhere')
httpseverywhere_dep = dependency('httpseverywhere-0.2', version: '>= 0.2.2')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 82406ad..d4a415e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,12 +4,6 @@ option('distributor_name',
description: 'Distributor name displayed on process crash page'
)
-option('enable_firefox_sync',
- type: 'boolean',
- value: false,
- description: 'Enable experimental Firefox Sync support'
-)
-
option('enable_https_everywhere',
type: 'boolean',
value: false,
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties-grid.c
index 5b8d22c..b538c63 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,9 +33,6 @@
#include <libsoup/soup.h>
#include <string.h>
-#if ENABLE_FIREFOX_SYNC
-#include "ephy-sync-service.h"
-#endif
struct _EphyBookmarkPropertiesGrid {
GtkGrid parent_instance;
@@ -245,17 +243,13 @@ ephy_bookmarks_properties_grid_actions_remove_bookmark (GSimpleAction *action,
GVariant *value,
gpointer user_data)
{
-#if ENABLE_FIREFOX_SYNC
EphySyncService *service;
-#endif
EphyBookmarkPropertiesGrid *self = user_data;
g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
-#if ENABLE_FIREFOX_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 adc5b25..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>
-
-#if ENABLE_FIREFOX_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)
{
-#if ENABLE_FIREFOX_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;
}
-#if ENABLE_FIREFOX_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 6811c46..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);
-#if ENABLE_FIREFOX_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 ace9ac1..d505faf 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,12 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#if ENABLE_FIREFOX_SYNC
-#include "ephy-notification.h"
-#endif
struct _EphyShell {
EphyEmbedShell parent_instance;
EphySession *session;
-#if ENABLE_FIREFOX_SYNC
EphySyncService *sync_service;
-#endif
GList *windows;
GObject *lockdown;
EphyBookmarksManager *bookmarks_manager;
@@ -312,7 +308,6 @@ download_started_cb (WebKitWebContext *web_context,
g_object_unref (ephy_download);
}
-#if ENABLE_FIREFOX_SYNC
static void
sync_tokens_load_finished_cb (EphySyncService *service,
GError *error,
@@ -333,7 +328,6 @@ sync_tokens_load_finished_cb (EphySyncService *service,
ephy_notification_show (notification);
}
}
-#endif
static void
ephy_shell_startup (GApplication *application)
@@ -373,13 +367,11 @@ ephy_shell_startup (GApplication *application)
G_BINDING_SYNC_CREATE);
}
-#if ENABLE_FIREFOX_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 +639,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);
-#if ENABLE_FIREFOX_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 +792,6 @@ ephy_shell_get_session (EphyShell *shell)
return shell->session;
}
-#if ENABLE_FIREFOX_SYNC
/**
* ephy_shell_get_sync_service:
* @shell: the #EphyShell
@@ -818,7 +807,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 e81c074..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>
-#if ENABLE_FIREFOX_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);
-#if ENABLE_FIREFOX_SYNC
EphySyncService *ephy_shell_get_sync_service (EphyShell *shell);
-#endif
GtkWidget *ephy_shell_get_history_dialog (EphyShell *shell);
diff --git a/src/meson.build b/src/meson.build
index 208bd46..cdab0e6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -40,6 +40,10 @@ libephymain_sources = [
'passwords-dialog.c',
'popup-commands.c',
'prefs-dialog.c',
+ 'sync/ephy-sync-crypto.c',
+ 'sync/ephy-sync-secret.c',
+ 'sync/ephy-sync-service.c',
+ 'sync/ephy-sync-utils.c',
'window-commands.c',
enums
]
@@ -48,8 +52,11 @@ libephymain_deps = [
ephyembed_dep,
ephymisc_dep,
ephywidgets_dep,
+ gmp_dep,
+ hogweed_dep,
json_glib_dep,
- libnotify_dep
+ libnotify_dep,
+ nettle_dep
]
libephymain_includes = include_directories(
@@ -58,21 +65,6 @@ libephymain_includes = include_directories(
'sync'
)
-if get_option('enable_firefox_sync')
- libephymain_sources += [
- 'sync/ephy-sync-crypto.c',
- 'sync/ephy-sync-secret.c',
- 'sync/ephy-sync-service.c',
- 'sync/ephy-sync-utils.c'
- ]
-
- libephymain_deps += [
- gmp_dep,
- hogweed_dep,
- nettle_dep
- ]
-endif
-
libephymain = shared_library('ephymain',
libephymain_sources,
dependencies: libephymain_deps,
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 1d5e635..4e4e09b 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>
-#if ENABLE_FIREFOX_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_desktop_v2"
@@ -115,7 +112,6 @@ struct _PrefsDialog {
GHashTable *iso_639_table;
GHashTable *iso_3166_table;
-#if ENABLE_FIREFOX_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;
};
-#if ENABLE_FIREFOX_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)
-#if ENABLE_FIREFOX_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);
-#if ENABLE_FIREFOX_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);
}
-#if ENABLE_FIREFOX_SYNC
static void
hide_fxa_iframe (PrefsDialog *dialog,
const char *email)
@@ -561,7 +548,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,
@@ -653,7 +639,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);
-#if ENABLE_FIREFOX_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);
@@ -661,12 +646,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
@@ -1647,7 +1631,6 @@ setup_language_page (PrefsDialog *dialog)
create_language_section (dialog);
}
-#if ENABLE_FIREFOX_SYNC
static void
setup_sync_page (PrefsDialog *dialog)
{
@@ -1678,7 +1661,6 @@ setup_sync_page (PrefsDialog *dialog)
G_CALLBACK (sync_tokens_store_finished_cb),
dialog, 0);
}
-#endif
static void
prefs_dialog_init (PrefsDialog *dialog)
@@ -1703,19 +1685,9 @@ prefs_dialog_init (PrefsDialog *dialog)
setup_fonts_page (dialog);
setup_stored_data_page (dialog);
setup_language_page (dialog);
-#if ENABLE_FIREFOX_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]