summaryrefslogtreecommitdiff
path: root/gladeui/glade-project.h
blob: 99f20b8744e05df1891a1be88ae28936ade69856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_PROJECT_H__
#define __GLADE_PROJECT_H__

#include <gladeui/glade-widget.h>
#include <gladeui/glade-command.h>
#include <gladeui/glade-utils.h>
#include <gladeui/glade-xml-utils.h>


G_BEGIN_DECLS

#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))

typedef struct _GladeProjectPrivate  GladeProjectPrivate;
typedef struct _GladeProjectClass    GladeProjectClass;

typedef enum
{
	GLADE_SUPPORT_OK                   = 0,
	GLADE_SUPPORT_DEPRECATED           = (0x01 << 0),
	GLADE_SUPPORT_MISMATCH             = (0x01 << 1),
	GLADE_SUPPORT_LIBGLADE_UNSUPPORTED = (0x01 << 2),
	GLADE_SUPPORT_LIBGLADE_ONLY        = (0x01 << 3)
} GladeSupportMask;

/**
 * GladeProjectModelColumns:
 * @GLADE_PROJECT_MODEL_ICON_NAME: name of the icon for the widget
 * @GLADE_PROJECT_MODEL_ICON_NAME_COLUMN_NAME: Name of the widget
 * @GLADE_PROJECT_MODEL_ICON_NAME_COLUMN_OBJECT: the GObject of the widget
 * @GLADE_PROJECT_MODEL_ICON_NAME_N_COLUMNS: Number of columns
 *
 * The tree view columns provided by the GtkTreeModel implemented
 * by GladeProject
 *
 **/
typedef enum
{
	GLADE_PROJECT_MODEL_COLUMN_ICON_NAME,
	GLADE_PROJECT_MODEL_COLUMN_NAME,
	GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME,
	GLADE_PROJECT_MODEL_COLUMN_OBJECT,
	GLADE_PROJECT_MODEL_COLUMN_MISC,
	GLADE_PROJECT_MODEL_N_COLUMNS
} GladeProjectModelColumns;

struct _GladeProject
{
	GObject parent_instance;

	GladeProjectPrivate *priv;
};

struct _GladeProjectClass
{
	GObjectClass parent_class;

	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          (*parse_finished)      (GladeProject *project);
};


GType          glade_project_get_type            (void) G_GNUC_CONST;

GladeProject  *glade_project_new                 (void);

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

gboolean       glade_project_save                (GladeProject *project, 
						  const gchar   *path, 
						  GError       **error);

void           glade_project_preview             (GladeProject *project, GladeWidget *gwidget);

const gchar   *glade_project_get_path            (GladeProject *project);

gchar         *glade_project_get_name            (GladeProject *project);


void           glade_project_undo                (GladeProject *project);

void           glade_project_redo                (GladeProject *project);

GladeCommand  *glade_project_next_undo_item      (GladeProject *project);

GladeCommand  *glade_project_next_redo_item      (GladeProject *project);

void           glade_project_push_undo           (GladeProject *project, 
						  GladeCommand *cmd);

GtkWidget     *glade_project_undo_items          (GladeProject *project);

GtkWidget     *glade_project_redo_items          (GladeProject *project);

void           glade_project_reset_path          (GladeProject *project);

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);

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

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

GladeWidget   *glade_project_get_widget_by_name  (GladeProject *project, 
						  GladeWidget  *ancestor,
						  const gchar  *name);

void           glade_project_set_widget_name     (GladeProject *project, 
						  GladeWidget  *widget, 
						  const gchar  *name);

gchar         *glade_project_new_widget_name     (GladeProject *project, 
						  GladeWidget  *widget, 
						  const gchar  *base_name);

gboolean       glade_project_available_widget_name (GladeProject *project, GladeWidget  *widget,
						    const gchar  *name);

/* Selection */

gboolean       glade_project_is_selected         (GladeProject *project,
						 GObject      *object);

void           glade_project_selection_set       (GladeProject *project,
						 GObject      *object,
						 gboolean      emit_signal);

void           glade_project_selection_add       (GladeProject *project,
						 GObject      *object,
						 gboolean      emit_signal);

void           glade_project_selection_remove    (GladeProject *project,
						 GObject      *object,
						 gboolean      emit_signal);

void           glade_project_selection_clear     (GladeProject *project,
						 gboolean      emit_signal);

void           glade_project_selection_changed   (GladeProject *project);

GList         *glade_project_selection_get       (GladeProject *project);

gboolean       glade_project_get_has_selection   (GladeProject *project);

gchar         *glade_project_resource_fullpath    (GladeProject  *project,
						   const gchar   *resource);
 
gboolean       glade_project_is_loading           (GladeProject *project);
 
time_t         glade_project_get_file_mtime       (GladeProject *project);

gboolean       glade_project_get_modified         (GladeProject *project);

gboolean       glade_project_get_previewable      (GladeProject *project);

void           glade_project_set_format      	  (GladeProject *project, GladeProjectFormat format);

GladeProjectFormat glade_project_get_format  	  (GladeProject *project);

void           glade_project_preferences          (GladeProject *project);

void           glade_project_verify_properties    (GladeWidget  *widget);

gchar         *glade_project_verify_widget_adaptor (GladeProject       *project,
						    GladeWidgetAdaptor *adaptor,
						    GladeSupportMask   *mask);

void          glade_project_verify_project_for_ui (GladeProject  *project);

GList        *glade_project_required_libs          (GladeProject       *project);

void          glade_project_set_naming_policy      (GladeProject       *project,
						    GladeNamingPolicy   policy);

GladeNamingPolicy glade_project_get_naming_policy  (GladeProject       *project);
void          glade_project_get_target_version     (GladeProject       *project,
						    const gchar        *catalog,
						    gint               *major,
						    gint               *minor);

void          glade_project_update_signal_support_warning (GladeWidget  *widget,
							   GladeSignal  *signal);


gchar        *glade_project_display_dependencies (GladeProject *project);

void          glade_project_push_progress (GladeProject *project);
gboolean      glade_project_load_cancelled (GladeProject *project);
void          glade_project_cancel_load (GladeProject *project);

G_END_DECLS

#endif /* __GLADE_PROJECT_H__ */