1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  * anjuta-session.h
4  * Copyright (c) 2005 Naba Kumar  <naba@gnome.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _ANJUTA_SESSION_H_
22 #define _ANJUTA_SESSION_H_
23 
24 #include <glib.h>
25 #include <glib-object.h>
26 #include <gio/gio.h>
27 
28 G_BEGIN_DECLS
29 
30 #define ANJUTA_TYPE_SESSION         (anjuta_session_get_type ())
31 #define ANJUTA_SESSION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_SESSION, AnjutaSession))
32 #define ANJUTA_SESSION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_SESSION, AnjutaSessionClass))
33 #define ANJUTA_IS_SESSION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_SESSION))
34 #define ANJUTA_IS_SESSION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_SESSION))
35 #define ANJUTA_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ANJUTA_TYPE_SESSION, AnjutaSessionClass))
36 
37 typedef struct _AnjutaSessionPriv AnjutaSessionPriv;
38 
39 typedef enum
40 {
41 	ANJUTA_SESSION_PHASE_START,
42 	ANJUTA_SESSION_PHASE_FIRST,
43 	ANJUTA_SESSION_PHASE_NORMAL,
44 	ANJUTA_SESSION_PHASE_LAST,
45 	ANJUTA_SESSION_PHASE_END,
46 } AnjutaSessionPhase;
47 
48 typedef struct {
49 	GObject parent;
50 	AnjutaSessionPriv *priv;
51 } AnjutaSession;
52 
53 typedef struct {
54 	GObjectClass parent_class;
55 	/* Add Signal Functions Here */
56 } AnjutaSessionClass;
57 
58 GType anjuta_session_get_type (void);
59 AnjutaSession *anjuta_session_new (const gchar *session_directory);
60 
61 gchar* anjuta_session_get_session_filename (AnjutaSession *session);
62 const gchar* anjuta_session_get_session_directory (AnjutaSession *session);
63 
64 void anjuta_session_sync (AnjutaSession *session);
65 void anjuta_session_clear (AnjutaSession *session);
66 void anjuta_session_clear_section (AnjutaSession *session,
67 								   const gchar *section);
68 
69 void anjuta_session_set_int (AnjutaSession *session, const gchar *section,
70 							 const gchar *key, gint value);
71 void anjuta_session_set_float (AnjutaSession *session, const gchar *section,
72 							   const gchar *key, gfloat value);
73 void anjuta_session_set_string (AnjutaSession *session, const gchar *section,
74 								const gchar *key, const gchar *value);
75 void anjuta_session_set_string_list (AnjutaSession *session,
76 									 const gchar *section,
77 									 const gchar *key, GList *value);
78 
79 gint anjuta_session_get_int (AnjutaSession *session, const gchar *section,
80 							 const gchar *key);
81 gfloat anjuta_session_get_float (AnjutaSession *session, const gchar *section,
82 								 const gchar *key);
83 gchar* anjuta_session_get_string (AnjutaSession *session, const gchar *section,
84 								  const gchar *key);
85 GList* anjuta_session_get_string_list (AnjutaSession *session,
86 									   const gchar *section,
87 									   const gchar *key);
88 
89 gchar *anjuta_session_get_relative_uri_from_file (AnjutaSession *session,
90                                                   GFile *file,
91                                                   const gchar *fragment);
92 GFile* anjuta_session_get_file_from_relative_uri (AnjutaSession *session,
93                                                   const gchar *uri,
94                                                   const gchar **fragment);
95 
96 G_END_DECLS
97 
98 #endif /* _ANJUTA_SESSION_H_ */
99