diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-03-13 17:02:09 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-03-13 18:33:41 +0800 |
commit | 637e046e0666576c71d1efa116d8148450b35db6 (patch) | |
tree | f83df81046290bbe1cb314bcde95ef2899e21289 | |
parent | f4ed0fb98f033727eb22f62ddb3ba60424c8cc91 (diff) | |
download | gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar.gz gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar.bz2 gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar.lz gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar.xz gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.tar.zst gsoc2013-epiphany-637e046e0666576c71d1efa116d8148450b35db6.zip |
ephy-history-service: make the async API cancellable
The main purpose of the cancellable API in ephy-history-service
is to let the user notify when the results of the operation
are no longer needed and the callback call can be omitted. Since
performing a read operation, in such cases, makes no sense, we
cancel them altogether. However, given the nature of the service,
we don't cancel write operations.
https://bugzilla.gnome.org/show_bug.cgi?id=671901
-rw-r--r-- | embed/ephy-embed.c | 4 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 2 | ||||
-rw-r--r-- | lib/ephy-profile-migrator.c | 2 | ||||
-rw-r--r-- | lib/history/ephy-history-service.c | 84 | ||||
-rw-r--r-- | lib/history/ephy-history-service.h | 33 | ||||
-rw-r--r-- | src/ephy-completion-model.c | 2 | ||||
-rw-r--r-- | src/ephy-history-window.c | 10 | ||||
-rw-r--r-- | src/pdm-dialog.c | 2 | ||||
-rw-r--r-- | tests/ephy-history-test.c | 34 |
9 files changed, 105 insertions, 68 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index a58e83f50..1c7505798 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -267,7 +267,7 @@ restore_zoom_level (EphyEmbed *embed, /* restore zoom level */ if (ephy_embed_utils_address_has_web_scheme (address)) { ephy_history_service_get_host_for_url (embed->priv->history_service, - address, + address, NULL, (EphyHistoryJobCallback)get_host_for_url_cb, embed); } } @@ -365,7 +365,7 @@ zoom_changed_cb (WebKitWebView *web_view, if (ephy_embed_utils_address_has_web_scheme (address)) { ephy_history_service_set_url_zoom_level (embed->priv->history_service, address, zoom, - NULL, NULL); + NULL, NULL, NULL); } g_free (address); diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 2295e6974..5951dc2cf 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1084,7 +1084,7 @@ title_changed_cb (WebKitWebView *web_view, ephy_web_view_set_title (EPHY_WEB_VIEW (web_view), title); if (uri && title) - ephy_history_service_set_url_title (history, uri, title, NULL, NULL); + ephy_history_service_set_url_title (history, uri, title, NULL, NULL, NULL); g_free (title); diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c index 55fa8a2f8..f7a34069a 100644 --- a/lib/ephy-profile-migrator.c +++ b/lib/ephy-profile-migrator.c @@ -594,7 +594,7 @@ migrate_history () g_input_stream_close (G_INPUT_STREAM (input), NULL, NULL); g_object_unref (input); - ephy_history_service_add_visits (history_service, parse_data.visits, (EphyHistoryJobCallback)visit_cb, NULL); + ephy_history_service_add_visits (history_service, parse_data.visits, NULL, (EphyHistoryJobCallback)visit_cb, NULL); ephy_history_page_visit_list_free (parse_data.visits); while (!all_done) diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c index 3a6c3fa25..f7b468b9e 100644 --- a/lib/history/ephy-history-service.c +++ b/lib/history/ephy-history-service.c @@ -60,6 +60,7 @@ typedef struct _EphyHistoryServiceMessage { gboolean success; gpointer result; gpointer user_data; + GCancellable *cancellable; GDestroyNotify method_argument_cleanup; EphyHistoryJobCallback callback; } EphyHistoryServiceMessage; @@ -132,7 +133,7 @@ impl_visit_url (EphyHistoryService *self, const char *url) time (NULL), EPHY_PAGE_VISIT_TYPED); ephy_history_service_add_visit (self, - visit, NULL, NULL); + visit, NULL, NULL, NULL); ephy_history_page_visit_free (visit); return FALSE; @@ -390,6 +391,7 @@ ephy_history_service_message_new (EphyHistoryService *service, EphyHistoryServiceMessageType type, gpointer method_argument, GDestroyNotify method_argument_cleanup, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -399,6 +401,7 @@ ephy_history_service_message_new (EphyHistoryService *service, message->type = type; message->method_argument = method_argument; message->method_argument_cleanup = method_argument_cleanup; + message->cancellable = cancellable ? g_object_ref (cancellable) : NULL; message->callback = callback; message->user_data = user_data; @@ -411,6 +414,9 @@ ephy_history_service_message_free (EphyHistoryServiceMessage *message) if (message->method_argument_cleanup) message->method_argument_cleanup (message->method_argument); + if (message->cancellable) + g_object_unref (message->cancellable); + g_slice_free1 (sizeof (EphyHistoryServiceMessage), message); } @@ -420,6 +426,11 @@ ephy_history_service_execute_job_callback (gpointer data) EphyHistoryServiceMessage *message = (EphyHistoryServiceMessage*) data; g_assert (message->callback); + + if (g_cancellable_is_cancelled (message->cancellable)) { + ephy_history_service_message_free (message); + return FALSE; + } message->callback (message->service, message->success, message->result, message->user_data); if (message->type == CLEAR) @@ -546,7 +557,7 @@ ephy_history_service_execute_query_hosts (EphyHistoryService *self, } void -ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit *visit, EphyHistoryJobCallback callback, gpointer user_data) +ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit *visit, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryServiceMessage *message; @@ -556,12 +567,12 @@ ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit * message = ephy_history_service_message_new (self, ADD_VISIT, ephy_history_page_visit_copy (visit), (GDestroyNotify) ephy_history_page_visit_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } void -ephy_history_service_add_visits (EphyHistoryService *self, GList *visits, EphyHistoryJobCallback callback, gpointer user_data) +ephy_history_service_add_visits (EphyHistoryService *self, GList *visits, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryServiceMessage *message; @@ -571,12 +582,12 @@ ephy_history_service_add_visits (EphyHistoryService *self, GList *visits, EphyHi message = ephy_history_service_message_new (self, ADD_VISITS, ephy_history_page_visit_list_copy (visits), (GDestroyNotify) ephy_history_page_visit_list_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } void -ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from, gint64 to, EphyHistoryJobCallback callback, gpointer user_data) +ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from, gint64 to, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryQuery *query; @@ -586,12 +597,12 @@ ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from, query->from = from; query->to = to; - ephy_history_service_query_visits (self, query, callback, user_data); + ephy_history_service_query_visits (self, query, cancellable, callback, user_data); ephy_history_query_free (query); } void -ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *query, EphyHistoryJobCallback callback, gpointer user_data) +ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryServiceMessage *message; @@ -599,7 +610,7 @@ ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *q g_return_if_fail (query != NULL); message = ephy_history_service_message_new (self, QUERY_VISITS, - ephy_history_query_copy (query), (GDestroyNotify) ephy_history_query_free, callback, user_data); + ephy_history_query_copy (query), (GDestroyNotify) ephy_history_query_free, cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -614,7 +625,7 @@ ephy_history_service_execute_query_urls (EphyHistoryService *self, EphyHistoryQu } void -ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *query, EphyHistoryJobCallback callback, gpointer user_data) +ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryServiceMessage *message; @@ -622,12 +633,14 @@ ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *que g_return_if_fail (query != NULL); message = ephy_history_service_message_new (self, QUERY_URLS, - ephy_history_query_copy (query), (GDestroyNotify) ephy_history_query_free, callback, user_data); + ephy_history_query_copy (query), (GDestroyNotify) ephy_history_query_free, + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } void ephy_history_service_get_hosts (EphyHistoryService *self, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -636,7 +649,7 @@ ephy_history_service_get_hosts (EphyHistoryService *self, g_return_if_fail (EPHY_IS_HISTORY_SERVICE (self)); message = ephy_history_service_message_new (self, GET_HOSTS, - NULL, NULL, + NULL, NULL, cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -644,6 +657,7 @@ ephy_history_service_get_hosts (EphyHistoryService *self, void ephy_history_service_query_hosts (EphyHistoryService *self, EphyHistoryQuery *query, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -654,7 +668,7 @@ ephy_history_service_query_hosts (EphyHistoryService *self, message = ephy_history_service_message_new (self, QUERY_HOSTS, ephy_history_query_copy (query), (GDestroyNotify) ephy_history_query_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -682,6 +696,7 @@ void ephy_history_service_set_url_title (EphyHistoryService *self, const char *orig_url, const char *title, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -694,7 +709,7 @@ ephy_history_service_set_url_title (EphyHistoryService *self, url = ephy_history_url_new (orig_url, title, 0, 0, 0); message = ephy_history_service_message_new (self, SET_URL_TITLE, url, (GDestroyNotify) ephy_history_url_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -725,6 +740,7 @@ void ephy_history_service_set_url_zoom_level (EphyHistoryService *self, const char *url, const double zoom_level, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -738,7 +754,7 @@ ephy_history_service_set_url_zoom_level (EphyHistoryService *self, message = ephy_history_service_message_new (self, SET_URL_ZOOM_LEVEL, variant, (GDestroyNotify)g_variant_unref, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -759,6 +775,7 @@ ephy_history_service_execute_get_url (EphyHistoryService *self, void ephy_history_service_get_url (EphyHistoryService *self, const char *url, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -769,7 +786,7 @@ ephy_history_service_get_url (EphyHistoryService *self, message = ephy_history_service_message_new (self, GET_URL, g_strdup (url), g_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -791,6 +808,7 @@ ephy_history_service_execute_get_host_for_url (EphyHistoryService *self, void ephy_history_service_get_host_for_url (EphyHistoryService *self, const char *url, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -801,7 +819,7 @@ ephy_history_service_get_host_for_url (EphyHistoryService *self, message = ephy_history_service_message_new (self, GET_HOST_FOR_URL, g_strdup (url), g_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -851,6 +869,7 @@ ephy_history_service_execute_clear (EphyHistoryService *self, void ephy_history_service_delete_urls (EphyHistoryService *self, GList *urls, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -861,25 +880,27 @@ ephy_history_service_delete_urls (EphyHistoryService *self, message = ephy_history_service_message_new (self, DELETE_URLS, ephy_history_url_list_copy (urls), (GDestroyNotify)ephy_history_url_list_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } void ephy_history_service_delete_host (EphyHistoryService *self, EphyHistoryHost *host, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { EphyHistoryServiceMessage *message = ephy_history_service_message_new (self, DELETE_HOST, ephy_history_host_copy (host), (GDestroyNotify)ephy_history_host_free, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } void ephy_history_service_clear (EphyHistoryService *self, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -889,7 +910,7 @@ ephy_history_service_clear (EphyHistoryService *self, message = ephy_history_service_message_new (self, CLEAR, NULL, NULL, - callback, user_data); + cancellable, callback, user_data); ephy_history_service_send_message (self, message); } @@ -900,7 +921,7 @@ ephy_history_service_quit (EphyHistoryService *self, { EphyHistoryServiceMessage *message = ephy_history_service_message_new (self, QUIT, - NULL, NULL, + NULL, NULL, NULL, callback, user_data); ephy_history_service_send_message (self, message); } @@ -922,6 +943,12 @@ static EphyHistoryServiceMethod methods[] = { (EphyHistoryServiceMethod)ephy_history_service_execute_query_hosts }; +static gboolean +ephy_history_service_message_is_write (EphyHistoryServiceMessage *message) +{ + return message->type < QUIT; +} + static void ephy_history_service_process_message (EphyHistoryService *self, EphyHistoryServiceMessage *message) @@ -930,6 +957,12 @@ ephy_history_service_process_message (EphyHistoryService *self, g_assert (self->priv->history_thread == g_thread_self ()); + if (g_cancellable_is_cancelled (message->cancellable) && + !ephy_history_service_message_is_write (message)) { + ephy_history_service_message_free (message); + return; + } + method = methods[message->type]; message->result = NULL; message->success = method (message->service, message->method_argument, &message->result); @@ -949,6 +982,7 @@ ephy_history_service_find_urls (EphyHistoryService *self, gint64 from, gint64 to, guint limit, gint host, GList *substring_list, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -967,7 +1001,8 @@ ephy_history_service_find_urls (EphyHistoryService *self, query->limit = limit; ephy_history_service_query_urls (self, - query, callback, user_data); + query, cancellable, + callback, user_data); ephy_history_query_free (query); } @@ -986,6 +1021,7 @@ ephy_history_service_visit_url (EphyHistoryService *self, void ephy_history_service_find_hosts (EphyHistoryService *self, gint64 from, gint64 to, + GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data) { @@ -998,7 +1034,7 @@ ephy_history_service_find_hosts (EphyHistoryService *self, query->from = from; query->to = to; - ephy_history_service_query_hosts (self, - query, callback, user_data); + ephy_history_service_query_hosts (self, query, + cancellable, callback, user_data); ephy_history_query_free (query); } diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h index 8e36d6317..c2e2093db 100644 --- a/lib/history/ephy-history-service.h +++ b/lib/history/ephy-history-service.h @@ -22,6 +22,7 @@ #define EPHY_HISTORY_SERVICE_H #include <glib-object.h> +#include <gio/gio.h> #include "ephy-history-types.h" G_BEGIN_DECLS @@ -58,23 +59,23 @@ struct _EphyHistoryServiceClass { GType ephy_history_service_get_type (void); EphyHistoryService * ephy_history_service_new (const char *history_filename); -void ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit *visit, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_add_visits (EphyHistoryService *self, GList *visits, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from, gint64 to, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *query, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *query, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_set_url_title (EphyHistoryService *self, const char *url, const char *title, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_set_url_zoom_level (EphyHistoryService *self, const char *url, const double zoom_level, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_get_host_for_url (EphyHistoryService *self, const char *url, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_get_hosts (EphyHistoryService *self, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_query_hosts (EphyHistoryService *self, EphyHistoryQuery *query, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_delete_host (EphyHistoryService *self, EphyHistoryHost *host, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_get_url (EphyHistoryService *self, const char *url, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_delete_urls (EphyHistoryService *self, GList *urls, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_find_urls (EphyHistoryService *self, gint64 from, gint64 to, guint limit, gint host, GList *substring_list, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit *visit, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_add_visits (EphyHistoryService *self, GList *visits, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from, gint64 to, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_set_url_title (EphyHistoryService *self, const char *url, const char *title, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_set_url_zoom_level (EphyHistoryService *self, const char *url, const double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_get_host_for_url (EphyHistoryService *self, const char *url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_get_hosts (EphyHistoryService *self, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_query_hosts (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_delete_host (EphyHistoryService *self, EphyHistoryHost *host, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_get_url (EphyHistoryService *self, const char *url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_delete_urls (EphyHistoryService *self, GList *urls, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_find_urls (EphyHistoryService *self, gint64 from, gint64 to, guint limit, gint host, GList *substring_list, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); void ephy_history_service_visit_url (EphyHistoryService *self, const char *orig_url); -void ephy_history_service_clear (EphyHistoryService *self, EphyHistoryJobCallback callback, gpointer user_data); -void ephy_history_service_find_hosts (EphyHistoryService *self, gint64 from, gint64 to, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_clear (EphyHistoryService *self, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_history_service_find_hosts (EphyHistoryService *self, gint64 from, gint64 to, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data); G_END_DECLS diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c index ea60c2a26..e3f25bda5 100644 --- a/src/ephy-completion-model.c +++ b/src/ephy-completion-model.c @@ -491,7 +491,7 @@ ephy_completion_model_update_for_string (EphyCompletionModel *model, ephy_history_service_find_urls (priv->history_service, 0, 0, MAX_COMPLETION_HISTORY_URLS, 0, - query, + query, NULL, (EphyHistoryJobCallback)query_completed_cb, user_data); } diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 0601278c6..5ddb0cb2e 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -203,7 +203,7 @@ confirmation_dialog_response_cb (GtkWidget *dialog, if (response == GTK_RESPONSE_ACCEPT) { ephy_history_service_clear (editor->priv->history_service, - NULL, NULL); + NULL, NULL, NULL); filter_now (editor, TRUE, TRUE); } } @@ -461,13 +461,13 @@ cmd_delete (GtkAction *action, { GList *selected; selected = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view)); - ephy_history_service_delete_urls (editor->priv->history_service, selected, + ephy_history_service_delete_urls (editor->priv->history_service, selected, NULL, (EphyHistoryJobCallback)on_browse_history_deleted_cb, editor); } else if (gtk_widget_is_focus (editor->priv->hosts_view)) { EphyHistoryHost *host = get_selected_host (editor); if (host) { ephy_history_service_delete_host (editor->priv->history_service, - host, + host, NULL, (EphyHistoryJobCallback)on_host_deleted_cb, editor); ephy_history_host_free (host); @@ -1076,7 +1076,7 @@ filter_now (EphyHistoryWindow *editor, if (hosts) { ephy_history_service_find_hosts (editor->priv->history_service, - from, to, + from, to, NULL, (EphyHistoryJobCallback) on_get_hosts_cb, editor); } @@ -1086,7 +1086,7 @@ filter_now (EphyHistoryWindow *editor, ephy_history_service_find_urls (editor->priv->history_service, from, to, 0, host ? host->id : 0, - substrings, + substrings, NULL, (EphyHistoryJobCallback)on_find_urls_cb, editor); ephy_history_host_free (host); } diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 9a06c4ff4..4f0139e6d 100644 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -256,7 +256,7 @@ clear_all_dialog_response_cb (GtkDialog *dialog, shell = ephy_embed_shell_get_default (); history = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (shell)); - ephy_history_service_clear (history, NULL, NULL); + ephy_history_service_clear (history, NULL, NULL, NULL); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbuttons->checkbutton_cookies))) diff --git a/tests/ephy-history-test.c b/tests/ephy-history-test.c index b49558198..63b4a0dd7 100644 --- a/tests/ephy-history-test.c +++ b/tests/ephy-history-test.c @@ -85,7 +85,7 @@ test_create_history_entry (void) EphyHistoryService *service = ensure_empty_history (temporary_file); EphyHistoryPageVisit *visit = ephy_history_page_visit_new ("http://www.gnome.org", 0, EPHY_PAGE_VISIT_TYPED); - ephy_history_service_add_visit (service, visit, page_vist_created, NULL); + ephy_history_service_add_visit (service, visit, NULL, page_vist_created, NULL); ephy_history_page_visit_free (visit); g_free (temporary_file); @@ -148,7 +148,7 @@ verify_create_history_entry (EphyHistoryService *service, gboolean success, gpoi g_assert (result_data == NULL); g_assert_cmpint (42, ==, GPOINTER_TO_INT(user_data)); g_assert (success); - ephy_history_service_find_visits_in_time (service, 0, 8, verify_create_history_entry_cb, NULL); + ephy_history_service_find_visits_in_time (service, 0, 8, NULL, verify_create_history_entry_cb, NULL); } static void @@ -160,7 +160,7 @@ test_create_history_entries (void) GList *visits = create_test_page_visit_list (); /* We use 42 here just to verify that user_data is passed properly to the callback */ - ephy_history_service_add_visits (service, visits, verify_create_history_entry, GINT_TO_POINTER(42)); + ephy_history_service_add_visits (service, visits, NULL, verify_create_history_entry, GINT_TO_POINTER(42)); ephy_history_page_visit_list_free (visits); g_free (temporary_file); @@ -191,13 +191,13 @@ set_url_title (EphyHistoryService *service, gboolean success, gpointer result_da g_object_unref (service); gtk_main_quit (); } else - ephy_history_service_get_url (service, "http://www.gnome.org", get_url, NULL); + ephy_history_service_get_url (service, "http://www.gnome.org", NULL, get_url, NULL); } static void set_url_title_visit_created (EphyHistoryService *service, gboolean success, gpointer result_data, gpointer user_data) { - ephy_history_service_set_url_title (service, "http://www.gnome.org", "GNOME", set_url_title, user_data); + ephy_history_service_set_url_title (service, "http://www.gnome.org", "GNOME", NULL, set_url_title, user_data); } static void @@ -207,7 +207,7 @@ test_set_url_title_helper (gboolean test_results) EphyHistoryService *service = ensure_empty_history (temporary_file); EphyHistoryPageVisit *visit = ephy_history_page_visit_new ("http://www.gnome.org", 0, EPHY_PAGE_VISIT_TYPED); - ephy_history_service_add_visit (service, visit, set_url_title_visit_created, GINT_TO_POINTER (test_results)); + ephy_history_service_add_visit (service, visit, NULL, set_url_title_visit_created, GINT_TO_POINTER (test_results)); ephy_history_page_visit_free (visit); g_free (temporary_file); @@ -241,7 +241,7 @@ test_set_url_title_url_not_existent (void) EphyHistoryService *service = ensure_empty_history (temporary_file); g_free (temporary_file); - ephy_history_service_set_url_title (service, "http://www.gnome.org", "GNOME", set_url_title_url_not_existent, NULL); + ephy_history_service_set_url_title (service, "http://www.gnome.org", "GNOME", NULL, set_url_title_url_not_existent, NULL); gtk_main(); } @@ -273,7 +273,7 @@ test_get_url_visit_added (EphyHistoryService *service, gboolean success, gpointe { g_assert (success == TRUE); - ephy_history_service_get_url (service, "http://www.gnome.org", test_get_url_done, user_data); + ephy_history_service_get_url (service, "http://www.gnome.org", NULL, test_get_url_done, user_data); } static void @@ -285,10 +285,10 @@ test_get_url_helper (gboolean add_entry) if (add_entry == TRUE) { EphyHistoryPageVisit *visit = ephy_history_page_visit_new ("http://www.gnome.org", 0, EPHY_PAGE_VISIT_TYPED); - ephy_history_service_add_visit (service, visit, test_get_url_visit_added, GINT_TO_POINTER (add_entry)); + ephy_history_service_add_visit (service, visit, NULL, test_get_url_visit_added, GINT_TO_POINTER (add_entry)); ephy_history_page_visit_free (visit); } else - ephy_history_service_get_url (service, "http://www.gnome.org", test_get_url_done, GINT_TO_POINTER (add_entry)); + ephy_history_service_get_url (service, "http://www.gnome.org", NULL, test_get_url_done, GINT_TO_POINTER (add_entry)); gtk_main(); } @@ -370,7 +370,7 @@ perform_complex_url_query (EphyHistoryService *service, "Wikipedia", 30, 30, 0); - ephy_history_service_query_urls (service, query, verify_complex_url_query, url); + ephy_history_service_query_urls (service, query, NULL, verify_complex_url_query, url); } static void @@ -382,7 +382,7 @@ test_complex_url_query (void) visits = create_visits_for_complex_tests (); - ephy_history_service_add_visits (service, visits, perform_complex_url_query, NULL); + ephy_history_service_add_visits (service, visits, NULL, perform_complex_url_query, NULL); gtk_main (); } @@ -410,7 +410,7 @@ perform_complex_url_query_with_time_range (EphyHistoryService *service, "WebKitGTK+", 2, 2, 0); - ephy_history_service_query_urls (service, query, verify_complex_url_query, url); + ephy_history_service_query_urls (service, query, NULL, verify_complex_url_query, url); } static void @@ -422,7 +422,7 @@ test_complex_url_query_with_time_range (void) visits = create_visits_for_complex_tests (); - ephy_history_service_add_visits (service, visits, perform_complex_url_query_with_time_range, NULL); + ephy_history_service_add_visits (service, visits, NULL, perform_complex_url_query_with_time_range, NULL); gtk_main (); } @@ -459,7 +459,7 @@ perform_query_after_clear (EphyHistoryService *service, query->limit = 10; query->sort_type = EPHY_HISTORY_SORT_MV; - ephy_history_service_query_urls (service, query, verify_query_after_clear, NULL); + ephy_history_service_query_urls (service, query, NULL, verify_query_after_clear, NULL); } static void @@ -469,8 +469,8 @@ test_clear () EphyHistoryService *service = ensure_empty_history (temporary_file); GList *visits = create_test_page_visit_list (); - ephy_history_service_add_visits (service, visits, NULL, NULL); - ephy_history_service_clear (service, perform_query_after_clear, NULL); + ephy_history_service_add_visits (service, visits, NULL, NULL, NULL); + ephy_history_service_clear (service, NULL, perform_query_after_clear, NULL); gtk_main (); } |