1 /*
2  * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 
20 #ifndef __BROWSER_CORE_H_
21 #define __BROWSER_CORE_H_
22 
23 #include <libgda/libgda.h>
24 #include "decl.h"
25 
26 G_BEGIN_DECLS
27 
28 #define BROWSER_TYPE_CORE          (browser_core_get_type())
29 #define BROWSER_CORE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, browser_core_get_type(), BrowserCore)
30 #define BROWSER_CORE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, browser_core_get_type (), BrowserCoreClass)
31 #define BROWSER_IS_CORE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, browser_core_get_type ())
32 
33 typedef struct _BrowserCoreClass BrowserCoreClass;
34 typedef struct _BrowserCorePrivate BrowserCorePrivate;
35 typedef GSList *(*BrowserCoreInitFactories) (void);
36 
37 /* struct for the object's data */
38 struct _BrowserCore
39 {
40 	GObject                object;
41 	BrowserCorePrivate *priv;
42 };
43 
44 /* struct for the object's class */
45 struct _BrowserCoreClass
46 {
47 	GObjectClass            parent_class;
48 
49 	/* signals */
50 	void    (*connection_added) (BrowserCore *bcore, BrowserConnection *bcnc);
51 	void    (*connection_removed) (BrowserCore *bcore, BrowserConnection *bcnc);
52 };
53 
54 /**
55  * SECTION:browser-core
56  * @short_description: Singleton holding the global browser information
57  * @title: BrowserCore
58  * @stability: Stable
59  * @see_also:
60  *
61  * A single instance of a #BrowserCore is created when the browser is started,
62  * accessible using browser_core_get().
63  */
64 
65 GType           browser_core_get_type               (void) G_GNUC_CONST;
66 gboolean        browser_core_exists                 (void);
67 BrowserCore    *browser_core_get                    (void);
68 
69 void            browser_core_take_window            (BrowserWindow *bwin);
70 GSList         *browser_core_get_windows            (void);
71 void            browser_core_close_window           (BrowserWindow *bwin);
72 
73 void            browser_core_take_connection        (BrowserConnection *bcnc);
74 GSList         *browser_core_get_connections        (void);
75 void            browser_core_close_connection       (BrowserConnection *bcnc);
76 
77 void            browser_core_quit                   (void);
78 
79 BrowserPerspectiveFactory *browser_core_get_default_factory    (void);
80 BrowserPerspectiveFactory *browser_core_get_factory (const gchar *factory);
81 void           browser_core_set_default_factory (const gchar *factory);
82 const GSList  *browser_core_get_factories          (void);
83 
84 G_END_DECLS
85 
86 #endif
87