summaryrefslogtreecommitdiff
path: root/src/csimport.c
blob: fd77744a389aa020a8f86f84203872110044b5b2 (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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
/* csimport.c generated by valac, the Vala compiler
 * generated from csimport.vala, do not modify */

/*
 * Copyright 2010 Joakim Sindholt <opensource@zhasha.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * on the rights to use, copy, modify, merge, publish, distribute, sub
 * license, and/or sell copies of the Software, and to permit persons to whom
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS IN THE SOFTWARE. */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <gdk/gdk.h>


#define GUI_TYPE_CS_IMPORT (gui_cs_import_get_type ())
#define GUI_CS_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CS_IMPORT, GUICSImport))
#define GUI_CS_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CS_IMPORT, GUICSImportClass))
#define GUI_IS_CS_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CS_IMPORT))
#define GUI_IS_CS_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CS_IMPORT))
#define GUI_CS_IMPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CS_IMPORT, GUICSImportClass))

typedef struct _GUICSImport GUICSImport;
typedef struct _GUICSImportClass GUICSImportClass;
typedef struct _GUICSImportPrivate GUICSImportPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_array_free0(var) ((var == NULL) ? NULL : (var = (g_array_free (var, TRUE), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define GUI_TYPE_MAIN_WINDOW (gui_main_window_get_type ())
#define GUI_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_MAIN_WINDOW, GUIMainWindow))
#define GUI_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_MAIN_WINDOW, GUIMainWindowClass))
#define GUI_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_MAIN_WINDOW))
#define GUI_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_MAIN_WINDOW))
#define GUI_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_MAIN_WINDOW, GUIMainWindowClass))

typedef struct _GUIMainWindow GUIMainWindow;
typedef struct _GUIMainWindowClass GUIMainWindowClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))

#define EMULATION_TYPE_CS (emulation_cs_get_type ())
#define EMULATION_CS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_CS, EmulationCS))
#define EMULATION_CS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_CS, EmulationCSClass))
#define EMULATION_IS_CS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_CS))
#define EMULATION_IS_CS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_CS))
#define EMULATION_CS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_CS, EmulationCSClass))

typedef struct _EmulationCS EmulationCS;
typedef struct _EmulationCSClass EmulationCSClass;
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))

#define EMULATION_TYPE_PACKET (emulation_packet_get_type ())
#define EMULATION_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET, EmulationPacket))
#define EMULATION_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET, EmulationPacketClass))
#define EMULATION_IS_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET))
#define EMULATION_IS_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET))
#define EMULATION_PACKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET, EmulationPacketClass))

typedef struct _EmulationPacket EmulationPacket;
typedef struct _EmulationPacketClass EmulationPacketClass;

struct _GUICSImport {
	GtkDialog parent_instance;
	GUICSImportPrivate * priv;
};

struct _GUICSImportClass {
	GtkDialogClass parent_class;
};

struct _GUICSImportPrivate {
	GtkEntry* name_entry;
	GtkLabel* status_label;
	GtkListStore* meta_store;
	GtkButton* ok_button;
	GArray* dwords;
	gboolean validcs;
};


static char* gui_cs_import_xml_ui;
static char* gui_cs_import_xml_ui = NULL;
static char** gui_cs_import_packets;
static gint gui_cs_import_packets_length1;
static char** gui_cs_import_packets = NULL;
static gint gui_cs_import_packets_length1 = 0;
static gint gui_cs_import_packets_size = 0;
extern GUIMainWindow* gui_main;
static gpointer gui_cs_import_parent_class = NULL;

