[epiphany/history-rewrite: 42/45] ephy-history-service: add EphyHistoryHost type and methods



commit 57c0aaa3e6902c078e52f9a012a5535e16294077
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Aug 3 18:17:53 2011 +0300

    ephy-history-service: add EphyHistoryHost type and methods

 lib/history/ephy-history-types.c |   41 ++++++++++++++++++++++++++++++++++++++
 lib/history/ephy-history-types.h |   12 +++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index b64f8bd..0a5d263 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -77,6 +77,47 @@ ephy_history_page_visit_list_free (GList *list)
   g_list_free_full (list, (GDestroyNotify) ephy_history_page_visit_free);
 }
 
+EphyHistoryHost *
+ephy_history_host_new (const char *url, const char *title, int visit_count)
+{
+  EphyHistoryHost *host = g_slice_alloc0 (sizeof (EphyHistoryHost));
+
+  host->id = -1;
+  host->url = g_strdup (url);
+  host->title = g_strdup (title);
+  host->visit_count = visit_count;
+
+  return host;
+}
+
+EphyHistoryHost *
+ephy_history_host_copy (EphyHistoryHost *original)
+{
+  EphyHistoryHost *host;
+
+  if (original == NULL)
+    return NULL;
+
+  host = ephy_history_host_new (original->url,
+                                original->title,
+                                original->visit_count);
+  host->id = original->id;
+
+  return host;
+}
+
+void
+ephy_history_host_free (EphyHistoryHost *host)
+{
+  if (host == NULL)
+    return;
+
+  g_free (host->url);
+  g_free (host->title);
+
+  g_slice_free1 (sizeof (EphyHistoryHost), host);
+}
+
 EphyHistoryURL *
 ephy_history_url_new (const char *url, const char *title, int visit_count, int typed_count, int last_visit_time, double zoom_level)
 {
diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h
index a234fb5..2babd4c 100644
--- a/lib/history/ephy-history-types.h
+++ b/lib/history/ephy-history-types.h
@@ -42,6 +42,14 @@ typedef enum {
   EPHY_HISTORY_URL_ZOOM_LEVEL
 } EphyHistoryURLProperty;
 
+typedef struct
+{
+  int id;
+  char* url;
+  char* title;
+  int visit_count;
+} EphyHistoryHost;
+
 typedef struct _EphyHistoryURL
 {
   int id;
@@ -77,6 +85,10 @@ void                            ephy_history_page_visit_free (EphyHistoryPageVis
 GList *                         ephy_history_page_visit_list_copy (GList* original);
 void                            ephy_history_page_visit_list_free (GList* list);
 
+EphyHistoryHost *               ephy_history_host_new (const char *url, const char *title, int visit_count);
+EphyHistoryHost *               ephy_history_host_copy (EphyHistoryHost *original);
+void                            ephy_history_host_free (EphyHistoryHost *host);
+
 EphyHistoryURL *                ephy_history_url_new (const char *url, const char* title, int visit_count, int typed_count, int last_visit_time, double zoom_level);
 EphyHistoryURL *                ephy_history_url_copy (EphyHistoryURL *url);
 void                            ephy_history_url_free (EphyHistoryURL *url);



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