midgard/midgard_connection.h

00001 /* 
00002  * Copyright (C) 2006 Piotr Pokora <piotr.pokora@infoglob.pl>
00003  * Copyright (C) 2006 Jukka Zitting <jukka.zitting@gmail.com>
00004  *
00005  * This program is free software; you can redistribute it and/or modify it
00006  * under the terms of the GNU Lesser General Public License as published
00007  * by the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef MIDGARD_CONNECTION_H
00021 #define MIDGARD_CONNECTION_H
00022 
00023 #define GETTEXT_PACKAGE "midgard"
00024 #include <glib/gi18n-lib.h>
00025 
00026 #include <midgard/midgard_defs.h>
00027 #include <midgard/midgard_config.h>
00028 
00029 /* convention macros */
00030 #define MIDGARD_TYPE_CONNECTION (midgard_connection_get_type())
00031 #define MIDGARD_CONNECTION(object)  \
00032                 (G_TYPE_CHECK_INSTANCE_CAST ((object),MIDGARD_TYPE_CONNECTION, MidgardConnection))
00033 #define MIDGARD_CONNECTION_CLASS(klass)  \
00034                 (G_TYPE_CHECK_CLASS_CAST ((klass), MIDGARD_TYPE_CONNECTION, MidgardConnectionClass))
00035 #define MIDGARD_IS_CONNECTION(object)   \
00036                 (G_TYPE_CHECK_INSTANCE_TYPE ((object), MIDGARD_TYPE_CONNECTION))
00037 #define MIDGARD_IS_CONNECTION_CLASS(klass) \
00038                 (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDGARD_TYPE_CONNECTION))
00039 #define MIDGARD_CONNECTION_GET_CLASS(obj) \
00040                 (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDGARD_TYPE_CONNECTION, MidgardConnectionClass))
00041 
00042 typedef struct MidgardConnection MidgardConnection;
00043 typedef struct MidgardConnectionClass MidgardConnectionClass;
00044 typedef struct _MidgardConnectionPrivate MidgardConnectionPrivate; 
00045 
00052 struct MidgardConnectionClass{
00053         GObjectClass parent;
00054 
00055         /* class members */
00056         gboolean (*open) (MidgardConnection *mgd, 
00057                         const char *name, GError *err);
00058         gboolean (*open_config) (MidgardConnection *mgd, 
00059                         MidgardConfig *config, GError *err);
00060         void (*close) (MidgardConnection *mgd);
00061         
00062         gboolean (*set_sitegroup) (MidgardConnection *mgd, 
00063                         const gchar *guid);
00064         const gchar *(*get_sitegroup) (MidgardConnection *mgd);
00065 
00066         gboolean (*set_lang) (MidgardConnection *mgd,
00067                         const char *language);
00068         const gchar *(*get_lang) (MidgardConnection *mgd);
00069 
00070         void (*set_loglevel) (MidgardConnection *mgd, 
00071                         const gchar *levelstring);
00072         guint (*get_loglevel) (MidgardConnection *mgd);
00073 
00074         void (*set_loghandler) (MidgardConnection *mgd, 
00075                         guint loghandler);
00076         guint (*get_loghandler) (MidgardConnection *mgd);
00077 
00078 };
00079 
00086 struct MidgardConnection{
00087 
00088         GObject parent;
00089         gint errnum;
00090         gchar *errstr;
00091         GError *err;
00092         
00093         /* < private > */
00094         MidgardConnectionPrivate *private;
00095         /* This is reserved */
00096         /* GdaConnection *connection; */
00097         /* Legacy, FIXME, remove */
00098         midgard *mgd;
00099 };
00100 
00109 extern GType midgard_connection_get_type(void);
00110 
00131 extern MidgardConnection *midgard_connection_new(void);
00132 
00153 extern gboolean midgard_connection_open(
00154                 MidgardConnection *mgd, const char *name, GError *error);
00155 
00169 extern gboolean midgard_connection_open_config(
00170                 MidgardConnection *mgd, MidgardConfig *config, GError *error);
00171 
00172 
00193 extern void midgard_connection_close(MidgardConnection *mgd);
00194 
00195 
00211 extern gboolean midgard_connection_set_sitegroup(MidgardConnection *mgd, const gchar *guid);
00212 
00228 extern const gchar *midgard_connection_get_sitegroup(MidgardConnection *mgd);
00229 
00248 extern gboolean midgard_connection_set_lang(
00249                 MidgardConnection *mgd, const char *language);
00250 
00265 extern const gchar *midgard_connection_get_lang(MidgardConnection *mgd);
00266 
00281 extern void midgard_connection_set_loglevel(MidgardConnection *mgd, const gchar *level);
00282 
00295 extern guint midgard_connection_get_loglevel(MidgardConnection *mgd);
00296 
00311 extern void midgard_connection_set_loghandler(
00312                 MidgardConnection *mgd, guint loghandler);
00313 
00327 extern guint midgard_connection_get_loghandler(MidgardConnection *mgd);
00328 
00329 #endif /* MIDGARD_CONNNECTION_H */

Generated on Thu Feb 22 06:15:14 2007 for midgard-core by  doxygen 1.4.6