GType gui_cs_import_get_type (void);
#define GUI_CS_IMPORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GUI_TYPE_CS_IMPORT, GUICSImportPrivate))
enum  {
	GUI_CS_IMPORT_DUMMY_PROPERTY
};
GType gui_main_window_get_type (void);
static void _lambda17_ (GtkCellLayout* coll, GtkCellRenderer* celll, GtkTreeModel* model, GtkTreeIter* iter, GUICSImport* self);
static void __lambda17__gtk_cell_layout_data_func (GtkCellLayout* cell_layout, GtkCellRenderer* cell, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer self);
static void gui_cs_import_open_cs (GUICSImport* self, const char* filename);
static void _lambda18_ (GtkButton* source, GUICSImport* self);
static void __lambda18__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void gui_cs_import_update_ok_button (GUICSImport* self);
static void _gui_cs_import_update_ok_button_gtk_editable_changed (GtkEditable* _sender, gpointer self);
GType emulation_cs_get_type (void);
void gui_main_window_add_cs (GUIMainWindow* self, const char* name, EmulationCS* cs);
EmulationCS* emulation_cs_new (guint32* dwords, guint len);
EmulationCS* emulation_cs_construct (GType object_type, guint32* dwords, guint len);
static void _lambda19_ (GtkDialog* source, gint id, GUICSImport* self);
static void __lambda19__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
GUICSImport* gui_cs_import_new (void);
GUICSImport* gui_cs_import_construct (GType object_type);
GType emulation_packet_get_type (void);
EmulationPacket* emulation_packet_make (guint32 header, guint32* dwords);
guint emulation_packet_get_length (EmulationPacket* self);
guint emulation_packet_get_type_id (EmulationPacket* self);
static void gui_cs_import_finalize (GObject* obj);



static glong string_get_length (const char* self) {
	glong result;
	g_return_val_if_fail (self != NULL, 0L);
	result = g_utf8_strlen (self, -1);
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _lambda17_ (GtkCellLayout* coll, GtkCellRenderer* celll, GtkTreeModel* model, GtkTreeIter* iter, GUICSImport* self) {
	GtkTreePath* path;
	gint* indices;
	char* _tmp0_;
	GtkCellRenderer* _tmp1_;
	g_return_if_fail (coll != NULL);
	g_return_if_fail (celll != NULL);
	g_return_if_fail (model != NULL);
	path = gtk_tree_model_get_path ((GtkTreeModel*) self->priv->meta_store, iter);
	g_assert (path != NULL);
	indices = gtk_tree_path_get_indices (path);
	g_assert (indices[0] < self->priv->dwords->len);
	g_object_set ((_tmp1_ = celll, GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL), "text", _tmp0_ = g_strdup_printf ("0x%08X", g_array_index (self->priv->dwords, guint32, (guint) indices[0])), NULL);
	_g_free0 (_tmp0_);
	_gtk_tree_path_free0 (path);
}


static void __lambda17__gtk_cell_layout_data_func (GtkCellLayout* cell_layout, GtkCellRenderer* cell, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer self) {
	_lambda17_ (cell_layout, cell, tree_model, iter, self);
}


static void _lambda18_ (GtkButton* source, GUICSImport* self) {
	GtkFileChooserDialog* fc;
	g_return_if_fail (source != NULL);
	fc = g_object_ref_sink ((GtkFileChooserDialog*) gtk_file_chooser_dialog_new ("Open File", (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL, NULL));
	if (gtk_dialog_run ((GtkDialog*) fc) == GTK_RESPONSE_OK) {
		char* _tmp0_;
		gui_cs_import_open_cs (self, _tmp0_ = gtk_file_chooser_get_filename ((GtkFileChooser*) fc));
		_g_free0 (_tmp0_);
	}
	gtk_object_destroy ((GtkObject*) fc);
	_g_object_unref0 (fc);
}


static void __lambda18__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	_lambda18_ (_sender, self);
}


static void _gui_cs_import_update_ok_button_gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	gui_cs_import_update_ok_button (self);
}


static void _lambda19_ (GtkDialog* source, gint id, GUICSImport* self) {
	g_return_if_fail (source != NULL);
	if (id == GTK_RESPONSE_OK) {
		EmulationCS* _tmp0_;
		gui_main_window_add_cs (gui_main, gtk_entry_get_text (self->priv->name_entry), _tmp0_ = emulation_cs_new (&g_array_index (self->priv->dwords, guint32, (guint) 0), self->priv->dwords->len));
		_g_object_unref0 (_tmp0_);
	}
	gtk_object_destroy ((GtkObject*) self);
}


