File: markers-vala.c

package info (click to toggle)
libchamplain 0.12.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,264 kB
  • ctags: 3,353
  • sloc: ansic: 16,562; sh: 11,332; makefile: 420; python: 244; xml: 211
file content (249 lines) | stat: -rw-r--r-- 8,424 bytes parent folder | download | duplicates (3)
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
/* markers-vala.c generated by valac 0.22.1, the Vala compiler
 * generated from markers-vala.vala, do not modify */

/*
 * Copyright (C) 2010 Simon Wenner <simon@wenner.ch>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <champlain/champlain.h>
#include <clutter/clutter.h>
#include <pango/pango.h>


#define TYPE_DEMO_LAYER (demo_layer_get_type ())
#define DEMO_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEMO_LAYER, DemoLayer))
#define DEMO_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEMO_LAYER, DemoLayerClass))
#define IS_DEMO_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEMO_LAYER))
#define IS_DEMO_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEMO_LAYER))
#define DEMO_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEMO_LAYER, DemoLayerClass))

typedef struct _DemoLayer DemoLayer;
typedef struct _DemoLayerClass DemoLayerClass;
typedef struct _DemoLayerPrivate DemoLayerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _DemoLayer {
	ChamplainMarkerLayer parent_instance;
	DemoLayerPrivate * priv;
};

struct _DemoLayerClass {
	ChamplainMarkerLayerClass parent_class;
};


static gpointer demo_layer_parent_class = NULL;

GType demo_layer_get_type (void) G_GNUC_CONST;
enum  {
	DEMO_LAYER_DUMMY_PROPERTY
};
DemoLayer* demo_layer_new (void);
DemoLayer* demo_layer_construct (GType object_type);


DemoLayer* demo_layer_construct (GType object_type) {
	DemoLayer * self = NULL;
	ClutterColor orange = {0};
	ClutterColor _tmp0_ = {0};
	ChamplainLabel* marker = NULL;
	ChamplainLabel* _tmp1_ = NULL;
	ChamplainLabel* _tmp2_ = NULL;
	ChamplainLabel* _tmp3_ = NULL;
	ChamplainLabel* _tmp4_ = NULL;
	ClutterColor _tmp5_ = {0};
	ChamplainLabel* _tmp6_ = NULL;
	ChamplainLabel* _tmp7_ = NULL;
	ChamplainLabel* _tmp12_ = NULL;
	ChamplainLabel* _tmp13_ = NULL;
	ChamplainLabel* _tmp14_ = NULL;
	ChamplainLabel* _tmp19_ = NULL;
	ChamplainLabel* _tmp20_ = NULL;
	ChamplainLabel* _tmp25_ = NULL;
	ChamplainLabel* _tmp26_ = NULL;
	ChamplainLabel* _tmp27_ = NULL;
	GError * _inner_error_ = NULL;
	self = (DemoLayer*) g_object_new (object_type, NULL);
	_tmp0_.red = (guint8) 0xf3;
	_tmp0_.green = (guint8) 0x94;
	_tmp0_.blue = (guint8) 0x07;
	_tmp0_.alpha = (guint8) 0xbb;
	orange = _tmp0_;
	_tmp1_ = (ChamplainLabel*) champlain_label_new_with_text ("Montréal\n<span size=\"xx-small\">Québec</span>", "Serif 14", NULL, NULL);
	g_object_ref_sink (_tmp1_);
	marker = _tmp1_;
	_tmp2_ = marker;
	champlain_label_set_use_markup (_tmp2_, TRUE);
	_tmp3_ = marker;
	champlain_label_set_alignment (_tmp3_, PANGO_ALIGN_RIGHT);
	_tmp4_ = marker;
	_tmp5_ = orange;
	champlain_label_set_color (_tmp4_, &_tmp5_);
	_tmp6_ = marker;
	champlain_location_set_location ((ChamplainLocation*) _tmp6_, 45.528178, -73.563788);
	_tmp7_ = marker;
	champlain_marker_layer_add_marker ((ChamplainMarkerLayer*) self, (ChamplainMarker*) _tmp7_);
	{
		ChamplainLabel* _tmp8_ = NULL;
		ChamplainLabel* _tmp9_ = NULL;
		_tmp9_ = (ChamplainLabel*) champlain_label_new_from_file ("icons/emblem-generic.png", &_inner_error_);
		g_object_ref_sink (_tmp9_);
		_tmp8_ = _tmp9_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		g_object_ref_sink (_tmp8_);
		_g_object_unref0 (marker);
		marker = _tmp8_;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp10_ = e;
		_tmp11_ = _tmp10_->message;
		g_warning ("markers-vala.vala:40: %s", _tmp11_);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (marker);
		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;
	}
	_tmp12_ = marker;
	champlain_label_set_text (_tmp12_, "New York");
	_tmp13_ = marker;
	champlain_location_set_location ((ChamplainLocation*) _tmp13_, 40.77, -73.98);
	_tmp14_ = marker;
	champlain_marker_layer_add_marker ((ChamplainMarkerLayer*) self, (ChamplainMarker*) _tmp14_);
	{
		ChamplainLabel* _tmp15_ = NULL;
		ChamplainLabel* _tmp16_ = NULL;
		_tmp16_ = (ChamplainLabel*) champlain_label_new_from_file ("icons/emblem-important.png", &_inner_error_);
		g_object_ref_sink (_tmp16_);
		_tmp15_ = _tmp16_;
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
		g_object_ref_sink (_tmp15_);
		_g_object_unref0 (marker);
		marker = _tmp15_;
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp17_ = NULL;
		const gchar* _tmp18_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp17_ = e;
		_tmp18_ = _tmp17_->message;
		g_warning ("markers-vala.vala:50: %s", _tmp18_);
		_g_error_free0 (e);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (marker);
		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;
	}
	_tmp19_ = marker;
	champlain_location_set_location ((ChamplainLocation*) _tmp19_, 47.130885, -70.764141);
	_tmp20_ = marker;
	champlain_marker_layer_add_marker ((ChamplainMarkerLayer*) self, (ChamplainMarker*) _tmp20_);
	{
		ChamplainLabel* _tmp21_ = NULL;
		ChamplainLabel* _tmp22_ = NULL;
		_tmp22_ = (ChamplainLabel*) champlain_label_new_from_file ("icons/emblem-favorite.png", &_inner_error_);
		g_object_ref_sink (_tmp22_);
		_tmp21_ = _tmp22_;
		if (_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
		g_object_ref_sink (_tmp21_);
		_g_object_unref0 (marker);
		marker = _tmp21_;
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
		GError* _tmp23_ = NULL;
		const gchar* _tmp24_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp23_ = e;
		_tmp24_ = _tmp23_->message;
		g_warning ("markers-vala.vala:59: %s", _tmp24_);
		_g_error_free0 (e);
	}
	__finally2:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (marker);
		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;
	}
	_tmp25_ = marker;
	champlain_label_set_draw_background (_tmp25_, FALSE);
	_tmp26_ = marker;
	champlain_location_set_location ((ChamplainLocation*) _tmp26_, 45.41484, -71.918907);
	_tmp27_ = marker;
	champlain_marker_layer_add_marker ((ChamplainMarkerLayer*) self, (ChamplainMarker*) _tmp27_);
	_g_object_unref0 (marker);
	return self;
}


DemoLayer* demo_layer_new (void) {
	return demo_layer_construct (TYPE_DEMO_LAYER);
}


static void demo_layer_class_init (DemoLayerClass * klass) {
	demo_layer_parent_class = g_type_class_peek_parent (klass);
}


static void demo_layer_instance_init (DemoLayer * self) {
}


GType demo_layer_get_type (void) {
	static volatile gsize demo_layer_type_id__volatile = 0;
	if (g_once_init_enter (&demo_layer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DemoLayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) demo_layer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DemoLayer), 0, (GInstanceInitFunc) demo_layer_instance_init, NULL };
		GType demo_layer_type_id;
		demo_layer_type_id = g_type_register_static (champlain_marker_layer_get_type (), "DemoLayer", &g_define_type_info, 0);
		g_once_init_leave (&demo_layer_type_id__volatile, demo_layer_type_id);
	}
	return demo_layer_type_id__volatile;
}