glade-project.h 6.81 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1 2 3 4
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_PROJECT_H__
#define __GLADE_PROJECT_H__

5 6
#include <gladeui/glade-widget.h>
#include <gladeui/glade-command.h>
Johan Dahlin's avatar
Johan Dahlin committed
7
#include <gladeui/glade-utils.h>
Jose Maria Celorio's avatar
Jose Maria Celorio committed
8

Tristan Van Berkom's avatar
Tristan Van Berkom committed
9
G_BEGIN_DECLS
10

11 12 13 14 15 16
#define GLADE_TYPE_PROJECT            (glade_project_get_type ())
#define GLADE_PROJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_PROJECT, GladeProject))
#define GLADE_PROJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_PROJECT, GladeProjectClass))
#define GLADE_IS_PROJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROJECT))
#define GLADE_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROJECT))
#define GLADE_PROJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PROJECT, GladeProjectClass))
Jose Maria Celorio's avatar
Jose Maria Celorio committed
17

18 19
typedef struct _GladeProjectPrivate  GladeProjectPrivate;
typedef struct _GladeProjectClass    GladeProjectClass;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
20

Johan Dahlin's avatar
Johan Dahlin committed
21 22 23 24 25 26 27

typedef enum
{
	GLADE_PROJECT_FORMAT_LIBGLADE,
	GLADE_PROJECT_FORMAT_GTKBUILDER
} GladeProjectFormat;

28 29 30 31 32 33 34 35
typedef enum
{
	GLADE_SUPPORT_OK                   = 0x00,
	GLADE_SUPPORT_DEPRECATED           = 0x01,
	GLADE_SUPPORT_MISMATCH             = 0x02,
	GLADE_SUPPORT_BUILDER_UNSUPPORTED  = 0x04
} GladeSupportMask;

Jose Maria Celorio's avatar
Jose Maria Celorio committed
36 37
struct _GladeProject
{
38
	GObject parent_instance;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
39

40
	GladeProjectPrivate *priv;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
41 42 43 44
};

struct _GladeProjectClass
{
45
	GObjectClass parent_class;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
46

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
	void          (*add_object)          (GladeProject *project,
					      GladeWidget  *widget);
	void          (*remove_object)       (GladeProject *project,
					      GladeWidget  *widget);
	
	void          (*undo)                (GladeProject *project);
	void          (*redo)                (GladeProject *project);
	GladeCommand *(*next_undo_item)      (GladeProject *project);
	GladeCommand *(*next_redo_item)      (GladeProject *project);
	void          (*push_undo)           (GladeProject *project,
					      GladeCommand *command);

	void          (*changed)             (GladeProject *project,
					      GladeCommand *command,
					      gboolean      forward);

	void          (*widget_name_changed) (GladeProject *project,
					      GladeWidget  *widget);
	void          (*selection_changed)   (GladeProject *project); 
	void          (*close)               (GladeProject *project);

	void          (*resource_added)      (GladeProject *project,
					      const gchar  *resource);
	void          (*resource_removed)    (GladeProject *project,
					      const gchar  *resource);
72
	void          (*parse_finished)      (GladeProject *project);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
73 74
};

75

76
GType          glade_project_get_type            (void) G_GNUC_CONST;
77

78
GladeProject  *glade_project_new                 (void);
79

80
gboolean       glade_project_load_from_file      (GladeProject *project, const gchar *path);
81

82
GladeProject  *glade_project_load                (const gchar  *path);
83

84 85 86 87 88
gboolean       glade_project_save                (GladeProject *project, 
						  const gchar   *path, 
						  GError       **error);
						 
const gchar   *glade_project_get_path            (GladeProject *project);						 
89

90
gchar         *glade_project_get_name            (GladeProject *project);
91 92


93
void           glade_project_undo                (GladeProject *project);
94

95
void           glade_project_redo                (GladeProject *project);
96