static void __lambda19__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	_lambda19_ (_sender, response_id, self);
}


GUICSImport* gui_cs_import_construct (GType object_type) {
	GError * _inner_error_;
	GUICSImport * self;
	GtkBuilder* builder;
	GObject* _tmp0_;
	GtkTreeViewColumn* col;
	GObject* _tmp1_;
	GtkCellRendererText* cell;
	GtkListStore* _tmp3_;
	GObject* _tmp2_;
	GtkButton* _tmp5_;
	GtkWidget* _tmp4_;
	GObject* _tmp6_;
	GtkButton* load_button;
	GArray* _tmp7_;
	GtkEntry* _tmp9_;
	GObject* _tmp8_;
	GdkColor _tmp10_ = {0};
	GdkColor color;
	GtkLabel* _tmp12_;
	GObject* _tmp11_;
	GObject* _tmp13_;
	_inner_error_ = NULL;
	self = g_object_newv (object_type, 0, NULL);
	builder = gtk_builder_new ();
	{
		gtk_builder_add_from_string (builder, gui_cs_import_xml_ui, (gsize) string_get_length (gui_cs_import_xml_ui), &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
			fprintf (stderr, "Unable to construct import dialog.\n");
			_g_error_free0 (e);
			_g_object_unref0 (builder);
			return self;
		}
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (builder);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) gui_main);
	gtk_window_set_title ((GtkWindow*) self, "Import CS");
	col = _g_object_ref0 ((_tmp0_ = gtk_builder_get_object (builder, "value_column"), GTK_IS_TREE_VIEW_COLUMN (_tmp0_) ? ((GtkTreeViewColumn*) _tmp0_) : NULL));
	cell = _g_object_ref0 ((_tmp1_ = gtk_builder_get_object (builder, "value_cell"), GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL));
	gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) col, (GtkCellRenderer*) cell, __lambda17__gtk_cell_layout_data_func, g_object_ref (self), g_object_unref);
	self->priv->meta_store = (_tmp3_ = _g_object_ref0 ((_tmp2_ = gtk_builder_get_object (builder, "meta_store"), GTK_IS_LIST_STORE (_tmp2_) ? ((GtkListStore*) _tmp2_) : NULL)), _g_object_unref0 (self->priv->meta_store), _tmp3_);
	gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CANCEL, (gint) GTK_RESPONSE_CANCEL);
	self->priv->ok_button = (_tmp5_ = _g_object_ref0 ((_tmp4_ = gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_OK, (gint) GTK_RESPONSE_OK), GTK_IS_BUTTON (_tmp4_) ? ((GtkButton*) _tmp4_) : NULL)), _g_object_unref0 (self->priv->ok_button), _tmp5_);
	gtk_widget_set_sensitive ((GtkWidget*) self->priv->ok_button, FALSE);
	load_button = _g_object_ref0 ((_tmp6_ = gtk_builder_get_object (builder, "load_button"), GTK_IS_BUTTON (_tmp6_) ? ((GtkButton*) _tmp6_) : NULL));
	g_signal_connect_object (load_button, "clicked", (GCallback) __lambda18__gtk_button_clicked, self, 0);
	self->priv->validcs = FALSE;
	self->priv->dwords = (_tmp7_ = g_array_new (FALSE, FALSE, (guint) sizeof (guint32)), _g_array_free0 (self->priv->dwords), _tmp7_);
	self->priv->name_entry = (_tmp9_ = _g_object_ref0 ((_tmp8_ = gtk_builder_get_object (builder, "name_entry"), GTK_IS_ENTRY (_tmp8_) ? ((GtkEntry*) _tmp8_) : NULL)), _g_object_unref0 (self->priv->name_entry), _tmp9_);
	g_signal_connect_object ((GtkEditable*) self->priv->name_entry, "changed", (GCallback) _gui_cs_import_update_ok_button_gtk_editable_changed, self, 0);
	color = (memset (&_tmp10_, 0, sizeof (GdkColor)), _tmp10_);
	color.red = (guint16) 0xFFFF;
	color.green = (guint16) 0x0000;
	color.blue = (guint16) 0x0000;
	self->priv->status_label = (_tmp12_ = _g_object_ref0 ((_tmp11_ = gtk_builder_get_object (builder, "status_label"), GTK_IS_LABEL (_tmp11_) ? ((GtkLabel*) _tmp11_) : NULL)), _g_object_unref0 (self->priv->status_label), _tmp12_);
	gtk_widget_modify_fg ((GtkWidget*) self->priv->status_label, GTK_STATE_NORMAL, &color);
	gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, (GtkWidget*) (_tmp13_ = gtk_builder_get_object (builder, "mainbox"), GTK_IS_VBOX (_tmp13_) ? ((GtkVBox*) _tmp13_) : NULL), TRUE, TRUE, (guint) 0);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) __lambda19__gtk_dialog_response, self, 0);
	gtk_window_set_default_size ((GtkWindow*) self, 300, 400);
	_g_object_unref0 (builder);
	_g_object_unref0 (col);
	_g_object_unref0 (cell);
	_g_object_unref0 (load_button);
	return self;
}


