summaryrefslogtreecommitdiff
path: root/libslab/bookmark-agent.h
blob: 409509e1eec8bb67acdc4bd8e843d6b9eee67790 (plain)
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
/*
 * This file is part of the Main Menu.
 *
 * Copyright (c) 2007 Novell, Inc.
 *
 * The Main Menu 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 of the License, or (at your option)
 * any later version.
 *
 * The Main Menu 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
 * the Main Menu; if not, write to the Free Software Foundation, Inc., 51
 * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __BOOKMARK_AGENT_H__
#define __BOOKMARK_AGENT_H__

#include <time.h>
#include <glib.h>
#include <glib-object.h>

G_BEGIN_DECLS

#define BOOKMARK_AGENT_TYPE         (bookmark_agent_get_type ())
#define BOOKMARK_AGENT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), BOOKMARK_AGENT_TYPE, BookmarkAgent))
#define BOOKMARK_AGENT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), BOOKMARK_AGENT_TYPE, BookmarkAgentClass))
#define IS_BOOKMARK_AGENT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), BOOKMARK_AGENT_TYPE))
#define IS_BOOKMARK_AGENT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), BOOKMARK_AGENT_TYPE))
#define BOOKMARK_AGENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BOOKMARK_AGENT_TYPE, BookmarkAgentClass))

#define BOOKMARK_AGENT_STORE_STATUS_PROP "store-status"
#define BOOKMARK_AGENT_ITEMS_PROP        "items"

typedef struct {
	gchar  *uri;
	gchar  *title;
	gchar  *mime_type;
	GDateTime  *mtime;
	gchar  *icon;
	gchar  *app_name;
	gchar  *app_exec;
} BookmarkItem;

typedef enum {
	BOOKMARK_STORE_DEFAULT_ONLY,
	BOOKMARK_STORE_DEFAULT,
	BOOKMARK_STORE_USER,
	BOOKMARK_STORE_ABSENT
} BookmarkStoreStatus;

typedef enum {
	BOOKMARK_STORE_USER_APPS   = 0,
	BOOKMARK_STORE_USER_DOCS   = 1,
	BOOKMARK_STORE_USER_DIRS   = 2,
	BOOKMARK_STORE_RECENT_APPS = 3,
	BOOKMARK_STORE_RECENT_DOCS = 4,
	BOOKMARK_STORE_SYSTEM      = 5,
	BOOKMARK_STORE_N_TYPES     = 6
} BookmarkStoreType;

typedef struct {
	GObject g_object;
} BookmarkAgent;

typedef struct {
	GObjectClass g_object_class;
} BookmarkAgentClass;

GType bookmark_agent_get_type (void);

BookmarkAgent *bookmark_agent_get_instance  (BookmarkStoreType type);
gboolean       bookmark_agent_has_item      (BookmarkAgent *this, const gchar *uri);
void           bookmark_agent_add_item      (BookmarkAgent *this, const BookmarkItem *item);
void           bookmark_agent_move_item     (BookmarkAgent *this, const gchar *uri, const gchar *uri_new);
void           bookmark_agent_remove_item   (BookmarkAgent *this, const gchar *uri);
void           bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris);

void	       bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
void	       bookmark_agent_purge_items (BookmarkAgent *this);

void           bookmark_item_free           (BookmarkItem *item);

G_END_DECLS

#endif /* __BOOKMARK_AGENT_H__ */