97
GladeCommand  *glade_project_next_undo_item      (GladeProject *project);
98

99
GladeCommand  *glade_project_next_redo_item      (GladeProject *project);
100

101 102
void           glade_project_push_undo           (GladeProject *project, 
						  GladeCommand *cmd);
103

104
GtkWidget     *glade_project_undo_items          (GladeProject *project);
105

106
GtkWidget     *glade_project_redo_items          (GladeProject *project);
107

108
void           glade_project_reset_path          (GladeProject *project);
109

110 111 112 113 114 115 116
gboolean       glade_project_get_readonly        (GladeProject *project);

const GList   *glade_project_get_objects         (GladeProject *project);

void           glade_project_add_object          (GladeProject *project, 
						  GladeProject *old_project,
						  GObject      *object);
117

118
void           glade_project_remove_object       (GladeProject *project, GObject     *object);
119

120
gboolean       glade_project_has_object          (GladeProject *project, GObject     *object);
121

122
GladeWidget   *glade_project_get_widget_by_name  (GladeProject *project, const char  *name);
123

124
char          *glade_project_new_widget_name     (GladeProject *project, const char  *base_name);
125

126
void           glade_project_widget_name_changed (GladeProject *project, GladeWidget *widget,
127
						 const char   *old_name);
128

129
/* Selection */
130

131
gboolean       glade_project_is_selected         (GladeProject *project,
132
						 GObject      *object);
133

134
void           glade_project_selection_set       (GladeProject *project,
135 136
						 GObject      *object,
						 gboolean      emit_signal);
137

138
void           glade_project_selection_add       (GladeProject *project,
139 140
						 GObject      *object,
						 gboolean      emit_signal);
141

142
void           glade_project_selection_remove    (GladeProject *project,
143 144
						 GObject      *object,
						 gboolean      emit_signal);
145

146
void           glade_project_selection_clear     (GladeProject *project,
147
						 gboolean      emit_signal);
148

149
void           glade_project_selection_changed   (GladeProject *project);
150

151
GList         *glade_project_selection_get       (GladeProject *project);
152

153
gboolean       glade_project_get_has_selection   (GladeProject *project);
154

155 156
void           glade_project_set_accel_group     (GladeProject  *project, 
						  GtkAccelGroup *accel_group);
157

158
void           glade_project_set_resource         (GladeProject  *project, 
159 160 161
						   GladeProperty *property,
						   const gchar   *resource);

162
GList         *glade_project_list_resources       (GladeProject  *project);
163

164
gchar         *glade_project_resource_fullpath    (GladeProject  *project,
165
						   const gchar   *resource);
166 167 168 169 170 171
 
gboolean       glade_project_is_loading           (GladeProject *project);
 
time_t         glade_project_get_file_mtime       (GladeProject *project);
  
guint          glade_project_get_instance_count   (GladeProject *project);
172

173
void           glade_project_set_instance_count   (GladeProject *project, guint instance_count);
174

175
gboolean       glade_project_get_modified         (GladeProject *project);
176

Johan Dahlin's avatar
Johan Dahlin committed
177 178 179 180
void           glade_project_set_format      	  (GladeProject *project, GladeProjectFormat format);

GladeProjectFormat glade_project_get_format  	  (GladeProject *project);

181 182
void           glade_project_preferences          (GladeProject *project);

183 184
void           glade_project_verify_properties    (GladeWidget  *widget);

185 186 187
gchar         *glade_project_verify_widget_adaptor (GladeProject       *project,
						    GladeWidgetAdaptor *adaptor,
						    GladeSupportMask   *mask);
188

189 190 191
gboolean      glade_project_is_loaded_factory_file (GladeProject       *project, 
						    const gchar        *stock_id);

Jose Maria Celorio's avatar
Jose Maria Celorio committed
192 193 194
G_END_DECLS

#endif /* __GLADE_PROJECT_H__ */