GUICSImport* gui_cs_import_new (void) {
	return gui_cs_import_construct (GUI_TYPE_CS_IMPORT);
}


static void gui_cs_import_open_cs (GUICSImport* self, const char* filename) {
	FILE* fs;
	guint32 dword = 0U;
	guint dword_count;
	g_return_if_fail (self != NULL);
	g_return_if_fail (filename != NULL);
	fs = fopen (filename, "r");
	if (fs == NULL) {
		char* _tmp0_;
		GtkMessageDialog* _tmp1_;
		GtkMessageDialog* dlg;
		dlg = (_tmp1_ = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _tmp0_ = g_strconcat ("Unable to open the selected file: ", filename, NULL))), _g_free0 (_tmp0_), _tmp1_);
		gtk_dialog_run ((GtkDialog*) dlg);
		gtk_object_destroy ((GtkObject*) dlg);
		_g_object_unref0 (dlg);
		_fclose0 (fs);
		return;
	}
	gtk_list_store_clear (self->priv->meta_store);
	g_array_set_size (self->priv->dwords, (guint) 0);
	dword_count = (guint) 0;
	{
		guint id;
		id = (guint) 0;
		{
			gboolean _tmp2_;
			_tmp2_ = TRUE;
			while (TRUE) {
				GtkTreeIter iter = {0};
				if (!_tmp2_) {
					id++;
				}
				_tmp2_ = FALSE;
				if (!(fscanf (fs, "%x", &dword) == 1)) {
					break;
				}
				g_array_append_val (self->priv->dwords, dword);
				gtk_list_store_append (self->priv->meta_store, &iter);
				if (dword_count > 0) {
					dword_count--;
					gtk_list_store_set (self->priv->meta_store, &iter, 0, NULL, -1, -1);
				} else {
					EmulationPacket* p;
					p = emulation_packet_make (dword, NULL);
					dword_count = emulation_packet_get_length (p);
					gtk_list_store_set (self->priv->meta_store, &iter, 0, gui_cs_import_packets[emulation_packet_get_type_id (p)], -1, -1);
					_g_object_unref0 (p);
				}
			}
		}
	}
	self->priv->validcs = dword_count == 0;
	gui_cs_import_update_ok_button (self);
	_fclose0 (fs);
}


static void gui_cs_import_update_ok_button (GUICSImport* self) {
	g_return_if_fail (self != NULL);
	if (self->priv->validcs) {
		gboolean _tmp0_ = FALSE;
		if (gtk_entry_get_text_length (self->priv->name_entry) > 0) {
			_tmp0_ = self->priv->dwords->len > 0;
		} else {
			_tmp0_ = FALSE;
		}
		gtk_widget_set_sensitive ((GtkWidget*) self->priv->ok_button, _tmp0_);
		gtk_label_set_label (self->priv->status_label, "");
	} else {
		if (gtk_widget_get_sensitive ((GtkWidget*) self->priv->ok_button)) {
			gtk_widget_set_sensitive ((GtkWidget*) self->priv->ok_button, FALSE);
			gtk_label_set_label (self->priv->status_label, "This CS is invalid!");
		}
	}
}


