1 /*
2  * This file is part of the Main Menu.
3  *
4  * Copyright (c) 2007 Novell, Inc.
5  *
6  * The Main Menu is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; either version 2 of the License, or (at your option)
9  * any later version.
10  *
11  * The Main Menu is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * the Main Menu; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #ifndef __BOOKMARK_AGENT_H__
22 #define __BOOKMARK_AGENT_H__
23 
24 #include <time.h>
25 #include <glib.h>
26 #include <glib-object.h>
27 
28 G_BEGIN_DECLS
29 
30 #define BOOKMARK_AGENT_TYPE         (bookmark_agent_get_type ())
31 #define BOOKMARK_AGENT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), BOOKMARK_AGENT_TYPE, BookmarkAgent))
32 #define BOOKMARK_AGENT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), BOOKMARK_AGENT_TYPE, BookmarkAgentClass))
33 #define IS_BOOKMARK_AGENT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), BOOKMARK_AGENT_TYPE))
34 #define IS_BOOKMARK_AGENT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), BOOKMARK_AGENT_TYPE))
35 #define BOOKMARK_AGENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BOOKMARK_AGENT_TYPE, BookmarkAgentClass))
36 
37 #define BOOKMARK_AGENT_STORE_STATUS_PROP "store-status"
38 #define BOOKMARK_AGENT_ITEMS_PROP        "items"
39 
40 typedef struct {
41 	gchar  *uri;
42 	gchar  *title;
43 	gchar  *mime_type;
44 	GDateTime  *mtime;
45 	gchar  *icon;
46 	gchar  *app_name;
47 	gchar  *app_exec;
48 } BookmarkItem;
49 
50 typedef enum {
51 	BOOKMARK_STORE_DEFAULT_ONLY,
52 	BOOKMARK_STORE_DEFAULT,
53 	BOOKMARK_STORE_USER,
54 	BOOKMARK_STORE_ABSENT
55 } BookmarkStoreStatus;
56 
57 typedef enum {
58 	BOOKMARK_STORE_USER_APPS   = 0,
59 	BOOKMARK_STORE_USER_DOCS   = 1,
60 	BOOKMARK_STORE_USER_DIRS   = 2,
61 	BOOKMARK_STORE_RECENT_APPS = 3,
62 	BOOKMARK_STORE_RECENT_DOCS = 4,
63 	BOOKMARK_STORE_SYSTEM      = 5,
64 	BOOKMARK_STORE_N_TYPES     = 6
65 } BookmarkStoreType;
66 
67 typedef struct {
68 	GObject g_object;
69 } BookmarkAgent;
70 
71 typedef struct {
72 	GObjectClass g_object_class;
73 } BookmarkAgentClass;
74 
75 GType bookmark_agent_get_type (void);
76 
77 BookmarkAgent *bookmark_agent_get_instance  (BookmarkStoreType type);
78 gboolean       bookmark_agent_has_item      (BookmarkAgent *this, const gchar *uri);
79 void           bookmark_agent_add_item      (BookmarkAgent *this, const BookmarkItem *item);
80 void           bookmark_agent_move_item     (BookmarkAgent *this, const gchar *uri, const gchar *uri_new);
81 void           bookmark_agent_remove_item   (BookmarkAgent *this, const gchar *uri);
82 void           bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris);
83 
84 void	       bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
85 void	       bookmark_agent_purge_items (BookmarkAgent *this);
86 
87 void           bookmark_item_free           (BookmarkItem *item);
88 
89 G_END_DECLS
90 
91 #endif /* __BOOKMARK_AGENT_H__ */
92