1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ 2 /* 3 * Copyright © 2011 Igalia S.L. 4 * 5 * This file is part of Epiphany. 6 * 7 * Epiphany is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * Epiphany is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with Epiphany. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #include <glib.h> 24 25 G_BEGIN_DECLS 26 27 28 typedef enum { 29 EPHY_PAGE_VISIT_NONE = 0, 30 EPHY_PAGE_VISIT_LINK, 31 EPHY_PAGE_VISIT_TYPED, 32 /* We jump to 8 to avoid changing the visits table format. */ 33 EPHY_PAGE_VISIT_BOOKMARK = 8, 34 EPHY_PAGE_VISIT_HOMEPAGE 35 } EphyHistoryPageVisitType; 36 37 typedef enum { 38 EPHY_HISTORY_URL_TITLE, 39 } EphyHistoryURLProperty; 40 41 typedef enum { 42 EPHY_HISTORY_SORT_NONE = 0, 43 EPHY_HISTORY_SORT_MOST_RECENTLY_VISITED, 44 EPHY_HISTORY_SORT_LEAST_RECENTLY_VISITED, 45 EPHY_HISTORY_SORT_MOST_VISITED, 46 EPHY_HISTORY_SORT_LEAST_VISITED, 47 EPHY_HISTORY_SORT_TITLE_ASCENDING, 48 EPHY_HISTORY_SORT_TITLE_DESCENDING, 49 EPHY_HISTORY_SORT_URL_ASCENDING, 50 EPHY_HISTORY_SORT_URL_DESCENDING 51 } EphyHistorySortType; 52 53 typedef struct 54 { 55 int id; 56 char* url; 57 char* title; 58 int visit_count; 59 double zoom_level; 60 } EphyHistoryHost; 61 62 typedef struct _EphyHistoryURL 63 { 64 int id; 65 char* url; 66 char* title; 67 char *sync_id; 68 int visit_count; 69 int typed_count; 70 gint64 last_visit_time; /* Microseconds */ 71 gboolean hidden; 72 EphyHistoryHost *host; 73 gboolean notify_visit; 74 gboolean notify_delete; 75 } EphyHistoryURL; 76 77 typedef struct _EphyHistoryPageVisit 78 { 79 EphyHistoryURL* url; 80 int id; 81 gint64 visit_time; /* Microseconds */ 82 EphyHistoryPageVisitType visit_type; 83 } EphyHistoryPageVisit; 84 85 typedef struct _EphyHistoryQuery 86 { 87 gint64 from; /* Microseconds */ 88 gint64 to; /* Microseconds */ 89 guint limit; 90 GList* substring_list; 91 gboolean ignore_hidden; 92 gboolean ignore_local; 93 gint host; 94 EphyHistorySortType sort_type; 95 } EphyHistoryQuery; 96 97 EphyHistoryPageVisit * ephy_history_page_visit_new (const char *url, gint64 visit_time, EphyHistoryPageVisitType visit_type); 98 EphyHistoryPageVisit * ephy_history_page_visit_new_with_url (EphyHistoryURL *url, gint64 visit_time, EphyHistoryPageVisitType visit_type); 99 EphyHistoryPageVisit * ephy_history_page_visit_copy (EphyHistoryPageVisit *visit); 100 void ephy_history_page_visit_free (EphyHistoryPageVisit *visit); 101 102 GList * ephy_history_page_visit_list_copy (GList* original); 103 void ephy_history_page_visit_list_free (GList* list); 104 105 EphyHistoryHost * ephy_history_host_new (const char *url, const char *title, int visit_count, double zoom_level); 106 EphyHistoryHost * ephy_history_host_copy (EphyHistoryHost *original); 107 void ephy_history_host_free (EphyHistoryHost *host); 108 void ephy_history_host_list_free (GList *list); 109 110 EphyHistoryURL * ephy_history_url_new (const char *url, const char *title, int visit_count, int typed_count, gint64 last_visit_time); 111 EphyHistoryURL * ephy_history_url_copy (EphyHistoryURL *url); 112 void ephy_history_url_free (EphyHistoryURL *url); 113 114 GList * ephy_history_url_list_copy (GList *original); 115 void ephy_history_url_list_free (GList *list); 116 117 EphyHistoryQuery * ephy_history_query_new (void); 118 void ephy_history_query_free (EphyHistoryQuery *query); 119 EphyHistoryQuery * ephy_history_query_copy (EphyHistoryQuery *query); 120 121 G_DEFINE_AUTOPTR_CLEANUP_FUNC(EphyHistoryHost, ephy_history_host_free) 122 G_DEFINE_AUTOPTR_CLEANUP_FUNC(EphyHistoryURL, ephy_history_url_free) 123 G_DEFINE_AUTOPTR_CLEANUP_FUNC(EphyHistoryPageVisit, ephy_history_page_visit_free) 124 G_DEFINE_AUTOPTR_CLEANUP_FUNC(EphyHistoryQuery, ephy_history_query_free) 125 126 G_END_DECLS 127