1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 
3 /*
4  *  GThumb
5  *
6  *  Copyright (C) 2008-2009 Free Software Foundation, Inc.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GTH_MAIN_H
23 #define GTH_MAIN_H
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 #include <gdk-pixbuf/gdk-pixbuf.h>
28 #include "gth-color-manager.h"
29 #include "gth-extensions.h"
30 #include "gth-file-data.h"
31 #include "gth-file-source.h"
32 #include "gth-filter-file.h"
33 #include "gth-hook.h"
34 #include "gth-image.h"
35 #include "gth-image-saver.h"
36 #include "gth-metadata-provider.h"
37 #include "gth-monitor.h"
38 #include "gth-shortcut.h"
39 #include "gth-tags-file.h"
40 #include "gth-test.h"
41 #include "pixbuf-io.h"
42 
43 G_BEGIN_DECLS
44 
45 #define GTH_TYPE_MAIN         (gth_main_get_type ())
46 #define GTH_MAIN(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTH_TYPE_MAIN, GthMain))
47 #define GTH_MAIN_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTH_TYPE_MAIN, GthMainClass))
48 #define GTH_IS_MAIN(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTH_TYPE_MAIN))
49 #define GTH_IS_MAIN_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTH_TYPE_MAIN))
50 #define GTH_MAIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GTH_TYPE_MAIN, GthMainClass))
51 
52 typedef struct _GthMain         GthMain;
53 typedef struct _GthMainPrivate  GthMainPrivate;
54 typedef struct _GthMainClass    GthMainClass;
55 
56 struct _GthMain {
57 	GObject __parent;
58 	GthMainPrivate *priv;
59 };
60 
61 struct _GthMainClass {
62 	GObjectClass __parent_class;
63 };
64 
65 GType                  gth_main_get_type                      (void) G_GNUC_CONST;
66 void                   gth_main_initialize                    (void);
67 void                   gth_main_release                       (void);
68 void                   gth_main_register_file_source          (GType                 file_source_type);
69 GthFileSource *        gth_main_get_file_source_for_uri       (const char           *uri);
70 GthFileSource *        gth_main_get_file_source               (GFile                *file);
71 char *                 gth_main_get_source_scheme             (const char           *uri);
72 GList *                gth_main_get_all_file_sources          (void);
73 GList *                gth_main_get_all_entry_points          (void);
74 GFile *                gth_main_get_nearest_entry_point       (GFile                *file);
75 char *                 gth_main_get_gio_uri                   (const char           *uri);
76 GFile *                gth_main_get_gio_file                  (GFile                *file);
77 void                   gth_main_register_metadata_category    (GthMetadataCategory  *metadata_category);
78 GthMetadataInfo *      gth_main_register_metadata_info        (GthMetadataInfo      *metadata_info);
79 void                   gth_main_register_metadata_info_v      (GthMetadataInfo       metadata_info[]);
80 void                   gth_main_register_metadata_provider    (GType                 metadata_provider_type);
81 GList *                gth_main_get_all_metadata_providers    (void);
82 char **                gth_main_get_metadata_attributes       (const char           *mask);
83 GthMetadataProvider *  gth_main_get_metadata_reader           (const char           *id,
84 							       const char           *mime_type);
85 GthMetadataProvider *  gth_main_get_metadata_writer           (const char           *id,
86 							       const char           *mime_type);
87 GthMetadataCategory *  gth_main_get_metadata_category         (const char           *id);
88 GthMetadataInfo *      gth_main_get_metadata_info             (const char           *id);
89 GList *                gth_main_get_all_metadata_info         (void);
90 void                   gth_main_register_shortcut_category    (GthShortcutCategory  *shortcut_category,
91 							       int                   n_categories);
92 GthShortcutCategory *  gth_main_get_shortcut_category         (const char           *id);
93 GPtrArray *            gth_main_get_shortcut_categories       (void);
94 void                   gth_main_register_sort_type            (GthFileDataSort      *sort_type);
95 GthFileDataSort *      gth_main_get_sort_type                 (const char           *name);
96 GList *                gth_main_get_all_sort_types            (void);
97 void                   gth_main_register_image_loader_func    (GthImageLoaderFunc    loader,
98 							       GthImageFormat        native_format,
99 						               ...) G_GNUC_NULL_TERMINATED;
100 void                   gth_main_register_image_loader_func_v  (GthImageLoaderFunc    loader,
101 							       GthImageFormat        native_format,
102 							       const char          **mime_types);
103 GthImageLoaderFunc     gth_main_get_image_loader_func         (const char           *mime_type,
104 							       GthImageFormat        preferred_format);
105 GthImageSaver *        gth_main_get_image_saver               (const char           *mime_type);
106 GthTest *              gth_main_get_general_filter            (void);
107 GthTest *              gth_main_add_general_filter            (GthTest              *filter);
108 void		       gth_main_register_object               (GType                 superclass_type,
109 							       const char           *object_id,
110 							       GType                 object_type,
111 							       ...) G_GNUC_NULL_TERMINATED;
112 GList *                gth_main_get_registered_objects        (GType                 superclass_type);
113 GList *                gth_main_get_registered_objects_id     (GType                 superclass_type);
114 gpointer               gth_main_get_registered_object         (GType                 superclass_type,
115 							       const char           *object_id);
116 void                   gth_main_register_type                 (const char           *set_name,
117 							       GType                 object_type);
118 GArray *               gth_main_get_type_set                  (const char           *set_name);
119 GBookmarkFile *        gth_main_get_default_bookmarks         (void);
120 void                   gth_main_bookmarks_changed             (void);
121 void                   gth_main_shortcuts_changed             (GPtrArray *shortcuts_v);
122 GthFilterFile *        gth_main_get_default_filter_file       (void);
123 GList *                gth_main_get_all_filters               (void);
124 void                   gth_main_filters_changed               (void);
125 GthTagsFile *          gth_main_get_default_tag_file          (void);
126 char **                gth_main_get_all_tags                  (void);
127 void                   gth_main_tags_changed                  (void);
128 GthMonitor *           gth_main_get_default_monitor           (void);
129 GthExtensionManager *  gth_main_get_default_extension_manager (void);
130 GthColorManager *      gth_main_get_default_color_manager     (void);
131 void                   gth_main_register_default_hooks        (void);
132 void                   gth_main_register_default_tests        (void);
133 void                   gth_main_register_default_types        (void);
134 void                   gth_main_register_default_sort_types   (void);
135 void                   gth_main_register_default_metadata     (void);
136 void                   gth_main_activate_extensions           (void);
137 gboolean               gth_main_extension_is_active           (const char *extension_name);
138 
139 /* utilities */
140 
141 gboolean               attribute_list_reload_required         (const char *old_attributes,
142 							       const char *new_attributes);
143 
144 G_END_DECLS
145 
146 #endif /* GTH_MAIN_H */
147