Commit 72355af6 authored by Gabriel Ivascu's avatar Gabriel Ivascu

sync: Use GList instead of GSList when handling records

GList has better performance at deleting list links.
parent 32000a52
......@@ -103,14 +103,14 @@ G_DEFINE_TYPE_WITH_CODE (EphyEmbedShell, ephy_embed_shell, GTK_TYPE_APPLICATION,
G_IMPLEMENT_INTERFACE (EPHY_TYPE_TABS_CATALOG,
ephy_embed_shell_tabs_catalog_iface_init))
static GSList *
static GList *
tabs_catalog_get_tabs_info (EphyTabsCatalog *catalog)
{
EphyEmbedShell *embed_shell = EPHY_EMBED_SHELL (catalog);
WebKitFaviconDatabase *database;
GList *windows;
GList *tabs;
GSList *tabs_info = NULL;
GList *tabs_info = NULL;
const char *title;
const char *url;
char *favicon;
......@@ -130,8 +130,8 @@ tabs_catalog_get_tabs_info (EphyTabsCatalog *catalog)
url = ephy_web_view_get_display_address (ephy_embed_get_web_view (t->data));
favicon = webkit_favicon_database_get_favicon_uri (database, url);
tabs_info = g_slist_prepend (tabs_info,
ephy_tab_info_new (title, url, favicon));
tabs_info = g_list_prepend (tabs_info,
ephy_tab_info_new (title, url, favicon));
g_free (favicon);
}
......
......@@ -367,7 +367,7 @@ out:
}
static void
should_store_cb (GSList *records,
should_store_cb (GList *records,
gpointer user_data)
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
......@@ -445,7 +445,7 @@ out:
g_free (origin);
g_free (uri_string);
g_object_unref (form_auth);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
}
static gboolean
......@@ -499,7 +499,7 @@ form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
}
static void
fill_form_cb (GSList *records,
fill_form_cb (GList *records,
gpointer user_data)
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
......@@ -528,7 +528,7 @@ fill_form_cb (GSList *records,
webkit_dom_html_input_element_set_auto_filled (password_node, TRUE);
webkit_dom_html_input_element_set_editing_value (password_node, password);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
}
static void
......@@ -739,7 +739,7 @@ show_user_choices (WebKitDOMDocument *document,
WebKitDOMNode *body;
WebKitDOMElement *main_div;
WebKitDOMElement *ul;
GSList *cached_users;
GList *cached_users;
gboolean username_node_ever_edited;
double x, y;
double input_width;
......@@ -785,13 +785,13 @@ show_user_choices (WebKitDOMDocument *document,
"padding: 0;",
NULL);
cached_users = (GSList *)g_object_get_data (G_OBJECT (username_node), "ephy-cached-users");
cached_users = (GList *)g_object_get_data (G_OBJECT (username_node), "ephy-cached-users");
username_node_ever_edited =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (username_node),
"ephy-user-ever-edited"));
for (GSList *l = cached_users; l && l->data; l = l->next) {
for (GList *l = cached_users; l && l->data; l = l->next) {
const char *user = l->data;
WebKitDOMElement *li;
WebKitDOMElement *anchor;
......@@ -1111,7 +1111,7 @@ web_page_form_controls_associated (WebKitWebPage *web_page,
/* We have a field that may be the user, and one for a password. */
if (ephy_web_dom_utils_find_form_auth_elements (form, &username_node, &password_node)) {
EphyEmbedFormAuth *form_auth;
GSList *cached_users;
GList *cached_users;
const char *uri;
LOG ("Hooking and pre-filling a form");
......
......@@ -48,8 +48,8 @@ static GParamSpec *obj_properties[LAST_PROP];
typedef struct {
EphyHistoryManager *manager;
gboolean is_initial;
GSList *remotes_deleted;
GSList *remotes_updated;
GList *remotes_deleted;
GList *remotes_updated;
EphySynchronizableManagerMergeCallback callback;
gpointer user_data;
} MergeHistoryAsyncData;
......@@ -57,8 +57,8 @@ typedef struct {
static MergeHistoryAsyncData *
merge_history_async_data_new (EphyHistoryManager *manager,
gboolean is_initial,
GSList *remotes_deleted,
GSList *remotes_updated,
GList *remotes_deleted,
GList *remotes_updated,
EphySynchronizableManagerMergeCallback callback,
gpointer user_data)
{
......@@ -287,12 +287,12 @@ synchronizable_manager_save (EphySynchronizableManager *manager,
}
static EphyHistoryRecord *
get_record_by_id (GSList *records,
get_record_by_id (GList *records,
const char *id)
{
g_assert (id);
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
if (!g_strcmp0 (ephy_history_record_get_id (l->data), id))
return l->data;
}
......@@ -301,12 +301,12 @@ get_record_by_id (GSList *records,
}
static EphyHistoryRecord *
get_record_by_url (GSList *records,
get_record_by_url (GList *records,
const char *url)
{
g_assert (url);
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
if (!g_strcmp0 (ephy_history_record_get_uri (l->data), url))
return l->data;
}
......@@ -314,14 +314,14 @@ get_record_by_url (GSList *records,
return NULL;
}
static GSList *
delete_record_by_id (GSList *records,
static GList *
delete_record_by_id (GList *records,
const char *id)
{
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
if (!g_strcmp0 (ephy_history_record_get_id (l->data), id)) {
g_object_unref (l->data);
return g_slist_delete_link (records, l);
return g_list_delete_link (records, l);
}
}
......@@ -354,14 +354,14 @@ ephy_history_manager_handle_different_id_same_url (EphyHistoryManager *self,
ephy_history_record_add_visit_time (remote, local_last_visit_time);
}
static GSList *
static GList *
ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
GSList *local_records,
GSList *remote_records)
GList *local_records,
GList *remote_records)
{
EphyHistoryRecord *record;
GHashTable *dont_upload;
GSList *to_upload = NULL;
GList *to_upload = NULL;
const char *remote_id;
const char *remote_url;
gint64 remote_last_visit_time;
......@@ -377,7 +377,7 @@ ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
*/
dont_upload = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
for (GSList *l = remote_records; l && l->data; l = l->next) {
for (GList *l = remote_records; l && l->data; l = l->next) {
remote_id = ephy_history_record_get_id (l->data);
remote_url = ephy_history_record_get_uri (l->data);
remote_last_visit_time = ephy_history_record_get_last_visit_time (l->data);
......@@ -393,7 +393,7 @@ ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
EPHY_PAGE_VISIT_LINK, FALSE);
if (ephy_history_record_add_visit_time (l->data, local_last_visit_time))
to_upload = g_slist_prepend (to_upload, g_object_ref (l->data));
to_upload = g_list_prepend (to_upload, g_object_ref (l->data));
g_hash_table_add (dont_upload, g_strdup (remote_id));
} else {
......@@ -402,7 +402,7 @@ ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
/* Different ID, same URL. Keep local ID. */
g_signal_emit_by_name (self, "synchronizable-deleted", l->data);
ephy_history_manager_handle_different_id_same_url (self, record, l->data);
to_upload = g_slist_prepend (to_upload, g_object_ref (l->data));
to_upload = g_list_prepend (to_upload, g_object_ref (l->data));
g_hash_table_add (dont_upload, g_strdup (ephy_history_record_get_id (record)));
} else {
/* Different ID, different URL. This is a new record. */
......@@ -415,10 +415,10 @@ ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
}
/* Set the remaining local records to be uploaded to server. */
for (GSList *l = local_records; l && l->data; l = l->next) {
for (GList *l = local_records; l && l->data; l = l->next) {
record = EPHY_HISTORY_RECORD (l->data);
if (!g_hash_table_contains (dont_upload, ephy_history_record_get_id (record))) {
to_upload = g_slist_prepend (to_upload, g_object_ref (record));
to_upload = g_list_prepend (to_upload, g_object_ref (record));
}
}
......@@ -427,14 +427,14 @@ ephy_history_manager_handle_initial_merge (EphyHistoryManager *self,
return to_upload;
}
static GSList *
static GList *
ephy_history_manager_handle_regular_merge (EphyHistoryManager *self,
GSList **local_records,
GSList *deleted_records,
GSList *updated_records)
GList **local_records,
GList *deleted_records,
GList *updated_records)
{
EphyHistoryRecord *record;
GSList *to_upload = NULL;
GList *to_upload = NULL;
const char *remote_id;
const char *remote_url;
gint64 remote_last_visit_time;
......@@ -442,7 +442,7 @@ ephy_history_manager_handle_regular_merge (EphyHistoryManager *self,
g_assert (EPHY_IS_HISTORY_MANAGER (self));
for (GSList *l = deleted_records; l && l->data; l = l->next) {
for (GList *l = deleted_records; l && l->data; l = l->next) {
remote_id = ephy_history_record_get_id (l->data);
record = get_record_by_id (*local_records, remote_id);
if (record) {
......@@ -453,7 +453,7 @@ ephy_history_manager_handle_regular_merge (EphyHistoryManager *self,
}
/* See comment in ephy_history_manager_handle_initial_merge. */
for (GSList *l = updated_records; l && l->data; l = l->next) {
for (GList *l = updated_records; l && l->data; l = l->next) {
remote_id = ephy_history_record_get_id (l->data);
remote_url = ephy_history_record_get_uri (l->data);
remote_last_visit_time = ephy_history_record_get_last_visit_time (l->data);
......@@ -482,7 +482,7 @@ ephy_history_manager_handle_regular_merge (EphyHistoryManager *self,
/* Different ID, same URL. Keep local ID. */
g_signal_emit_by_name (self, "synchronizable-deleted", l->data);
ephy_history_manager_handle_different_id_same_url (self, record, l->data);
to_upload = g_slist_prepend (to_upload, g_object_ref (l->data));
to_upload = g_list_prepend (to_upload, g_object_ref (l->data));
} else {
/* Different ID, different URL. This is a new record. */
if (remote_last_visit_time > 0)
......@@ -502,8 +502,8 @@ merge_history_cb (EphyHistoryService *service,
GList *urls,
MergeHistoryAsyncData *data)
{
GSList *records = NULL;
GSList *to_upload = NULL;
GList *records = NULL;
GList *to_upload = NULL;
if (!success) {
g_warning ("Failed to retrieve URLs in history");
......@@ -517,10 +517,10 @@ merge_history_cb (EphyHistoryService *service,
if (!url->sync_id)
continue;
records = g_slist_prepend (records, ephy_history_record_new (url->sync_id,
url->title,
url->url,
url->last_visit_time));
records = g_list_prepend (records, ephy_history_record_new (url->sync_id,
url->title,
url->url,
url->last_visit_time));
}
if (data->is_initial)
......@@ -537,15 +537,15 @@ out:
data->callback (to_upload, TRUE, data->user_data);
g_list_free_full (urls, (GDestroyNotify)ephy_history_url_free);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
merge_history_async_data_free (data);
}
static void
synchronizable_manager_merge (EphySynchronizableManager *manager,
gboolean is_initial,
GSList *remotes_deleted,
GSList *remotes_updated,
GList *remotes_deleted,
GList *remotes_updated,
EphySynchronizableManagerMergeCallback callback,
gpointer user_data)
{
......
......@@ -32,7 +32,7 @@ struct _EphyOpenTabsManager {
/* A list of EphyOpenTabsRecord objects describing the open tabs
* of other sync clients. This is updated at every sync. */
GSList *remote_records;
GList *remote_records;
};
static void ephy_synchronizable_manager_iface_init (EphySynchronizableManagerInterface *iface);
......@@ -90,7 +90,7 @@ ephy_open_tabs_manager_finalize (GObject *object)
{
EphyOpenTabsManager *self = EPHY_OPEN_TABS_MANAGER (object);
g_slist_free_full (self->remote_records, g_object_unref);
g_list_free_full (self->remote_records, g_object_unref);
G_OBJECT_CLASS (ephy_open_tabs_manager_parent_class)->finalize (object);
}
......@@ -143,7 +143,7 @@ ephy_open_tabs_manager_get_local_tabs (EphyOpenTabsManager *self)
{
EphyOpenTabsRecord *local_tabs;
EphyTabInfo *info;
GSList *tabs_info;
GList *tabs_info;
char *id;
char *name;
......@@ -154,19 +154,19 @@ ephy_open_tabs_manager_get_local_tabs (EphyOpenTabsManager *self)
local_tabs = ephy_open_tabs_record_new (id, name);
tabs_info = ephy_tabs_catalog_get_tabs_info (self->catalog);
for (GSList *l = tabs_info; l && l->data; l = l->next) {
for (GList *l = tabs_info; l && l->data; l = l->next) {
info = (EphyTabInfo *)l->data;
ephy_open_tabs_record_add_tab (local_tabs, info->title, info->url, info->favicon);
}
g_free (id);
g_free (name);
g_slist_free_full (tabs_info, (GDestroyNotify)ephy_tab_info_free);
g_list_free_full (tabs_info, (GDestroyNotify)ephy_tab_info_free);
return local_tabs;
}
GSList *
GList *
ephy_open_tabs_manager_get_remote_tabs (EphyOpenTabsManager *self)
{
g_return_val_if_fail (EPHY_IS_OPEN_TABS_MANAGER (self), NULL);
......@@ -179,7 +179,7 @@ ephy_open_tabs_manager_clear_cache (EphyOpenTabsManager *self)
{
g_return_if_fail (EPHY_IS_OPEN_TABS_MANAGER (self));
g_slist_free_full (self->remote_records, g_object_unref);
g_list_free_full (self->remote_records, g_object_unref);
self->remote_records = NULL;
}
......@@ -250,33 +250,33 @@ synchronizable_manager_save (EphySynchronizableManager *manager,
static void
synchronizable_manager_merge (EphySynchronizableManager *manager,
gboolean is_initial,
GSList *remotes_deleted,
GSList *remotes_updated,
GList *remotes_deleted,
GList *remotes_updated,
EphySynchronizableManagerMergeCallback callback,
gpointer user_data)
{
EphyOpenTabsManager *self = EPHY_OPEN_TABS_MANAGER (manager);
EphyOpenTabsRecord *local_tabs;
GSList *to_upload = NULL;
GList *to_upload = NULL;
char *id;
id = ephy_sync_utils_get_device_id ();
g_slist_free_full (self->remote_records, g_object_unref);
g_list_free_full (self->remote_records, g_object_unref);
self->remote_records = NULL;
for (GSList *l = remotes_updated; l && l->data; l = l->next) {
for (GList *l = remotes_updated; l && l->data; l = l->next) {
/* Exclude the record which describes the local open tabs. */
if (!g_strcmp0 (id, ephy_open_tabs_record_get_id (l->data)))
continue;
self->remote_records = g_slist_prepend (self->remote_records, g_object_ref (l->data));
self->remote_records = g_list_prepend (self->remote_records, g_object_ref (l->data));
}
/* Only upload the local open tabs, we don't want to alter open tabs of
* other clients. Also, overwrite any previous value by doing a force upload.
*/
local_tabs = ephy_open_tabs_manager_get_local_tabs (self);
to_upload = g_slist_prepend (to_upload, local_tabs);
to_upload = g_list_prepend (to_upload, local_tabs);
g_free (id);
......
......@@ -33,7 +33,7 @@ G_DECLARE_FINAL_TYPE (EphyOpenTabsManager, ephy_open_tabs_manager, EPHY, OPEN_TA
EphyOpenTabsManager *ephy_open_tabs_manager_new (EphyTabsCatalog *catalog);
EphyOpenTabsRecord *ephy_open_tabs_manager_get_local_tabs (EphyOpenTabsManager *self);
GSList *ephy_open_tabs_manager_get_remote_tabs (EphyOpenTabsManager *self);
GList *ephy_open_tabs_manager_get_remote_tabs (EphyOpenTabsManager *self);
void ephy_open_tabs_manager_clear_cache (EphyOpenTabsManager *self);
G_END_DECLS
......@@ -37,7 +37,7 @@ struct _EphyOpenTabsRecord {
* @lastUsed: an integer representing the UNIX time in seconds at which the
* tab was last accessed, or 0
*/
GSList *tabs;
GList *tabs;
};
static void json_serializable_iface_init (JsonSerializableIface *iface);
......@@ -77,7 +77,7 @@ ephy_open_tabs_record_set_property (GObject *object,
self->client_name = g_strdup (g_value_get_string (value));
break;
case PROP_TABS:
g_slist_free_full (self->tabs, (GDestroyNotify)json_object_unref);
g_list_free_full (self->tabs, (GDestroyNotify)json_object_unref);
self->tabs = g_value_get_pointer (value);
break;
default:
......@@ -115,7 +115,7 @@ ephy_open_tabs_record_finalize (GObject *object)
g_free (self->id);
g_free (self->client_name);
g_slist_free_full (self->tabs, (GDestroyNotify)json_object_unref);
g_list_free_full (self->tabs, (GDestroyNotify)json_object_unref);
G_OBJECT_CLASS (ephy_open_tabs_record_parent_class)->finalize (object);
}
......@@ -181,7 +181,7 @@ ephy_open_tabs_record_get_client_name (EphyOpenTabsRecord *self)
return self->client_name;
}
GSList *
GList *
ephy_open_tabs_record_get_tabs (EphyOpenTabsRecord *self)
{
g_return_val_if_fail (EPHY_IS_OPEN_TABS_RECORD (self), NULL);
......@@ -211,7 +211,7 @@ ephy_open_tabs_record_add_tab (EphyOpenTabsRecord *self,
json_object_set_string_member (tab, "icon", favicon);
json_object_set_int_member (tab, "lastUsed", g_get_real_time () / 1000000);
self->tabs = g_slist_prepend (self->tabs, tab);
self->tabs = g_list_prepend (self->tabs, tab);
}
static JsonNode *
......@@ -244,11 +244,11 @@ serializable_deserialize_property (JsonSerializable *serializable,
{
if (!g_strcmp0 (name, "tabs")) {
JsonArray *array;
GSList *tabs = NULL;
GList *tabs = NULL;
array = json_node_get_array (node);
for (guint i = 0; i < json_array_get_length (array); i++)
tabs = g_slist_prepend (tabs, json_object_ref (json_array_get_object_element (array, i)));
tabs = g_list_prepend (tabs, json_object_ref (json_array_get_object_element (array, i)));
g_value_set_pointer (value, tabs);
......
......@@ -32,7 +32,7 @@ EphyOpenTabsRecord *ephy_open_tabs_record_new (const char *id,
const char *client_name);
const char *ephy_open_tabs_record_get_id (EphyOpenTabsRecord *self);
const char *ephy_open_tabs_record_get_client_name (EphyOpenTabsRecord *self);
GSList *ephy_open_tabs_record_get_tabs (EphyOpenTabsRecord *self);
GList *ephy_open_tabs_record_get_tabs (EphyOpenTabsRecord *self);
void ephy_open_tabs_record_add_tab (EphyOpenTabsRecord *self,
const char *title,
const char *url,
......
......@@ -78,8 +78,8 @@ typedef struct {
typedef struct {
EphyPasswordManager *manager;
gboolean is_initial;
GSList *remotes_deleted;
GSList *remotes_updated;
GList *remotes_deleted;
GList *remotes_updated;
EphySynchronizableManagerMergeCallback callback;
gpointer user_data;
} MergePasswordsAsyncData;
......@@ -131,8 +131,8 @@ update_password_async_data_free (UpdatePasswordAsyncData *data)
static MergePasswordsAsyncData *
merge_passwords_async_data_new (EphyPasswordManager *manager,
gboolean is_initial,
GSList *remotes_deleted,
GSList *remotes_updated,
GList *remotes_deleted,
GList *remotes_updated,
EphySynchronizableManagerMergeCallback callback,
gpointer user_data)
{
......@@ -230,7 +230,7 @@ ephy_password_manager_cache_clear (EphyPasswordManager *self)
g_hash_table_iter_init (&iter, self->cache);
while (g_hash_table_iter_next (&iter, &key, &value))
g_slist_free_full (value, g_free);
g_list_free_full (value, g_free);
g_hash_table_remove_all (self->cache);
}
......@@ -239,8 +239,8 @@ ephy_password_manager_cache_remove (EphyPasswordManager *self,
const char *hostname,
const char *username)
{
GSList *usernames;
GSList *new_usernames = NULL;
GList *usernames;
GList *new_usernames = NULL;
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (self->cache);
......@@ -250,12 +250,12 @@ ephy_password_manager_cache_remove (EphyPasswordManager *self,
usernames = g_hash_table_lookup (self->cache, hostname);
if (usernames) {
for (GSList *l = usernames; l && l->data; l = l->next) {
for (GList *l = usernames; l && l->data; l = l->next) {
if (g_strcmp0 (username, l->data))
new_usernames = g_slist_prepend (new_usernames, g_strdup (l->data));
new_usernames = g_list_prepend (new_usernames, g_strdup (l->data));
}
g_hash_table_replace (self->cache, g_strdup (hostname), new_usernames);
g_slist_free_full (usernames, g_free);
g_list_free_full (usernames, g_free);
}
}
......@@ -264,7 +264,7 @@ ephy_password_manager_cache_add (EphyPasswordManager *self,
const char *hostname,
const char *username)
{
GSList *usernames;
GList *usernames;
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (self->cache);
......@@ -273,21 +273,21 @@ ephy_password_manager_cache_add (EphyPasswordManager *self,
return;
usernames = g_hash_table_lookup (self->cache, hostname);
for (GSList *l = usernames; l && l->data; l = l->next) {
for (GList *l = usernames; l && l->data; l = l->next) {
if (!g_strcmp0 (username, l->data))
return;
}
usernames = g_slist_prepend (usernames, g_strdup (username));
usernames = g_list_prepend (usernames, g_strdup (username));
g_hash_table_replace (self->cache, g_strdup (hostname), usernames);
}
static void
populate_cache_cb (GSList *records,
populate_cache_cb (GList *records,
gpointer user_data)
{
EphyPasswordManager *self = EPHY_PASSWORD_MANAGER (user_data);
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
EphyPasswordRecord *record = EPHY_PASSWORD_RECORD (l->data);
const char *hostname = ephy_password_record_get_hostname (record);
const char *username = ephy_password_record_get_username (record);
......@@ -295,7 +295,7 @@ populate_cache_cb (GSList *records,
ephy_password_manager_cache_add (self, hostname, username);
}
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
}
static void
......@@ -334,11 +334,11 @@ ephy_password_manager_new (void)
return EPHY_PASSWORD_MANAGER (g_object_new (EPHY_TYPE_PASSWORD_MANAGER, NULL));
}
GSList *
GList *
ephy_password_manager_get_cached_users_for_uri (EphyPasswordManager *self,
const char *uri)
{
GSList *list;
GList *list;
char *hostname;
g_return_val_if_fail (EPHY_IS_PASSWORD_MANAGER (self), NULL);
......@@ -440,21 +440,21 @@ ephy_password_manger_store_record (EphyPasswordManager *self,
}
static void
update_password_cb (GSList *records,
update_password_cb (GList *records,
gpointer user_data)
{
UpdatePasswordAsyncData *data = (UpdatePasswordAsyncData *)user_data;
EphyPasswordRecord *record;
/* We only expect one matching record here. */
g_assert (g_slist_length (records) == 1);
g_assert (g_list_length (records) == 1);
record = EPHY_PASSWORD_RECORD (records->data);
ephy_password_record_set_password (record, data->password);
ephy_password_manger_store_record (data->manager, record);
g_signal_emit_by_name (data->manager, "synchronizable-modified", record, FALSE);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
update_password_async_data_free (data);
}
......@@ -512,7 +512,7 @@ secret_service_search_cb (SecretService *service,
QueryAsyncData *data)
{
GList *matches = NULL;
GSList *records = NULL;
GList *records = NULL;
GError *error = NULL;
matches = secret_service_search_finish (service, result, &error);
......@@ -547,7 +547,7 @@ secret_service_search_cb (SecretService *service,
sscanf (timestamp, "%lf", &server_time_modified);
ephy_synchronizable_set_server_time_modified (EPHY_SYNCHRONIZABLE (record),
server_time_modified);
records = g_slist_prepend (records, record);
records = g_list_prepend (records, record);
secret_value_unref (value);
g_hash_table_unref (attributes);
......@@ -680,20 +680,20 @@ ephy_password_manager_forget_record (EphyPasswordManager *self,
}
static void
forget_cb (GSList *records,
forget_cb (GList *records,
gpointer user_data)
{
EphyPasswordManager *self = EPHY_PASSWORD_MANAGER (user_data);
EphyPasswordRecord *record;
/* We only expect one matching record here. */
g_assert (g_slist_length (records) == 1);
g_assert (g_list_length (records) == 1);
record = EPHY_PASSWORD_RECORD (records->data);
g_signal_emit_by_name (self, "synchronizable-deleted", record);
ephy_password_manager_forget_record (self, record, NULL);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
}
void
......@@ -714,7 +714,7 @@ ephy_password_manager_forget (EphyPasswordManager *self,
}
static void
forget_all_cb (GSList *records,
forget_all_cb (GList *records,
gpointer user_data)
{
EphyPasswordManager *self = EPHY_PASSWORD_MANAGER (user_data);
......@@ -724,13 +724,13 @@ forget_all_cb (GSList *records,
secret_service_clear (NULL, EPHY_FORM_PASSWORD_SCHEMA, attributes, NULL,
(GAsyncReadyCallback)secret_service_clear_cb, NULL);
for (GSList *l = records; l && l->data; l = l->next)
for (GList *l = records; l && l->data; l = l->next)
g_signal_emit_by_name (self, "synchronizable-deleted", l->data);
ephy_password_manager_cache_clear (self);
g_hash_table_unref (attributes);
g_slist_free_full (records, g_object_unref);
g_list_free_full (records, g_object_unref);
}
void
......@@ -804,12 +804,12 @@ synchronizable_manager_remove (EphySynchronizableManager *manager,
}
static void
replace_existing_cb (GSList *records,
replace_existing_cb (GList *records,
gpointer user_data)
{
ReplaceRecordAsyncData *data = (ReplaceRecordAsyncData *)user_data;
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
/* NULL fields can cause the query to match other records too,
* so we need to make sure we have the record we've been looking for. */
if (!g_strcmp0 (ephy_password_record_get_hostname (records->data),
......@@ -855,12 +855,12 @@ synchronizable_manager_save (EphySynchronizableManager *manager,
}
static EphyPasswordRecord *
get_record_by_id (GSList *records,
get_record_by_id (GList *records,
const char *id)
{
g_assert (id);
for (GSList *l = records; l && l->data; l = l->next) {
for (GList *l = records; l && l->data; l = l->next) {
if (!g_strcmp0 (ephy_password_record_get_id (l->data), id))
return l->data;
}
......@@ -869,13 +869,13 @@ get_record_by_id (GSList *records,
}
static EphyPasswordRecord *
get_record_by_parameters (GSList *records,
get_record_by_parameters (GList *records,
const char *hostname,
const char *username,
const char *username_field,
const char *password_field)