1 /*
2  * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
3  * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef RS_LIBRARY_H
21 #define RS_LIBRARY_H
22 
23 #include <glib-object.h>
24 #include <glib.h>
25 #include <gtk/gtk.h>
26 #include <rawstudio.h>
27 
28 G_BEGIN_DECLS
29 
30 #define RS_TYPE_LIBRARY rs_library_get_type()
31 #define RS_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_LIBRARY, RSLibrary))
32 #define RS_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_LIBRARY, RSLibraryClass))
33 #define RS_IS_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_LIBRARY))
34 #define RS_IS_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RS_TYPE_LIBRARY))
35 #define RS_LIBRARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_LIBRARY, RSLibraryClass))
36 
37 typedef struct _RSLibrary RSLibrary;
38 
39 typedef struct {
40 	GObjectClass parent_class;
41 } RSLibraryClass;
42 
43 GType rs_library_get_type(void);
44 
45 gboolean rs_library_has_database_connection(RSLibrary *library);
46 gchar *rs_library_get_init_error_msg(RSLibrary *library);
47 RSLibrary *rs_library_get_singleton(void);
48 gint rs_library_add_photo(RSLibrary *library, const gchar *filename);
49 gint rs_library_add_tag(RSLibrary *library, const gchar *tagname);
50 
51 /* Links an image to a tag */
52 /* You must have created the tag on beforehand using rs_library_add_tag */
53 /* Pass the returned value as tag_id */
54 void rs_library_photo_add_tag(RSLibrary *library, const gchar *filename, gint tag_id, const gboolean autotag);
55 void rs_library_delete_photo(RSLibrary *library, const gchar *photo);
56 gboolean rs_library_delete_tag(RSLibrary *library, const gchar *tag, const gboolean force);
57 GList *rs_library_search(RSLibrary *library, GList *tags);
58 GList *rs_library_photo_tags(RSLibrary *library, const gchar *photo, const gboolean autotag);
59 GList *rs_library_find_tag(RSLibrary *library, const gchar *tag);
60 gboolean rs_library_set_tag_search(gchar *str);
61 void rs_library_add_photo_with_metadata(RSLibrary *library, const gchar *photo, RSMetadata *metadata);
62 void rs_library_restore_tags(const gchar *directory);
63 void rs_library_backup_tags(RSLibrary *library, const gchar *photo_filename);
64 
65 G_END_DECLS
66 
67 #endif /* RS_LIBRARY_H */
68