[epiphany/history-rewrite: 32/45] ephy-history-service: add ephy_history_query_copy()



commit 322b64747629d3adcda31774fd877e80377701b7
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Jul 18 16:01:57 2011 +0300

    ephy-history-service: add ephy_history_query_copy()

 lib/history/ephy-history-types.c |   16 ++++++++++++++++
 lib/history/ephy-history-types.h |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index b21a83c..921c617 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -131,3 +131,19 @@ ephy_history_query_free (EphyHistoryQuery *query)
   g_list_free_full (query->substring_list, g_free);
   g_slice_free1 (sizeof (EphyHistoryQuery), query);
 }
+
+EphyHistoryQuery *
+ephy_history_query_copy (EphyHistoryQuery *query)
+{
+  GList *iter;
+  EphyHistoryQuery *copy = ephy_history_query_new ();
+  copy->from = query->from;
+  copy->to = query->to;
+
+  for (iter = query->substring_list; iter != NULL; iter = iter->next) {
+    copy->substring_list = g_list_prepend (copy->substring_list, g_strdup (iter->data));
+  }
+  copy->substring_list = g_list_reverse (copy->substring_list);
+
+  return copy;
+}
diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h
index b77fe77..0b7bc64 100644
--- a/lib/history/ephy-history-types.h
+++ b/lib/history/ephy-history-types.h
@@ -83,6 +83,7 @@ void                            ephy_history_url_free (EphyHistoryURL *url);
 
 EphyHistoryQuery *              ephy_history_query_new (void);
 void                            ephy_history_query_free (EphyHistoryQuery *query);
+EphyHistoryQuery *              ephy_history_query_copy (EphyHistoryQuery *query);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]