Initial commit
[fillmore] / src / marina / marina / DialogUtils.c
1 /* DialogUtils.c generated by valac, the Vala compiler
2  * generated from DialogUtils.vala, do not modify */
3
4 /* Copyright 2009-2010 Yorba Foundation
5  *
6  * This software is licensed under the GNU Lesser General Public License
7  * (version 2.1 or later).  See the COPYING file in this distribution. 
8  */
9
10 #include <glib.h>
11 #include <glib-object.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <gtk/gtk.h>
15 #include <gee.h>
16 #include <stdio.h>
17 #include <hildon/hildon-file-chooser-dialog.h>
18 #include <errno.h>
19 #include <glib/gstdio.h>
20 #include <hildon/hildon.h>
21 #include <float.h>
22 #include <math.h>
23 #include <gst/gst.h>
24 #include <gdk-pixbuf/gdk-pixdata.h>
25
26
27 #define DIALOG_UTILS_TYPE_FILTER_DESCRIPTION_STRUCT (dialog_utils_filter_description_struct_get_type ())
28 typedef struct _DialogUtilsfilter_description_struct DialogUtilsfilter_description_struct;
29 #define _g_free0(var) (var = (g_free (var), NULL))
30 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
31 #define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL)))
32
33 #define DIALOG_UTILS_TYPE_BUTTON_STRUCT (dialog_utils_button_struct_get_type ())
34 typedef struct _DialogUtilsButtonStruct DialogUtilsButtonStruct;
35
36 #define TYPE_CLIP_VIEW (clip_view_get_type ())
37 #define CLIP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLIP_VIEW, ClipView))
38 #define CLIP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLIP_VIEW, ClipViewClass))
39 #define IS_CLIP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLIP_VIEW))
40 #define IS_CLIP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLIP_VIEW))
41 #define CLIP_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLIP_VIEW, ClipViewClass))
42
43 typedef struct _ClipView ClipView;
44 typedef struct _ClipViewClass ClipViewClass;
45 typedef struct _ClipViewPrivate ClipViewPrivate;
46
47 #define MODEL_TYPE_CLIP (model_clip_get_type ())
48 #define MODEL_CLIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_CLIP, ModelClip))
49 #define MODEL_CLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_CLIP, ModelClipClass))
50 #define MODEL_IS_CLIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_CLIP))
51 #define MODEL_IS_CLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_CLIP))
52 #define MODEL_CLIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_CLIP, ModelClipClass))
53
54 typedef struct _ModelClip ModelClip;
55 typedef struct _ModelClipClass ModelClipClass;
56 typedef struct _ModelClipPrivate ModelClipPrivate;
57
58 #define MODEL_TYPE_CLIP_FILE (model_clip_file_get_type ())
59 #define MODEL_CLIP_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_CLIP_FILE, ModelClipFile))
60 #define MODEL_CLIP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_CLIP_FILE, ModelClipFileClass))
61 #define MODEL_IS_CLIP_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_CLIP_FILE))
62 #define MODEL_IS_CLIP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_CLIP_FILE))
63 #define MODEL_CLIP_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_CLIP_FILE, ModelClipFileClass))
64
65 typedef struct _ModelClipFile ModelClipFile;
66 typedef struct _ModelClipFileClass ModelClipFileClass;
67
68 #define MODEL_TYPE_MEDIA_TYPE (model_media_type_get_type ())
69 typedef struct _ModelClipFilePrivate ModelClipFilePrivate;
70
71 #define TYPE_FRACTION (fraction_get_type ())
72 typedef struct _Fraction Fraction;
73
74 #define TYPE_TIME_CODE (time_code_get_type ())
75 typedef struct _TimeCode TimeCode;
76
77 struct _DialogUtilsfilter_description_struct {
78         char* name;
79         char* extension;
80 };
81
82 struct _DialogUtilsButtonStruct {
83         char* title;
84         GtkResponseType type;
85 };
86
87 struct _ClipView {
88         GtkDrawingArea parent_instance;
89         ClipViewPrivate * priv;
90         ModelClip* clip;
91         gint64 initial_time;
92         gboolean is_selected;
93         gint height;
94 };
95
96 struct _ClipViewClass {
97         GtkDrawingAreaClass parent_class;
98 };
99
100 typedef enum  {
101         MODEL_MEDIA_TYPE_AUDIO,
102         MODEL_MEDIA_TYPE_VIDEO
103 } ModelMediaType;
104
105 struct _ModelClip {
106         GObject parent_instance;
107         ModelClipPrivate * priv;
108         ModelClipFile* clipfile;
109         ModelMediaType type;
110         gboolean is_recording;
111         char* name;
112 };
113
114 struct _ModelClipClass {
115         GObjectClass parent_class;
116 };
117
118 struct _ModelClipFile {
119         GObject parent_instance;
120         ModelClipFilePrivate * priv;
121         char* filename;
122         GstCaps* video_caps;
123         GstCaps* audio_caps;
124         GdkPixbuf* thumbnail;
125 };
126
127 struct _ModelClipFileClass {
128         GObjectClass parent_class;
129 };
130
131 struct _Fraction {
132         gint numerator;
133         gint denominator;
134 };
135
136 struct _TimeCode {
137         gint hour;
138         gint minute;
139         gint second;
140         gint frame;
141         gboolean drop_code;
142 };
143
144
145
146 GType dialog_utils_filter_description_struct_get_type (void);
147 DialogUtilsfilter_description_struct* dialog_utils_filter_description_struct_dup (const DialogUtilsfilter_description_struct* self);
148 void dialog_utils_filter_description_struct_free (DialogUtilsfilter_description_struct* self);
149 void dialog_utils_filter_description_struct_copy (const DialogUtilsfilter_description_struct* self, DialogUtilsfilter_description_struct* dest);
150 void dialog_utils_filter_description_struct_destroy (DialogUtilsfilter_description_struct* self);
151 GtkFileFilter* dialog_utils_add_filter (GtkFileChooserDialog* d, const char* name, const char* extension);
152 void dialog_utils_add_filters (DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, GtkFileChooserDialog* d, GeeArrayList* filters, gboolean allow_all);
153 static void _g_slist_free_g_free (GSList* self);
154 gboolean dialog_utils_open (GtkWindow* parent, DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, gboolean allow_multiple, gboolean allow_all, GSList** filenames);
155 void dialog_utils_error (const char* major_message, const char* minor_message);
156 char* append_extension (const char* path, const char* extension);
157 gboolean dialog_utils_confirm_replace (GtkWindow* parent, const char* filename);
158 gboolean dialog_utils_save (GtkWindow* parent, const char* title, gboolean create_directory, DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, char** filename);
159 char* dialog_utils_bold_message (const char* message);
160 void dialog_utils_warning (const char* major_message, const char* minor_message);
161 GType dialog_utils_button_struct_get_type (void);
162 DialogUtilsButtonStruct* dialog_utils_button_struct_dup (const DialogUtilsButtonStruct* self);
163 void dialog_utils_button_struct_free (DialogUtilsButtonStruct* self);
164 void dialog_utils_button_struct_copy (const DialogUtilsButtonStruct* self, DialogUtilsButtonStruct* dest);
165 void dialog_utils_button_struct_destroy (DialogUtilsButtonStruct* self);
166 GtkResponseType dialog_utils_run_dialog (GtkWindow* parent, GtkMessageType type, const char* title, const char* message, DialogUtilsButtonStruct* buttons, int buttons_length1);
167 GtkResponseType dialog_utils_two_button_dialog (const char* message, const char* first_button, const char* second_button);
168 GtkResponseType dialog_utils_delete_keep (const char* message);
169 GtkResponseType dialog_utils_add_cancel (const char* message);
170 GtkResponseType dialog_utils_delete_cancel (const char* message);
171 void dialog_utils_button_struct_init (DialogUtilsButtonStruct *self, const char* title, GtkResponseType type);
172 static void _vala_DialogUtilsButtonStruct_array_free (DialogUtilsButtonStruct* array, gint array_length);
173 GtkResponseType dialog_utils_save_close_cancel (GtkWindow* parent, const char* title, const char* message);
174 GtkAlignment* dialog_utils_get_aligned_label (float x, float y, float exp_x, float exp_y, const char* text, gboolean selectable);
175 void dialog_utils_add_label_to_table (GtkTable* t, const char* str, gint x, gint y, gint xpad, gint ypad, gboolean selectable);
176 GType clip_view_get_type (void);
177 GType model_clip_get_type (void);
178 GType model_clip_file_get_type (void);
179 GType model_media_type_get_type (void);
180 GType fraction_get_type (void);
181 Fraction* fraction_dup (const Fraction* self);
182 void fraction_free (Fraction* self);
183 GType time_code_get_type (void);
184 TimeCode* time_code_dup (const TimeCode* self);
185 void time_code_free (TimeCode* self);
186 void frame_to_time (gint frame, Fraction* rate, TimeCode* result);
187 gint time_to_frame_with_rate (gint64 time, Fraction* rate);
188 gint64 model_clip_get_duration (ModelClip* self);
189 char* time_code_to_string (TimeCode *self);
190 gint64 model_clip_file_get_length (ModelClipFile* self);
191 char* time_to_string (gint64 time);
192 gboolean model_clip_is_trimmed (ModelClip* self);
193 gboolean model_clip_file_has_caps_structure (ModelClipFile* self, ModelMediaType m);
194 gboolean model_clip_file_get_dimensions (ModelClipFile* self, gint* w, gint* h);
195 gboolean model_clip_file_get_frame_rate (ModelClipFile* self, Fraction* rate);
196 gboolean model_clip_file_get_sample_rate (ModelClipFile* self, gint* rate);
197 gboolean model_clip_file_get_num_channels_string (ModelClipFile* self, char** s);
198 void dialog_utils_show_clip_properties (GtkWindow* parent, ClipView* selected_clip, ModelClipFile* clip_file, Fraction* frames_per_second);
199
200
201
202 void dialog_utils_filter_description_struct_copy (const DialogUtilsfilter_description_struct* self, DialogUtilsfilter_description_struct* dest) {
203         dest->name = g_strdup (self->name);
204         dest->extension = g_strdup (self->extension);
205 }
206
207
208 void dialog_utils_filter_description_struct_destroy (DialogUtilsfilter_description_struct* self) {
209         _g_free0 (self->name);
210         _g_free0 (self->extension);
211 }
212
213
214 DialogUtilsfilter_description_struct* dialog_utils_filter_description_struct_dup (const DialogUtilsfilter_description_struct* self) {
215         DialogUtilsfilter_description_struct* dup;
216         dup = g_new0 (DialogUtilsfilter_description_struct, 1);
217         dialog_utils_filter_description_struct_copy (self, dup);
218         return dup;
219 }
220
221
222 void dialog_utils_filter_description_struct_free (DialogUtilsfilter_description_struct* self) {
223         dialog_utils_filter_description_struct_destroy (self);
224         g_free (self);
225 }
226
227
228 GType dialog_utils_filter_description_struct_get_type (void) {
229         static volatile gsize dialog_utils_filter_description_struct_type_id__volatile = 0;
230         if (g_once_init_enter (&dialog_utils_filter_description_struct_type_id__volatile)) {
231                 GType dialog_utils_filter_description_struct_type_id;
232                 dialog_utils_filter_description_struct_type_id = g_boxed_type_register_static ("DialogUtilsfilter_description_struct", (GBoxedCopyFunc) dialog_utils_filter_description_struct_dup, (GBoxedFreeFunc) dialog_utils_filter_description_struct_free);
233                 g_once_init_leave (&dialog_utils_filter_description_struct_type_id__volatile, dialog_utils_filter_description_struct_type_id);
234         }
235         return dialog_utils_filter_description_struct_type_id__volatile;
236 }
237
238
239 #line 13 "DialogUtils.vala"
240 GtkFileFilter* dialog_utils_add_filter (GtkFileChooserDialog* d, const char* name, const char* extension) {
241 #line 242 "DialogUtils.c"
242         GtkFileFilter* result = NULL;
243         GtkFileFilter* filter;
244 #line 13 "DialogUtils.vala"
245         g_return_val_if_fail (GTK_IS_FILE_CHOOSER_DIALOG (d), NULL);
246 #line 13 "DialogUtils.vala"
247         g_return_val_if_fail (name != NULL, NULL);
248 #line 14 "DialogUtils.vala"
249         filter = g_object_ref_sink (gtk_file_filter_new ());
250 #line 15 "DialogUtils.vala"
251         gtk_file_filter_set_name (filter, name);
252 #line 16 "DialogUtils.vala"
253         if (extension != NULL) {
254 #line 255 "DialogUtils.c"
255                 char* _tmp0_;
256 #line 17 "DialogUtils.vala"
257                 gtk_file_filter_add_pattern (filter, _tmp0_ = g_strconcat ("*.", extension, NULL));
258 #line 259 "DialogUtils.c"
259                 _g_free0 (_tmp0_);
260         } else {
261 #line 19 "DialogUtils.vala"
262                 gtk_file_filter_add_pattern (filter, "*");
263 #line 264 "DialogUtils.c"
264         }
265 #line 21 "DialogUtils.vala"
266         gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (d), filter);
267 #line 268 "DialogUtils.c"
268         result = filter;
269 #line 22 "DialogUtils.vala"
270         return result;
271 #line 272 "DialogUtils.c"
272 }
273
274
275 #line 25 "DialogUtils.vala"
276 void dialog_utils_add_filters (DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, GtkFileChooserDialog* d, GeeArrayList* filters, gboolean allow_all) {
277 #line 278 "DialogUtils.c"
278         gint length;
279         GtkFileFilter* _tmp2_;
280 #line 25 "DialogUtils.vala"
281         g_return_if_fail (GTK_IS_FILE_CHOOSER_DIALOG (d));
282 #line 25 "DialogUtils.vala"
283         g_return_if_fail (GEE_IS_ARRAY_LIST (filters));
284 #line 28 "DialogUtils.vala"
285         length = filter_descriptions_length1;
286 #line 287 "DialogUtils.c"
287         {
288                 gint i;
289 #line 29 "DialogUtils.vala"
290                 i = 0;
291 #line 292 "DialogUtils.c"
292                 {
293                         gboolean _tmp0_;
294 #line 29 "DialogUtils.vala"
295                         _tmp0_ = TRUE;
296 #line 29 "DialogUtils.vala"
297                         while (TRUE) {
298 #line 299 "DialogUtils.c"
299                                 GtkFileFilter* filter;
300 #line 29 "DialogUtils.vala"
301                                 if (!_tmp0_) {
302 #line 29 "DialogUtils.vala"
303                                         i = i + 1;
304 #line 305 "DialogUtils.c"
305                                 }
306 #line 29 "DialogUtils.vala"
307                                 _tmp0_ = FALSE;
308 #line 29 "DialogUtils.vala"
309                                 if (!(i < length)) {
310 #line 29 "DialogUtils.vala"
311                                         break;
312 #line 313 "DialogUtils.c"
313                                 }
314 #line 30 "DialogUtils.vala"
315                                 filter = dialog_utils_add_filter (d, filter_descriptions[i].name, filter_descriptions[i].extension);
316 #line 32 "DialogUtils.vala"
317                                 gee_abstract_collection_add (GEE_ABSTRACT_COLLECTION (filters), filter);
318 #line 319 "DialogUtils.c"
319                                 _g_object_unref0 (filter);
320                         }
321                 }
322         }
323 #line 35 "DialogUtils.vala"
324         if (allow_all) {
325 #line 326 "DialogUtils.c"
326                 GtkFileFilter* _tmp1_;
327 #line 36 "DialogUtils.vala"
328                 _tmp1_ = dialog_utils_add_filter (d, "All files", NULL);
329 #line 330 "DialogUtils.c"
330                 _g_object_unref0 (_tmp1_);
331         }
332 #line 40 "DialogUtils.vala"
333         g_assert (filter_descriptions_length1 == gee_collection_get_size (GEE_COLLECTION (filters)));
334 #line 42 "DialogUtils.vala"
335         gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (d), _tmp2_ = (GtkFileFilter*) gee_abstract_list_get (GEE_ABSTRACT_LIST (filters), 0));
336 #line 337 "DialogUtils.c"
337         _g_object_unref0 (_tmp2_);
338 }
339
340
341 static void _g_slist_free_g_free (GSList* self) {
342         g_slist_foreach (self, (GFunc) g_free, NULL);
343         g_slist_free (self);
344 }
345
346
347 #line 45 "DialogUtils.vala"
348 gboolean dialog_utils_open (GtkWindow* parent, DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, gboolean allow_multiple, gboolean allow_all, GSList** filenames) {
349 #line 350 "DialogUtils.c"
350         gboolean result = FALSE;
351         gboolean return_value;
352         HildonFileChooserDialog* file_chooser;
353         GeeArrayList* filters;
354 #line 45 "DialogUtils.vala"
355         g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
356 #line 357 "DialogUtils.c"
357         if (filenames != NULL) {
358                 *filenames = NULL;
359         }
360 #line 47 "DialogUtils.vala"
361         fprintf (stdout, "open called\n");
362 #line 48 "DialogUtils.vala"
363         fflush (stdout);
364 #line 49 "DialogUtils.vala"
365         return_value = FALSE;
366 #line 50 "DialogUtils.vala"
367         file_chooser = g_object_ref_sink ((HildonFileChooserDialog*) hildon_file_chooser_dialog_new (parent, GTK_FILE_CHOOSER_ACTION_OPEN));
368 #line 51 "DialogUtils.vala"
369         gtk_window_set_title (GTK_WINDOW (file_chooser), "Open Files");
370 #line 55 "DialogUtils.vala"
371         hildon_file_chooser_dialog_set_show_upnp (file_chooser, TRUE);
372 #line 56 "DialogUtils.vala"
373         filters = gee_array_list_new (GTK_TYPE_FILE_FILTER, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
374 #line 57 "DialogUtils.vala"
375         dialog_utils_add_filters (filter_descriptions, filter_descriptions_length1, GTK_FILE_CHOOSER_DIALOG (file_chooser), filters, allow_all);
376 #line 58 "DialogUtils.vala"
377         gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (file_chooser), allow_multiple);
378 #line 59 "DialogUtils.vala"
379         if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_OK) {
380 #line 381 "DialogUtils.c"
381                 GSList* _tmp0_;
382 #line 60 "DialogUtils.vala"
383                 return_value = TRUE;
384 #line 61 "DialogUtils.vala"
385                 *filenames = (_tmp0_ = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (file_chooser)), __g_slist_free_g_free0 (*filenames), _tmp0_);
386 #line 387 "DialogUtils.c"
387         }
388 #line 63 "DialogUtils.vala"
389         gtk_object_destroy (GTK_OBJECT (file_chooser));
390 #line 391 "DialogUtils.c"
391         result = return_value;
392         _g_object_unref0 (file_chooser);
393         _g_object_unref0 (filters);
394 #line 64 "DialogUtils.vala"
395         return result;
396 #line 397 "DialogUtils.c"
397 }
398
399
400 #line 67 "DialogUtils.vala"
401 gboolean dialog_utils_save (GtkWindow* parent, const char* title, gboolean create_directory, DialogUtilsfilter_description_struct* filter_descriptions, int filter_descriptions_length1, char** filename) {
402 #line 403 "DialogUtils.c"
403         gboolean result = FALSE;
404         gboolean return_value;
405         HildonFileChooserDialog* file_chooser;
406         gint length;
407         GeeArrayList* filters;
408 #line 67 "DialogUtils.vala"
409         g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
410 #line 67 "DialogUtils.vala"
411         g_return_val_if_fail (title != NULL, FALSE);
412 #line 67 "DialogUtils.vala"
413         g_return_val_if_fail (filename != NULL, FALSE);
414 #line 69 "DialogUtils.vala"
415         return_value = FALSE;
416 #line 72 "DialogUtils.vala"
417         file_chooser = g_object_ref_sink ((HildonFileChooserDialog*) hildon_file_chooser_dialog_new (parent, GTK_FILE_CHOOSER_ACTION_SAVE));
418 #line 73 "DialogUtils.vala"
419         gtk_window_set_title (GTK_WINDOW (file_chooser), title);
420 #line 74 "DialogUtils.vala"
421         hildon_file_chooser_dialog_set_show_upnp (file_chooser, FALSE);
422 #line 75 "DialogUtils.vala"
423         if ((*filename) != NULL) {
424 #line 425 "DialogUtils.c"
425                 char* _tmp0_;
426 #line 76 "DialogUtils.vala"
427                 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser), _tmp0_ = g_path_get_dirname (*filename));
428 #line 429 "DialogUtils.c"
429                 _g_free0 (_tmp0_);
430         } else {
431         }
432 #line 80 "DialogUtils.vala"
433         length = filter_descriptions_length1;
434 #line 81 "DialogUtils.vala"
435         filters = gee_array_list_new (GTK_TYPE_FILE_FILTER, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
436 #line 88 "DialogUtils.vala"
437         while (TRUE) {
438 #line 439 "DialogUtils.c"
439                 char* local_filename;
440                 GtkFileFilter* selected_filter;
441                 gint i;
442                 char* _tmp3_;
443                 gboolean _tmp4_ = FALSE;
444 #line 88 "DialogUtils.vala"
445                 if (!(gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_OK)) {
446 #line 88 "DialogUtils.vala"
447                         break;
448 #line 449 "DialogUtils.c"
449                 }
450 #line 89 "DialogUtils.vala"
451                 local_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
452 #line 90 "DialogUtils.vala"
453                 if (create_directory) {
454 #line 455 "DialogUtils.c"
455                         char* _tmp2_;
456                         char* _tmp1_;
457 #line 91 "DialogUtils.vala"
458                         if (g_mkdir (local_filename, 0777) != 0) {
459 #line 92 "DialogUtils.vala"
460                                 dialog_utils_error ("Could not create directory", g_strerror (errno));
461 #line 462 "DialogUtils.c"
462                                 ;
463 #line 93 "DialogUtils.vala"
464                                 gtk_window_present (GTK_WINDOW (file_chooser));
465 #line 466 "DialogUtils.c"
466                                 _g_free0 (local_filename);
467 #line 94 "DialogUtils.vala"
468                                 continue;
469 #line 470 "DialogUtils.c"
470                         }
471 #line 96 "DialogUtils.vala"
472                         local_filename = (_tmp2_ = g_build_filename (local_filename, _tmp1_ = g_path_get_basename (local_filename), NULL), _g_free0 (local_filename), _tmp2_);
473 #line 474 "DialogUtils.c"
474                         _g_free0 (_tmp1_);
475                 }
476 #line 100 "DialogUtils.vala"
477                 selected_filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (file_chooser));
478 #line 102 "DialogUtils.vala"
479                 i = 0;
480 #line 481 "DialogUtils.c"
481                 {
482                         GeeIterator* _file_filter_it;
483                         _file_filter_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (filters));
484 #line 103 "DialogUtils.vala"
485                         while (TRUE) {
486 #line 487 "DialogUtils.c"
487                                 GtkFileFilter* file_filter;
488 #line 103 "DialogUtils.vala"
489                                 if (!gee_iterator_next (_file_filter_it)) {
490 #line 103 "DialogUtils.vala"
491                                         break;
492 #line 493 "DialogUtils.c"
493                                 }
494 #line 103 "DialogUtils.vala"
495                                 file_filter = (GtkFileFilter*) gee_iterator_get (_file_filter_it);
496 #line 104 "DialogUtils.vala"
497                                 if (file_filter == selected_filter) {
498 #line 499 "DialogUtils.c"
499                                         _g_object_unref0 (file_filter);
500 #line 105 "DialogUtils.vala"
501                                         break;
502 #line 503 "DialogUtils.c"
503                                 }
504 #line 107 "DialogUtils.vala"
505                                 i = i + 1;
506 #line 507 "DialogUtils.c"
507                                 _g_object_unref0 (file_filter);
508                         }
509                         _g_object_unref0 (_file_filter_it);
510                 }
511 #line 110 "DialogUtils.vala"
512                 g_assert (i < length);
513 #line 112 "DialogUtils.vala"
514                 local_filename = (_tmp3_ = append_extension (local_filename, filter_descriptions[i].extension), _g_free0 (local_filename), _tmp3_);
515 #line 113 "DialogUtils.vala"
516                 if (!g_file_test (local_filename, G_FILE_TEST_EXISTS)) {
517 #line 113 "DialogUtils.vala"
518                         _tmp4_ = TRUE;
519 #line 520 "DialogUtils.c"
520                 } else {
521 #line 114 "DialogUtils.vala"
522                         _tmp4_ = dialog_utils_confirm_replace (parent, local_filename);
523 #line 524 "DialogUtils.c"
524                 }
525 #line 113 "DialogUtils.vala"
526                 if (_tmp4_) {
527 #line 528 "DialogUtils.c"
528                         char* _tmp5_;
529 #line 115 "DialogUtils.vala"
530                         return_value = TRUE;
531 #line 116 "DialogUtils.vala"
532                         *filename = (_tmp5_ = g_strdup (local_filename), _g_free0 (*filename), _tmp5_);
533 #line 534 "DialogUtils.c"
534                         _g_free0 (local_filename);
535 #line 117 "DialogUtils.vala"
536                         break;
537 #line 538 "DialogUtils.c"
538                 } else {
539 #line 120 "DialogUtils.vala"
540                         gtk_window_present (GTK_WINDOW (file_chooser));
541 #line 542 "DialogUtils.c"
542                 }
543                 _g_free0 (local_filename);
544         }
545 #line 123 "DialogUtils.vala"
546         gtk_object_destroy (GTK_OBJECT (file_chooser));
547 #line 548 "DialogUtils.c"
548         result = return_value;
549         _g_object_unref0 (file_chooser);
550         _g_object_unref0 (filters);
551 #line 124 "DialogUtils.vala"
552         return result;
553 #line 554 "DialogUtils.c"
554 }
555
556
557 #line 127 "DialogUtils.vala"
558 char* dialog_utils_bold_message (const char* message) {
559 #line 560 "DialogUtils.c"
560         char* result = NULL;
561 #line 127 "DialogUtils.vala"
562         g_return_val_if_fail (message != NULL, NULL);
563 #line 564 "DialogUtils.c"
564         result = g_strdup (message);
565 #line 128 "DialogUtils.vala"
566         return result;
567 #line 568 "DialogUtils.c"
568 }
569
570
571 static gpointer _g_object_ref0 (gpointer self) {
572         return self ? g_object_ref (self) : NULL;
573 }
574
575
576 #line 131 "DialogUtils.vala"
577 void dialog_utils_warning (const char* major_message, const char* minor_message) {
578 #line 579 "DialogUtils.c"
579         char* message;
580         GtkWidget* banner;
581 #line 131 "DialogUtils.vala"
582         g_return_if_fail (major_message != NULL);
583 #line 132 "DialogUtils.vala"
584         message = dialog_utils_bold_message (major_message);
585 #line 133 "DialogUtils.vala"
586         if (minor_message != NULL) {
587 #line 588 "DialogUtils.c"
588                 char* _tmp1_;
589                 char* _tmp0_;
590 #line 134 "DialogUtils.vala"
591                 message = (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat (message, "\n\n", NULL), minor_message, NULL), _g_free0 (message), _tmp1_);
592 #line 593 "DialogUtils.c"
593                 _g_free0 (_tmp0_);
594         }
595 #line 136 "DialogUtils.vala"
596         banner = _g_object_ref0 (hildon_banner_show_information_with_markup (NULL, NULL, message));
597 #line 137 "DialogUtils.vala"
598         hildon_banner_set_timeout (HILDON_BANNER (banner), (guint) (1000 * 2));
599 #line 600 "DialogUtils.c"
600         _g_free0 (message);
601         _g_object_unref0 (banner);
602 }
603
604
605 #line 140 "DialogUtils.vala"
606 void dialog_utils_error (const char* major_message, const char* minor_message) {
607 #line 608 "DialogUtils.c"
608         char* message;
609         GtkWidget* banner;
610 #line 140 "DialogUtils.vala"
611         g_return_if_fail (major_message != NULL);
612 #line 141 "DialogUtils.vala"
613         message = dialog_utils_bold_message (major_message);
614 #line 142 "DialogUtils.vala"
615         if (minor_message != NULL) {
616 #line 617 "DialogUtils.c"
617                 char* _tmp1_;
618                 char* _tmp0_;
619 #line 143 "DialogUtils.vala"
620                 message = (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat (message, "\n\n", NULL), minor_message, NULL), _g_free0 (message), _tmp1_);
621 #line 622 "DialogUtils.c"
622                 _g_free0 (_tmp0_);
623         }
624 #line 145 "DialogUtils.vala"
625         banner = _g_object_ref0 (hildon_banner_show_information_with_markup (NULL, NULL, message));
626 #line 146 "DialogUtils.vala"
627         hildon_banner_set_timeout (HILDON_BANNER (banner), (guint) (1000 * 2));
628 #line 629 "DialogUtils.c"
629         _g_free0 (message);
630         _g_object_unref0 (banner);
631 }
632
633
634 #line 149 "DialogUtils.vala"
635 GtkResponseType dialog_utils_run_dialog (GtkWindow* parent, GtkMessageType type, const char* title, const char* message, DialogUtilsButtonStruct* buttons, int buttons_length1) {
636 #line 637 "DialogUtils.c"
637         GtkResponseType result = 0;
638         HildonDialog* dialog;
639         GtkVBox* content;
640         GtkLabel* label;
641         gint length;
642         GtkResponseType response;
643 #line 149 "DialogUtils.vala"
644         g_return_val_if_fail ((parent == NULL) || GTK_IS_WINDOW (parent), 0);
645 #line 149 "DialogUtils.vala"
646         g_return_val_if_fail (message != NULL, 0);
647 #line 152 "DialogUtils.vala"
648         if (NULL == title) {
649 #line 152 "DialogUtils.vala"
650                 title = "Message";
651 #line 652 "DialogUtils.c"
652         }
653 #line 153 "DialogUtils.vala"
654         dialog = g_object_ref_sink ((HildonDialog*) hildon_dialog_new ());
655 #line 154 "DialogUtils.vala"
656         gtk_widget_set_parent (GTK_WIDGET (dialog), GTK_WIDGET (parent));
657 #line 155 "DialogUtils.vala"
658         gtk_window_set_title (GTK_WINDOW (dialog), title);
659 #line 156 "DialogUtils.vala"
660         content = _g_object_ref0 (GTK_VBOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))));
661 #line 157 "DialogUtils.vala"
662         label = g_object_ref_sink ((GtkLabel*) gtk_label_new (message));
663 #line 159 "DialogUtils.vala"
664         gtk_label_set_single_line_mode (label, FALSE);
665 #line 160 "DialogUtils.vala"
666         gtk_label_set_line_wrap (label, TRUE);
667 #line 162 "DialogUtils.vala"
668         gtk_container_add (GTK_CONTAINER (content), GTK_WIDGET (label));
669 #line 164 "DialogUtils.vala"
670         length = buttons_length1;
671 #line 672 "DialogUtils.c"
672         {
673                 gint i;
674 #line 165 "DialogUtils.vala"
675                 i = 0;
676 #line 677 "DialogUtils.c"
677                 {
678                         gboolean _tmp0_;
679 #line 165 "DialogUtils.vala"
680                         _tmp0_ = TRUE;
681 #line 165 "DialogUtils.vala"
682                         while (TRUE) {
683 #line 165 "DialogUtils.vala"
684                                 if (!_tmp0_) {
685 #line 165 "DialogUtils.vala"
686                                         i = i + 1;
687 #line 688 "DialogUtils.c"
688                                 }
689 #line 165 "DialogUtils.vala"
690                                 _tmp0_ = FALSE;
691 #line 165 "DialogUtils.vala"
692                                 if (!(i < length)) {
693 #line 165 "DialogUtils.vala"
694                                         break;
695 #line 696 "DialogUtils.c"
696                                 }
697 #line 166 "DialogUtils.vala"
698                                 hildon_dialog_add_button (dialog, buttons[i].title, (gint) buttons[i].type);
699 #line 700 "DialogUtils.c"
700                         }
701                 }
702         }
703 #line 169 "DialogUtils.vala"
704         gtk_widget_show_all (GTK_WIDGET (dialog));
705 #line 170 "DialogUtils.vala"
706         response = (GtkResponseType) gtk_dialog_run (GTK_DIALOG (dialog));
707 #line 171 "DialogUtils.vala"
708         gtk_object_destroy (GTK_OBJECT (dialog));
709 #line 710 "DialogUtils.c"
710         result = response;
711         _g_object_unref0 (dialog);
712         _g_object_unref0 (content);
713         _g_object_unref0 (label);
714 #line 173 "DialogUtils.vala"
715         return result;
716 #line 717 "DialogUtils.c"
717 }
718
719
720 #line 176 "DialogUtils.vala"
721 GtkResponseType dialog_utils_two_button_dialog (const char* message, const char* first_button, const char* second_button) {
722 #line 723 "DialogUtils.c"
723         GtkResponseType result = 0;
724         HildonDialog* d;
725         GtkVBox* contents;
726         GtkVBox* vbox;
727         GtkLabel* label;
728         GtkResponseType r;
729 #line 176 "DialogUtils.vala"
730         g_return_val_if_fail (message != NULL, 0);
731 #line 176 "DialogUtils.vala"
732         g_return_val_if_fail (first_button != NULL, 0);
733 #line 176 "DialogUtils.vala"
734         g_return_val_if_fail (second_button != NULL, 0);
735 #line 177 "DialogUtils.vala"
736         d = g_object_ref_sink ((HildonDialog*) hildon_dialog_new ());
737 #line 179 "DialogUtils.vala"
738         contents = _g_object_ref0 (GTK_VBOX (gtk_dialog_get_content_area (GTK_DIALOG (d))));
739 #line 180 "DialogUtils.vala"
740         vbox = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (TRUE, 4));
741 #line 181 "DialogUtils.vala"
742         label = g_object_ref_sink ((GtkLabel*) gtk_label_new (message));
743 #line 182 "DialogUtils.vala"
744         gtk_label_set_use_markup (label, TRUE);
745 #line 183 "DialogUtils.vala"
746         gtk_label_set_single_line_mode (label, FALSE);
747 #line 184 "DialogUtils.vala"
748         gtk_label_set_line_wrap (label, TRUE);
749 #line 185 "DialogUtils.vala"
750         gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (label), TRUE, TRUE, 0);
751 #line 186 "DialogUtils.vala"
752         gtk_container_add (GTK_CONTAINER (contents), GTK_WIDGET (vbox));
753 #line 187 "DialogUtils.vala"
754         hildon_dialog_add_buttons (d, first_button, GTK_RESPONSE_NO, second_button, GTK_RESPONSE_YES, NULL);
755 #line 190 "DialogUtils.vala"
756         gtk_widget_show_all (GTK_WIDGET (d));
757 #line 191 "DialogUtils.vala"
758         r = (GtkResponseType) gtk_dialog_run (GTK_DIALOG (d));
759 #line 192 "DialogUtils.vala"
760         gtk_object_destroy (GTK_OBJECT (d));
761 #line 762 "DialogUtils.c"
762         result = r;
763         _g_object_unref0 (d);
764         _g_object_unref0 (contents);
765         _g_object_unref0 (vbox);
766         _g_object_unref0 (label);
767 #line 194 "DialogUtils.vala"
768         return result;
769 #line 770 "DialogUtils.c"
770 }
771
772
773 #line 197 "DialogUtils.vala"
774 GtkResponseType dialog_utils_delete_keep (const char* message) {
775 #line 776 "DialogUtils.c"
776         GtkResponseType result = 0;
777 #line 197 "DialogUtils.vala"
778         g_return_val_if_fail (message != NULL, 0);
779 #line 780 "DialogUtils.c"
780         result = dialog_utils_two_button_dialog (message, "Keep", GTK_STOCK_DELETE);
781 #line 198 "DialogUtils.vala"
782         return result;
783 #line 784 "DialogUtils.c"
784 }
785
786
787 #line 201 "DialogUtils.vala"
788 GtkResponseType dialog_utils_add_cancel (const char* message) {
789 #line 790 "DialogUtils.c"
790         GtkResponseType result = 0;
791 #line 201 "DialogUtils.vala"
792         g_return_val_if_fail (message != NULL, 0);
793 #line 794 "DialogUtils.c"
794         result = dialog_utils_two_button_dialog (message, GTK_STOCK_CANCEL, GTK_STOCK_ADD);
795 #line 202 "DialogUtils.vala"
796         return result;
797 #line 798 "DialogUtils.c"
798 }
799
800
801 #line 205 "DialogUtils.vala"
802 GtkResponseType dialog_utils_delete_cancel (const char* message) {
803 #line 804 "DialogUtils.c"
804         GtkResponseType result = 0;
805 #line 205 "DialogUtils.vala"
806         g_return_val_if_fail (message != NULL, 0);
807 #line 808 "DialogUtils.c"
808         result = dialog_utils_two_button_dialog (message, GTK_STOCK_CANCEL, GTK_STOCK_DELETE);
809 #line 206 "DialogUtils.vala"
810         return result;
811 #line 812 "DialogUtils.c"
812 }
813
814
815 #line 209 "DialogUtils.vala"
816 gboolean dialog_utils_confirm_replace (GtkWindow* parent, const char* filename) {
817 #line 818 "DialogUtils.c"
818         gboolean result = FALSE;
819 #line 209 "DialogUtils.vala"
820         g_return_val_if_fail ((parent == NULL) || GTK_IS_WINDOW (parent), FALSE);
821 #line 209 "DialogUtils.vala"
822         g_return_val_if_fail (filename != NULL, FALSE);
823 #line 824 "DialogUtils.c"
824         result = GTK_RESPONSE_YES == dialog_utils_two_button_dialog ("<big><b>A file named \"%s\" already exists.  Do you want to replace it" \
825 "?</b></big>", "Cancel", "Replace");
826 #line 210 "DialogUtils.vala"
827         return result;
828 #line 828 "DialogUtils.c"
829 }
830
831
832 #line 214 "DialogUtils.vala"
833 void dialog_utils_button_struct_init (DialogUtilsButtonStruct *self, const char* title, GtkResponseType type) {
834 #line 834 "DialogUtils.c"
835         char* _tmp0_;
836 #line 214 "DialogUtils.vala"
837         g_return_if_fail (title != NULL);
838 #line 838 "DialogUtils.c"
839         memset (self, 0, sizeof (DialogUtilsButtonStruct));
840 #line 215 "DialogUtils.vala"
841         (*self).title = (_tmp0_ = g_strdup (title), _g_free0 ((*self).title), _tmp0_);
842 #line 216 "DialogUtils.vala"
843         (*self).type = type;
844 #line 844 "DialogUtils.c"
845 }
846
847
848 void dialog_utils_button_struct_copy (const DialogUtilsButtonStruct* self, DialogUtilsButtonStruct* dest) {
849         dest->title = g_strdup (self->title);
850         dest->type = self->type;
851 }
852
853
854 void dialog_utils_button_struct_destroy (DialogUtilsButtonStruct* self) {
855         _g_free0 (self->title);
856 }
857
858
859 DialogUtilsButtonStruct* dialog_utils_button_struct_dup (const DialogUtilsButtonStruct* self) {
860         DialogUtilsButtonStruct* dup;
861         dup = g_new0 (DialogUtilsButtonStruct, 1);
862         dialog_utils_button_struct_copy (self, dup);
863         return dup;
864 }
865
866
867 void dialog_utils_button_struct_free (DialogUtilsButtonStruct* self) {
868         dialog_utils_button_struct_destroy (self);
869         g_free (self);
870 }
871
872
873 GType dialog_utils_button_struct_get_type (void) {
874         static volatile gsize dialog_utils_button_struct_type_id__volatile = 0;
875         if (g_once_init_enter (&dialog_utils_button_struct_type_id__volatile)) {
876                 GType dialog_utils_button_struct_type_id;
877                 dialog_utils_button_struct_type_id = g_boxed_type_register_static ("DialogUtilsButtonStruct", (GBoxedCopyFunc) dialog_utils_button_struct_dup, (GBoxedFreeFunc) dialog_utils_button_struct_free);
878                 g_once_init_leave (&dialog_utils_button_struct_type_id__volatile, dialog_utils_button_struct_type_id);
879         }
880         return dialog_utils_button_struct_type_id__volatile;
881 }
882
883
884 static void _vala_DialogUtilsButtonStruct_array_free (DialogUtilsButtonStruct* array, gint array_length) {
885         if (array != NULL) {
886                 int i;
887                 for (i = 0; i < array_length; i = i + 1) {
888                         dialog_utils_button_struct_destroy (&array[i]);
889                 }
890         }
891         g_free (array);
892 }
893
894
895 #line 223 "DialogUtils.vala"
896 GtkResponseType dialog_utils_save_close_cancel (GtkWindow* parent, const char* title, const char* message) {
897 #line 897 "DialogUtils.c"
898         GtkResponseType result = 0;
899         DialogUtilsButtonStruct* _tmp4_;
900         gint _buttons_size_;
901         gint buttons_length1;
902         DialogUtilsButtonStruct* _tmp3_ = NULL;
903         DialogUtilsButtonStruct _tmp0_ = {0};
904         DialogUtilsButtonStruct _tmp1_ = {0};
905         DialogUtilsButtonStruct _tmp2_ = {0};
906         DialogUtilsButtonStruct* buttons;
907 #line 223 "DialogUtils.vala"
908         g_return_val_if_fail ((parent == NULL) || GTK_IS_WINDOW (parent), 0);
909 #line 223 "DialogUtils.vala"
910         g_return_val_if_fail (message != NULL, 0);
911 #line 911 "DialogUtils.c"
912         buttons = (_tmp4_ = (_tmp3_ = g_new0 (DialogUtilsButtonStruct, 3), _tmp3_[0] = (dialog_utils_button_struct_init (&_tmp0_, GTK_STOCK_CLOSE, GTK_RESPONSE_NO), _tmp0_), _tmp3_[1] = (dialog_utils_button_struct_init (&_tmp1_, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL), _tmp1_), _tmp3_[2] = (dialog_utils_button_struct_init (&_tmp2_, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT), _tmp2_), _tmp3_), buttons_length1 = 3, _buttons_size_ = buttons_length1, _tmp4_);
913         result = dialog_utils_run_dialog (parent, GTK_MESSAGE_WARNING, title, message, buttons, buttons_length1);
914         buttons = (_vala_DialogUtilsButtonStruct_array_free (buttons, buttons_length1), NULL);
915 #line 230 "DialogUtils.vala"
916         return result;
917 #line 917 "DialogUtils.c"
918 }
919
920
921 #line 233 "DialogUtils.vala"
922 GtkAlignment* dialog_utils_get_aligned_label (float x, float y, float exp_x, float exp_y, const char* text, gboolean selectable) {
923 #line 923 "DialogUtils.c"
924         GtkAlignment* result = NULL;
925         GtkLabel* l;
926         GtkAlignment* a;
927 #line 233 "DialogUtils.vala"
928         g_return_val_if_fail (text != NULL, NULL);
929 #line 235 "DialogUtils.vala"
930         l = g_object_ref_sink ((GtkLabel*) gtk_label_new (text));
931 #line 236 "DialogUtils.vala"
932         gtk_label_set_line_wrap (l, TRUE);
933 #line 237 "DialogUtils.vala"
934         gtk_label_set_use_markup (l, TRUE);
935 #line 238 "DialogUtils.vala"
936         gtk_label_set_selectable (l, selectable);
937 #line 240 "DialogUtils.vala"
938         a = g_object_ref_sink ((GtkAlignment*) gtk_alignment_new (x, y, exp_x, exp_y));
939 #line 241 "DialogUtils.vala"
940         gtk_container_add (GTK_CONTAINER (a), GTK_WIDGET (l));
941 #line 941 "DialogUtils.c"
942         result = a;
943         _g_object_unref0 (l);
944 #line 243 "DialogUtils.vala"
945         return result;
946 #line 946 "DialogUtils.c"
947 }
948
949
950 #line 246 "DialogUtils.vala"
951 void dialog_utils_add_label_to_table (GtkTable* t, const char* str, gint x, gint y, gint xpad, gint ypad, gboolean selectable) {
952 #line 952 "DialogUtils.c"
953         GtkAlignment* a;
954 #line 246 "DialogUtils.vala"
955         g_return_if_fail (GTK_IS_TABLE (t));
956 #line 246 "DialogUtils.vala"
957         g_return_if_fail (str != NULL);
958 #line 248 "DialogUtils.vala"
959         a = dialog_utils_get_aligned_label (0.0f, 0.0f, 0.0f, 0.0f, str, selectable);
960 #line 249 "DialogUtils.vala"
961         gtk_table_attach (t, GTK_WIDGET (a), (guint) x, (guint) (x + 1), (guint) y, (guint) (y + 1), GTK_FILL, GTK_FILL, (guint) xpad, (guint) ypad);
962 #line 962 "DialogUtils.c"
963         _g_object_unref0 (a);
964 }
965
966
967 #line 252 "DialogUtils.vala"
968 void dialog_utils_show_clip_properties (GtkWindow* parent, ClipView* selected_clip, ModelClipFile* clip_file, Fraction* frames_per_second) {
969 #line 969 "DialogUtils.c"
970         HildonDialog* d;
971         GtkTable* t;
972         gint row;
973         gint tab_padding;
974         char* _tmp2_;
975 #line 252 "DialogUtils.vala"
976         g_return_if_fail (GTK_IS_WINDOW (parent));
977 #line 252 "DialogUtils.vala"
978         g_return_if_fail ((selected_clip == NULL) || IS_CLIP_VIEW (selected_clip));
979 #line 252 "DialogUtils.vala"
980         g_return_if_fail ((clip_file == NULL) || MODEL_IS_CLIP_FILE (clip_file));
981 #line 254 "DialogUtils.vala"
982         d = g_object_ref_sink ((HildonDialog*) hildon_dialog_new_with_buttons ("Clip Properties", parent, GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL));
983 #line 256 "DialogUtils.vala"
984         if (selected_clip != NULL) {
985 #line 257 "DialogUtils.vala"
986                 clip_file = selected_clip->clip->clipfile;
987 #line 987 "DialogUtils.c"
988         }
989 #line 260 "DialogUtils.vala"
990         g_object_set (G_OBJECT (d), "has-separator", FALSE, NULL);
991 #line 262 "DialogUtils.vala"
992         t = g_object_ref_sink ((GtkTable*) gtk_table_new ((guint) 10, (guint) 2, FALSE));
993 #line 263 "DialogUtils.vala"
994         row = 0;
995 #line 264 "DialogUtils.vala"
996         tab_padding = 25;
997 #line 997 "DialogUtils.c"
998         {
999                 gint i;
1000 #line 266 "DialogUtils.vala"
1001                 i = 0;
1002 #line 1002 "DialogUtils.c"
1003                 {
1004                         gboolean _tmp0_;
1005 #line 266 "DialogUtils.vala"
1006                         _tmp0_ = TRUE;
1007 #line 266 "DialogUtils.vala"
1008                         while (TRUE) {
1009 #line 266 "DialogUtils.vala"
1010                                 if (!_tmp0_) {
1011 #line 266 "DialogUtils.vala"
1012                                         i++;
1013 #line 1013 "DialogUtils.c"
1014                                 }
1015 #line 266 "DialogUtils.vala"
1016                                 _tmp0_ = FALSE;
1017 #line 266 "DialogUtils.vala"
1018                                 if (!(i < 10)) {
1019 #line 266 "DialogUtils.vala"
1020                                         break;
1021 #line 1021 "DialogUtils.c"
1022                                 }
1023 #line 267 "DialogUtils.vala"
1024                                 gtk_table_set_row_spacing (t, (guint) i, (guint) 10);
1025 #line 1025 "DialogUtils.c"
1026                         }
1027                 }
1028         }
1029 #line 269 "DialogUtils.vala"
1030         row = 1;
1031 #line 270 "DialogUtils.vala"
1032         dialog_utils_add_label_to_table (t, "<b>Clip</b>", 0, row++, 5, 0, FALSE);
1033 #line 272 "DialogUtils.vala"
1034         if (selected_clip != NULL) {
1035 #line 1035 "DialogUtils.c"
1036                 char* _tmp1_;
1037 #line 273 "DialogUtils.vala"
1038                 dialog_utils_add_label_to_table (t, "<i>Name:</i>", 0, row, tab_padding, 0, FALSE);
1039 #line 274 "DialogUtils.vala"
1040                 dialog_utils_add_label_to_table (t, _tmp1_ = g_strdup_printf ("%s", selected_clip->clip->name), 1, row++, 5, 0, TRUE);
1041 #line 1041 "DialogUtils.c"
1042                 _g_free0 (_tmp1_);
1043         }
1044 #line 277 "DialogUtils.vala"
1045         dialog_utils_add_label_to_table (t, "<i>Location:</i>", 0, row, tab_padding, 0, FALSE);
1046 #line 278 "DialogUtils.vala"
1047         dialog_utils_add_label_to_table (t, _tmp2_ = g_strdup_printf ("%s", clip_file->filename), 1, row++, 5, 0, TRUE);
1048 #line 1048 "DialogUtils.c"
1049         _g_free0 (_tmp2_);
1050 #line 280 "DialogUtils.vala"
1051         if (selected_clip != NULL) {
1052 #line 1052 "DialogUtils.c"
1053                 char* length_string;
1054                 char* actual_length;
1055                 gboolean _tmp3_ = FALSE;
1056                 char* _tmp10_;
1057 #line 281 "DialogUtils.vala"
1058                 dialog_utils_add_label_to_table (t, "<i>Timeline length:</i>", 0, row, tab_padding, 0, FALSE);
1059 #line 283 "DialogUtils.vala"
1060                 length_string = g_strdup ("");
1061 #line 284 "DialogUtils.vala"
1062                 actual_length = g_strdup ("");
1063 #line 286 "DialogUtils.vala"
1064                 if (frames_per_second != NULL) {
1065 #line 286 "DialogUtils.vala"
1066                         _tmp3_ = (*frames_per_second).numerator > 0;
1067 #line 1067 "DialogUtils.c"
1068                 } else {
1069 #line 286 "DialogUtils.vala"
1070                         _tmp3_ = FALSE;
1071 #line 1071 "DialogUtils.c"
1072                 }
1073 #line 286 "DialogUtils.vala"
1074                 if (_tmp3_) {
1075 #line 1075 "DialogUtils.c"
1076                         TimeCode _tmp4_ = {0};
1077                         TimeCode time;
1078                         char* _tmp5_;
1079                         TimeCode _tmp6_ = {0};
1080                         char* _tmp7_;
1081 #line 287 "DialogUtils.vala"
1082                         time = (frame_to_time (time_to_frame_with_rate (model_clip_get_duration (selected_clip->clip), frames_per_second), frames_per_second, &_tmp4_), _tmp4_);
1083 #line 289 "DialogUtils.vala"
1084                         length_string = (_tmp5_ = time_code_to_string (&time), _g_free0 (length_string), _tmp5_);
1085 #line 290 "DialogUtils.vala"
1086                         time = (frame_to_time (time_to_frame_with_rate (model_clip_file_get_length (selected_clip->clip->clipfile), frames_per_second), frames_per_second, &_tmp6_), _tmp6_);
1087 #line 292 "DialogUtils.vala"
1088                         actual_length = (_tmp7_ = time_code_to_string (&time), _g_free0 (actual_length), _tmp7_);
1089 #line 1089 "DialogUtils.c"
1090                 } else {
1091                         char* _tmp8_;
1092                         char* _tmp9_;
1093 #line 294 "DialogUtils.vala"
1094                         length_string = (_tmp8_ = time_to_string (model_clip_get_duration (selected_clip->clip)), _g_free0 (length_string), _tmp8_);
1095 #line 295 "DialogUtils.vala"
1096                         actual_length = (_tmp9_ = time_to_string (model_clip_file_get_length (selected_clip->clip->clipfile)), _g_free0 (actual_length), _tmp9_);
1097 #line 1097 "DialogUtils.c"
1098                 }
1099 #line 298 "DialogUtils.vala"
1100                 dialog_utils_add_label_to_table (t, _tmp10_ = g_strdup_printf ("%s", length_string), 1, row++, 5, 0, TRUE);
1101 #line 1101 "DialogUtils.c"
1102                 _g_free0 (_tmp10_);
1103 #line 300 "DialogUtils.vala"
1104                 if (model_clip_is_trimmed (selected_clip->clip)) {
1105 #line 1105 "DialogUtils.c"
1106                         char* _tmp11_;
1107 #line 301 "DialogUtils.vala"
1108                         dialog_utils_add_label_to_table (t, "<i>Actual length:</i>", 0, row, tab_padding, 0, FALSE);
1109 #line 302 "DialogUtils.vala"
1110                         dialog_utils_add_label_to_table (t, _tmp11_ = g_strdup_printf ("%s", actual_length), 1, row++, 5, 0, TRUE);
1111 #line 1111 "DialogUtils.c"
1112                         _g_free0 (_tmp11_);
1113                 }
1114                 _g_free0 (length_string);
1115                 _g_free0 (actual_length);
1116         }
1117 #line 306 "DialogUtils.vala"
1118         if (model_clip_file_has_caps_structure (clip_file, MODEL_MEDIA_TYPE_VIDEO)) {
1119 #line 1119 "DialogUtils.c"
1120                 gint w = 0;
1121                 gint h = 0;
1122                 Fraction r = {0};
1123 #line 307 "DialogUtils.vala"
1124                 dialog_utils_add_label_to_table (t, "<b>Video</b>", 0, row++, 5, 0, FALSE);
1125 #line 310 "DialogUtils.vala"
1126                 if (model_clip_file_get_dimensions (clip_file, &w, &h)) {
1127 #line 1127 "DialogUtils.c"
1128                         char* _tmp12_;
1129 #line 311 "DialogUtils.vala"
1130                         dialog_utils_add_label_to_table (t, "<i>Dimensions:</i>", 0, row, tab_padding, 0, FALSE);
1131 #line 312 "DialogUtils.vala"
1132                         dialog_utils_add_label_to_table (t, _tmp12_ = g_strdup_printf ("%d x %d", w, h), 1, row++, 5, 0, TRUE);
1133 #line 1133 "DialogUtils.c"
1134                         _g_free0 (_tmp12_);
1135                 }
1136 #line 316 "DialogUtils.vala"
1137                 if (model_clip_file_get_frame_rate (clip_file, &r)) {
1138 #line 317 "DialogUtils.vala"
1139                         dialog_utils_add_label_to_table (t, "<i>Frame rate:</i>", 0, row, tab_padding, 0, FALSE);
1140 #line 319 "DialogUtils.vala"
1141                         if ((r.numerator % r.denominator) != 0) {
1142 #line 1142 "DialogUtils.c"
1143                                 char* _tmp13_;
1144 #line 320 "DialogUtils.vala"
1145                                 dialog_utils_add_label_to_table (t, _tmp13_ = g_strdup_printf ("%.2f frames per second", (double) (r.numerator / ((float) r.denominator))), 1, row++, 5, 0, TRUE);
1146 #line 1146 "DialogUtils.c"
1147                                 _g_free0 (_tmp13_);
1148                         } else {
1149                                 char* _tmp14_;
1150 #line 324 "DialogUtils.vala"
1151                                 dialog_utils_add_label_to_table (t, _tmp14_ = g_strdup_printf ("%d frames per second", r.numerator / r.denominator), 1, row++, 5, 0, TRUE);
1152 #line 1152 "DialogUtils.c"
1153                                 _g_free0 (_tmp14_);
1154                         }
1155                 }
1156         }
1157 #line 330 "DialogUtils.vala"
1158         if (model_clip_file_has_caps_structure (clip_file, MODEL_MEDIA_TYPE_AUDIO)) {
1159 #line 1159 "DialogUtils.c"
1160                 gint rate = 0;
1161                 char* s;
1162                 char* _tmp18_;
1163                 gboolean _tmp17_;
1164                 char* _tmp16_ = NULL;
1165 #line 331 "DialogUtils.vala"
1166                 dialog_utils_add_label_to_table (t, "<b>Audio</b>", 0, row++, 5, 0, FALSE);
1167 #line 334 "DialogUtils.vala"
1168                 if (model_clip_file_get_sample_rate (clip_file, &rate)) {
1169 #line 1169 "DialogUtils.c"
1170                         char* _tmp15_;
1171 #line 335 "DialogUtils.vala"
1172                         dialog_utils_add_label_to_table (t, "<i>Sample rate:</i>", 0, row, tab_padding, 0, FALSE);
1173 #line 336 "DialogUtils.vala"
1174                         dialog_utils_add_label_to_table (t, _tmp15_ = g_strdup_printf ("%d Hz", rate), 1, row++, 5, 0, TRUE);
1175 #line 1175 "DialogUtils.c"
1176                         _g_free0 (_tmp15_);
1177                 }
1178                 s = NULL;
1179 #line 340 "DialogUtils.vala"
1180                 if ((_tmp17_ = model_clip_file_get_num_channels_string (clip_file, &_tmp16_), s = (_tmp18_ = _tmp16_, _g_free0 (s), _tmp18_), _tmp17_)) {
1181 #line 1181 "DialogUtils.c"
1182                         char* _tmp19_;
1183 #line 341 "DialogUtils.vala"
1184                         dialog_utils_add_label_to_table (t, "<i>Number of channels:</i>", 0, row, tab_padding, 0, FALSE);
1185 #line 342 "DialogUtils.vala"
1186                         dialog_utils_add_label_to_table (t, _tmp19_ = g_strdup_printf ("%s", s), 1, row++, 5, 0, TRUE);
1187 #line 1187 "DialogUtils.c"
1188                         _g_free0 (_tmp19_);
1189                 }
1190                 _g_free0 (s);
1191         }
1192 #line 346 "DialogUtils.vala"
1193         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d)->vbox), GTK_WIDGET (t), FALSE, FALSE, (guint) 0);
1194 #line 348 "DialogUtils.vala"
1195         gtk_widget_show_all (GTK_WIDGET (d));
1196 #line 349 "DialogUtils.vala"
1197         gtk_dialog_run (GTK_DIALOG (d));
1198 #line 350 "DialogUtils.vala"
1199         gtk_object_destroy (GTK_OBJECT (d));
1200 #line 1200 "DialogUtils.c"
1201         _g_object_unref0 (d);
1202         _g_object_unref0 (t);
1203 }
1204
1205
1206
1207