aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.h
blob: ee3bff26cf7b4f530219af7945696f2b34545046 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 *  Copyright © 2000-2004 Marco Pesenti Gritti
 *  Copyright © 2003, 2004 Christian Persch
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *  $Id$
 */

#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
#error "Only <epiphany/epiphany.h> can be included directly."
#endif

#ifndef EPHY_BOOKMARKS_H
#define EPHY_BOOKMARKS_H

#include <glib-object.h>
#include <gtk/gtkwidget.h>

#include "ephy-node.h"

G_BEGIN_DECLS

#define EPHY_TYPE_BOOKMARKS     (ephy_bookmarks_get_type ())
#define EPHY_BOOKMARKS(o)       (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_BOOKMARKS, EphyBookmarks))
#define EPHY_BOOKMARKS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_BOOKMARKS, EphyBookmarksClass))
#define EPHY_IS_BOOKMARKS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_BOOKMARKS))
#define EPHY_IS_BOOKMARKS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_BOOKMARKS))
#define EPHY_BOOKMARKS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_BOOKMARKS, EphyBookmarksClass))

typedef struct _EphyBookmarksClass  EphyBookmarksClass;
typedef struct _EphyBookmarks       EphyBookmarks;
typedef struct _EphyBookmarksPrivate    EphyBookmarksPrivate;

#define BOOKMARKS_HIERARCHY_SEP "->"

typedef enum
{
    EPHY_NODE_BMK_PROP_TITLE    = 2,
    EPHY_NODE_BMK_PROP_LOCATION = 3,
    EPHY_NODE_BMK_PROP_KEYWORDS = 4,
    EPHY_NODE_KEYWORD_PROP_NAME = 5,
    EPHY_NODE_BMK_PROP_USERICON = 6,
    EPHY_NODE_BMK_PROP_ICON     = 7,
    EPHY_NODE_KEYWORD_PROP_PRIORITY = 8,
    EPHY_NODE_BMK_PROP_SERVICE_ID   = 14,
    EPHY_NODE_BMK_PROP_IMMUTABLE    = 15
} EphyBookmarkProperty;

struct _EphyBookmarks
{
    GObject parent;

    /*< private >*/
    EphyBookmarksPrivate *priv;
};

struct _EphyBookmarksClass
{
    GObjectClass parent_class;

    void    (* tree_changed)    (EphyBookmarks *eb);
    char *  (* resolve_address) (EphyBookmarks *eb,
                     const char *address,
                     const char *argument);
};

GType         ephy_bookmarks_get_type       (void);

EphyBookmarks    *ephy_bookmarks_new            (void);

EphyNode     *ephy_bookmarks_get_from_id        (EphyBookmarks *eb,
                             long id);

/* Bookmarks */

EphyNode     *ephy_bookmarks_add            (EphyBookmarks *eb,
                             const char *title,
                             const char *url);

EphyNode*     ephy_bookmarks_find_bookmark      (EphyBookmarks *eb,
                             const char *url);

gint              ephy_bookmarks_get_similar        (EphyBookmarks *eb,
                             EphyNode *bookmark,
                             GPtrArray *identical,
                             GPtrArray *similar);
    
void          ephy_bookmarks_set_icon       (EphyBookmarks *eb,
                             const char *url,
                             const char *icon);

void          ephy_bookmarks_set_usericon       (EphyBookmarks *eb,
                             const char *url,
                             const char *icon);

void          ephy_bookmarks_set_address        (EphyBookmarks *eb,
                             EphyNode *bookmark,
                             const char *address);

char         *ephy_bookmarks_resolve_address    (EphyBookmarks *eb,
                             const char *address,
                             const char *parameter);

guint       ephy_bookmarks_get_smart_bookmark_width (EphyNode *bookmark);


/* Keywords */

EphyNode     *ephy_bookmarks_add_keyword        (EphyBookmarks *eb,
                             const char *name);

EphyNode     *ephy_bookmarks_find_keyword       (EphyBookmarks *eb,
                             const char *name,
                             gboolean partial_match);

void          ephy_bookmarks_remove_keyword     (EphyBookmarks *eb,
                             EphyNode *keyword);

gboolean      ephy_bookmarks_has_keyword        (EphyBookmarks *eb,
                             EphyNode *keyword,
                             EphyNode *bookmark);

void          ephy_bookmarks_set_keyword        (EphyBookmarks *eb,
                             EphyNode *keyword,
                             EphyNode *bookmark);

void          ephy_bookmarks_unset_keyword      (EphyBookmarks *eb,
                             EphyNode *keyword,
                             EphyNode *bookmark);

char         *ephy_bookmarks_get_topic_uri      (EphyBookmarks *eb,
                             EphyNode *node);

/* Favorites */

EphyNode     *ephy_bookmarks_get_favorites      (EphyBookmarks *eb);

/* Root */

EphyNode     *ephy_bookmarks_get_keywords       (EphyBookmarks *eb);

EphyNode     *ephy_bookmarks_get_bookmarks      (EphyBookmarks *eb);

EphyNode     *ephy_bookmarks_get_not_categorized    (EphyBookmarks *eb);

EphyNode     *ephy_bookmarks_get_smart_bookmarks    (EphyBookmarks *eb);

EphyNode     *ephy_bookmarks_get_local      (EphyBookmarks *eb);

/* Comparison functions, useful for sorting lists and arrays. */
int            ephy_bookmarks_compare_topics            (gconstpointer a, gconstpointer b);
int            ephy_bookmarks_compare_topic_pointers    (gconstpointer a, gconstpointer b);
int            ephy_bookmarks_compare_bookmarks         (gconstpointer a, gconstpointer b);
int            ephy_bookmarks_compare_bookmark_pointers (gconstpointer a, gconstpointer b);

G_END_DECLS

#endif