summaryrefslogtreecommitdiff
path: root/src/util/ui.c
blob: ac81527f9574536aada0b5176963d37ac3731229 (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
/* ui.c generated by valac 0.34.1, the Vala compiler
 * generated from ui.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <glib.h>
#include <glib-object.h>
#include "shotwell-plugin-dev-1.0.h"
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>


#define TYPE_ADJUSTMENT_RELATION (adjustment_relation_get_type ())

#define TYPE_COMPASS_POINT (compass_point_get_type ())

#define TYPE_DIRECTION (direction_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))

typedef enum  {
	ADJUSTMENT_RELATION_BELOW,
	ADJUSTMENT_RELATION_IN_RANGE,
	ADJUSTMENT_RELATION_ABOVE
} AdjustmentRelation;

typedef enum  {
	COMPASS_POINT_NORTH,
	COMPASS_POINT_SOUTH,
	COMPASS_POINT_EAST,
	COMPASS_POINT_WEST
} CompassPoint;

typedef enum  {
	DIRECTION_FORWARD,
	DIRECTION_BACKWARD
} Direction;



GType adjustment_relation_get_type (void) G_GNUC_CONST;
GType compass_point_get_type (void) G_GNUC_CONST;
GType direction_get_type (void) G_GNUC_CONST;
SpitTransitionsDirection direction_to_transition_direction (Direction self);
const gchar* direction_to_string (Direction self);
void spin_event_loop (void);
AdjustmentRelation get_adjustment_relation (GtkAdjustment* adjustment, gint value);
void get_adjustment_page (GtkAdjustment* hadj, GtkAdjustment* vadj, GdkRectangle* result);
gboolean has_only_key_modifier (GdkModifierType field, GdkModifierType mask);
gchar* build_dummy_ui_string (GtkActionGroup** groups, int groups_length1);


GType adjustment_relation_get_type (void) {
	static volatile gsize adjustment_relation_type_id__volatile = 0;
	if (g_once_init_enter (&adjustment_relation_type_id__volatile)) {
		static const GEnumValue values[] = {{ADJUSTMENT_RELATION_BELOW, "ADJUSTMENT_RELATION_BELOW", "below"}, {ADJUSTMENT_RELATION_IN_RANGE, "ADJUSTMENT_RELATION_IN_RANGE", "in-range"}, {ADJUSTMENT_RELATION_ABOVE, "ADJUSTMENT_RELATION_ABOVE", "above"}, {0, NULL, NULL}};
		GType adjustment_relation_type_id;
		adjustment_relation_type_id = g_enum_register_static ("AdjustmentRelation", values);
		g_once_init_leave (&adjustment_relation_type_id__volatile, adjustment_relation_type_id);
	}
	return adjustment_relation_type_id__volatile;
}


GType compass_point_get_type (void) {
	static volatile gsize compass_point_type_id__volatile = 0;
	if (g_once_init_enter (&compass_point_type_id__volatile)) {
		static const GEnumValue values[] = {{COMPASS_POINT_NORTH, "COMPASS_POINT_NORTH", "north"}, {COMPASS_POINT_SOUTH, "COMPASS_POINT_SOUTH", "south"}, {COMPASS_POINT_EAST, "COMPASS_POINT_EAST", "east"}, {COMPASS_POINT_WEST, "COMPASS_POINT_WEST", "west"}, {0, NULL, NULL}};
		GType compass_point_type_id;
		compass_point_type_id = g_enum_register_static ("CompassPoint", values);
		g_once_init_leave (&compass_point_type_id__volatile, compass_point_type_id);
	}
	return compass_point_type_id__volatile;
}


SpitTransitionsDirection direction_to_transition_direction (Direction self) {
	SpitTransitionsDirection result = 0;
#line 25 "/home/jens/Source/shotwell/src/util/ui.vala"
	switch (self) {
#line 25 "/home/jens/Source/shotwell/src/util/ui.vala"
		case DIRECTION_FORWARD:
#line 91 "ui.c"
		{
#line 27 "/home/jens/Source/shotwell/src/util/ui.vala"
			result = SPIT_TRANSITIONS_DIRECTION_FORWARD;
#line 27 "/home/jens/Source/shotwell/src/util/ui.vala"
			return result;
#line 97 "ui.c"
		}
#line 25 "/home/jens/Source/shotwell/src/util/ui.vala"
		case DIRECTION_BACKWARD:
#line 101 "ui.c"
		{
#line 30 "/home/jens/Source/shotwell/src/util/ui.vala"
			result = SPIT_TRANSITIONS_DIRECTION_BACKWARD;
#line 30 "/home/jens/Source/shotwell/src/util/ui.vala"
			return result;
#line 107 "ui.c"
		}
		default:
		{
			GEnumValue* _tmp0_;
#line 33 "/home/jens/Source/shotwell/src/util/ui.vala"
			_tmp0_ = g_enum_get_value (g_type_class_ref (TYPE_DIRECTION), self);
#line 33 "/home/jens/Source/shotwell/src/util/ui.vala"
			g_error ("ui.vala:33: Unknown Direction %s", (_tmp0_ != NULL) ? _tmp0_->value_name : NULL);
#line 116 "ui.c"
		}
	}
}


GType direction_get_type (void) {
	static volatile gsize direction_type_id__volatile = 0;
	if (g_once_init_enter (&direction_type_id__volatile)) {
		static const GEnumValue values[] = {{DIRECTION_FORWARD, "DIRECTION_FORWARD", "forward"}, {DIRECTION_BACKWARD, "DIRECTION_BACKWARD", "backward"}, {0, NULL, NULL}};
		GType direction_type_id;
		direction_type_id = g_enum_register_static ("Direction", values);
		g_once_init_leave (&direction_type_id__volatile, direction_type_id);
	}
	return direction_type_id__volatile;
}


void spin_event_loop (void) {
#line 39 "/home/jens/Source/shotwell/src/util/ui.vala"
	while (TRUE) {
#line 137 "ui.c"
		gboolean _tmp0_ = FALSE;
#line 39 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp0_ = gtk_events_pending ();
#line 39 "/home/jens/Source/shotwell/src/util/ui.vala"
		if (!_tmp0_) {
#line 39 "/home/jens/Source/shotwell/src/util/ui.vala"
			break;
#line 145 "ui.c"
		}
#line 40 "/home/jens/Source/shotwell/src/util/ui.vala"
		gtk_main_iteration ();
#line 149 "ui.c"
	}
}


AdjustmentRelation get_adjustment_relation (GtkAdjustment* adjustment, gint value) {
	AdjustmentRelation result = 0;
	gint _tmp0_ = 0;
	GtkAdjustment* _tmp1_ = NULL;
	gdouble _tmp2_ = 0.0;
#line 43 "/home/jens/Source/shotwell/src/util/ui.vala"
	g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0);
#line 44 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp0_ = value;
#line 44 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp1_ = adjustment;
#line 44 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
#line 44 "/home/jens/Source/shotwell/src/util/ui.vala"
	if (_tmp0_ < ((gint) _tmp2_)) {
#line 45 "/home/jens/Source/shotwell/src/util/ui.vala"
		result = ADJUSTMENT_RELATION_BELOW;
#line 45 "/home/jens/Source/shotwell/src/util/ui.vala"
		return result;
#line 173 "ui.c"
	} else {
		gint _tmp3_ = 0;
		GtkAdjustment* _tmp4_ = NULL;
		gdouble _tmp5_ = 0.0;
		GtkAdjustment* _tmp6_ = NULL;
		gdouble _tmp7_ = 0.0;
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp3_ = value;
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp4_ = adjustment;
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp5_ = gtk_adjustment_get_value (_tmp4_);
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp6_ = adjustment;
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		_tmp7_ = gtk_adjustment_get_page_size (_tmp6_);
#line 46 "/home/jens/Source/shotwell/src/util/ui.vala"
		if (_tmp3_ > ((gint) (_tmp5_ + _tmp7_))) {
#line 47 "/home/jens/Source/shotwell/src/util/ui.vala"
			result = ADJUSTMENT_RELATION_ABOVE;
#line 47 "/home/jens/Source/shotwell/src/util/ui.vala"
			return result;
#line 196 "ui.c"
		} else {
#line 49 "/home/jens/Source/shotwell/src/util/ui.vala"
			result = ADJUSTMENT_RELATION_IN_RANGE;
#line 49 "/home/jens/Source/shotwell/src/util/ui.vala"
			return result;
#line 202 "ui.c"
		}
	}
}


void get_adjustment_page (GtkAdjustment* hadj, GtkAdjustment* vadj, GdkRectangle* result) {
	GdkRectangle rect = {0};
	GtkAdjustment* _tmp0_ = NULL;
	gdouble _tmp1_ = 0.0;
	GtkAdjustment* _tmp2_ = NULL;
	gdouble _tmp3_ = 0.0;
	GtkAdjustment* _tmp4_ = NULL;
	gdouble _tmp5_ = 0.0;
	GtkAdjustment* _tmp6_ = NULL;
	gdouble _tmp7_ = 0.0;
#line 52 "/home/jens/Source/shotwell/src/util/ui.vala"
	g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
#line 52 "/home/jens/Source/shotwell/src/util/ui.vala"
	g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
#line 53 "/home/jens/Source/shotwell/src/util/ui.vala"
	memset (&rect, 0, sizeof (GdkRectangle));
#line 54 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp0_ = hadj;
#line 54 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp1_ = gtk_adjustment_get_value (_tmp0_);
#line 54 "/home/jens/Source/shotwell/src/util/ui.vala"
	rect.x = (gint) _tmp1_;
#line 55 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp2_ = vadj;
#line 55 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp3_ = gtk_adjustment_get_value (_tmp2_);
#line 55 "/home/jens/Source/shotwell/src/util/ui.vala"
	rect.y = (gint) _tmp3_;
#line 56 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp4_ = hadj;
#line 56 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp5_ = gtk_adjustment_get_page_size (_tmp4_);
#line 56 "/home/jens/Source/shotwell/src/util/ui.vala"
	rect.width = (gint) _tmp5_;
#line 57 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp6_ = vadj;
#line 57 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp7_ = gtk_adjustment_get_page_size (_tmp6_);
#line 57 "/home/jens/Source/shotwell/src/util/ui.vala"
	rect.height = (gint) _tmp7_;
#line 59 "/home/jens/Source/shotwell/src/util/ui.vala"
	*result = rect;
#line 59 "/home/jens/Source/shotwell/src/util/ui.vala"
	return;
#line 252 "ui.c"
}


gboolean has_only_key_modifier (GdkModifierType field, GdkModifierType mask) {
	gboolean result = FALSE;
	GdkModifierType _tmp0_ = 0;
	GdkModifierType _tmp1_ = 0;
#line 77 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp0_ = field;
#line 77 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp1_ = mask;
#line 77 "/home/jens/Source/shotwell/src/util/ui.vala"
	result = (_tmp0_ & ((((((((GDK_SHIFT_MASK | GDK_CONTROL_MASK) | GDK_MOD1_MASK) | GDK_MOD3_MASK) | GDK_MOD4_MASK) | GDK_MOD5_MASK) | GDK_SUPER_MASK) | GDK_HYPER_MASK) | GDK_META_MASK)) == _tmp1_;
#line 77 "/home/jens/Source/shotwell/src/util/ui.vala"
	return result;
#line 268 "ui.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
	return self ? g_object_ref (self) : NULL;
#line 275 "ui.c"
}


gchar* build_dummy_ui_string (GtkActionGroup** groups, int groups_length1) {
	gchar* result = NULL;
	gchar* ui_string = NULL;
	gchar* _tmp0_ = NULL;
	GtkActionGroup** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	const gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
#line 90 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp0_ = g_strdup ("<ui>");
#line 90 "/home/jens/Source/shotwell/src/util/ui.vala"
	ui_string = _tmp0_;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp1_ = groups;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp1__length1 = groups_length1;
#line 295 "ui.c"
	{
		GtkActionGroup** group_collection = NULL;
		gint group_collection_length1 = 0;
		gint _group_collection_size_ = 0;
		gint group_it = 0;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
		group_collection = _tmp1_;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
		group_collection_length1 = _tmp1__length1;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
		for (group_it = 0; group_it < _tmp1__length1; group_it = group_it + 1) {
#line 307 "ui.c"
			GtkActionGroup* _tmp2_ = NULL;
			GtkActionGroup* group = NULL;
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
			_tmp2_ = _g_object_ref0 (group_collection[group_it]);
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
			group = _tmp2_;
#line 314 "ui.c"
			{
				GtkActionGroup* _tmp3_ = NULL;
				GList* _tmp4_ = NULL;
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
				_tmp3_ = group;
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
				_tmp4_ = gtk_action_group_list_actions (_tmp3_);
#line 322 "ui.c"
				{
					GList* action_collection = NULL;
					GList* action_it = NULL;
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
					action_collection = _tmp4_;
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
					for (action_it = action_collection; action_it != NULL; action_it = action_it->next) {
#line 330 "ui.c"
						GtkAction* _tmp5_ = NULL;
						GtkAction* action = NULL;
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
						_tmp5_ = _g_object_ref0 ((GtkAction*) action_it->data);
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
						action = _tmp5_;
#line 337 "ui.c"
						{
							const gchar* _tmp6_ = NULL;
							GtkAction* _tmp7_ = NULL;
							const gchar* _tmp8_ = NULL;
							const gchar* _tmp9_ = NULL;
							GtkAction* _tmp10_ = NULL;
							const gchar* _tmp11_ = NULL;
							const gchar* _tmp12_ = NULL;
							gchar* _tmp13_ = NULL;
							gchar* _tmp14_ = NULL;
							gchar* _tmp15_ = NULL;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp6_ = ui_string;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp7_ = action;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp8_ = gtk_action_get_name (_tmp7_);
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp9_ = _tmp8_;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp10_ = action;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp11_ = gtk_action_get_name (_tmp10_);
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp12_ = _tmp11_;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp13_ = g_strdup_printf ("<accelerator name=\"%s\" action=\"%s\" />", _tmp9_, _tmp12_);
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp14_ = _tmp13_;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_tmp15_ = g_strconcat (_tmp6_, _tmp14_, NULL);
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_g_free0 (ui_string);
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							ui_string = _tmp15_;
#line 93 "/home/jens/Source/shotwell/src/util/ui.vala"
							_g_free0 (_tmp14_);
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
							_g_object_unref0 (action);
#line 377 "ui.c"
						}
					}
#line 92 "/home/jens/Source/shotwell/src/util/ui.vala"
					_g_list_free0 (action_collection);
#line 382 "ui.c"
				}
#line 91 "/home/jens/Source/shotwell/src/util/ui.vala"
				_g_object_unref0 (group);
#line 386 "ui.c"
			}
		}
	}
#line 95 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp16_ = ui_string;
#line 95 "/home/jens/Source/shotwell/src/util/ui.vala"
	_tmp17_ = g_strconcat (_tmp16_, "</ui>", NULL);
#line 95 "/home/jens/Source/shotwell/src/util/ui.vala"
	_g_free0 (ui_string);
#line 95 "/home/jens/Source/shotwell/src/util/ui.vala"
	ui_string = _tmp17_;
#line 97 "/home/jens/Source/shotwell/src/util/ui.vala"
	result = ui_string;
#line 97 "/home/jens/Source/shotwell/src/util/ui.vala"
	return result;
#line 402 "ui.c"
}