[epiphany/history-rewrite: 12/45] Add API to set the URL title in the history
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/history-rewrite: 12/45] Add API to set the URL title in the history
- Date: Wed, 24 Aug 2011 19:40:19 +0000 (UTC)
commit c3b2885a4448a6059cbf095fa5dd006ea6b4fe7a
Author: Claudio Saavedra <csaavedra igalia com>
Date: Sun Jul 3 21:49:53 2011 +0300
Add API to set the URL title in the history
lib/history/ephy-history-service.c | 39 ++++++++++++++++++++++++++++++++++++
lib/history/ephy-history-service.h | 1 +
2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index c0f39a7..2af60d8 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -501,3 +501,42 @@ ephy_history_service_find_visits_in_time (EphyHistoryService *self, gint64 from,
details);
}
+
+static gboolean
+ephy_history_service_execute_set_url_title (EphyHistoryService *self,
+ EphyHistoryURL *url,
+ gpointer *result)
+{
+ char *title = g_strdup (url->title);
+
+ if (NULL == ephy_history_service_get_url_row (self, NULL, url)) {
+ /* The URL is not yet in the database, so we can't update it.. */
+ g_free (title);
+ return FALSE;
+ } else {
+ g_free (url->title);
+ url->title = title;
+ ephy_history_service_update_url_row (self, url);
+ ephy_history_service_schedule_commit (self);
+ return TRUE;
+ }
+}
+
+void
+ephy_history_service_set_url_title (EphyHistoryService *self,
+ const char *orig_url,
+ const char *title,
+ EphyHistoryJobCallback callback,
+ gpointer user_data)
+{
+ EphyHistoryURL *url = ephy_history_url_new (orig_url, title, 0, 0, 0);
+
+ EphyHistoryThreadJobDetails *details =
+ ephy_history_thread_job_details_new (self,
+ (EphyHistoryJobMethod) ephy_history_service_execute_set_url_title,
+ url, (GDestroyNotify) ephy_history_url_free,
+ callback, user_data);
+ ephy_history_service_schedule_idle (self, G_PRIORITY_DEFAULT,
+ ephy_history_service_execute_job_on_history_thread,
+ details);
+}
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index 8911745..862f7f6 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -55,6 +55,7 @@ EphyHistoryService * ephy_history_service_new (const cha
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_set_url_title (EphyHistoryService *self, const char *url, const char *title, EphyHistoryJobCallback callback, gpointer user_data);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]