static void gui_cs_import_class_init (GUICSImportClass * klass) {
	char** _tmp0_ = NULL;
	gui_cs_import_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GUICSImportPrivate));
	G_OBJECT_CLASS (klass)->finalize = gui_cs_import_finalize;
	gui_cs_import_xml_ui = g_strdup ("\n        <?xml version=\"1.0\"?>\n        <interface>\n          <requires lib=\"gtk+\" version=\"2.16\"/>\n          <!-- interface-naming-policy project-wide -->\n          <object class=\"GtkListStore\" id=\"meta_store\">\n            <columns>\n              <!-- column-name Meta -->\n              <column type=\"gchararray\"/>\n            </columns>\n          </object>\n          <object class=\"GtkVBox\" id=\"mainbox\">\n            <property name=\"visible\">True</property>\n            <property name=\"orientation\">vertical</property>\n            <child>\n              <object class=\"GtkFrame\" id=\"frame1\">\n                <property name=\"visible\">True</property>\n                <property name=\"label_xalign\">0</property>\n                <property name=\"shadow_type\">none</property>\n                <child>\n                  <object class=\"GtkAlignment\" id=\"alignment1\">\n                    <property name=\"visible\">True</property>\n                    <property name=\"left_padding\">12</property>\n                    <child>\n                      <object class=\"GtkEntry\" id=\"name_entry\">\n                        <property name=\"visible\">True</property>\n                        <property name=\"can_focus\">True</property>\n                        <property name=\"invisible_char\">&#x25CF;</property>\n                      </object>\n                    </child>\n                  </object>\n                </child>\n                <child type=\"label\">\n                  <object class=\"GtkLabel\" id=\"label1\">\n                    <property name=\"visible\">True</property>\n                    <property name=\"label\" translatable=\"yes\">&lt;b&gt;Name&lt;/b&gt;</property>\n                    <property name=\"use_markup\">True</property>\n                  </object>\n                </child>\n              </object>\n              <packing>\n                <property name=\"expand\">False</property>\n                <property name=\"position\">0</property>\n              </packing>\n            </child>\n            <child>\n              <object class=\"GtkFrame\" id=\"frame2\">\n                <property name=\"visible\">True</property>\n                <property name=\"label_xalign\">0</property>\n                <property name=\"shadow_type\">none</property>\n                <child>\n                  <object class=\"GtkAlignment\" id=\"alignment2\">\n                    <property name=\"visible\">True</property>\n                    <property name=\"left_padding\">12</property>\n                    <child>\n                      <object class=\"GtkScrolledWindow\" id=\"scrolledwindow1\">\n                        <property name=\"visible\">True</property>\n                        <property name=\"can_focus\">True</property>\n                        <property name=\"hscrollbar_policy\">automatic</property>\n                        <property name=\"vscrollbar_policy\">automatic</property>\n                        <property name=\"shadow_type\">etched-in</property>\n                        <child>\n                          <object class=\"GtkTreeView\" id=\"dword_view\">\n                            <property name=\"visible\">True</property>\n                            <property name=\"can_focus\">True</property>\n                            <property name=\"model\">meta_store</property>\n                            <child>\n                              <object class=\"GtkTreeViewColumn\" id=\"value_column\">\n                                <property name=\"title\">Value</property>\n                                <child>\n                                  <object class=\"GtkCellRendererText\" id=\"value_cell\"/>\n                                </child>\n                              </object>\n                            </child>\n                            <child>\n                              <object class=\"GtkTreeViewColumn\" id=\"treeviewcolumn3\">\n                                <property name=\"title\">Meta</property>\n                                <child>\n                                  <object class=\"GtkCellRendererText\" id=\"cellrenderertext2\"/>\n                                  <attributes>\n                                    <attribute name=\"text\">0</attribute>\n                                  </attributes>\n                                </child>\n                              </object>\n                            </child>\n                          </object>\n                        </child>\n                      </object>\n                    </child>\n                  </object>\n                </child>\n                <child type=\"label\">\n                  <object class=\"GtkLabel\" id=\"label2\">\n                    <property name=\"visible\">True</property>\n                    <property name=\"label\" translatable=\"yes\">&lt;b&gt;DWORDs&lt;/b&gt;</property>\n                    <property name=\"use_markup\">True</property>\n                  </object>\n                </child>\n              </object>\n              <packing>\n                <property name=\"position\">1</property>\n              </packing>\n            </child>\n            <child>\n              <object class=\"GtkAlignment\" id=\"alignment3\">\n                <property name=\"visible\">True</property>\n                <property name=\"right_padding\">5</property>\n                <property name=\"bottom_padding\">3</property>\n                <child>\n                  <object class=\"GtkHBox\" id=\"hbox1\">\n                    <property name=\"visible\">True</property>\n                    <child>\n                      <object class=\"GtkLabel\" id=\"status_label\">\n                        <property name=\"visible\">True</property>\n                      </object>\n                      <packing>\n                        <property name=\"position\">0</property>\n                      </packing>\n                    </child>\n                    <child>\n                      <object class=\"GtkHButtonBox\" id=\"hbuttonbox1\">\n                        <property name=\"visible\">True</property>\n                        <property name=\"layout_style\">end</property>\n                        <child>\n                          <object class=\"GtkButton\" id=\"load_button\">\n                            <property name=\"label\" translatable=\"yes\">Load</property>\n                            <property name=\"visible\">True</property>\n                            <property name=\"can_focus\">True</property>\n                            <property name=\"receives_default\">True</property>\n                            <property name=\"image\">image1</property>\n                          </object>\n                          <packing>\n                            <property name=\"expand\">False</property>\n                            <property name=\"fill\">False</property>\n                            <property name=\"position\">0</property>\n                          </packing>\n                        </child>\n                      </object>\n                      <packing>\n                        <property name=\"expand\">False</property>\n                        <property name=\"position\">1</property>\n                      </packing>\n                    </child>\n                  </object>\n                </child>\n              </object>\n              <packing>\n                <property name=\"expand\">False</property>\n                <property name=\"fill\">False</property>\n                <property name=\"position\">2</property>\n              </packing>\n            </child>\n          </object>\n          <object class=\"GtkImage\" id=\"image1\">\n            <property name=\"visible\">True</property>\n            <property name=\"stock\">gtk-convert</property>\n          </object>\n        </interface>\n        ");
	gui_cs_import_packets = (_tmp0_ = g_new0 (char*, 4 + 1), _tmp0_[0] = g_strdup ("packet0"), _tmp0_[1] = g_strdup ("packet1"), _tmp0_[2] = g_strdup ("packet2"), _tmp0_[3] = g_strdup ("packet3"), _tmp0_);
	gui_cs_import_packets_length1 = 4;
}


static void gui_cs_import_instance_init (GUICSImport * self) {
	self->priv = GUI_CS_IMPORT_GET_PRIVATE (self);
}


static void gui_cs_import_finalize (GObject* obj) {
	GUICSImport * self;
	self = GUI_CS_IMPORT (obj);
	_g_object_unref0 (self->priv->name_entry);
	_g_object_unref0 (self->priv->status_label);
	_g_object_unref0 (self->priv->meta_store);
	_g_object_unref0 (self->priv->ok_button);
	_g_array_free0 (self->priv->dwords);
	G_OBJECT_CLASS (gui_cs_import_parent_class)->finalize (obj);
}


GType gui_cs_import_get_type (void) {
	static GType gui_cs_import_type_id = 0;
	if (gui_cs_import_type_id == 0) {
		static const GTypeInfo g_define_type_info = { sizeof (GUICSImportClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gui_cs_import_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GUICSImport), 0, (GInstanceInitFunc) gui_cs_import_instance_init, NULL };
		gui_cs_import_type_id = g_type_register_static (GTK_TYPE_DIALOG, "GUICSImport", &g_define_type_info, 0);
	}
	return gui_cs_import_type_id;
}