diff options
author | Gabriel Ivascu <ivascu.gabriel59@gmail.com> | 2017-07-31 13:06:00 +0300 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@igalia.com> | 2017-08-06 09:28:09 -0500 |
commit | dd0ace0aa1914eb48b963a955f57e3845e8c42c4 (patch) | |
tree | cecc8e82d7b7db981a36ce8a83f824bbc018406d | |
parent | 2e0a15b06efe1a7efdd91e330726c8b95cbc848c (diff) | |
download | epiphany-dd0ace0aa1914eb48b963a955f57e3845e8c42c4.tar.gz |
sync: Fix issues pointed in the code review
-rw-r--r-- | embed/ephy-about-handler.c | 3 | ||||
-rw-r--r-- | embed/ephy-embed-utils.c | 2 | ||||
-rw-r--r-- | embed/ephy-embed-utils.h | 3 | ||||
-rw-r--r-- | embed/ephy-embed.c | 3 | ||||
-rw-r--r-- | lib/ephy-sync-utils.c | 7 | ||||
-rw-r--r-- | lib/sync/ephy-history-manager.c | 3 | ||||
-rw-r--r-- | lib/sync/ephy-history-record.c | 4 | ||||
-rw-r--r-- | lib/sync/ephy-open-tabs-manager.c | 3 | ||||
-rw-r--r-- | lib/sync/ephy-sync-service.c | 17 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/bookmarks/ephy-add-bookmark-popover.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark.h | 7 | ||||
-rw-r--r-- | src/passwords-dialog.c | 3 | ||||
-rw-r--r-- | src/prefs-dialog.c | 6 | ||||
-rw-r--r-- | src/profile-migrator/ephy-profile-migrator.c | 2 | ||||
-rw-r--r-- | src/synced-tabs-dialog.c | 3 |
16 files changed, 38 insertions, 31 deletions
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c index 9e12c1996..fc550fb2c 100644 --- a/embed/ephy-about-handler.c +++ b/embed/ephy-about-handler.c @@ -23,6 +23,7 @@ #include "ephy-embed-shell.h" #include "ephy-embed-prefs.h" +#include "ephy-embed-utils.h" #include "ephy-file-helpers.h" #include "ephy-history-service.h" #include "ephy-prefs.h" @@ -454,7 +455,7 @@ history_service_query_urls_cb (EphyHistoryService *history, "<body>\n", lang, lang, ((gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) ? "rtl" : "ltr"), - _("Most Visited")); + _(OVERVIEW_PAGE_TITLE)); g_free (lang); if (g_list_length (urls) == 0 || !success) { diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index 2da1f5c40..83e6065b8 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -341,7 +341,7 @@ ephy_embed_utils_get_title_from_address (const char *address) if (!strcmp (address, EPHY_ABOUT_SCHEME ":overview") || !strcmp (address, "about:overview")) - return g_strdup (_("Most Visited")); + return g_strdup (_(OVERVIEW_PAGE_TITLE)); return ephy_string_get_host_name (address); } diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h index 6dd989261..322487610 100644 --- a/embed/ephy-embed-utils.h +++ b/embed/ephy-embed-utils.h @@ -28,6 +28,9 @@ G_BEGIN_DECLS +#define BLANK_PAGE_TITLE N_("Blank page") /* Title for the blank page */ +#define OVERVIEW_PAGE_TITLE N_("Most Visited") /* Title for the overview page */ + #define EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED(embed) (WEBKIT_WEB_VIEW (ephy_embed_get_web_view (embed))) #define EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW(view) (EPHY_EMBED (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent ((GTK_WIDGET (view))))))) diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index c77de682d..355da7200 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -46,7 +46,6 @@ static void ephy_embed_restored_window_cb (EphyEmbedShell *shell, #define EPHY_EMBED_STATUSBAR_TAB_MESSAGE_CONTEXT_DESCRIPTION "tab_message" #define MAX_TITLE_LENGTH 512 /* characters */ -#define EMPTY_PAGE_TITLE _("Blank page") /* Title for the empty page */ typedef struct { gchar *text; @@ -263,7 +262,7 @@ ephy_embed_set_title (EphyEmbed *embed, if (new_title == NULL || new_title[0] == '\0') { g_free (new_title); - new_title = g_strdup (EMPTY_PAGE_TITLE); + new_title = g_strdup (_(BLANK_PAGE_TITLE)); } } diff --git a/lib/ephy-sync-utils.c b/lib/ephy-sync-utils.c index 894d4b83c..f212971a0 100644 --- a/lib/ephy-sync-utils.c +++ b/lib/ephy-sync-utils.c @@ -84,7 +84,10 @@ base64_to_base64_urlsafe (char *text) { g_assert (text); - /* Replace '+' with '-' and '/' with '_' */ + /* / and + are inappropriate for URLs and file systems paths, so they have to + * be omitted to make the base64 string safe. / is replaced with _ and + is + * replaced with -. + */ g_strcanon (text, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=/", '-'); g_strcanon (text, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=-", '_'); } @@ -265,7 +268,7 @@ ephy_sync_utils_get_device_name (void) name = g_settings_get_string (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_DEVICE_NAME); if (!g_strcmp0 (name, "")) { g_free (name); - name = g_strdup_printf ("%s's Epiphany on %s", + name = g_strdup_printf ("%s's GNOME Web on %s", g_get_user_name (), g_get_host_name ()); } diff --git a/lib/sync/ephy-history-manager.c b/lib/sync/ephy-history-manager.c index 1fb439d1f..b3a8da7f8 100644 --- a/lib/sync/ephy-history-manager.c +++ b/lib/sync/ephy-history-manager.c @@ -118,7 +118,8 @@ ephy_history_manager_set_property (GObject *object, switch (prop_id) { case PROP_HISTORY_SERVICE: - g_clear_object (&self->service); + if (self->service) + g_object_unref (self->service); self->service = g_object_ref (g_value_get_object (value)); break; default: diff --git a/lib/sync/ephy-history-record.c b/lib/sync/ephy-history-record.c index 93287f674..b0027d7cb 100644 --- a/lib/sync/ephy-history-record.c +++ b/lib/sync/ephy-history-record.c @@ -156,7 +156,9 @@ ephy_history_record_finalize (GObject *object) g_free (self->id); g_free (self->title); g_free (self->uri); - g_sequence_free (self->visits); + + if (self->visits) + g_sequence_free (self->visits); G_OBJECT_CLASS (ephy_history_record_parent_class)->finalize (object); } diff --git a/lib/sync/ephy-open-tabs-manager.c b/lib/sync/ephy-open-tabs-manager.c index 882617d73..9ed8aba66 100644 --- a/lib/sync/ephy-open-tabs-manager.c +++ b/lib/sync/ephy-open-tabs-manager.c @@ -23,6 +23,7 @@ #include "ephy-embed-container.h" #include "ephy-embed-shell.h" +#include "ephy-embed-utils.h" #include "ephy-settings.h" #include "ephy-sync-utils.h" #include "ephy-synchronizable-manager.h" @@ -99,7 +100,7 @@ ephy_open_tabs_manager_get_local_tabs (EphyOpenTabsManager *self) for (GList *t = tabs; t && t->data; t = t->next) { title = ephy_embed_get_title (t->data); - if (!g_strcmp0 (title, "Blank page") || !g_strcmp0 (title, "Most Visited")) + if (!g_strcmp0 (title, _(BLANK_PAGE_TITLE)) || !g_strcmp0 (title, _(OVERVIEW_PAGE_TITLE))) continue; url = ephy_web_view_get_display_address (ephy_embed_get_web_view (t->data)); diff --git a/lib/sync/ephy-sync-service.c b/lib/sync/ephy-sync-service.c index d9b88c57f..011513276 100644 --- a/lib/sync/ephy-sync-service.c +++ b/lib/sync/ephy-sync-service.c @@ -32,7 +32,7 @@ #include <json-glib/json-glib.h> #include <string.h> -#define STORAGE_VERSION 5 +#define EPHY_STORAGE_VERSION 5 struct _EphySyncService { GObject parent_instance; @@ -641,7 +641,8 @@ ephy_sync_service_forget_secrets (EphySyncService *self) g_assert (self->secrets); user = ephy_sync_utils_get_sync_user (); - g_assert (user); + g_return_if_fail (user); + attributes = secret_attributes_build (EPHY_SYNC_SECRET_SCHEMA, ACCOUNT_KEY, user, NULL); @@ -1900,7 +1901,7 @@ ephy_sync_service_upload_meta_global (EphySyncService *self) json_object_set_object_member (engines, "passwords", make_engine_object (1)); json_object_set_object_member (engines, "forms", make_engine_object (1)); json_object_set_object_member (payload, "engines", engines); - json_object_set_int_member (payload, "storageVersion", STORAGE_VERSION); + json_object_set_int_member (payload, "storageVersion", EPHY_STORAGE_VERSION); sync_id = ephy_sync_utils_get_random_sync_id (); json_object_set_string_member (payload, "syncID", sync_id); json_node_set_object (node, payload); @@ -1978,11 +1979,11 @@ verify_storage_version_cb (SoupSession *session, goto out_error; } storage_version = json_object_get_int_member (json, "storageVersion"); - if (storage_version != STORAGE_VERSION) { + if (storage_version != EPHY_STORAGE_VERSION) { /* Translators: the %d is the storage version, the \n is a newline character. */ - message = g_strdup_printf (_("Your Firefox Account uses storage version %d " - "which Epiphany does not support.\n" - "Create a new account to use the latest storage version."), + message = g_strdup_printf (_("Your Firefox Account uses storage version %d. " + "Web only supports version %d."), + EPHY_STORAGE_VERSION, storage_version); goto out_error; } @@ -2273,7 +2274,7 @@ ephy_sync_service_register_device (EphySyncService *self, g_return_if_fail (EPHY_IS_SYNC_SERVICE (self)); /* Make protocol. */ - protocol = g_strdup_printf ("1.%d", STORAGE_VERSION); + protocol = g_strdup_printf ("1.%d", EPHY_STORAGE_VERSION); array = json_array_new (); json_array_add_string_element (array, protocol); diff --git a/po/POTFILES.in b/po/POTFILES.in index f9308f092..2fb6cbfbc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -8,6 +8,7 @@ embed/ephy-download.c embed/ephy-embed.c embed/ephy-embed-shell.c embed/ephy-embed-utils.c +embed/ephy-embed-utils.h embed/ephy-encodings.c embed/ephy-find-toolbar.c embed/ephy-web-view.c diff --git a/src/bookmarks/ephy-add-bookmark-popover.c b/src/bookmarks/ephy-add-bookmark-popover.c index 2bef61167..bfe041b49 100644 --- a/src/bookmarks/ephy-add-bookmark-popover.c +++ b/src/bookmarks/ephy-add-bookmark-popover.c @@ -118,13 +118,13 @@ ephy_add_bookmark_popover_closed_cb (GtkPopover *popover, g_assert (EPHY_IS_ADD_BOOKMARK_POPOVER (popover)); + self = EPHY_ADD_BOOKMARK_POPOVER (popover); manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ()); ephy_bookmarks_manager_save_to_file_async (manager, NULL, ephy_bookmarks_manager_save_to_file_warn_on_error_cb, NULL); - self = EPHY_ADD_BOOKMARK_POPOVER (popover); g_clear_pointer (&self->address, g_free); g_clear_pointer (&self->grid, gtk_widget_destroy); } diff --git a/src/bookmarks/ephy-bookmark.h b/src/bookmarks/ephy-bookmark.h index cb96a4da2..f8504db38 100644 --- a/src/bookmarks/ephy-bookmark.h +++ b/src/bookmarks/ephy-bookmark.h @@ -33,27 +33,21 @@ EphyBookmark *ephy_bookmark_new (const char *url, const char *title, GSequence *tags, const char *id); - void ephy_bookmark_set_time_added (EphyBookmark *self, gint64 time_added); gint64 ephy_bookmark_get_time_added (EphyBookmark *self); - void ephy_bookmark_set_url (EphyBookmark *self, const char *url); const char *ephy_bookmark_get_url (EphyBookmark *self); - void ephy_bookmark_set_title (EphyBookmark *self, const char *title); const char *ephy_bookmark_get_title (EphyBookmark *self); - void ephy_bookmark_set_id (EphyBookmark *self, const char *id); const char *ephy_bookmark_get_id (EphyBookmark *self); - void ephy_bookmark_set_is_uploaded (EphyBookmark *self, gboolean uploaded); gboolean ephy_bookmark_is_uploaded (EphyBookmark *self); - void ephy_bookmark_add_tag (EphyBookmark *self, const char *tag); void ephy_bookmark_remove_tag (EphyBookmark *self, @@ -61,7 +55,6 @@ void ephy_bookmark_remove_tag (EphyBookmark *self, gboolean ephy_bookmark_has_tag (EphyBookmark *self, const char *tag); GSequence *ephy_bookmark_get_tags (EphyBookmark *self); - int ephy_bookmark_bookmarks_compare_func (EphyBookmark *bookmark1, EphyBookmark *bookmark2); int ephy_bookmark_tags_compare (const char *tag1, diff --git a/src/passwords-dialog.c b/src/passwords-dialog.c index 7bcfaae66..c5b8fbdb5 100644 --- a/src/passwords-dialog.c +++ b/src/passwords-dialog.c @@ -80,7 +80,8 @@ ephy_passwords_dialog_set_property (GObject *object, switch (prop_id) { case PROP_PASSWORD_MANAGER: - g_clear_object (&dialog->manager); + if (dialog->manager) + g_object_unref (dialog->manager); dialog->manager = g_object_ref (g_value_get_object (value)); break; default: diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index f7271ce7e..448ba3791 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1983,10 +1983,10 @@ prefs_dialog_init (PrefsDialog *dialog) setup_stored_data_page (dialog); setup_language_page (dialog); - if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION || mode == EPHY_EMBED_SHELL_MODE_INCOGNITO) - gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1); - else + if (mode == EPHY_EMBED_SHELL_MODE_BROWSER) setup_sync_page (dialog); + else + gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1); ephy_gui_ensure_window_group (GTK_WINDOW (dialog)); g_signal_connect (dialog, "response", diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c index 5666ba6a7..18a4d873f 100644 --- a/src/profile-migrator/ephy-profile-migrator.c +++ b/src/profile-migrator/ephy-profile-migrator.c @@ -1005,7 +1005,7 @@ migrate_passwords_to_firefox_sync_passwords (void) GError *error = NULL; int default_profile_migration_version; - /* Similar to the insecure passowrds migration, we want to migrate passwords + /* Similar to the insecure passwords migration, we want to migrate passwords * to Firefox Sync passwords only once since saved passwords are stored * globally and not per profile. This won't affect password lookup for web * apps because this migration only adds a couple of new fields to the diff --git a/src/synced-tabs-dialog.c b/src/synced-tabs-dialog.c index d6cd8eb1e..3176553c0 100644 --- a/src/synced-tabs-dialog.c +++ b/src/synced-tabs-dialog.c @@ -235,7 +235,8 @@ synced_tabs_dialog_set_property (GObject *object, switch (prop_id) { case PROP_OPEN_TABS_MANAGER: - g_clear_object (&dialog->manager); + if (dialog->manager) + g_object_unref (dialog->manager); dialog->manager = g_object_ref (g_value_get_object (value)); break; default: |