Initial commit
[fillmore] / src / fillmore / fillmore / fillmore.c
1 /* fillmore.c generated by valac, the Vala compiler
2  * generated from fillmore.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 <gtk/gtk.h>
13 #include <marina.h>
14 #include <hildon/hildon.h>
15 #include <gee.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <gio/gio.h>
19 #include <gdk/gdk.h>
20 #include <gst/gst.h>
21 #include <stdio.h>
22 #include <float.h>
23 #include <math.h>
24 #include <gdk/gdkkeysyms.h>
25 #include <glib/gstdio.h>
26
27
28 #define TYPE_RECORDER (recorder_get_type ())
29 #define RECORDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RECORDER, Recorder))
30 #define RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RECORDER, RecorderClass))
31 #define IS_RECORDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RECORDER))
32 #define IS_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RECORDER))
33 #define RECORDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RECORDER, RecorderClass))
34
35 typedef struct _Recorder Recorder;
36 typedef struct _RecorderClass RecorderClass;
37 typedef struct _RecorderPrivate RecorderPrivate;
38
39 #define MODEL_TYPE_AUDIO_PROJECT (model_audio_project_get_type ())
40 #define MODEL_AUDIO_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_AUDIO_PROJECT, ModelAudioProject))
41 #define MODEL_AUDIO_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_AUDIO_PROJECT, ModelAudioProjectClass))
42 #define MODEL_IS_AUDIO_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_AUDIO_PROJECT))
43 #define MODEL_IS_AUDIO_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_AUDIO_PROJECT))
44 #define MODEL_AUDIO_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_AUDIO_PROJECT, ModelAudioProjectClass))
45
46 typedef struct _ModelAudioProject ModelAudioProject;
47 typedef struct _ModelAudioProjectClass ModelAudioProjectClass;
48
49 #define TYPE_HEADER_AREA (header_area_get_type ())
50 #define HEADER_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HEADER_AREA, HeaderArea))
51 #define HEADER_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HEADER_AREA, HeaderAreaClass))
52 #define IS_HEADER_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HEADER_AREA))
53 #define IS_HEADER_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HEADER_AREA))
54 #define HEADER_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HEADER_AREA, HeaderAreaClass))
55
56 typedef struct _HeaderArea HeaderArea;
57 typedef struct _HeaderAreaClass HeaderAreaClass;
58 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
59 #define _g_free0(var) (var = (g_free (var), NULL))
60 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
61 #define _gst_caps_unref0(var) ((var == NULL) ? NULL : (var = (gst_caps_unref (var), NULL)))
62 #define __g_list_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_free (var), NULL)))
63 #define __g_slist_free_g_free0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_free (var), NULL)))
64
65 #define TYPE_PROJECT_PROPERTIES (project_properties_get_type ())
66 #define PROJECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROJECT_PROPERTIES, ProjectProperties))
67 #define PROJECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROJECT_PROPERTIES, ProjectPropertiesClass))
68 #define IS_PROJECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROJECT_PROPERTIES))
69 #define IS_PROJECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROJECT_PROPERTIES))
70 #define PROJECT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROJECT_PROPERTIES, ProjectPropertiesClass))
71
72 typedef struct _ProjectProperties ProjectProperties;
73 typedef struct _ProjectPropertiesClass ProjectPropertiesClass;
74
75 #define UI_TYPE_TRACK_INFORMATION (ui_track_information_get_type ())
76 #define UI_TRACK_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_TRACK_INFORMATION, UITrackInformation))
77 #define UI_TRACK_INFORMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_TRACK_INFORMATION, UITrackInformationClass))
78 #define UI_IS_TRACK_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_TRACK_INFORMATION))
79 #define UI_IS_TRACK_INFORMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_TRACK_INFORMATION))
80 #define UI_TRACK_INFORMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_TRACK_INFORMATION, UITrackInformationClass))
81
82 typedef struct _UITrackInformation UITrackInformation;
83 typedef struct _UITrackInformationClass UITrackInformationClass;
84
85 #define TYPE_FILLMORE (fillmore_get_type ())
86 #define FILLMORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FILLMORE, Fillmore))
87 #define FILLMORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FILLMORE, FillmoreClass))
88 #define IS_FILLMORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FILLMORE))
89 #define IS_FILLMORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FILLMORE))
90 #define FILLMORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FILLMORE, FillmoreClass))
91
92 typedef struct _Fillmore Fillmore;
93 typedef struct _FillmoreClass FillmoreClass;
94 typedef struct _FillmorePrivate FillmorePrivate;
95 #define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
96
97 #define TYPE_FILLMORE_CLASS_FACTORY (fillmore_class_factory_get_type ())
98 #define FILLMORE_CLASS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FILLMORE_CLASS_FACTORY, FillmoreClassFactory))
99 #define FILLMORE_CLASS_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FILLMORE_CLASS_FACTORY, FillmoreClassFactoryClass))
100 #define IS_FILLMORE_CLASS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FILLMORE_CLASS_FACTORY))
101 #define IS_FILLMORE_CLASS_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FILLMORE_CLASS_FACTORY))
102 #define FILLMORE_CLASS_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FILLMORE_CLASS_FACTORY, FillmoreClassFactoryClass))
103
104 typedef struct _FillmoreClassFactory FillmoreClassFactory;
105 typedef struct _FillmoreClassFactoryClass FillmoreClassFactoryClass;
106 #define _class_factory_unref0(var) ((var == NULL) ? NULL : (var = (class_factory_unref (var), NULL)))
107
108 struct _Recorder {
109         GtkWindow parent_instance;
110         RecorderPrivate * priv;
111         ModelAudioProject* project;
112         TimeLine* timeline;
113 };
114
115 struct _RecorderClass {
116         GtkWindowClass parent_class;
117 };
118
119 struct _RecorderPrivate {
120         ViewClickTrack* click_track;
121         HeaderArea* header_area;
122         ClipLibraryView* library;
123         ModelTimeSystem* provider;
124         GtkAdjustment* h_adjustment;
125         GtkHPaned* timeline_library_pane;
126         GtkScrolledWindow* library_scrolled;
127         GtkScrolledWindow* timeline_scrolled;
128         gint cursor_pos;
129         gint64 center_time;
130         gboolean loading;
131         GtkActionGroup* main_group;
132         GtkToggleButton* play_button;
133         GtkToggleButton* record_button;
134         GtkButton* addnew_button;
135         GtkButton* rewind_button;
136         GtkButton* forward_button;
137         GtkButton* zoomin_button;
138         GtkButton* zoomout_button;
139         GtkButton* volume_button;
140         HildonPannableArea* scrollwin;
141         gint scrollwin_pos_y;
142         GtkUIManager* manager;
143         ViewOggVorbisExport* audio_export;
144         ViewAudioOutput* audio_output;
145         GeeArrayList* load_errors;
146 };
147
148 struct _Fillmore {
149         HildonProgram parent_instance;
150         FillmorePrivate * priv;
151 };
152
153 struct _FillmoreClass {
154         HildonProgramClass parent_class;
155 };
156
157
158 extern gboolean do_print_graph;
159 gboolean do_print_graph = FALSE;
160 extern gint debug_level;
161 gint debug_level = 0;
162 static gpointer recorder_parent_class = NULL;
163 static TransportDelegateIface* recorder_transport_delegate_parent_iface = NULL;
164 static gpointer fillmore_parent_class = NULL;
165
166 GType recorder_get_type (void);
167 GType model_audio_project_get_type (void);
168 GType header_area_get_type (void);
169 #define RECORDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_RECORDER, RecorderPrivate))
170 enum  {
171         RECORDER_DUMMY_PROPERTY
172 };
173 #define RECORDER_scroll_speed 8
174 #define RECORDER_NAME "Fillmore"
175 static void recorder_on_project_open (Recorder* self);
176 static void _recorder_on_project_open_gtk_action_callback (GtkAction* action, gpointer self);
177 static void recorder_on_project_new (Recorder* self);
178 static void _recorder_on_project_new_gtk_action_callback (GtkAction* action, gpointer self);
179 static void recorder_on_project_save (Recorder* self);
180 static void _recorder_on_project_save_gtk_action_callback (GtkAction* action, gpointer self);
181 static void recorder_on_project_save_as (Recorder* self);
182 static void _recorder_on_project_save_as_gtk_action_callback (GtkAction* action, gpointer self);
183 static void recorder_on_export (Recorder* self);
184 static void _recorder_on_export_gtk_action_callback (GtkAction* action, gpointer self);
185 static void recorder_on_properties (Recorder* self);
186 static void _recorder_on_properties_gtk_action_callback (GtkAction* action, gpointer self);
187 static void recorder_on_quit (Recorder* self);
188 static void _recorder_on_quit_gtk_action_callback (GtkAction* action, gpointer self);
189 static void recorder_on_undo (Recorder* self);
190 static void _recorder_on_undo_gtk_action_callback (GtkAction* action, gpointer self);
191 static void recorder_on_cut (Recorder* self);
192 static void _recorder_on_cut_gtk_action_callback (GtkAction* action, gpointer self);
193 static void recorder_on_copy (Recorder* self);
194 static void _recorder_on_copy_gtk_action_callback (GtkAction* action, gpointer self);
195 static void recorder_on_paste (Recorder* self);
196 static void _recorder_on_paste_gtk_action_callback (GtkAction* action, gpointer self);
197 static void recorder_on_delete (Recorder* self);
198 static void _recorder_on_delete_gtk_action_callback (GtkAction* action, gpointer self);
199 static void recorder_on_select_all (Recorder* self);
200 static void _recorder_on_select_all_gtk_action_callback (GtkAction* action, gpointer self);
201 void recorder_on_split_at_playhead (Recorder* self);
202 static void _recorder_on_split_at_playhead_gtk_action_callback (GtkAction* action, gpointer self);
203 void recorder_on_trim_to_playhead (Recorder* self);
204 static void _recorder_on_trim_to_playhead_gtk_action_callback (GtkAction* action, gpointer self);
205 void recorder_on_clip_properties (Recorder* self);
206 static void _recorder_on_clip_properties_gtk_action_callback (GtkAction* action, gpointer self);
207 static void recorder_on_zoom_in (Recorder* self);
208 static void _recorder_on_zoom_in_gtk_action_callback (GtkAction* action, gpointer self);
209 static void recorder_on_zoom_out (Recorder* self);
210 static void _recorder_on_zoom_out_gtk_action_callback (GtkAction* action, gpointer self);
211 static void recorder_on_zoom_to_project (Recorder* self);
212 static void _recorder_on_zoom_to_project_gtk_action_callback (GtkAction* action, gpointer self);
213 static void recorder_on_track_new (Recorder* self);
214 static void _recorder_on_track_new_gtk_action_callback (GtkAction* action, gpointer self);
215 static void recorder_on_track_rename (Recorder* self);
216 static void _recorder_on_track_rename_gtk_action_callback (GtkAction* action, gpointer self);
217 static void recorder_on_track_remove (Recorder* self);
218 static void _recorder_on_track_remove_gtk_action_callback (GtkAction* action, gpointer self);
219 static void recorder_on_track_move_up (Recorder* self);
220 static void _recorder_on_track_move_up_gtk_action_callback (GtkAction* action, gpointer self);
221 static void recorder_on_track_move_down (Recorder* self);
222 static void _recorder_on_track_move_down_gtk_action_callback (GtkAction* action, gpointer self);
223 static void recorder_on_tracks_scroll_up (Recorder* self);
224 static void _recorder_on_tracks_scroll_up_gtk_action_callback (GtkAction* action, gpointer self);
225 static void recorder_on_tracks_scroll_down (Recorder* self);
226 static void _recorder_on_tracks_scroll_down_gtk_action_callback (GtkAction* action, gpointer self);
227 static void recorder_on_help_contents (Recorder* self);
228 static void _recorder_on_help_contents_gtk_action_callback (GtkAction* action, gpointer self);
229 static void recorder_on_about (Recorder* self);
230 static void _recorder_on_about_gtk_action_callback (GtkAction* action, gpointer self);
231 static void recorder_on_save_graph (Recorder* self);
232 static void _recorder_on_save_graph_gtk_action_callback (GtkAction* action, gpointer self);
233 static void recorder_on_rewind (Recorder* self);
234 static void _recorder_on_rewind_gtk_action_callback (GtkAction* action, gpointer self);
235 static void recorder_on_end (Recorder* self);
236 static void _recorder_on_end_gtk_action_callback (GtkAction* action, gpointer self);
237 static void recorder_on_play (Recorder* self);
238 static void _recorder_on_play_gtk_action_callback (GtkAction* action, gpointer self);
239 static void recorder_on_record (Recorder* self);
240 static void _recorder_on_record_gtk_action_callback (GtkAction* action, gpointer self);
241 static void recorder_on_view_library (Recorder* self);
242 static void _recorder_on_view_library_gtk_action_callback (GtkAction* action, gpointer self);
243 static void recorder_on_snap (Recorder* self);
244 static void _recorder_on_snap_gtk_action_callback (GtkAction* action, gpointer self);
245 #define RECORDER_ui "\n" \
246 "<ui>\n" \
247 "  <menubar name=\"MenuBar\">\n" \
248 "    <menu name=\"ProjectMenu\" action=\"Project\">\n" \
249 "      <menuitem name=\"New\" action=\"NewProject\"/>\n" \
250 "      <menuitem name=\"Open\" action=\"Open\"/>\n" \
251 "      <menuitem name=\"Save\" action=\"Save\"/>\n" \
252 "      <menuitem name=\"SaveAs\" action=\"SaveAs\"/>\n" \
253 "      <separator/>\n" \
254 "      <menuitem name=\"Export\" action=\"Export\"/>\n" \
255 "      <separator/>\n" \
256 "      <menuitem name=\"Property\" action=\"Settings\"/>\n" \
257 "      <separator/>\n" \
258 "      <menuitem name=\"Quit\" action=\"Quit\"/>\n" \
259 "    </menu>\n" \
260 "    <menu name=\"EditMenu\" action=\"Edit\">\n" \
261 "      <menuitem name=\"EditUndo\" action=\"Undo\"/>\n" \
262 "      <separator/>\n" \
263 "      <menuitem name=\"EditCut\" action=\"Cut\"/>\n" \
264 "      <menuitem name=\"EditCopy\" action=\"Copy\"/>\n" \
265 "      <menuitem name=\"EditPaste\" action=\"Paste\"/>\n" \
266 "      <menuitem name=\"EditDelete\" action=\"Delete\"/>\n" \
267 "      <separator/>\n" \
268 "      <menuitem name=\"EditSelectAll\" action=\"SelectAll\"/>\n" \
269 "      <separator/>\n" \
270 "      <menuitem name=\"ClipSplitAtPlayhead\" action=\"SplitAtPlayhead\"" \
271 "/>\n" \
272 "      <menuitem name=\"ClipTrimToPlayhead\" action=\"TrimToPlayhead\"/" \
273 ">\n" \
274 "      <separator/>\n" \
275 "      <menuitem name=\"ClipViewProperties\" action=\"ClipProperties\"/" \
276 ">\n" \
277 "    </menu>\n" \
278 "    <menu name=\"ViewMenu\" action=\"View\">\n" \
279 "        <menuitem name=\"ViewLibrary\" action=\"Library\"/>\n" \
280 "        <separator/>\n" \
281 "        <menuitem name=\"ViewZoomIn\" action=\"ZoomIn\"/>\n" \
282 "        <menuitem name=\"ViewZoomOut\" action=\"ZoomOut\"/>\n" \
283 "        <menuitem name=\"ViewZoomProject\" action=\"ZoomProject\"/>\n" \
284 "        <separator/>\n" \
285 "        <menuitem name=\"Snap\" action=\"Snap\"/>\n" \
286 "    </menu>\n" \
287 "    <menu name=\"TrackMenu\" action=\"Track\">\n" \
288 "      <menuitem name=\"TrackNew\" action=\"NewTrack\"/>\n" \
289 "      <menuitem name=\"TrackRename\" action=\"Rename\"/>\n" \
290 "      <menuitem name=\"TrackDelete\" action=\"DeleteTrack\"/>\n" \
291 "      <separator/>\n" \
292 "      <menuitem name=\"TrackMoveUp\" action=\"MoveTrackUp\"/>\n" \
293 "      <menuitem name=\"TrackMoveDown\" action=\"MoveTrackDown\"/>\n" \
294 "      <menuitem name=\"TrackScrollUp\" action=\"ScrollTracksUp\"/>\n" \
295 "      <menuitem name=\"TrackScrollDown\" action=\"ScrollTracksDown\"/>" \
296 "\n" \
297 "    </menu>\n" \
298 "    <menu name=\"HelpMenu\" action=\"Help\">\n" \
299 "      <menuitem name=\"HelpContents\" action=\"Contents\"/>\n" \
300 "      <separator/>\n" \
301 "      <menuitem name=\"HelpAbout\" action=\"About\"/>\n" \
302 "      <menuitem name=\"SaveGraph\" action=\"SaveGraph\"/>\n" \
303 "    </menu>\n" \
304 "  </menubar>\n" \
305 "  <popup name=\"ClipContextMenu\">\n" \
306 "    <menuitem name=\"Cut\" action=\"Cut\"/>\n" \
307 "    <menuitem name=\"Copy\" action=\"Copy\"/>\n" \
308 "    <separator/>\n" \
309 "    <menuitem name=\"ClipContextProperties\" action=\"ClipProperties\"" \
310 "/>\n" \
311 "  </popup>\n" \
312 "  <popup name=\"LibraryContextMenu\">\n" \
313 "    <menuitem name=\"ClipContextProperties\" action=\"ClipProperties\"" \
314 "/>\n" \
315 "  </popup>\n" \
316 "  <toolbar name=\"Toolbar\">\n" \
317 "    <toolitem name=\"New\" action=\"NewTrack\"/>\n" \
318 "    <separator/>\n" \
319 "    <toolitem name=\"Rewind\" action=\"Rewind\"/>\n" \
320 "    <toolitem name=\"End\" action=\"End\"/>\n" \
321 "    <toolitem name=\"Play\" action=\"Play\"/>\n" \
322 "    <toolitem name=\"Record\" action=\"Record\"/>\n" \
323 "  </toolbar>\n" \
324 "  <accelerator name=\"Rewind\" action=\"Rewind\"/>\n" \
325 "  <accelerator name=\"End\" action=\"End\"/>\n" \
326 "  <accelerator name=\"Play\" action=\"Play\"/>\n" \
327 "  <accelerator name=\"Record\" action=\"Record\"/>\n" \
328 "</ui>\n"
329 static char* recorder_get_fillmore_directory (Recorder* self);
330 ModelAudioProject* model_audio_project_new (const char* filename, GError** error);
331 ModelAudioProject* model_audio_project_construct (GType object_type, const char* filename, GError** error);
332 static void recorder_on_callback_pulse (Recorder* self);
333 static void _recorder_on_callback_pulse_view_media_engine_callback_pulse (ViewMediaEngine* _sender, gpointer self);
334 static void recorder_on_post_export (Recorder* self, gboolean canceled);
335 static void _recorder_on_post_export_view_media_engine_post_export (ViewMediaEngine* _sender, gboolean canceled, gpointer self);
336 static void recorder_on_position_changed (Recorder* self);
337 static void _recorder_on_position_changed_view_media_engine_position_changed (ViewMediaEngine* _sender, gint64 position, gpointer self);
338 void recorder_on_load_error (Recorder* self, const char* message);
339 static void _recorder_on_load_error_model_project_load_error (ModelProject* _sender, const char* _error_, gpointer self);
340 static void recorder_on_name_changed (Recorder* self);
341 static void _recorder_on_name_changed_model_project_name_changed (ModelProject* _sender, const char* project_file, gpointer self);
342 static void recorder_on_dirty_changed (Recorder* self, gboolean isDirty);
343 static void _recorder_on_dirty_changed_model_undo_manager_dirty_changed (ModelUndoManager* _sender, gboolean is_dirty, gpointer self);
344 static void recorder_on_undo_changed (Recorder* self, gboolean can_undo);
345 static void _recorder_on_undo_changed_model_undo_manager_undo_changed (ModelUndoManager* _sender, gboolean can_undo, gpointer self);
346 static void recorder_on_error_occurred (Recorder* self, const char* major_message, const char* minor_message);
347 static void _recorder_on_error_occurred_model_project_error_occurred (ModelProject* _sender, const char* major_message, const char* minor_message, gpointer self);
348 static void recorder_on_playstate_changed (Recorder* self, PlayState playstate);
349 static void _recorder_on_playstate_changed_model_project_playstate_changed (ModelProject* _sender, PlayState playstate, gpointer self);
350 static void recorder_on_track_added (Recorder* self, ModelTrack* track);
351 static void _recorder_on_track_added_model_project_track_added (ModelProject* _sender, ModelTrack* track, gpointer self);
352 static void recorder_on_track_removed (Recorder* self, ModelTrack* unused);
353 static void _recorder_on_track_removed_model_project_track_removed (ModelProject* _sender, ModelTrack* track, gpointer self);
354 void recorder_on_load_complete (Recorder* self);
355 static void _recorder_on_load_complete_model_project_load_complete (ModelProject* _sender, gpointer self);
356 static void recorder_on_project_close (Recorder* self);
357 static void _recorder_on_project_close_model_project_closed (ModelProject* _sender, gpointer self);
358 static GtkWidget* recorder_get_widget (Recorder* self, GtkUIManager* manager, const char* name);
359 void recorder_on_library_selection_changed (Recorder* self, gboolean selected);
360 static void _recorder_on_library_selection_changed_clip_library_view_selection_changed (ClipLibraryView* _sender, gboolean selected, gpointer self);
361 static void recorder_on_drag_data_received (Recorder* self, GtkWidget* w, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint drag_info, guint time);
362 static void _recorder_on_drag_data_received_gtk_widget_drag_data_received (GtkWidget* _sender, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint info, guint time_, gpointer self);
363 static void recorder_on_track_changed (Recorder* self);
364 static void _recorder_on_track_changed_time_line_track_changed (TimeLine* _sender, gpointer self);
365 static void recorder_on_timeline_size_allocate (Recorder* self, GdkRectangle* rectangle);
366 static void _recorder_on_timeline_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender, GdkRectangle* allocation, gpointer self);
367 static void recorder_on_timeline_selection_changed (Recorder* self, gboolean selected);
368 static void _recorder_on_timeline_selection_changed_time_line_selection_changed (TimeLine* _sender, gboolean selected, gpointer self);
369 static void recorder_update_menu (Recorder* self);
370 HeaderArea* header_area_new (Recorder* recorder, ModelTimeSystem* provider, gint height);
371 HeaderArea* header_area_construct (GType object_type, Recorder* recorder, ModelTimeSystem* provider, gint height);
372 static void _recorder_on_track_new_gtk_button_clicked (GtkButton* _sender, gpointer self);
373 static void _recorder_on_play_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
374 static void _recorder_on_record_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
375 static void _recorder_on_rewind_gtk_button_clicked (GtkButton* _sender, gpointer self);
376 static void _recorder_on_end_gtk_button_clicked (GtkButton* _sender, gpointer self);
377 static void _recorder_on_zoom_in_gtk_button_clicked (GtkButton* _sender, gpointer self);
378 static void _recorder_on_zoom_out_gtk_button_clicked (GtkButton* _sender, gpointer self);
379 static void recorder_on_volume (Recorder* self);
380 static void _recorder_on_volume_gtk_button_clicked (GtkButton* _sender, gpointer self);
381 static void recorder_on_library_size_allocate (Recorder* self, GdkRectangle* rectangle);
382 static void _recorder_on_library_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender, GdkRectangle* allocation, gpointer self);
383 static gboolean recorder_on_delete_event (Recorder* self);
384 static gboolean _recorder_on_delete_event_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self);
385 static void recorder_default_track_set (Recorder* self);
386 Recorder* recorder_new (const char* project_file, GError** error);
387 Recorder* recorder_construct (GType object_type, const char* project_file, GError** error);
388 char* recorder_get_default_track_name (Recorder* self);
389 static gint recorder_default_track_number_compare (void* a, void* b);
390 static gint _recorder_default_track_number_compare_gcompare_func (void* a, void* b);
391 static void _g_list_free_g_free (GList* self);
392 ModelTrack* recorder_selected_track (Recorder* self);
393 static void recorder_set_sensitive_group (Recorder* self, GtkActionGroup* group, const char* group_path, gboolean sensitive);
394 static void recorder_on_clip_added (Recorder* self, ModelClip* clip);
395 static void _recorder_on_clip_added_model_track_clip_added (ModelTrack* _sender, ModelClip* clip, gboolean select, gpointer self);
396 static void recorder_on_clip_removed (Recorder* self, ModelClip* clip);
397 static void _recorder_on_clip_removed_model_track_clip_removed (ModelTrack* _sender, ModelClip* clip, gpointer self);
398 static void recorder_on_track_selection_changed (Recorder* self, ModelTrack* track);
399 static void _recorder_on_track_selection_changed_model_track_track_selection_changed (ModelTrack* _sender, ModelTrack* track, gpointer self);
400 static void recorder_on_clip_moved (Recorder* self, ModelClip* clip);
401 static void _recorder_on_clip_moved_model_clip_moved (ModelClip* _sender, ModelClip* clip, gpointer self);
402 void recorder_scroll_to_beginning (Recorder* self);
403 void recorder_scroll_to_time (Recorder* self, gint64 time);
404 void recorder_page_to_time (Recorder* self, gint64 time);
405 void recorder_scroll_to_end (Recorder* self);
406 static gint recorder_sgn (gint x);
407 void recorder_scroll_toward_center (Recorder* self, gint xpos);
408 static gboolean recorder_real_key_press_event (GtkWidget* base, GdkEventKey* event);
409 void recorder_do_error_dialog (const char* major_message, const char* minor_message);
410 static void recorder_on_project_new_finished_closing (Recorder* self, gboolean project_did_close);
411 static void _recorder_on_project_new_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self);
412 static void recorder_on_project_open_finished_closing (Recorder* self, gboolean project_did_close);
413 static void _recorder_on_project_open_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self);
414 static void _g_slist_free_g_free (GSList* self);
415 static gboolean recorder_save_dialog (Recorder* self);
416 static gboolean recorder_do_save (Recorder* self);
417 static void recorder_on_save_new_file_finished_closing (Recorder* self, gboolean did_close);
418 static void _recorder_on_save_new_file_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self);
419 GType project_properties_get_type (void);
420 void project_properties_setup (ProjectProperties* self, ModelProject* project, GtkBuilder* builder);
421 gint project_properties_get_tempo (ProjectProperties* self);
422 void project_properties_get_time_signature (ProjectProperties* self, Fraction* result);
423 gboolean project_properties_during_record (ProjectProperties* self);
424 gboolean project_properties_during_play (ProjectProperties* self);
425 double project_properties_get_click_volume (ProjectProperties* self);
426 static void recorder_on_quit_finished_closing (Recorder* self, gboolean project_did_close);
427 static void _recorder_on_quit_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self);
428 UITrackInformation* ui_track_information_new (void);
429 UITrackInformation* ui_track_information_construct (GType object_type);
430 GType ui_track_information_get_type (void);
431 void ui_track_information_set_track_name (UITrackInformation* self, const char* new_name);
432 static gboolean recorder_track_name_dialog (Recorder* self, UITrackInformation* dialog, ModelTrack* track);
433 char* ui_track_information_get_track_name (UITrackInformation* self);
434 static void recorder_do_zoom (Recorder* self, float increment);
435 void model_audio_project_record (ModelAudioProject* self, ModelAudioTrack* track);
436 static gint64 recorder_get_zoom_center_time (Recorder* self);
437 static gboolean recorder_real_is_playing (TransportDelegate* base);
438 static gboolean recorder_real_is_recording (TransportDelegate* base);
439 static gboolean recorder_real_is_stopped (TransportDelegate* base);
440 static void recorder_finalize (GObject* obj);
441 GType fillmore_get_type (void);
442 enum  {
443         FILLMORE_DUMMY_PROPERTY
444 };
445 FillmoreClassFactory* fillmore_class_factory_new (void);
446 FillmoreClassFactory* fillmore_class_factory_construct (GType object_type);
447 GType fillmore_class_factory_get_type (void);
448 void fillmore_run (Fillmore* self, char** args, int args_length1);
449 Fillmore* fillmore_new (void);
450 Fillmore* fillmore_construct (GType object_type);
451 static GObject * fillmore_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
452 gint _vala_main (char** args, int args_length1);
453 void NO_main (char** args, int args_length1);
454 static int _vala_strcmp0 (const char * str1, const char * str2);
455
456 const GOptionEntry options[3] = {{"print-graph", (gchar) 0, 0, G_OPTION_ARG_NONE, &do_print_graph, "Show Print Graph in help menu", NULL}, {"debug-level", (gchar) 0, 0, G_OPTION_ARG_INT, &debug_level, "Control amount of diagnostic information", "[0 (minimal),5 (maximum)]"}, {NULL}};
457 static const GtkActionEntry RECORDER_entries[36] = {{"Project", NULL, "_Project", NULL, NULL, (GCallback) NULL}, {"Open", GTK_STOCK_OPEN, "_Open...", NULL, "Open a project", (GCallback) _recorder_on_project_open_gtk_action_callback}, {"NewProject", GTK_STOCK_NEW, "_New", NULL, "Create new project", (GCallback) _recorder_on_project_new_gtk_action_callback}, {"Save", GTK_STOCK_SAVE, "_Save", "<Control>S", "Save project", (GCallback) _recorder_on_project_save_gtk_action_callback}, {"SaveAs", GTK_STOCK_SAVE_AS, "Save _As...", "<Control><Shift>S", "Save project with new name", (GCallback) _recorder_on_project_save_as_gtk_action_callback}, {"Export", GTK_STOCK_JUMP_TO, "_Export...", "<Control>E", NULL, (GCallback) _recorder_on_export_gtk_action_callback}, {"Settings", GTK_STOCK_PROPERTIES, "Se_ttings", "<Control><Alt>Return", NULL, (GCallback) _recorder_on_properties_gtk_action_callback}, {"Quit", GTK_STOCK_QUIT, NULL, NULL, NULL, (GCallback) _recorder_on_quit_gtk_action_callback}, {"Edit", NULL, "_Edit", NULL, NULL, (GCallback) NULL}, {"Undo", GTK_STOCK_UNDO, NULL, "<Control>Z", NULL, (GCallback) _recorder_on_undo_gtk_action_callback}, {"Cut", GTK_STOCK_CUT, NULL, NULL, NULL, (GCallback) _recorder_on_cut_gtk_action_callback}, {"Copy", GTK_STOCK_COPY, NULL, NULL, NULL, (GCallback) _recorder_on_copy_gtk_action_callback}, {"Paste", GTK_STOCK_PASTE, NULL, NULL, NULL, (GCallback) _recorder_on_paste_gtk_action_callback}, {"Delete", GTK_STOCK_DELETE, NULL, "Delete", NULL, (GCallback) _recorder_on_delete_gtk_action_callback}, {"SelectAll", GTK_STOCK_SELECT_ALL, NULL, "<Control>A", NULL, (GCallback) _recorder_on_select_all_gtk_action_callback}, {"SplitAtPlayhead", NULL, "_Split at Playhead", "<Control>P", NULL, (GCallback) _recorder_on_split_at_playhead_gtk_action_callback}, {"TrimToPlayhead", NULL, "Trim to Play_head", "<Control>H", NULL, (GCallback) _recorder_on_trim_to_playhead_gtk_action_callback}, {"ClipProperties", GTK_STOCK_PROPERTIES, "Properti_es", "<Alt>Return", NULL, (GCallback) _recorder_on_clip_properties_gtk_action_callback}, {"View", NULL, "_View", NULL, NULL, (GCallback) NULL}, {"ZoomIn", GTK_STOCK_ZOOM_IN, "Zoom _In", "<Control>plus", NULL, (GCallback) _recorder_on_zoom_in_gtk_action_callback}, {"ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<Control>minus", NULL, (GCallback) _recorder_on_zoom_out_gtk_action_callback}, {"ZoomProject", NULL, "Fit to _Window", "<Shift>Z", NULL, (GCallback) _recorder_on_zoom_to_project_gtk_action_callback}, {"Track", NULL, "_Track", NULL, NULL, (GCallback) NULL}, {"NewTrack", GTK_STOCK_ADD, "_New...", "<Control><Shift>N", "Create new track", (GCallback) _recorder_on_track_new_gtk_action_callback}, {"Rename", NULL, "_Rename...", NULL, "Rename Track", (GCallback) _recorder_on_track_rename_gtk_action_callback}, {"DeleteTrack", NULL, "_Delete", "<Control><Shift>Delete", "Delete track", (GCallback) _recorder_on_track_remove_gtk_action_callback}, {"MoveTrackUp", NULL, "Move Track Up", "<Control>Up", NULL, (GCallback) _recorder_on_track_move_up_gtk_action_callback}, {"MoveTrackDown", NULL, "Move Track Down", "<Control>Down", NULL, (GCallback) _recorder_on_track_move_down_gtk_action_callback}, {"ScrollTracksUp", NULL, "Scroll Tracks Up", "<Shift>Up", NULL, (GCallback) _recorder_on_tracks_scroll_up_gtk_action_callback}, {"ScrollTracksDown", NULL, "Scroll Tracks Down", "<Shift>Down", NULL, (GCallback) _recorder_on_tracks_scroll_down_gtk_action_callback}, {"Help", NULL, "_Help", NULL, NULL, (GCallback) NULL}, {"Contents", GTK_STOCK_HELP, "_Contents", "F1", "More information on Fillmore", (GCallback) _recorder_on_help_contents_gtk_action_callback}, {"About", GTK_STOCK_ABOUT, NULL, NULL, NULL, (GCallback) _recorder_on_about_gtk_action_callback}, {"SaveGraph", NULL, "Save _Graph", NULL, "Save graph", (GCallback) _recorder_on_save_graph_gtk_action_callback}, {"Rewind", GTK_STOCK_MEDIA_PREVIOUS, "Rewind", "Home", "Go to beginning", (GCallback) _recorder_on_rewind_gtk_action_callback}, {"End", GTK_STOCK_MEDIA_NEXT, "End", "End", "Go to end", (GCallback) _recorder_on_end_gtk_action_callback}};
458 static const GtkToggleActionEntry RECORDER_toggle_entries[4] = {{"Play", GTK_STOCK_MEDIA_PLAY, NULL, "space", "Play", (GCallback) _recorder_on_play_gtk_action_callback}, {"Record", GTK_STOCK_MEDIA_RECORD, NULL, "r", "Record", (GCallback) _recorder_on_record_gtk_action_callback}, {"Library", NULL, "_Library", "F9", NULL, (GCallback) _recorder_on_view_library_gtk_action_callback, FALSE}, {"Snap", NULL, "_Snap to Clip Edges", NULL, NULL, (GCallback) _recorder_on_snap_gtk_action_callback, FALSE}};
459 static const DialogUtilsfilter_description_struct RECORDER_filters[2] = {{"Fillmore Project Files", MODEL_PROJECT_FILLMORE_FILE_EXTENSION}, {"Lombard Project Files", MODEL_PROJECT_LOMBARD_FILE_EXTENSION}};
460 static const DialogUtilsfilter_description_struct RECORDER_export_filters[1] = {{"Ogg Files", "ogg"}};
461
462
463 #line 774 "fillmore.vala"
464 static void _recorder_on_project_open_gtk_action_callback (GtkAction* action, gpointer self) {
465 #line 383 "fillmore.c"
466         recorder_on_project_open (self);
467 }
468
469
470 #line 755 "fillmore.vala"
471 static void _recorder_on_project_new_gtk_action_callback (GtkAction* action, gpointer self) {
472 #line 390 "fillmore.c"
473         recorder_on_project_new (self);
474 }
475
476
477 #line 785 "fillmore.vala"
478 static void _recorder_on_project_save_gtk_action_callback (GtkAction* action, gpointer self) {
479 #line 397 "fillmore.c"
480         recorder_on_project_save (self);
481 }
482
483
484 #line 781 "fillmore.vala"
485 static void _recorder_on_project_save_as_gtk_action_callback (GtkAction* action, gpointer self) {
486 #line 404 "fillmore.c"
487         recorder_on_project_save_as (self);
488 }
489
490
491 #line 714 "fillmore.vala"
492 static void _recorder_on_export_gtk_action_callback (GtkAction* action, gpointer self) {
493 #line 411 "fillmore.c"
494         recorder_on_export (self);
495 }
496
497
498 #line 822 "fillmore.vala"
499 static void _recorder_on_properties_gtk_action_callback (GtkAction* action, gpointer self) {
500 #line 418 "fillmore.c"
501         recorder_on_properties (self);
502 }
503
504
505 #line 858 "fillmore.vala"
506 static void _recorder_on_quit_gtk_action_callback (GtkAction* action, gpointer self) {
507 #line 425 "fillmore.c"
508         recorder_on_quit (self);
509 }
510
511
512 #line 913 "fillmore.vala"
513 static void _recorder_on_undo_gtk_action_callback (GtkAction* action, gpointer self) {
514 #line 432 "fillmore.c"
515         recorder_on_undo (self);
516 }
517
518
519 #line 901 "fillmore.vala"
520 static void _recorder_on_cut_gtk_action_callback (GtkAction* action, gpointer self) {
521 #line 439 "fillmore.c"
522         recorder_on_cut (self);
523 }
524
525
526 #line 905 "fillmore.vala"
527 static void _recorder_on_copy_gtk_action_callback (GtkAction* action, gpointer self) {
528 #line 446 "fillmore.c"
529         recorder_on_copy (self);
530 }
531
532
533 #line 909 "fillmore.vala"
534 static void _recorder_on_paste_gtk_action_callback (GtkAction* action, gpointer self) {
535 #line 453 "fillmore.c"
536         recorder_on_paste (self);
537 }
538
539
540 #line 917 "fillmore.vala"
541 static void _recorder_on_delete_gtk_action_callback (GtkAction* action, gpointer self) {
542 #line 460 "fillmore.c"
543         recorder_on_delete (self);
544 }
545
546
547 #line 925 "fillmore.vala"
548 static void _recorder_on_select_all_gtk_action_callback (GtkAction* action, gpointer self) {
549 #line 467 "fillmore.c"
550         recorder_on_select_all (self);
551 }
552
553
554 #line 933 "fillmore.vala"
555 static void _recorder_on_split_at_playhead_gtk_action_callback (GtkAction* action, gpointer self) {
556 #line 474 "fillmore.c"
557         recorder_on_split_at_playhead (self);
558 }
559
560
561 #line 937 "fillmore.vala"
562 static void _recorder_on_trim_to_playhead_gtk_action_callback (GtkAction* action, gpointer self) {
563 #line 481 "fillmore.c"
564         recorder_on_trim_to_playhead (self);
565 }
566
567
568 #line 941 "fillmore.vala"
569 static void _recorder_on_clip_properties_gtk_action_callback (GtkAction* action, gpointer self) {
570 #line 488 "fillmore.c"
571         recorder_on_clip_properties (self);
572 }
573
574
575 #line 1008 "fillmore.vala"
576 static void _recorder_on_zoom_in_gtk_action_callback (GtkAction* action, gpointer self) {
577 #line 495 "fillmore.c"
578         recorder_on_zoom_in (self);
579 }
580
581
582 #line 1012 "fillmore.vala"
583 static void _recorder_on_zoom_out_gtk_action_callback (GtkAction* action, gpointer self) {
584 #line 502 "fillmore.c"
585         recorder_on_zoom_out (self);
586 }
587
588
589 #line 1016 "fillmore.vala"
590 static void _recorder_on_zoom_to_project_gtk_action_callback (GtkAction* action, gpointer self) {
591 #line 509 "fillmore.c"
592         recorder_on_zoom_to_project (self);
593 }
594
595
596 #line 960 "fillmore.vala"
597 static void _recorder_on_track_new_gtk_action_callback (GtkAction* action, gpointer self) {
598 #line 516 "fillmore.c"
599         recorder_on_track_new (self);
600 }
601
602
603 #line 969 "fillmore.vala"
604 static void _recorder_on_track_rename_gtk_action_callback (GtkAction* action, gpointer self) {
605 #line 523 "fillmore.c"
606         recorder_on_track_rename (self);
607 }
608
609
610 #line 1003 "fillmore.vala"
611 static void _recorder_on_track_remove_gtk_action_callback (GtkAction* action, gpointer self) {
612 #line 530 "fillmore.c"
613         recorder_on_track_remove (self);
614 }
615
616
617 #line 426 "fillmore.vala"
618 static void _recorder_on_track_move_up_gtk_action_callback (GtkAction* action, gpointer self) {
619 #line 537 "fillmore.c"
620         recorder_on_track_move_up (self);
621 }
622
623
624 #line 444 "fillmore.vala"
625 static void _recorder_on_track_move_down_gtk_action_callback (GtkAction* action, gpointer self) {
626 #line 544 "fillmore.c"
627         recorder_on_track_move_down (self);
628 }
629
630
631 #line 463 "fillmore.vala"
632 static void _recorder_on_tracks_scroll_up_gtk_action_callback (GtkAction* action, gpointer self) {
633 #line 551 "fillmore.c"
634         recorder_on_tracks_scroll_up (self);
635 }
636
637
638 #line 475 "fillmore.vala"
639 static void _recorder_on_tracks_scroll_down_gtk_action_callback (GtkAction* action, gpointer self) {
640 #line 558 "fillmore.c"
641         recorder_on_tracks_scroll_down (self);
642 }
643
644
645 #line 1043 "fillmore.vala"
646 static void _recorder_on_help_contents_gtk_action_callback (GtkAction* action, gpointer self) {
647 #line 565 "fillmore.c"
648         recorder_on_help_contents (self);
649 }
650
651
652 #line 1050 "fillmore.vala"
653 static void _recorder_on_about_gtk_action_callback (GtkAction* action, gpointer self) {
654 #line 572 "fillmore.c"
655         recorder_on_about (self);
656 }
657
658
659 #line 1062 "fillmore.vala"
660 static void _recorder_on_save_graph_gtk_action_callback (GtkAction* action, gpointer self) {
661 #line 579 "fillmore.c"
662         recorder_on_save_graph (self);
663 }
664
665
666 #line 1072 "fillmore.vala"
667 static void _recorder_on_rewind_gtk_action_callback (GtkAction* action, gpointer self) {
668 #line 586 "fillmore.c"
669         recorder_on_rewind (self);
670 }
671
672
673 #line 1077 "fillmore.vala"
674 static void _recorder_on_end_gtk_action_callback (GtkAction* action, gpointer self) {
675 #line 593 "fillmore.c"
676         recorder_on_end (self);
677 }
678
679
680 #line 1082 "fillmore.vala"
681 static void _recorder_on_play_gtk_action_callback (GtkAction* action, gpointer self) {
682 #line 600 "fillmore.c"
683         recorder_on_play (self);
684 }
685
686
687 #line 1094 "fillmore.vala"
688 static void _recorder_on_record_gtk_action_callback (GtkAction* action, gpointer self) {
689 #line 607 "fillmore.c"
690         recorder_on_record (self);
691 }
692
693
694 #line 1024 "fillmore.vala"
695 static void _recorder_on_view_library_gtk_action_callback (GtkAction* action, gpointer self) {
696 #line 614 "fillmore.c"
697         recorder_on_view_library (self);
698 }
699
700
701 #line 1020 "fillmore.vala"
702 static void _recorder_on_snap_gtk_action_callback (GtkAction* action, gpointer self) {
703 #line 621 "fillmore.c"
704         recorder_on_snap (self);
705 }
706
707
708 #line 1114 "fillmore.vala"
709 static void _recorder_on_callback_pulse_view_media_engine_callback_pulse (ViewMediaEngine* _sender, gpointer self) {
710 #line 628 "fillmore.c"
711         recorder_on_callback_pulse (self);
712 }
713
714
715 #line 730 "fillmore.vala"
716 static void _recorder_on_post_export_view_media_engine_post_export (ViewMediaEngine* _sender, gboolean canceled, gpointer self) {
717 #line 635 "fillmore.c"
718         recorder_on_post_export (self, canceled);
719 }
720
721
722 #line 498 "fillmore.vala"
723 static void _recorder_on_position_changed_view_media_engine_position_changed (ViewMediaEngine* _sender, gint64 position, gpointer self) {
724 #line 642 "fillmore.c"
725         recorder_on_position_changed (self);
726 }
727
728
729 #line 1210 "fillmore.vala"
730 static void _recorder_on_load_error_model_project_load_error (ModelProject* _sender, const char* _error_, gpointer self) {
731 #line 649 "fillmore.c"
732         recorder_on_load_error (self, _error_);
733 }
734
735
736 #line 1251 "fillmore.vala"
737 static void _recorder_on_name_changed_model_project_name_changed (ModelProject* _sender, const char* project_file, gpointer self) {
738 #line 656 "fillmore.c"
739         recorder_on_name_changed (self);
740 }
741
742
743 #line 1256 "fillmore.vala"
744 static void _recorder_on_dirty_changed_model_undo_manager_dirty_changed (ModelUndoManager* _sender, gboolean is_dirty, gpointer self) {
745 #line 663 "fillmore.c"
746         recorder_on_dirty_changed (self, is_dirty);
747 }
748
749
750 #line 1263 "fillmore.vala"
751 static void _recorder_on_undo_changed_model_undo_manager_undo_changed (ModelUndoManager* _sender, gboolean can_undo, gpointer self) {
752 #line 670 "fillmore.c"
753         recorder_on_undo_changed (self, can_undo);
754 }
755
756
757 #line 1281 "fillmore.vala"
758 static void _recorder_on_error_occurred_model_project_error_occurred (ModelProject* _sender, const char* major_message, const char* minor_message, gpointer self) {
759 #line 677 "fillmore.c"
760         recorder_on_error_occurred (self, major_message, minor_message);
761 }
762
763
764 #line 1271 "fillmore.vala"
765 static void _recorder_on_playstate_changed_model_project_playstate_changed (ModelProject* _sender, PlayState playstate, gpointer self) {
766 #line 684 "fillmore.c"
767         recorder_on_playstate_changed (self, playstate);
768 }
769
770
771 #line 503 "fillmore.vala"
772 static void _recorder_on_track_added_model_project_track_added (ModelProject* _sender, ModelTrack* track, gpointer self) {
773 #line 691 "fillmore.c"
774         recorder_on_track_added (self, track);
775 }
776
777
778 #line 511 "fillmore.vala"
779 static void _recorder_on_track_removed_model_project_track_removed (ModelProject* _sender, ModelTrack* track, gpointer self) {
780 #line 698 "fillmore.c"
781         recorder_on_track_removed (self, track);
782 }
783
784
785 #line 1215 "fillmore.vala"
786 static void _recorder_on_load_complete_model_project_load_complete (ModelProject* _sender, gpointer self) {
787 #line 705 "fillmore.c"
788         recorder_on_load_complete (self);
789 }
790
791
792 #line 872 "fillmore.vala"
793 static void _recorder_on_project_close_model_project_closed (ModelProject* _sender, gpointer self) {
794 #line 712 "fillmore.c"
795         recorder_on_project_close (self);
796 }
797
798
799 #line 1148 "fillmore.vala"
800 static void _recorder_on_library_selection_changed_clip_library_view_selection_changed (ClipLibraryView* _sender, gboolean selected, gpointer self) {
801 #line 719 "fillmore.c"
802         recorder_on_library_selection_changed (self, selected);
803 }
804
805
806 #line 543 "fillmore.vala"
807 static void _recorder_on_drag_data_received_gtk_widget_drag_data_received (GtkWidget* _sender, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint info, guint time_, gpointer self) {
808 #line 726 "fillmore.c"
809         recorder_on_drag_data_received (self, _sender, context, x, y, selection_data, info, time_);
810 }
811
812
813 #line 493 "fillmore.vala"
814 static void _recorder_on_track_changed_time_line_track_changed (TimeLine* _sender, gpointer self) {
815 #line 733 "fillmore.c"
816         recorder_on_track_changed (self);
817 }
818
819
820 #line 1131 "fillmore.vala"
821 static void _recorder_on_timeline_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender, GdkRectangle* allocation, gpointer self) {
822 #line 740 "fillmore.c"
823         recorder_on_timeline_size_allocate (self, allocation);
824 }
825
826
827 #line 1140 "fillmore.vala"
828 static void _recorder_on_timeline_selection_changed_time_line_selection_changed (TimeLine* _sender, gboolean selected, gpointer self) {
829 #line 747 "fillmore.c"
830         recorder_on_timeline_selection_changed (self, selected);
831 }
832
833
834 static gpointer _g_object_ref0 (gpointer self) {
835         return self ? g_object_ref (self) : NULL;
836 }
837
838
839 #line 960 "fillmore.vala"
840 static void _recorder_on_track_new_gtk_button_clicked (GtkButton* _sender, gpointer self) {
841 #line 759 "fillmore.c"
842         recorder_on_track_new (self);
843 }
844
845
846 #line 1082 "fillmore.vala"
847 static void _recorder_on_play_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
848 #line 766 "fillmore.c"
849         recorder_on_play (self);
850 }
851
852
853 #line 1094 "fillmore.vala"
854 static void _recorder_on_record_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
855 #line 773 "fillmore.c"
856         recorder_on_record (self);
857 }
858
859
860 #line 1072 "fillmore.vala"
861 static void _recorder_on_rewind_gtk_button_clicked (GtkButton* _sender, gpointer self) {
862 #line 780 "fillmore.c"
863         recorder_on_rewind (self);
864 }
865
866
867 #line 1077 "fillmore.vala"
868 static void _recorder_on_end_gtk_button_clicked (GtkButton* _sender, gpointer self) {
869 #line 787 "fillmore.c"
870         recorder_on_end (self);
871 }
872
873
874 #line 1008 "fillmore.vala"
875 static void _recorder_on_zoom_in_gtk_button_clicked (GtkButton* _sender, gpointer self) {
876 #line 794 "fillmore.c"
877         recorder_on_zoom_in (self);
878 }
879
880
881 #line 1012 "fillmore.vala"
882 static void _recorder_on_zoom_out_gtk_button_clicked (GtkButton* _sender, gpointer self) {
883 #line 801 "fillmore.c"
884         recorder_on_zoom_out (self);
885 }
886
887
888 #line 1068 "fillmore.vala"
889 static void _recorder_on_volume_gtk_button_clicked (GtkButton* _sender, gpointer self) {
890 #line 808 "fillmore.c"
891         recorder_on_volume (self);
892 }
893
894
895 #line 1035 "fillmore.vala"
896 static void _recorder_on_library_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender, GdkRectangle* allocation, gpointer self) {
897 #line 815 "fillmore.c"
898         recorder_on_library_size_allocate (self, allocation);
899 }
900
901
902 #line 866 "fillmore.vala"
903 static gboolean _recorder_on_delete_event_gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) {
904 #line 822 "fillmore.c"
905         gboolean result;
906         result = recorder_on_delete_event (self);
907         return result;
908 }
909
910
911 #line 207 "fillmore.vala"
912 Recorder* recorder_construct (GType object_type, const char* project_file, GError** error) {
913 #line 831 "fillmore.c"
914         GError * _inner_error_;
915         Recorder * self;
916         char* _tmp0_;
917         GeeArrayList* _tmp1_;
918         ModelAudioProject* _tmp5_;
919         ModelAudioProject* _tmp6_;
920         ModelTimeSystem* _tmp7_;
921         GstCaps* _tmp8_;
922         ViewAudioOutput* _tmp9_;
923         ViewAudioOutput* _tmp10_;
924         ViewAudioOutput* _tmp11_;
925         ViewClickTrack* _tmp12_;
926         ViewClickTrack* _tmp13_;
927         GtkActionGroup* _tmp14_;
928         GtkUIManager* _tmp15_;
929         GtkMenuBar* menubar;
930         GtkToolbar* toolbar;
931         ClipLibraryView* _tmp16_;
932         TimeLine* _tmp17_;
933         GtkMenu* _tmp18_;
934         GtkMenu* _tmp19_;
935         GtkScrolledWindow* _tmp20_;
936         GtkHBox* hbox;
937         HeaderArea* _tmp21_;
938         GtkScrolledWindow* _tmp22_;
939         GtkAdjustment* _tmp23_;
940         GtkHButtonBox* buttons;
941         GtkButton* _tmp24_;
942         GtkImage* _tmp25_;
943         GtkToggleButton* _tmp26_;
944         GtkImage* _tmp27_;
945         GtkToggleButton* _tmp28_;
946         GtkImage* _tmp29_;
947         GtkButton* _tmp30_;
948         GtkImage* _tmp31_;
949         GtkButton* _tmp32_;
950         GtkImage* _tmp33_;
951         GtkButton* _tmp34_;
952         GtkImage* _tmp35_;
953         GtkButton* _tmp36_;
954         GtkImage* _tmp37_;
955         GtkButton* _tmp38_;
956         GtkImage* _tmp39_;
957         GtkVBox* vbox;
958         GtkVBox* main_view;
959         GtkHPaned* _tmp40_;
960         HildonPannableArea* _tmp41_;
961         GtkMenuItem* save_graph;
962         gboolean _tmp42_ = FALSE;
963         _inner_error_ = NULL;
964         self = g_object_newv (object_type, 0, NULL);
965 #line 208 "fillmore.vala"
966         class_factory_set_transport_delegate (TRANSPORT_DELEGATE (self));
967 #line 209 "fillmore.vala"
968         g_mkdir (_tmp0_ = recorder_get_fillmore_directory (self), 0777);
969 #line 887 "fillmore.c"
970         _g_free0 (_tmp0_);
971 #line 210 "fillmore.vala"
972         self->priv->load_errors = (_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL), _g_object_unref0 (self->priv->load_errors), _tmp1_);
973 #line 891 "fillmore.c"
974         {
975                 char* _tmp4_;
976                 GFile* _tmp3_;
977                 GFile* _tmp2_;
978 #line 212 "fillmore.vala"
979                 gtk_window_set_icon_from_file (GTK_WINDOW (self), _tmp4_ = g_file_get_path (_tmp3_ = g_file_get_child (_tmp2_ = app_dirs_get_resources_dir (), "fillmore_icon.png")), &_inner_error_);
980 #line 898 "fillmore.c"
981                 _g_free0 (_tmp4_);
982                 _g_object_unref0 (_tmp3_);
983                 _g_object_unref0 (_tmp2_);
984                 if (_inner_error_ != NULL) {
985                         goto __catch3_g_error;
986                 }
987         }
988         goto __finally3;
989         __catch3_g_error:
990         {
991                 GError * e;
992                 e = _inner_error_;
993                 _inner_error_ = NULL;
994                 {
995 #line 215 "fillmore.vala"
996                         g_warning ("fillmore.vala:215: Could not load application icon: %s", e->message);
997 #line 915 "fillmore.c"
998                         _g_error_free0 (e);
999                 }
1000         }
1001         __finally3:
1002         if (_inner_error_ != NULL) {
1003                 g_propagate_error (error, _inner_error_);
1004                 g_object_unref (self);
1005                 return NULL;
1006         }
1007 #line 219 "fillmore.vala"
1008         _tmp5_ = model_audio_project_new (project_file, &_inner_error_);
1009 #line 927 "fillmore.c"
1010         if (_inner_error_ != NULL) {
1011                 g_propagate_error (error, _inner_error_);
1012                 g_object_unref (self);
1013                 return NULL;
1014         }
1015 #line 219 "fillmore.vala"
1016         self->project = (_tmp6_ = _tmp5_, _g_object_unref0 (self->project), _tmp6_);
1017 #line 220 "fillmore.vala"
1018         MODEL_PROJECT (self->project)->snap_to_clip = FALSE;
1019 #line 221 "fillmore.vala"
1020         self->priv->provider = (_tmp7_ = MODEL_TIME_SYSTEM (model_bar_beat_time_system_new (MODEL_TEMPO_INFORMATION (self->project))), _g_object_unref0 (self->priv->provider), _tmp7_);
1021 #line 223 "fillmore.vala"
1022         g_signal_connect_object (MODEL_PROJECT (self->project)->media_engine, "callback-pulse", (GCallback) _recorder_on_callback_pulse_view_media_engine_callback_pulse, self, 0);
1023 #line 224 "fillmore.vala"
1024         g_signal_connect_object (MODEL_PROJECT (self->project)->media_engine, "post-export", (GCallback) _recorder_on_post_export_view_media_engine_post_export, self, 0);
1025 #line 225 "fillmore.vala"
1026         g_signal_connect_object (MODEL_PROJECT (self->project)->media_engine, "position-changed", (GCallback) _recorder_on_position_changed_view_media_engine_position_changed, self, 0);
1027 #line 227 "fillmore.vala"
1028         g_signal_connect_object (MODEL_PROJECT (self->project), "load-error", (GCallback) _recorder_on_load_error_model_project_load_error, self, 0);
1029 #line 228 "fillmore.vala"
1030         g_signal_connect_object (MODEL_PROJECT (self->project), "name-changed", (GCallback) _recorder_on_name_changed_model_project_name_changed, self, 0);
1031 #line 229 "fillmore.vala"
1032         g_signal_connect_object (MODEL_PROJECT (self->project)->undo_manager, "dirty-changed", (GCallback) _recorder_on_dirty_changed_model_undo_manager_dirty_changed, self, 0);
1033 #line 230 "fillmore.vala"
1034         g_signal_connect_object (MODEL_PROJECT (self->project)->undo_manager, "undo-changed", (GCallback) _recorder_on_undo_changed_model_undo_manager_undo_changed, self, 0);
1035 #line 231 "fillmore.vala"
1036         g_signal_connect_object (MODEL_PROJECT (self->project), "error-occurred", (GCallback) _recorder_on_error_occurred_model_project_error_occurred, self, 0);
1037 #line 232 "fillmore.vala"
1038         g_signal_connect_object (MODEL_PROJECT (self->project), "playstate-changed", (GCallback) _recorder_on_playstate_changed_model_project_playstate_changed, self, 0);
1039 #line 233 "fillmore.vala"
1040         g_signal_connect_object (MODEL_PROJECT (self->project), "track-added", (GCallback) _recorder_on_track_added_model_project_track_added, self, 0);
1041 #line 234 "fillmore.vala"
1042         g_signal_connect_object (MODEL_PROJECT (self->project), "track-removed", (GCallback) _recorder_on_track_removed_model_project_track_removed, self, 0);
1043 #line 235 "fillmore.vala"
1044         g_signal_connect_object (MODEL_PROJECT (self->project), "load-complete", (GCallback) _recorder_on_load_complete_model_project_load_complete, self, 0);
1045 #line 236 "fillmore.vala"
1046         g_signal_connect_object (MODEL_PROJECT (self->project), "closed", (GCallback) _recorder_on_project_close_model_project_closed, self, 0);
1047 #line 238 "fillmore.vala"
1048         _tmp10_ = (_tmp9_ = view_audio_output_new (_tmp8_ = view_media_engine_get_project_audio_caps (MODEL_PROJECT (self->project)->media_engine), &_inner_error_), _gst_caps_unref0 (_tmp8_), _tmp9_);
1049 #line 967 "fillmore.c"
1050         if (_inner_error_ != NULL) {
1051                 g_propagate_error (error, _inner_error_);
1052                 g_object_unref (self);
1053                 return NULL;
1054         }
1055 #line 238 "fillmore.vala"
1056         self->priv->audio_output = (_tmp11_ = _tmp10_, _g_object_unref0 (self->priv->audio_output), _tmp11_);
1057 #line 239 "fillmore.vala"
1058         view_media_engine_connect_output (MODEL_PROJECT (self->project)->media_engine, VIEW_MEDIA_CONNECTOR (self->priv->audio_output));
1059 #line 240 "fillmore.vala"
1060         _tmp12_ = view_click_track_new (MODEL_PROJECT (self->project)->media_engine, MODEL_PROJECT (self->project), &_inner_error_);
1061 #line 979 "fillmore.c"
1062         if (_inner_error_ != NULL) {
1063                 g_propagate_error (error, _inner_error_);
1064                 g_object_unref (self);
1065                 return NULL;
1066         }
1067 #line 240 "fillmore.vala"
1068         self->priv->click_track = (_tmp13_ = _tmp12_, _g_object_unref0 (self->priv->click_track), _tmp13_);
1069 #line 241 "fillmore.vala"
1070         gtk_window_set_position (GTK_WINDOW (self), GTK_WIN_POS_CENTER);
1071 #line 242 "fillmore.vala"
1072         gtk_window_set_title (GTK_WINDOW (self), "Fillmore");
1073 #line 243 "fillmore.vala"
1074         gtk_window_set_default_size (GTK_WINDOW (self), 800, 1200);
1075 #line 245 "fillmore.vala"
1076         self->priv->main_group = (_tmp14_ = gtk_action_group_new ("main"), _g_object_unref0 (self->priv->main_group), _tmp14_);
1077 #line 246 "fillmore.vala"
1078         gtk_action_group_add_actions (self->priv->main_group, RECORDER_entries, G_N_ELEMENTS (RECORDER_entries), self);
1079 #line 247 "fillmore.vala"
1080         gtk_action_group_add_toggle_actions (self->priv->main_group, RECORDER_toggle_entries, G_N_ELEMENTS (RECORDER_toggle_entries), self);
1081 #line 249 "fillmore.vala"
1082         self->priv->manager = (_tmp15_ = gtk_ui_manager_new (), _g_object_unref0 (self->priv->manager), _tmp15_);
1083 #line 250 "fillmore.vala"
1084         gtk_ui_manager_insert_action_group (self->priv->manager, self->priv->main_group, 0);
1085 #line 1003 "fillmore.c"
1086         {
1087 #line 252 "fillmore.vala"
1088                 gtk_ui_manager_add_ui_from_string (self->priv->manager, RECORDER_ui, (gssize) (-1), &_inner_error_);
1089 #line 1007 "fillmore.c"
1090                 if (_inner_error_ != NULL) {
1091                         goto __catch4_g_error;
1092                 }
1093         }
1094         goto __finally4;
1095         __catch4_g_error:
1096         {
1097                 GError * e;
1098                 e = _inner_error_;
1099                 _inner_error_ = NULL;
1100                 {
1101 #line 253 "fillmore.vala"
1102                         g_error ("fillmore.vala:253: %s", e->message);
1103 #line 1021 "fillmore.c"
1104                         _g_error_free0 (e);
1105                 }
1106         }
1107         __finally4:
1108         if (_inner_error_ != NULL) {
1109                 g_propagate_error (error, _inner_error_);
1110                 g_object_unref (self);
1111                 return NULL;
1112         }
1113 #line 255 "fillmore.vala"
1114         menubar = GTK_MENU_BAR (recorder_get_widget (self, self->priv->manager, "/MenuBar"));
1115 #line 256 "fillmore.vala"
1116         toolbar = GTK_TOOLBAR (recorder_get_widget (self, self->priv->manager, "/Toolbar"));
1117 #line 262 "fillmore.vala"
1118         recorder_on_undo_changed (self, FALSE);
1119 #line 264 "fillmore.vala"
1120         self->priv->library = (_tmp16_ = g_object_ref_sink (clip_library_view_new (MODEL_PROJECT (self->project), self->priv->provider, NULL, GDK_ACTION_COPY)), _g_object_unref0 (self->priv->library), _tmp16_);
1121 #line 265 "fillmore.vala"
1122         g_signal_connect_object (self->priv->library, "selection-changed", (GCallback) _recorder_on_library_selection_changed_clip_library_view_selection_changed, self, 0);
1123 #line 266 "fillmore.vala"
1124         g_signal_connect_object (GTK_WIDGET (self->priv->library), "drag-data-received", (GCallback) _recorder_on_drag_data_received_gtk_widget_drag_data_received, self, 0);
1125 #line 268 "fillmore.vala"
1126         self->timeline = (_tmp17_ = g_object_ref_sink (time_line_new (MODEL_PROJECT (self->project), self->priv->provider, GDK_ACTION_COPY)), _g_object_unref0 (self->timeline), _tmp17_);
1127 #line 269 "fillmore.vala"
1128         g_signal_connect_object (self->timeline, "track-changed", (GCallback) _recorder_on_track_changed_time_line_track_changed, self, 0);
1129 #line 270 "fillmore.vala"
1130         g_signal_connect_object (GTK_WIDGET (self->timeline), "drag-data-received", (GCallback) _recorder_on_drag_data_received_gtk_widget_drag_data_received, self, 0);
1131 #line 271 "fillmore.vala"
1132         g_signal_connect_object (GTK_WIDGET (self->timeline), "size-allocate", (GCallback) _recorder_on_timeline_size_allocate_gtk_widget_size_allocate, self, 0);
1133 #line 272 "fillmore.vala"
1134         g_signal_connect_object (self->timeline, "selection-changed", (GCallback) _recorder_on_timeline_selection_changed_time_line_selection_changed, self, 0);
1135 #line 274 "fillmore.vala"
1136         clip_view_context_menu = (_tmp18_ = _g_object_ref0 (GTK_MENU (gtk_ui_manager_get_widget (self->priv->manager, "/ClipContextMenu"))), _g_object_unref0 (clip_view_context_menu), _tmp18_);
1137 #line 275 "fillmore.vala"
1138         clip_library_view_context_menu = (_tmp19_ = _g_object_ref0 (GTK_MENU (gtk_ui_manager_get_widget (self->priv->manager, "/LibraryContextMenu"))), _g_object_unref0 (clip_library_view_context_menu), _tmp19_);
1139 #line 276 "fillmore.vala"
1140         recorder_update_menu (self);
1141 #line 278 "fillmore.vala"
1142         self->priv->library_scrolled = (_tmp20_ = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL)), _g_object_unref0 (self->priv->library_scrolled), _tmp20_);
1143 #line 279 "fillmore.vala"
1144         gtk_scrolled_window_set_policy (self->priv->library_scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1145 #line 280 "fillmore.vala"
1146         gtk_scrolled_window_add_with_viewport (self->priv->library_scrolled, GTK_WIDGET (self->priv->library));
1147 #line 282 "fillmore.vala"
1148         hbox = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0));
1149 #line 283 "fillmore.vala"
1150         self->priv->header_area = (_tmp21_ = g_object_ref_sink (header_area_new (self, self->priv->provider, TIME_LINE_RULER_HEIGHT)), _g_object_unref0 (self->priv->header_area), _tmp21_);
1151 #line 284 "fillmore.vala"
1152         gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (self->priv->header_area), FALSE, FALSE, (guint) 0);
1153 #line 287 "fillmore.vala"
1154         self->priv->timeline_scrolled = (_tmp22_ = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL)), _g_object_unref0 (self->priv->timeline_scrolled), _tmp22_);
1155 #line 288 "fillmore.vala"
1156         gtk_scrolled_window_set_policy (self->priv->timeline_scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1157 #line 289 "fillmore.vala"
1158         gtk_scrolled_window_add_with_viewport (self->priv->timeline_scrolled, GTK_WIDGET (self->timeline));
1159 #line 290 "fillmore.vala"
1160         gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (self->priv->timeline_scrolled), TRUE, TRUE, (guint) 0);
1161 #line 291 "fillmore.vala"
1162         self->priv->h_adjustment = (_tmp23_ = _g_object_ref0 (gtk_scrolled_window_get_hadjustment (self->priv->timeline_scrolled)), _g_object_unref0 (self->priv->h_adjustment), _tmp23_);
1163 #line 295 "fillmore.vala"
1164         buttons = g_object_ref_sink ((GtkHButtonBox*) gtk_hbutton_box_new ());
1165 #line 296 "fillmore.vala"
1166         self->priv->addnew_button = (_tmp24_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->addnew_button), _tmp24_);
1167 #line 297 "fillmore.vala"
1168         gtk_button_set_image (self->priv->addnew_button, GTK_WIDGET (_tmp25_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("general_add", GTK_ICON_SIZE_BUTTON))));
1169 #line 1087 "fillmore.c"
1170         _g_object_unref0 (_tmp25_);
1171 #line 298 "fillmore.vala"
1172         g_signal_connect_object (self->priv->addnew_button, "clicked", (GCallback) _recorder_on_track_new_gtk_button_clicked, self, 0);
1173 #line 299 "fillmore.vala"
1174         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->addnew_button));
1175 #line 300 "fillmore.vala"
1176         self->priv->play_button = (_tmp26_ = g_object_ref_sink ((GtkToggleButton*) gtk_toggle_button_new ()), _g_object_unref0 (self->priv->play_button), _tmp26_);
1177 #line 301 "fillmore.vala"
1178         gtk_button_set_image (GTK_BUTTON (self->priv->play_button), GTK_WIDGET (_tmp27_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("camera_playback", GTK_ICON_SIZE_BUTTON))));
1179 #line 1097 "fillmore.c"
1180         _g_object_unref0 (_tmp27_);
1181 #line 302 "fillmore.vala"
1182         g_signal_connect_object (self->priv->play_button, "toggled", (GCallback) _recorder_on_play_gtk_toggle_button_toggled, self, 0);
1183 #line 303 "fillmore.vala"
1184         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->play_button));
1185 #line 304 "fillmore.vala"
1186         self->priv->record_button = (_tmp28_ = g_object_ref_sink ((GtkToggleButton*) gtk_toggle_button_new ()), _g_object_unref0 (self->priv->record_button), _tmp28_);
1187 #line 305 "fillmore.vala"
1188         gtk_button_set_image (GTK_BUTTON (self->priv->record_button), GTK_WIDGET (_tmp29_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("camera_video_recording", GTK_ICON_SIZE_BUTTON))));
1189 #line 1107 "fillmore.c"
1190         _g_object_unref0 (_tmp29_);
1191 #line 306 "fillmore.vala"
1192         g_signal_connect_object (self->priv->record_button, "toggled", (GCallback) _recorder_on_record_gtk_toggle_button_toggled, self, 0);
1193 #line 307 "fillmore.vala"
1194         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->record_button));
1195 #line 308 "fillmore.vala"
1196         self->priv->rewind_button = (_tmp30_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->rewind_button), _tmp30_);
1197 #line 309 "fillmore.vala"
1198         gtk_button_set_image (self->priv->rewind_button, GTK_WIDGET (_tmp31_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("pdf_viewer_first_page", GTK_ICON_SIZE_BUTTON))));
1199 #line 1117 "fillmore.c"
1200         _g_object_unref0 (_tmp31_);
1201 #line 310 "fillmore.vala"
1202         g_signal_connect_object (self->priv->rewind_button, "clicked", (GCallback) _recorder_on_rewind_gtk_button_clicked, self, 0);
1203 #line 311 "fillmore.vala"
1204         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->rewind_button));
1205 #line 312 "fillmore.vala"
1206         self->priv->forward_button = (_tmp32_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->forward_button), _tmp32_);
1207 #line 313 "fillmore.vala"
1208         gtk_button_set_image (self->priv->forward_button, GTK_WIDGET (_tmp33_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("pdf_viewer_last_page", GTK_ICON_SIZE_BUTTON))));
1209 #line 1127 "fillmore.c"
1210         _g_object_unref0 (_tmp33_);
1211 #line 314 "fillmore.vala"
1212         g_signal_connect_object (self->priv->forward_button, "clicked", (GCallback) _recorder_on_end_gtk_button_clicked, self, 0);
1213 #line 315 "fillmore.vala"
1214         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->forward_button));
1215 #line 316 "fillmore.vala"
1216         self->priv->zoomin_button = (_tmp34_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->zoomin_button), _tmp34_);
1217 #line 317 "fillmore.vala"
1218         gtk_button_set_image (self->priv->zoomin_button, GTK_WIDGET (_tmp35_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("pdf_zoomin", GTK_ICON_SIZE_BUTTON))));
1219 #line 1137 "fillmore.c"
1220         _g_object_unref0 (_tmp35_);
1221 #line 318 "fillmore.vala"
1222         g_signal_connect_object (self->priv->zoomin_button, "clicked", (GCallback) _recorder_on_zoom_in_gtk_button_clicked, self, 0);
1223 #line 319 "fillmore.vala"
1224         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->zoomin_button));
1225 #line 320 "fillmore.vala"
1226         self->priv->zoomout_button = (_tmp36_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->zoomout_button), _tmp36_);
1227 #line 321 "fillmore.vala"
1228         gtk_button_set_image (self->priv->zoomout_button, GTK_WIDGET (_tmp37_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("pdf_zoomout", GTK_ICON_SIZE_BUTTON))));
1229 #line 1147 "fillmore.c"
1230         _g_object_unref0 (_tmp37_);
1231 #line 322 "fillmore.vala"
1232         g_signal_connect_object (self->priv->zoomout_button, "clicked", (GCallback) _recorder_on_zoom_out_gtk_button_clicked, self, 0);
1233 #line 323 "fillmore.vala"
1234         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->zoomout_button));
1235 #line 324 "fillmore.vala"
1236         self->priv->volume_button = (_tmp38_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), _g_object_unref0 (self->priv->volume_button), _tmp38_);
1237 #line 325 "fillmore.vala"
1238         gtk_button_set_image (self->priv->volume_button, GTK_WIDGET (_tmp39_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_icon_name ("statusarea_volumelevel4", GTK_ICON_SIZE_BUTTON))));
1239 #line 1157 "fillmore.c"
1240         _g_object_unref0 (_tmp39_);
1241 #line 326 "fillmore.vala"
1242         g_signal_connect_object (self->priv->volume_button, "clicked", (GCallback) _recorder_on_volume_gtk_button_clicked, self, 0);
1243 #line 327 "fillmore.vala"
1244         gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (self->priv->volume_button));
1245 #line 330 "fillmore.vala"
1246         vbox = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0));
1247 #line 331 "fillmore.vala"
1248         gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (menubar), FALSE, FALSE, (guint) 0);
1249 #line 333 "fillmore.vala"
1250         gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (buttons), FALSE, FALSE, (guint) 0);
1251 #line 335 "fillmore.vala"
1252         main_view = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0));
1253 #line 337 "fillmore.vala"
1254         self->priv->timeline_library_pane = (_tmp40_ = g_object_ref_sink ((GtkHPaned*) gtk_hpaned_new ()), _g_object_unref0 (self->priv->timeline_library_pane), _tmp40_);
1255 #line 338 "fillmore.vala"
1256         gtk_paned_set_position (GTK_PANED (self->priv->timeline_library_pane), MODEL_PROJECT (self->project)->library_width);
1257 #line 339 "fillmore.vala"
1258         gtk_paned_add1 (GTK_PANED (self->priv->timeline_library_pane), GTK_WIDGET (hbox));
1259 #line 340 "fillmore.vala"
1260         GTK_PANED (self->priv->timeline_library_pane)->child1_resize = (guint) 1;
1261 #line 341 "fillmore.vala"
1262         gtk_paned_add2 (GTK_PANED (self->priv->timeline_library_pane), GTK_WIDGET (self->priv->library_scrolled));
1263 #line 342 "fillmore.vala"
1264         GTK_PANED (self->priv->timeline_library_pane)->child2_resize = (guint) 0;
1265 #line 343 "fillmore.vala"
1266         g_signal_connect_object (GTK_PANED (self->priv->timeline_library_pane)->child1, "size-allocate", (GCallback) _recorder_on_library_size_allocate_gtk_widget_size_allocate, self, 0);
1267 #line 346 "fillmore.vala"
1268         gtk_box_pack_start (GTK_BOX (main_view), GTK_WIDGET (self->priv->timeline_library_pane), TRUE, TRUE, (guint) 0);
1269 #line 349 "fillmore.vala"
1270         self->priv->scrollwin = (_tmp41_ = g_object_ref_sink ((HildonPannableArea*) hildon_pannable_area_new ()), _g_object_unref0 (self->priv->scrollwin), _tmp41_);
1271 #line 350 "fillmore.vala"
1272         hildon_pannable_area_add_with_viewport (self->priv->scrollwin, GTK_WIDGET (main_view));
1273 #line 351 "fillmore.vala"
1274         gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (self->priv->scrollwin));
1275 #line 353 "fillmore.vala"
1276         gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (vbox));
1277 #line 355 "fillmore.vala"
1278         recorder_on_view_library (self);
1279 #line 357 "fillmore.vala"
1280         save_graph = GTK_MENU_ITEM (recorder_get_widget (self, self->priv->manager, "/MenuBar/HelpMenu/SaveGraph"));
1281 #line 360 "fillmore.vala"
1282         if (!do_print_graph) {
1283 #line 360 "fillmore.vala"
1284                 _tmp42_ = save_graph != NULL;
1285 #line 1203 "fillmore.c"
1286         } else {
1287 #line 360 "fillmore.vala"
1288                 _tmp42_ = FALSE;
1289 #line 1207 "fillmore.c"
1290         }
1291 #line 360 "fillmore.vala"
1292         if (_tmp42_) {
1293 #line 361 "fillmore.vala"
1294                 gtk_object_destroy (GTK_OBJECT (save_graph));
1295 #line 1213 "fillmore.c"
1296         }
1297 #line 364 "fillmore.vala"
1298         gtk_window_add_accel_group (GTK_WINDOW (self), gtk_ui_manager_get_accel_group (self->priv->manager));
1299 #line 365 "fillmore.vala"
1300         gtk_widget_grab_focus (GTK_WIDGET (self->timeline));
1301 #line 366 "fillmore.vala"
1302         g_signal_connect_object (GTK_WIDGET (self), "delete-event", (GCallback) _recorder_on_delete_event_gtk_widget_delete_event, self, 0);
1303 #line 367 "fillmore.vala"
1304         self->priv->loading = TRUE;
1305 #line 368 "fillmore.vala"
1306         model_project_load (MODEL_PROJECT (self->project), project_file);
1307 #line 369 "fillmore.vala"
1308         if (project_file == NULL) {
1309 #line 370 "fillmore.vala"
1310                 recorder_default_track_set (self);
1311 #line 371 "fillmore.vala"
1312                 self->priv->loading = FALSE;
1313 #line 1231 "fillmore.c"
1314         }
1315 #line 373 "fillmore.vala"
1316         gst_element_set_state (GST_ELEMENT (MODEL_PROJECT (self->project)->media_engine->pipeline), GST_STATE_PAUSED);
1317 #line 1235 "fillmore.c"
1318         _g_object_unref0 (menubar);
1319         _g_object_unref0 (toolbar);
1320         _g_object_unref0 (hbox);
1321         _g_object_unref0 (buttons);
1322         _g_object_unref0 (vbox);
1323         _g_object_unref0 (main_view);
1324         _g_object_unref0 (save_graph);
1325         return self;
1326 }
1327
1328
1329 #line 207 "fillmore.vala"
1330 Recorder* recorder_new (const char* project_file, GError** error) {
1331 #line 207 "fillmore.vala"
1332         return recorder_construct (TYPE_RECORDER, project_file, error);
1333 #line 1251 "fillmore.c"
1334 }
1335
1336
1337 #line 376 "fillmore.vala"
1338 static void recorder_default_track_set (Recorder* self) {
1339 #line 1257 "fillmore.c"
1340         ModelAudioTrack* _tmp1_;
1341         char* _tmp0_;
1342         ModelTrack* _tmp2_;
1343 #line 376 "fillmore.vala"
1344         g_return_if_fail (IS_RECORDER (self));
1345 #line 377 "fillmore.vala"
1346         model_project_add_track (MODEL_PROJECT (self->project), MODEL_TRACK (_tmp1_ = model_audio_track_new (MODEL_PROJECT (self->project), _tmp0_ = recorder_get_default_track_name (self))));
1347 #line 1265 "fillmore.c"
1348         _g_object_unref0 (_tmp1_);
1349         _g_free0 (_tmp0_);
1350 #line 378 "fillmore.vala"
1351         model_track_set_selected (_tmp2_ = (ModelTrack*) gee_abstract_list_get (GEE_ABSTRACT_LIST (MODEL_PROJECT (self->project)->tracks), 0), TRUE);
1352 #line 1270 "fillmore.c"
1353         _g_object_unref0 (_tmp2_);
1354 }
1355
1356
1357 #line 381 "fillmore.vala"
1358 static gint recorder_default_track_number_compare (void* a, void* b) {
1359 #line 1277 "fillmore.c"
1360         gint result = 0;
1361         const char* s1;
1362         const char* s2;
1363         gint i;
1364         gint j;
1365 #line 382 "fillmore.vala"
1366         s1 = (const char*) a;
1367 #line 383 "fillmore.vala"
1368         s2 = (const char*) b;
1369 #line 384 "fillmore.vala"
1370         i = -1;
1371 #line 385 "fillmore.vala"
1372         j = -1;
1373 #line 386 "fillmore.vala"
1374         sscanf (s1, "track %d", &i);
1375 #line 387 "fillmore.vala"
1376         sscanf (s2, "track %d", &j);
1377 #line 388 "fillmore.vala"
1378         g_assert (i > 0);
1379 #line 389 "fillmore.vala"
1380         g_assert (j > 0);
1381 #line 390 "fillmore.vala"
1382         if (i == j) {
1383 #line 1301 "fillmore.c"
1384                 result = 0;
1385 #line 391 "fillmore.vala"
1386                 return result;
1387 #line 1305 "fillmore.c"
1388         } else {
1389 #line 392 "fillmore.vala"
1390                 if (i < j) {
1391 #line 1309 "fillmore.c"
1392                         result = -1;
1393 #line 393 "fillmore.vala"
1394                         return result;
1395 #line 1313 "fillmore.c"
1396                 } else {
1397                         result = 1;
1398 #line 395 "fillmore.vala"
1399                         return result;
1400 #line 1318 "fillmore.c"
1401                 }
1402         }
1403 }
1404
1405
1406 #line 381 "fillmore.vala"
1407 static gint _recorder_default_track_number_compare_gcompare_func (void* a, void* b) {
1408 #line 1326 "fillmore.c"
1409         gint result;
1410         result = recorder_default_track_number_compare (a, b);
1411         return result;
1412 }
1413
1414
1415 static void _g_list_free_g_free (GList* self) {
1416         g_list_foreach (self, (GFunc) g_free, NULL);
1417         g_list_free (self);
1418 }
1419
1420
1421 #line 399 "fillmore.vala"
1422 char* recorder_get_default_track_name (Recorder* self) {
1423 #line 1341 "fillmore.c"
1424         char* result = NULL;
1425         GList* default_track_names;
1426         gint i;
1427 #line 399 "fillmore.vala"
1428         g_return_val_if_fail (IS_RECORDER (self), NULL);
1429 #line 400 "fillmore.vala"
1430         default_track_names = NULL;
1431 #line 1349 "fillmore.c"
1432         {
1433                 GeeIterator* _track_it;
1434                 _track_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1435 #line 401 "fillmore.vala"
1436                 while (TRUE) {
1437 #line 1355 "fillmore.c"
1438                         ModelTrack* track;
1439 #line 401 "fillmore.vala"
1440                         if (!gee_iterator_next (_track_it)) {
1441 #line 401 "fillmore.vala"
1442                                 break;
1443 #line 1361 "fillmore.c"
1444                         }
1445 #line 401 "fillmore.vala"
1446                         track = (ModelTrack*) gee_iterator_get (_track_it);
1447 #line 402 "fillmore.vala"
1448                         if (g_str_has_prefix (track->display_name, "track ")) {
1449 #line 403 "fillmore.vala"
1450                                 default_track_names = g_list_append (default_track_names, g_strdup (track->display_name));
1451 #line 1369 "fillmore.c"
1452                         }
1453                         _g_object_unref0 (track);
1454                 }
1455                 _g_object_unref0 (_track_it);
1456         }
1457 #line 406 "fillmore.vala"
1458         default_track_names = g_list_sort (default_track_names, _recorder_default_track_number_compare_gcompare_func);
1459 #line 408 "fillmore.vala"
1460         i = 1;
1461 #line 1379 "fillmore.c"
1462         {
1463                 GList* s_collection;
1464                 GList* s_it;
1465 #line 409 "fillmore.vala"
1466                 s_collection = default_track_names;
1467 #line 1385 "fillmore.c"
1468                 for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
1469                         char* s;
1470 #line 409 "fillmore.vala"
1471                         s = g_strdup ((const char*) s_it->data);
1472 #line 1390 "fillmore.c"
1473                         {
1474                                 char* track_name;
1475 #line 410 "fillmore.vala"
1476                                 track_name = g_strdup_printf ("track %d", i);
1477 #line 411 "fillmore.vala"
1478                                 if (_vala_strcmp0 (s, track_name) != 0) {
1479 #line 1397 "fillmore.c"
1480                                         result = track_name;
1481                                         _g_free0 (s);
1482                                         __g_list_free_g_free0 (default_track_names);
1483 #line 412 "fillmore.vala"
1484                                         return result;
1485 #line 1403 "fillmore.c"
1486                                 }
1487 #line 414 "fillmore.vala"
1488                                 i = i + 1;
1489 #line 1407 "fillmore.c"
1490                                 _g_free0 (s);
1491                                 _g_free0 (track_name);
1492                         }
1493                 }
1494         }
1495         result = g_strdup_printf ("track %d", i);
1496         __g_list_free_g_free0 (default_track_names);
1497 #line 416 "fillmore.vala"
1498         return result;
1499 #line 1417 "fillmore.c"
1500 }
1501
1502
1503 #line 419 "fillmore.vala"
1504 static GtkWidget* recorder_get_widget (Recorder* self, GtkUIManager* manager, const char* name) {
1505 #line 1423 "fillmore.c"
1506         GtkWidget* result = NULL;
1507         GtkWidget* widget;
1508 #line 419 "fillmore.vala"
1509         g_return_val_if_fail (IS_RECORDER (self), NULL);
1510 #line 419 "fillmore.vala"
1511         g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
1512 #line 419 "fillmore.vala"
1513         g_return_val_if_fail (name != NULL, NULL);
1514 #line 420 "fillmore.vala"
1515         widget = _g_object_ref0 (gtk_ui_manager_get_widget (manager, name));
1516 #line 421 "fillmore.vala"
1517         if (widget == NULL) {
1518 #line 422 "fillmore.vala"
1519                 g_error ("fillmore.vala:422: can't find widget");
1520 #line 1438 "fillmore.c"
1521         }
1522         result = widget;
1523 #line 423 "fillmore.vala"
1524         return result;
1525 #line 1443 "fillmore.c"
1526 }
1527
1528
1529 #line 426 "fillmore.vala"
1530 static void recorder_on_track_move_up (Recorder* self) {
1531 #line 1449 "fillmore.c"
1532         gint index;
1533         gint position;
1534         gint track_ct;
1535 #line 426 "fillmore.vala"
1536         g_return_if_fail (IS_RECORDER (self));
1537 #line 427 "fillmore.vala"
1538         index = -1;
1539 #line 428 "fillmore.vala"
1540         position = 0;
1541 #line 429 "fillmore.vala"
1542         track_ct = gee_collection_get_size (GEE_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1543 #line 430 "fillmore.vala"
1544         if (0 < track_ct) {
1545 #line 1463 "fillmore.c"
1546                 {
1547                         GeeIterator* _track_it;
1548                         _track_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1549 #line 431 "fillmore.vala"
1550                         while (TRUE) {
1551 #line 1469 "fillmore.c"
1552                                 ModelTrack* track;
1553                                 ModelTrack* _tmp0_;
1554                                 gboolean _tmp1_;
1555 #line 431 "fillmore.vala"
1556                                 if (!gee_iterator_next (_track_it)) {
1557 #line 431 "fillmore.vala"
1558                                         break;
1559 #line 1477 "fillmore.c"
1560                                 }
1561 #line 431 "fillmore.vala"
1562                                 track = (ModelTrack*) gee_iterator_get (_track_it);
1563 #line 432 "fillmore.vala"
1564                                 index = index + 1;
1565 #line 433 "fillmore.vala"
1566                                 if ((_tmp1_ = (_tmp0_ = recorder_selected_track (self)) == track, _g_object_unref0 (_tmp0_), _tmp1_)) {
1567 #line 434 "fillmore.vala"
1568                                         position = index;
1569 #line 1487 "fillmore.c"
1570                                 }
1571                                 _g_object_unref0 (track);
1572                         }
1573                         _g_object_unref0 (_track_it);
1574                 }
1575 #line 437 "fillmore.vala"
1576                 if (0 < position) {
1577 #line 1495 "fillmore.c"
1578                         ModelTrack* _tmp2_;
1579                         ModelAudioTrack* track;
1580 #line 438 "fillmore.vala"
1581                         track = (_tmp2_ = recorder_selected_track (self), MODEL_IS_AUDIO_TRACK (_tmp2_) ? ((ModelAudioTrack*) _tmp2_) : NULL);
1582 #line 439 "fillmore.vala"
1583                         gee_abstract_collection_remove (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks), MODEL_TRACK (track));
1584 #line 440 "fillmore.vala"
1585                         gee_abstract_list_insert (GEE_ABSTRACT_LIST (MODEL_PROJECT (self->project)->tracks), position - 1, MODEL_TRACK (track));
1586 #line 1504 "fillmore.c"
1587                         _g_object_unref0 (track);
1588                 }
1589         }
1590 }
1591
1592
1593 #line 444 "fillmore.vala"
1594 static void recorder_on_track_move_down (Recorder* self) {
1595 #line 1513 "fillmore.c"
1596         gint index;
1597         gint position;
1598         gint track_ct;
1599 #line 444 "fillmore.vala"
1600         g_return_if_fail (IS_RECORDER (self));
1601 #line 446 "fillmore.vala"
1602         index = -1;
1603 #line 447 "fillmore.vala"
1604         position = 0;
1605 #line 448 "fillmore.vala"
1606         track_ct = gee_collection_get_size (GEE_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1607 #line 449 "fillmore.vala"
1608         if (0 < track_ct) {
1609 #line 1527 "fillmore.c"
1610                 {
1611                         GeeIterator* _track_it;
1612                         _track_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1613 #line 450 "fillmore.vala"
1614                         while (TRUE) {
1615 #line 1533 "fillmore.c"
1616                                 ModelTrack* track;
1617                                 ModelTrack* _tmp0_;
1618                                 gboolean _tmp1_;
1619 #line 450 "fillmore.vala"
1620                                 if (!gee_iterator_next (_track_it)) {
1621 #line 450 "fillmore.vala"
1622                                         break;
1623 #line 1541 "fillmore.c"
1624                                 }
1625 #line 450 "fillmore.vala"
1626                                 track = (ModelTrack*) gee_iterator_get (_track_it);
1627 #line 451 "fillmore.vala"
1628                                 index = index + 1;
1629 #line 452 "fillmore.vala"
1630                                 if ((_tmp1_ = (_tmp0_ = recorder_selected_track (self)) == track, _g_object_unref0 (_tmp0_), _tmp1_)) {
1631 #line 453 "fillmore.vala"
1632                                         position = index;
1633 #line 1551 "fillmore.c"
1634                                 }
1635                                 _g_object_unref0 (track);
1636                         }
1637                         _g_object_unref0 (_track_it);
1638                 }
1639 #line 456 "fillmore.vala"
1640                 if ((track_ct - 1) > position) {
1641 #line 1559 "fillmore.c"
1642                         ModelTrack* _tmp2_;
1643                         ModelAudioTrack* audio_track;
1644 #line 457 "fillmore.vala"
1645                         audio_track = (_tmp2_ = recorder_selected_track (self), MODEL_IS_AUDIO_TRACK (_tmp2_) ? ((ModelAudioTrack*) _tmp2_) : NULL);
1646 #line 458 "fillmore.vala"
1647                         gee_abstract_collection_remove (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks), MODEL_TRACK (audio_track));
1648 #line 459 "fillmore.vala"
1649                         gee_abstract_list_insert (GEE_ABSTRACT_LIST (MODEL_PROJECT (self->project)->tracks), position + 1, MODEL_TRACK (audio_track));
1650 #line 1568 "fillmore.c"
1651                         _g_object_unref0 (audio_track);
1652                 }
1653         }
1654 }
1655
1656
1657 #line 463 "fillmore.vala"
1658 static void recorder_on_tracks_scroll_up (Recorder* self) {
1659 #line 1577 "fillmore.c"
1660         gint _tmp0_ = 0;
1661 #line 463 "fillmore.vala"
1662         g_return_if_fail (IS_RECORDER (self));
1663 #line 472 "fillmore.vala"
1664         if (self->priv->scrollwin_pos_y < 4) {
1665 #line 472 "fillmore.vala"
1666                 _tmp0_ = 0;
1667 #line 1585 "fillmore.c"
1668         } else {
1669 #line 472 "fillmore.vala"
1670                 _tmp0_ = 64;
1671 #line 1589 "fillmore.c"
1672         }
1673 #line 472 "fillmore.vala"
1674         self->priv->scrollwin_pos_y = self->priv->scrollwin_pos_y - _tmp0_;
1675 #line 473 "fillmore.vala"
1676         hildon_pannable_area_scroll_to (self->priv->scrollwin, 0, self->priv->scrollwin_pos_y);
1677 #line 1595 "fillmore.c"
1678 }
1679
1680
1681 #line 475 "fillmore.vala"
1682 static void recorder_on_tracks_scroll_down (Recorder* self) {
1683 #line 475 "fillmore.vala"
1684         g_return_if_fail (IS_RECORDER (self));
1685 #line 484 "fillmore.vala"
1686         self->priv->scrollwin_pos_y = self->priv->scrollwin_pos_y + 64;
1687 #line 485 "fillmore.vala"
1688         hildon_pannable_area_scroll_to (self->priv->scrollwin, 0, self->priv->scrollwin_pos_y);
1689 #line 1607 "fillmore.c"
1690 }
1691
1692
1693 #line 488 "fillmore.vala"
1694 static void recorder_set_sensitive_group (Recorder* self, GtkActionGroup* group, const char* group_path, gboolean sensitive) {
1695 #line 1613 "fillmore.c"
1696         GtkAction* action;
1697 #line 488 "fillmore.vala"
1698         g_return_if_fail (IS_RECORDER (self));
1699 #line 488 "fillmore.vala"
1700         g_return_if_fail (GTK_IS_ACTION_GROUP (group));
1701 #line 488 "fillmore.vala"
1702         g_return_if_fail (group_path != NULL);
1703 #line 489 "fillmore.vala"
1704         action = _g_object_ref0 (gtk_action_group_get_action (group, group_path));
1705 #line 490 "fillmore.vala"
1706         gtk_action_set_sensitive (action, sensitive);
1707 #line 1625 "fillmore.c"
1708         _g_object_unref0 (action);
1709 }
1710
1711
1712 #line 493 "fillmore.vala"
1713 static void recorder_on_track_changed (Recorder* self) {
1714 #line 493 "fillmore.vala"
1715         g_return_if_fail (IS_RECORDER (self));
1716 #line 494 "fillmore.vala"
1717         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_track_changed");
1718 #line 495 "fillmore.vala"
1719         recorder_update_menu (self);
1720 #line 1638 "fillmore.c"
1721 }
1722
1723
1724 #line 498 "fillmore.vala"
1725 static void recorder_on_position_changed (Recorder* self) {
1726 #line 498 "fillmore.vala"
1727         g_return_if_fail (IS_RECORDER (self));
1728 #line 499 "fillmore.vala"
1729         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_position_changed");
1730 #line 500 "fillmore.vala"
1731         recorder_update_menu (self);
1732 #line 1650 "fillmore.c"
1733 }
1734
1735
1736 #line 516 "fillmore.vala"
1737 static void _recorder_on_clip_added_model_track_clip_added (ModelTrack* _sender, ModelClip* clip, gboolean select, gpointer self) {
1738 #line 1656 "fillmore.c"
1739         recorder_on_clip_added (self, clip);
1740 }
1741
1742
1743 #line 522 "fillmore.vala"
1744 static void _recorder_on_clip_removed_model_track_clip_removed (ModelTrack* _sender, ModelClip* clip, gpointer self) {
1745 #line 1663 "fillmore.c"
1746         recorder_on_clip_removed (self, clip);
1747 }
1748
1749
1750 #line 528 "fillmore.vala"
1751 static void _recorder_on_track_selection_changed_model_track_track_selection_changed (ModelTrack* _sender, ModelTrack* track, gpointer self) {
1752 #line 1670 "fillmore.c"
1753         recorder_on_track_selection_changed (self, track);
1754 }
1755
1756
1757 #line 503 "fillmore.vala"
1758 static void recorder_on_track_added (Recorder* self, ModelTrack* track) {
1759 #line 503 "fillmore.vala"
1760         g_return_if_fail (IS_RECORDER (self));
1761 #line 503 "fillmore.vala"
1762         g_return_if_fail (MODEL_IS_TRACK (track));
1763 #line 504 "fillmore.vala"
1764         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_track_added");
1765 #line 505 "fillmore.vala"
1766         recorder_update_menu (self);
1767 #line 506 "fillmore.vala"
1768         g_signal_connect_object (track, "clip-added", (GCallback) _recorder_on_clip_added_model_track_clip_added, self, 0);
1769 #line 507 "fillmore.vala"
1770         g_signal_connect_object (track, "clip-removed", (GCallback) _recorder_on_clip_removed_model_track_clip_removed, self, 0);
1771 #line 508 "fillmore.vala"
1772         g_signal_connect_object (track, "track-selection-changed", (GCallback) _recorder_on_track_selection_changed_model_track_track_selection_changed, self, 0);
1773 #line 1691 "fillmore.c"
1774 }
1775
1776
1777 #line 511 "fillmore.vala"
1778 static void recorder_on_track_removed (Recorder* self, ModelTrack* unused) {
1779 #line 511 "fillmore.vala"
1780         g_return_if_fail (IS_RECORDER (self));
1781 #line 511 "fillmore.vala"
1782         g_return_if_fail (MODEL_IS_TRACK (unused));
1783 #line 512 "fillmore.vala"
1784         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_track_removed");
1785 #line 513 "fillmore.vala"
1786         recorder_update_menu (self);
1787 #line 1705 "fillmore.c"
1788 }
1789
1790
1791 #line 538 "fillmore.vala"
1792 static void _recorder_on_clip_moved_model_clip_moved (ModelClip* _sender, ModelClip* clip, gpointer self) {
1793 #line 1711 "fillmore.c"
1794         recorder_on_clip_moved (self, clip);
1795 }
1796
1797
1798 #line 516 "fillmore.vala"
1799 static void recorder_on_clip_added (Recorder* self, ModelClip* clip) {
1800 #line 516 "fillmore.vala"
1801         g_return_if_fail (IS_RECORDER (self));
1802 #line 516 "fillmore.vala"
1803         g_return_if_fail (MODEL_IS_CLIP (clip));
1804 #line 517 "fillmore.vala"
1805         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_clip_added");
1806 #line 518 "fillmore.vala"
1807         g_signal_connect_object (clip, "moved", (GCallback) _recorder_on_clip_moved_model_clip_moved, self, 0);
1808 #line 519 "fillmore.vala"
1809         recorder_update_menu (self);
1810 #line 1728 "fillmore.c"
1811 }
1812
1813
1814 #line 522 "fillmore.vala"
1815 static void recorder_on_clip_removed (Recorder* self, ModelClip* clip) {
1816 #line 1734 "fillmore.c"
1817         guint _tmp0_;
1818 #line 522 "fillmore.vala"
1819         g_return_if_fail (IS_RECORDER (self));
1820 #line 522 "fillmore.vala"
1821         g_return_if_fail (MODEL_IS_CLIP (clip));
1822 #line 523 "fillmore.vala"
1823         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_clip_removed");
1824 #line 524 "fillmore.vala"
1825         g_signal_parse_name ("moved", MODEL_TYPE_CLIP, &_tmp0_, NULL, FALSE);
1826 #line 524 "fillmore.vala"
1827         g_signal_handlers_disconnect_matched (clip, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _recorder_on_clip_moved_model_clip_moved, self);
1828 #line 525 "fillmore.vala"
1829         recorder_update_menu (self);
1830 #line 1748 "fillmore.c"
1831 }
1832
1833
1834 #line 528 "fillmore.vala"
1835 static void recorder_on_track_selection_changed (Recorder* self, ModelTrack* track) {
1836 #line 528 "fillmore.vala"
1837         g_return_if_fail (IS_RECORDER (self));
1838 #line 528 "fillmore.vala"
1839         g_return_if_fail (MODEL_IS_TRACK (track));
1840 #line 529 "fillmore.vala"
1841         if (model_track_get_is_selected (track)) {
1842 #line 1760 "fillmore.c"
1843                 {
1844                         GeeIterator* _t_it;
1845                         _t_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1846 #line 530 "fillmore.vala"
1847                         while (TRUE) {
1848 #line 1766 "fillmore.c"
1849                                 ModelTrack* t;
1850 #line 530 "fillmore.vala"
1851                                 if (!gee_iterator_next (_t_it)) {
1852 #line 530 "fillmore.vala"
1853                                         break;
1854 #line 1772 "fillmore.c"
1855                                 }
1856 #line 530 "fillmore.vala"
1857                                 t = (ModelTrack*) gee_iterator_get (_t_it);
1858 #line 531 "fillmore.vala"
1859                                 if (t != track) {
1860 #line 532 "fillmore.vala"
1861                                         model_track_set_selected (t, FALSE);
1862 #line 1780 "fillmore.c"
1863                                 }
1864                                 _g_object_unref0 (t);
1865                         }
1866                         _g_object_unref0 (_t_it);
1867                 }
1868         }
1869 }
1870
1871
1872 #line 538 "fillmore.vala"
1873 static void recorder_on_clip_moved (Recorder* self, ModelClip* clip) {
1874 #line 538 "fillmore.vala"
1875         g_return_if_fail (IS_RECORDER (self));
1876 #line 538 "fillmore.vala"
1877         g_return_if_fail (MODEL_IS_CLIP (clip));
1878 #line 539 "fillmore.vala"
1879         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_clip_moved");
1880 #line 540 "fillmore.vala"
1881         recorder_update_menu (self);
1882 #line 1800 "fillmore.c"
1883 }
1884
1885
1886 #line 543 "fillmore.vala"
1887 static void recorder_on_drag_data_received (Recorder* self, GtkWidget* w, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint drag_info, guint time) {
1888 #line 543 "fillmore.vala"
1889         g_return_if_fail (IS_RECORDER (self));
1890 #line 543 "fillmore.vala"
1891         g_return_if_fail (GTK_IS_WIDGET (w));
1892 #line 543 "fillmore.vala"
1893         g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
1894 #line 543 "fillmore.vala"
1895         g_return_if_fail (selection_data != NULL);
1896 #line 545 "fillmore.vala"
1897         gtk_window_present (GTK_WINDOW (self));
1898 #line 1816 "fillmore.c"
1899 }
1900
1901
1902 #line 548 "fillmore.vala"
1903 static void recorder_update_menu (Recorder* self) {
1904 #line 1822 "fillmore.c"
1905         gboolean library_selected;
1906         gboolean selected;
1907         gboolean playhead_on_clip;
1908         gint number_of_tracks;
1909         gboolean is_stopped;
1910         gboolean one_selected;
1911         gboolean _tmp1_ = FALSE;
1912         gboolean _tmp2_ = FALSE;
1913         gboolean _tmp3_ = FALSE;
1914         gboolean _tmp4_ = FALSE;
1915         gboolean _tmp5_ = FALSE;
1916         gboolean _tmp6_ = FALSE;
1917         gboolean _tmp7_ = FALSE;
1918         gboolean _tmp8_ = FALSE;
1919         gboolean _tmp9_ = FALSE;
1920         gboolean _tmp10_ = FALSE;
1921         gboolean _tmp11_ = FALSE;
1922         gboolean _tmp12_ = FALSE;
1923         gboolean _tmp13_ = FALSE;
1924 #line 548 "fillmore.vala"
1925         g_return_if_fail (IS_RECORDER (self));
1926 #line 549 "fillmore.vala"
1927         library_selected = clip_library_view_has_selection (self->priv->library);
1928 #line 550 "fillmore.vala"
1929         selected = time_line_is_clip_selected (self->timeline);
1930 #line 551 "fillmore.vala"
1931         playhead_on_clip = model_project_playhead_on_clip (MODEL_PROJECT (self->project));
1932 #line 552 "fillmore.vala"
1933         number_of_tracks = gee_collection_get_size (GEE_COLLECTION (MODEL_PROJECT (self->project)->tracks));
1934 #line 553 "fillmore.vala"
1935         is_stopped = transport_delegate_is_stopped (TRANSPORT_DELEGATE (self));
1936 #line 554 "fillmore.vala"
1937         one_selected = FALSE;
1938 #line 555 "fillmore.vala"
1939         if (library_selected) {
1940 #line 1858 "fillmore.c"
1941                 GeeArrayList* _tmp0_;
1942 #line 556 "fillmore.vala"
1943                 one_selected = gee_collection_get_size (GEE_COLLECTION (_tmp0_ = clip_library_view_get_selected_files (self->priv->library))) == 1;
1944 #line 1862 "fillmore.c"
1945                 _g_object_unref0 (_tmp0_);
1946         } else {
1947 #line 557 "fillmore.vala"
1948                 if (selected) {
1949 #line 558 "fillmore.vala"
1950                         one_selected = gee_collection_get_size (GEE_COLLECTION (self->timeline->selected_clips)) == 1;
1951 #line 1869 "fillmore.c"
1952                 }
1953         }
1954 #line 562 "fillmore.vala"
1955         recorder_set_sensitive_group (self, self->priv->main_group, "NewProject", is_stopped);
1956 #line 563 "fillmore.vala"
1957         recorder_set_sensitive_group (self, self->priv->main_group, "Open", is_stopped);
1958 #line 564 "fillmore.vala"
1959         recorder_set_sensitive_group (self, self->priv->main_group, "Save", is_stopped);
1960 #line 565 "fillmore.vala"
1961         recorder_set_sensitive_group (self, self->priv->main_group, "SaveAs", is_stopped);
1962 #line 566 "fillmore.vala"
1963         recorder_set_sensitive_group (self, self->priv->main_group, "Settings", is_stopped);
1964 #line 567 "fillmore.vala"
1965         recorder_set_sensitive_group (self, self->priv->main_group, "Export", model_project_can_export (MODEL_PROJECT (self->project)));
1966 #line 568 "fillmore.vala"
1967         recorder_set_sensitive_group (self, self->priv->main_group, "Quit", !model_project_transport_is_recording (MODEL_PROJECT (self->project)));
1968 #line 571 "fillmore.vala"
1969         if (is_stopped) {
1970 #line 571 "fillmore.vala"
1971                 _tmp1_ = model_undo_manager_get_can_undo (MODEL_PROJECT (self->project)->undo_manager);
1972 #line 1890 "fillmore.c"
1973         } else {
1974 #line 571 "fillmore.vala"
1975                 _tmp1_ = FALSE;
1976 #line 1894 "fillmore.c"
1977         }
1978 #line 571 "fillmore.vala"
1979         recorder_set_sensitive_group (self, self->priv->main_group, "Undo", _tmp1_);
1980 #line 572 "fillmore.vala"
1981         if (is_stopped) {
1982 #line 572 "fillmore.vala"
1983                 _tmp2_ = selected;
1984 #line 1902 "fillmore.c"
1985         } else {
1986 #line 572 "fillmore.vala"
1987                 _tmp2_ = FALSE;
1988 #line 1906 "fillmore.c"
1989         }
1990 #line 572 "fillmore.vala"
1991         recorder_set_sensitive_group (self, self->priv->main_group, "Copy", _tmp2_);
1992 #line 573 "fillmore.vala"
1993         if (is_stopped) {
1994 #line 573 "fillmore.vala"
1995                 _tmp3_ = selected;
1996 #line 1914 "fillmore.c"
1997         } else {
1998 #line 573 "fillmore.vala"
1999                 _tmp3_ = FALSE;
2000 #line 1918 "fillmore.c"
2001         }
2002 #line 573 "fillmore.vala"
2003         recorder_set_sensitive_group (self, self->priv->main_group, "Cut", _tmp3_);
2004 #line 574 "fillmore.vala"
2005         if (gee_collection_get_size (GEE_COLLECTION (self->timeline->clipboard->clips)) != 0) {
2006 #line 574 "fillmore.vala"
2007                 _tmp4_ = is_stopped;
2008 #line 1926 "fillmore.c"
2009         } else {
2010 #line 574 "fillmore.vala"
2011                 _tmp4_ = FALSE;
2012 #line 1930 "fillmore.c"
2013         }
2014 #line 574 "fillmore.vala"
2015         recorder_set_sensitive_group (self, self->priv->main_group, "Paste", _tmp4_);
2016 #line 575 "fillmore.vala"
2017         if (selected) {
2018 #line 575 "fillmore.vala"
2019                 _tmp6_ = TRUE;
2020 #line 1938 "fillmore.c"
2021         } else {
2022 #line 575 "fillmore.vala"
2023                 _tmp6_ = library_selected;
2024 #line 1942 "fillmore.c"
2025         }
2026 #line 575 "fillmore.vala"
2027         if (_tmp6_) {
2028 #line 575 "fillmore.vala"
2029                 _tmp5_ = is_stopped;
2030 #line 1948 "fillmore.c"
2031         } else {
2032 #line 575 "fillmore.vala"
2033                 _tmp5_ = FALSE;
2034 #line 1952 "fillmore.c"
2035         }
2036 #line 575 "fillmore.vala"
2037         recorder_set_sensitive_group (self, self->priv->main_group, "Delete", _tmp5_);
2038 #line 577 "fillmore.vala"
2039         if (selected) {
2040 #line 577 "fillmore.vala"
2041                 _tmp8_ = playhead_on_clip;
2042 #line 1960 "fillmore.c"
2043         } else {
2044 #line 577 "fillmore.vala"
2045                 _tmp8_ = FALSE;
2046 #line 1964 "fillmore.c"
2047         }
2048 #line 577 "fillmore.vala"
2049         if (_tmp8_) {
2050 #line 577 "fillmore.vala"
2051                 _tmp7_ = is_stopped;
2052 #line 1970 "fillmore.c"
2053         } else {
2054 #line 577 "fillmore.vala"
2055                 _tmp7_ = FALSE;
2056 #line 1974 "fillmore.c"
2057         }
2058 #line 576 "fillmore.vala"
2059         recorder_set_sensitive_group (self, self->priv->main_group, "SplitAtPlayhead", _tmp7_);
2060 #line 579 "fillmore.vala"
2061         if (selected) {
2062 #line 579 "fillmore.vala"
2063                 _tmp10_ = playhead_on_clip;
2064 #line 1982 "fillmore.c"
2065         } else {
2066 #line 579 "fillmore.vala"
2067                 _tmp10_ = FALSE;
2068 #line 1986 "fillmore.c"
2069         }
2070 #line 579 "fillmore.vala"
2071         if (_tmp10_) {
2072 #line 579 "fillmore.vala"
2073                 _tmp9_ = is_stopped;
2074 #line 1992 "fillmore.c"
2075         } else {
2076 #line 579 "fillmore.vala"
2077                 _tmp9_ = FALSE;
2078 #line 1996 "fillmore.c"
2079         }
2080 #line 578 "fillmore.vala"
2081         recorder_set_sensitive_group (self, self->priv->main_group, "TrimToPlayhead", _tmp9_);
2082 #line 580 "fillmore.vala"
2083         recorder_set_sensitive_group (self, self->priv->main_group, "ClipProperties", one_selected);
2084 #line 583 "fillmore.vala"
2085         recorder_set_sensitive_group (self, self->priv->main_group, "ZoomProject", model_project_get_length (MODEL_PROJECT (self->project)) != 0);
2086 #line 586 "fillmore.vala"
2087         if (number_of_tracks > 0) {
2088 #line 586 "fillmore.vala"
2089                 _tmp11_ = is_stopped;
2090 #line 2008 "fillmore.c"
2091         } else {
2092 #line 586 "fillmore.vala"
2093                 _tmp11_ = FALSE;
2094 #line 2012 "fillmore.c"
2095         }
2096 #line 586 "fillmore.vala"
2097         recorder_set_sensitive_group (self, self->priv->main_group, "Rename", _tmp11_);
2098 #line 587 "fillmore.vala"
2099         if (number_of_tracks > 0) {
2100 #line 587 "fillmore.vala"
2101                 _tmp12_ = is_stopped;
2102 #line 2020 "fillmore.c"
2103         } else {
2104 #line 587 "fillmore.vala"
2105                 _tmp12_ = FALSE;
2106 #line 2024 "fillmore.c"
2107         }
2108 #line 587 "fillmore.vala"
2109         recorder_set_sensitive_group (self, self->priv->main_group, "DeleteTrack", _tmp12_);
2110 #line 588 "fillmore.vala"
2111         recorder_set_sensitive_group (self, self->priv->main_group, "NewTrack", is_stopped);
2112 #line 591 "fillmore.vala"
2113         recorder_set_sensitive_group (self, self->priv->main_group, "Play", TRUE);
2114 #line 592 "fillmore.vala"
2115         if (number_of_tracks > 0) {
2116 #line 592 "fillmore.vala"
2117                 _tmp13_ = is_stopped;
2118 #line 2036 "fillmore.c"
2119         } else {
2120 #line 592 "fillmore.vala"
2121                 _tmp13_ = FALSE;
2122 #line 2040 "fillmore.c"
2123         }
2124 #line 592 "fillmore.vala"
2125         recorder_set_sensitive_group (self, self->priv->main_group, "Record", _tmp13_);
2126 #line 2044 "fillmore.c"
2127 }
2128
2129
2130 #line 595 "fillmore.vala"
2131 ModelTrack* recorder_selected_track (Recorder* self) {
2132 #line 2050 "fillmore.c"
2133         ModelTrack* result = NULL;
2134 #line 595 "fillmore.vala"
2135         g_return_val_if_fail (IS_RECORDER (self), NULL);
2136 #line 2054 "fillmore.c"
2137         {
2138                 GeeIterator* _track_it;
2139                 _track_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (MODEL_PROJECT (self->project)->tracks));
2140 #line 596 "fillmore.vala"
2141                 while (TRUE) {
2142 #line 2060 "fillmore.c"
2143                         ModelTrack* track;
2144 #line 596 "fillmore.vala"
2145                         if (!gee_iterator_next (_track_it)) {
2146 #line 596 "fillmore.vala"
2147                                 break;
2148 #line 2066 "fillmore.c"
2149                         }
2150 #line 596 "fillmore.vala"
2151                         track = (ModelTrack*) gee_iterator_get (_track_it);
2152 #line 597 "fillmore.vala"
2153                         if (model_track_get_is_selected (track)) {
2154 #line 2072 "fillmore.c"
2155                                 result = track;
2156                                 _g_object_unref0 (_track_it);
2157 #line 598 "fillmore.vala"
2158                                 return result;
2159 #line 2077 "fillmore.c"
2160                         }
2161                         _g_object_unref0 (track);
2162                 }
2163                 _g_object_unref0 (_track_it);
2164         }
2165 #line 601 "fillmore.vala"
2166         g_error ("fillmore.vala:601: can't find selected track");
2167 #line 2085 "fillmore.c"
2168         result = NULL;
2169 #line 602 "fillmore.vala"
2170         return result;
2171 #line 2089 "fillmore.c"
2172 }
2173
2174
2175 #line 605 "fillmore.vala"
2176 void recorder_scroll_to_beginning (Recorder* self) {
2177 #line 605 "fillmore.vala"
2178         g_return_if_fail (IS_RECORDER (self));
2179 #line 606 "fillmore.vala"
2180         gtk_adjustment_set_value (self->priv->h_adjustment, 0.0);
2181 #line 2099 "fillmore.c"
2182 }
2183
2184
2185 #line 609 "fillmore.vala"
2186 void recorder_page_to_time (Recorder* self, gint64 time) {
2187 #line 2105 "fillmore.c"
2188         double location_in_window;
2189         gint window_width;
2190         gboolean _tmp0_ = FALSE;
2191 #line 609 "fillmore.vala"
2192         g_return_if_fail (IS_RECORDER (self));
2193 #line 610 "fillmore.vala"
2194         location_in_window = model_time_system_time_to_xpos (self->timeline->provider, time) - gtk_adjustment_get_value (self->priv->h_adjustment);
2195 #line 611 "fillmore.vala"
2196         window_width = GTK_WIDGET (gtk_widget_get_parent (GTK_WIDGET (self->timeline)))->allocation.width;
2197 #line 612 "fillmore.vala"
2198         if (location_in_window > (0.9 * window_width)) {
2199 #line 612 "fillmore.vala"
2200                 _tmp0_ = TRUE;
2201 #line 2119 "fillmore.c"
2202         } else {
2203 #line 613 "fillmore.vala"
2204                 _tmp0_ = location_in_window < (0.1 * window_width);
2205 #line 2123 "fillmore.c"
2206         }
2207 #line 612 "fillmore.vala"
2208         if (_tmp0_) {
2209 #line 614 "fillmore.vala"
2210                 recorder_scroll_to_time (self, time);
2211 #line 2129 "fillmore.c"
2212         }
2213 }
2214
2215
2216 #line 618 "fillmore.vala"
2217 void recorder_scroll_to_time (Recorder* self, gint64 time) {
2218 #line 2136 "fillmore.c"
2219         gint new_adjustment;
2220         gint window_width;
2221         gint max_value;
2222 #line 618 "fillmore.vala"
2223         g_return_if_fail (IS_RECORDER (self));
2224 #line 619 "fillmore.vala"
2225         new_adjustment = model_time_system_time_to_xpos (self->timeline->provider, time);
2226 #line 620 "fillmore.vala"
2227         window_width = GTK_WIDGET (gtk_widget_get_parent (GTK_WIDGET (self->timeline)))->allocation.width;
2228 #line 621 "fillmore.vala"
2229         if (new_adjustment < GTK_WIDGET (gtk_widget_get_parent (GTK_WIDGET (self->timeline)))->allocation.width) {
2230 #line 622 "fillmore.vala"
2231                 new_adjustment = 0;
2232 #line 2150 "fillmore.c"
2233         } else {
2234 #line 624 "fillmore.vala"
2235                 new_adjustment = new_adjustment - (window_width / 2);
2236 #line 2154 "fillmore.c"
2237         }
2238 #line 627 "fillmore.vala"
2239         max_value = (gint) (gtk_adjustment_get_upper (self->priv->h_adjustment) - GTK_WIDGET (self->priv->timeline_scrolled)->allocation.width);
2240 #line 628 "fillmore.vala"
2241         if (new_adjustment > max_value) {
2242 #line 629 "fillmore.vala"
2243                 new_adjustment = max_value;
2244 #line 2162 "fillmore.c"
2245         }
2246 #line 632 "fillmore.vala"
2247         gtk_adjustment_set_value (self->priv->h_adjustment, (double) new_adjustment);
2248 #line 2166 "fillmore.c"
2249 }
2250
2251
2252 #line 635 "fillmore.vala"
2253 void recorder_scroll_to_end (Recorder* self) {
2254 #line 635 "fillmore.vala"
2255         g_return_if_fail (IS_RECORDER (self));
2256 #line 636 "fillmore.vala"
2257         recorder_scroll_to_time (self, model_project_get_length (MODEL_PROJECT (self->project)));
2258 #line 2176 "fillmore.c"
2259 }
2260
2261
2262 #line 639 "fillmore.vala"
2263 static gint recorder_sgn (gint x) {
2264 #line 2182 "fillmore.c"
2265         gint result = 0;
2266         gint _tmp0_ = 0;
2267 #line 640 "fillmore.vala"
2268         if (x == 0) {
2269 #line 2187 "fillmore.c"
2270                 result = 0;
2271 #line 641 "fillmore.vala"
2272                 return result;
2273 #line 2191 "fillmore.c"
2274         }
2275 #line 642 "fillmore.vala"
2276         if (x < 0) {
2277 #line 642 "fillmore.vala"
2278                 _tmp0_ = -1;
2279 #line 2197 "fillmore.c"
2280         } else {
2281 #line 642 "fillmore.vala"
2282                 _tmp0_ = 1;
2283 #line 2201 "fillmore.c"
2284         }
2285         result = _tmp0_;
2286 #line 642 "fillmore.vala"
2287         return result;
2288 #line 2206 "fillmore.c"
2289 }
2290
2291
2292 #line 645 "fillmore.vala"
2293 void recorder_scroll_toward_center (Recorder* self, gint xpos) {
2294 #line 2212 "fillmore.c"
2295         gint page_size;
2296         gint diff;
2297         gint d;
2298         gint x;
2299         gint max_value;
2300 #line 645 "fillmore.vala"
2301         g_return_if_fail (IS_RECORDER (self));
2302 #line 646 "fillmore.vala"
2303         if (self->priv->cursor_pos == (-1)) {
2304 #line 647 "fillmore.vala"
2305                 self->priv->cursor_pos = xpos - ((gint) gtk_adjustment_get_value (self->priv->h_adjustment));
2306 #line 2224 "fillmore.c"
2307         }
2308 #line 652 "fillmore.vala"
2309         page_size = (gint) gtk_adjustment_get_page_size (self->priv->h_adjustment);
2310 #line 653 "fillmore.vala"
2311         diff = (page_size / 2) - self->priv->cursor_pos;
2312 #line 654 "fillmore.vala"
2313         d = recorder_sgn (diff) * ((gint) sqrt ((double) abs (diff)));
2314 #line 655 "fillmore.vala"
2315         self->priv->cursor_pos = self->priv->cursor_pos + d;
2316 #line 656 "fillmore.vala"
2317         x = MAX (0, xpos - self->priv->cursor_pos);
2318 #line 657 "fillmore.vala"
2319         max_value = (gint) (gtk_adjustment_get_upper (self->priv->h_adjustment) - GTK_WIDGET (self->priv->timeline_scrolled)->allocation.width);
2320 #line 658 "fillmore.vala"
2321         if (x > max_value) {
2322 #line 659 "fillmore.vala"
2323                 x = max_value;
2324 #line 2242 "fillmore.c"
2325         }
2326 #line 661 "fillmore.vala"
2327         gtk_adjustment_set_value (self->priv->h_adjustment, (double) x);
2328 #line 2246 "fillmore.c"
2329 }
2330
2331
2332 #line 664 "fillmore.vala"
2333 static gboolean recorder_real_key_press_event (GtkWidget* base, GdkEventKey* event) {
2334 #line 2252 "fillmore.c"
2335         Recorder * self;
2336         gboolean result = FALSE;
2337         self = RECORDER (base);
2338 #line 665 "fillmore.vala"
2339         switch ((*event).keyval) {
2340 #line 2258 "fillmore.c"
2341                 case GDK_KP_Enter:
2342                 case GDK_Return:
2343                 {
2344 #line 668 "fillmore.vala"
2345                         if (model_project_transport_is_recording (MODEL_PROJECT (self->project))) {
2346 #line 669 "fillmore.vala"
2347                                 break;
2348 #line 2266 "fillmore.c"
2349                         }
2350 #line 671 "fillmore.vala"
2351                         if (((*event).state & GDK_SHIFT_ALT_CONTROL_MASK) != 0) {
2352 #line 2270 "fillmore.c"
2353                                 result = GTK_WIDGET_CLASS (recorder_parent_class)->key_press_event (GTK_WIDGET (GTK_WINDOW (self)), event);
2354 #line 672 "fillmore.vala"
2355                                 return result;
2356 #line 2274 "fillmore.c"
2357                         }
2358 #line 673 "fillmore.vala"
2359                         recorder_on_rewind (self);
2360 #line 674 "fillmore.vala"
2361                         break;
2362 #line 2280 "fillmore.c"
2363                 }
2364                 case GDK_Left:
2365                 {
2366 #line 676 "fillmore.vala"
2367                         if (model_project_transport_is_recording (MODEL_PROJECT (self->project))) {
2368 #line 677 "fillmore.vala"
2369                                 break;
2370 #line 2288 "fillmore.c"
2371                         }
2372 #line 679 "fillmore.vala"
2373                         if (((*event).state & GDK_CONTROL_MASK) != 0) {
2374 #line 680 "fillmore.vala"
2375                                 model_project_go_previous (MODEL_PROJECT (self->project));
2376 #line 2294 "fillmore.c"
2377                         } else {
2378 #line 682 "fillmore.vala"
2379                                 view_media_engine_go (MODEL_PROJECT (self->project)->media_engine, model_project_transport_get_position (MODEL_PROJECT (self->project)) - GST_SECOND);
2380 #line 2298 "fillmore.c"
2381                         }
2382 #line 684 "fillmore.vala"
2383                         recorder_page_to_time (self, model_project_transport_get_position (MODEL_PROJECT (self->project)));
2384 #line 685 "fillmore.vala"
2385                         break;
2386 #line 2304 "fillmore.c"
2387                 }
2388                 case GDK_Right:
2389                 {
2390 #line 687 "fillmore.vala"
2391                         if (model_project_transport_is_recording (MODEL_PROJECT (self->project))) {
2392 #line 688 "fillmore.vala"
2393                                 break;
2394 #line 2312 "fillmore.c"
2395                         }
2396 #line 690 "fillmore.vala"
2397                         if (((*event).state & GDK_CONTROL_MASK) != 0) {
2398 #line 691 "fillmore.vala"
2399                                 model_project_go_next (MODEL_PROJECT (self->project));
2400 #line 2318 "fillmore.c"
2401                         } else {
2402 #line 693 "fillmore.vala"
2403                                 view_media_engine_go (MODEL_PROJECT (self->project)->media_engine, model_project_transport_get_position (MODEL_PROJECT (self->project)) + GST_SECOND);
2404 #line 2322 "fillmore.c"
2405                         }
2406 #line 695 "fillmore.vala"
2407                         recorder_page_to_time (self, model_project_transport_get_position (MODEL_PROJECT (self->project)));
2408 #line 696 "fillmore.vala"
2409                         break;
2410 #line 2328 "fillmore.c"
2411                 }
2412                 case GDK_KP_Add:
2413                 case GDK_equal:
2414                 case GDK_plus:
2415                 {
2416 #line 700 "fillmore.vala"
2417                         recorder_on_zoom_in (self);
2418 #line 701 "fillmore.vala"
2419                         break;
2420 #line 2338 "fillmore.c"
2421                 }
2422                 case GDK_KP_Subtract:
2423                 case GDK_minus:
2424                 case GDK_underscore:
2425                 {
2426 #line 705 "fillmore.vala"
2427                         recorder_on_zoom_out (self);
2428 #line 706 "fillmore.vala"
2429                         break;
2430 #line 2348 "fillmore.c"
2431                 }
2432                 default:
2433                 {
2434                         result = GTK_WIDGET_CLASS (recorder_parent_class)->key_press_event (GTK_WIDGET (GTK_WINDOW (self)), event);
2435 #line 708 "fillmore.vala"
2436                         return result;
2437 #line 2355 "fillmore.c"
2438                 }
2439         }
2440         result = TRUE;
2441 #line 710 "fillmore.vala"
2442         return result;
2443 #line 2361 "fillmore.c"
2444 }
2445
2446
2447 #line 714 "fillmore.vala"
2448 static void recorder_on_export (Recorder* self) {
2449 #line 2367 "fillmore.c"
2450         GError * _inner_error_;
2451         char* filename;
2452 #line 714 "fillmore.vala"
2453         g_return_if_fail (IS_RECORDER (self));
2454 #line 2372 "fillmore.c"
2455         _inner_error_ = NULL;
2456 #line 715 "fillmore.vala"
2457         filename = NULL;
2458 #line 716 "fillmore.vala"
2459         if (dialog_utils_save (GTK_WINDOW (self), "Export", FALSE, RECORDER_export_filters, G_N_ELEMENTS (RECORDER_export_filters), &filename)) {
2460 #line 2378 "fillmore.c"
2461                 {
2462                         MultiFileProgress* _tmp0_;
2463                         GstCaps* _tmp1_;
2464                         ViewOggVorbisExport* _tmp2_;
2465                         ViewOggVorbisExport* _tmp3_;
2466                         ViewOggVorbisExport* _tmp4_;
2467 #line 718 "fillmore.vala"
2468                         _tmp0_ = g_object_ref_sink (multi_file_progress_new (GTK_WINDOW (self), 1, "Export", MULTI_FILE_PROGRESS_INTERFACE (MODEL_PROJECT (self->project)->media_engine)));
2469 #line 2387 "fillmore.c"
2470                         _g_object_unref0 (_tmp0_);
2471 #line 719 "fillmore.vala"
2472                         view_media_engine_disconnect_output (MODEL_PROJECT (self->project)->media_engine, VIEW_MEDIA_CONNECTOR (self->priv->audio_output));
2473 #line 720 "fillmore.vala"
2474                         _tmp3_ = (_tmp2_ = view_ogg_vorbis_export_new (VIEW_MEDIA_CONNECTOR_MEDIA_TYPES_Audio, filename, _tmp1_ = view_media_engine_get_project_audio_export_caps (MODEL_PROJECT (self->project)->media_engine), &_inner_error_), _gst_caps_unref0 (_tmp1_), _tmp2_);
2475 #line 2393 "fillmore.c"
2476                         if (_inner_error_ != NULL) {
2477                                 goto __catch5_g_error;
2478                         }
2479 #line 720 "fillmore.vala"
2480                         self->priv->audio_export = (_tmp4_ = _tmp3_, _g_object_unref0 (self->priv->audio_export), _tmp4_);
2481 #line 722 "fillmore.vala"
2482                         view_media_engine_connect_output (MODEL_PROJECT (self->project)->media_engine, VIEW_MEDIA_CONNECTOR (self->priv->audio_export));
2483 #line 723 "fillmore.vala"
2484                         view_media_engine_start_export (MODEL_PROJECT (self->project)->media_engine, filename);
2485 #line 2403 "fillmore.c"
2486                 }
2487                 goto __finally5;
2488                 __catch5_g_error:
2489                 {
2490                         GError * e;
2491                         e = _inner_error_;
2492                         _inner_error_ = NULL;
2493                         {
2494 #line 725 "fillmore.vala"
2495                                 recorder_do_error_dialog ("Could not export file", e->message);
2496 #line 2414 "fillmore.c"
2497                                 _g_error_free0 (e);
2498                         }
2499                 }
2500                 __finally5:
2501                 if (_inner_error_ != NULL) {
2502                         _g_free0 (filename);
2503                         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);
2504                         g_clear_error (&_inner_error_);
2505                         return;
2506                 }
2507         }
2508         _g_free0 (filename);
2509 }
2510
2511
2512 #line 730 "fillmore.vala"
2513 static void recorder_on_post_export (Recorder* self, gboolean canceled) {
2514 #line 2432 "fillmore.c"
2515         ViewOggVorbisExport* _tmp1_;
2516 #line 730 "fillmore.vala"
2517         g_return_if_fail (IS_RECORDER (self));
2518 #line 731 "fillmore.vala"
2519         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_post_export");
2520 #line 732 "fillmore.vala"
2521         view_media_engine_disconnect_output (MODEL_PROJECT (self->project)->media_engine, VIEW_MEDIA_CONNECTOR (self->priv->audio_export));
2522 #line 733 "fillmore.vala"
2523         view_media_engine_connect_output (MODEL_PROJECT (self->project)->media_engine, VIEW_MEDIA_CONNECTOR (self->priv->audio_output));
2524 #line 735 "fillmore.vala"
2525         if (canceled) {
2526 #line 2444 "fillmore.c"
2527                 char* _tmp0_;
2528 #line 736 "fillmore.vala"
2529                 g_remove (_tmp0_ = view_ogg_vorbis_export_get_filename (self->priv->audio_export));
2530 #line 2448 "fillmore.c"
2531                 _g_free0 (_tmp0_);
2532         }
2533 #line 739 "fillmore.vala"
2534         self->priv->audio_export = (_tmp1_ = NULL, _g_object_unref0 (self->priv->audio_export), _tmp1_);
2535 #line 2453 "fillmore.c"
2536 }
2537
2538
2539 #line 742 "fillmore.vala"
2540 static void _recorder_on_project_new_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self) {
2541 #line 2459 "fillmore.c"
2542         recorder_on_project_new_finished_closing (self, project_did_close);
2543 }
2544
2545
2546 #line 742 "fillmore.vala"
2547 static void recorder_on_project_new_finished_closing (Recorder* self, gboolean project_did_close) {
2548 #line 2466 "fillmore.c"
2549         guint _tmp0_;
2550         guint _tmp1_;
2551 #line 742 "fillmore.vala"
2552         g_return_if_fail (IS_RECORDER (self));
2553 #line 743 "fillmore.vala"
2554         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_project_new_finished_closing");
2555 #line 744 "fillmore.vala"
2556         g_signal_parse_name ("closed", MODEL_TYPE_PROJECT, &_tmp0_, NULL, FALSE);
2557 #line 744 "fillmore.vala"
2558         g_signal_handlers_disconnect_matched (MODEL_PROJECT (self->project), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _recorder_on_project_close_model_project_closed, self);
2559 #line 745 "fillmore.vala"
2560         g_signal_parse_name ("finished-closing", TYPE_RECORDER, &_tmp1_, NULL, FALSE);
2561 #line 745 "fillmore.vala"
2562         g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _recorder_on_project_new_finished_closing_recorder_finished_closing, self);
2563 #line 746 "fillmore.vala"
2564         if (project_did_close) {
2565 #line 747 "fillmore.vala"
2566                 view_media_engine_set_play_state (MODEL_PROJECT (self->project)->media_engine, PLAY_STATE_LOADING);
2567 #line 748 "fillmore.vala"
2568                 model_project_load (MODEL_PROJECT (self->project), NULL);
2569 #line 749 "fillmore.vala"
2570                 recorder_default_track_set (self);
2571 #line 750 "fillmore.vala"
2572                 gst_element_set_state (GST_ELEMENT (MODEL_PROJECT (self->project)->media_engine->pipeline), GST_STATE_PAUSED);
2573 #line 751 "fillmore.vala"
2574                 model_undo_manager_reset (MODEL_PROJECT (self->project)->undo_manager);
2575 #line 2493 "fillmore.c"
2576         }
2577 }
2578
2579
2580 #line 755 "fillmore.vala"
2581 static void recorder_on_project_new (Recorder* self) {
2582 #line 755 "fillmore.vala"
2583         g_return_if_fail (IS_RECORDER (self));
2584 #line 756 "fillmore.vala"
2585         gee_abstract_collection_clear (GEE_ABSTRACT_COLLECTION (self->priv->load_errors));
2586 #line 757 "fillmore.vala"
2587         g_signal_connect_object (MODEL_PROJECT (self->project), "closed", (GCallback) _recorder_on_project_close_model_project_closed, self, 0);
2588 #line 758 "fillmore.vala"
2589         g_signal_connect_object (self, "finished-closing", (GCallback) _recorder_on_project_new_finished_closing_recorder_finished_closing, self, 0);
2590 #line 759 "fillmore.vala"
2591         model_project_close (MODEL_PROJECT (self->project));
2592 #line 2510 "fillmore.c"
2593 }
2594
2595
2596 #line 762 "fillmore.vala"
2597 static void _recorder_on_project_open_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self) {
2598 #line 2516 "fillmore.c"
2599         recorder_on_project_open_finished_closing (self, project_did_close);
2600 }
2601
2602
2603 static void _g_slist_free_g_free (GSList* self) {
2604         g_slist_foreach (self, (GFunc) g_free, NULL);
2605         g_slist_free (self);
2606 }
2607
2608
2609 #line 762 "fillmore.vala"
2610 static void recorder_on_project_open_finished_closing (Recorder* self, gboolean project_did_close) {
2611 #line 2529 "fillmore.c"
2612         guint _tmp0_;
2613         guint _tmp1_;
2614 #line 762 "fillmore.vala"
2615         g_return_if_fail (IS_RECORDER (self));
2616 #line 763 "fillmore.vala"
2617         g_signal_parse_name ("closed", MODEL_TYPE_PROJECT, &_tmp0_, NULL, FALSE);
2618 #line 763 "fillmore.vala"
2619         g_signal_handlers_disconnect_matched (MODEL_PROJECT (self->project), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _recorder_on_project_close_model_project_closed, self);
2620 #line 764 "fillmore.vala"
2621         g_signal_parse_name ("finished-closing", TYPE_RECORDER, &_tmp1_, NULL, FALSE);
2622 #line 764 "fillmore.vala"
2623         g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _recorder_on_project_open_finished_closing_recorder_finished_closing, self);
2624 #line 765 "fillmore.vala"
2625         if (project_did_close) {
2626 #line 2544 "fillmore.c"
2627                 GSList* filenames;
2628                 GSList* _tmp4_;
2629                 gboolean _tmp3_;
2630                 GSList* _tmp2_ = NULL;
2631                 filenames = NULL;
2632 #line 767 "fillmore.vala"
2633                 if ((_tmp3_ = dialog_utils_open (GTK_WINDOW (self), RECORDER_filters, G_N_ELEMENTS (RECORDER_filters), FALSE, FALSE, &_tmp2_), filenames = (_tmp4_ = _tmp2_, __g_slist_free_g_free0 (filenames), _tmp4_), _tmp3_)) {
2634 #line 768 "fillmore.vala"
2635                         self->priv->loading = TRUE;
2636 #line 769 "fillmore.vala"
2637                         model_project_load (MODEL_PROJECT (self->project), (const char*) filenames->data);
2638 #line 2556 "fillmore.c"
2639                 }
2640                 __g_slist_free_g_free0 (filenames);
2641         }
2642 }
2643
2644
2645 #line 774 "fillmore.vala"
2646 static void recorder_on_project_open (Recorder* self) {
2647 #line 774 "fillmore.vala"
2648         g_return_if_fail (IS_RECORDER (self));
2649 #line 775 "fillmore.vala"
2650         gee_abstract_collection_clear (GEE_ABSTRACT_COLLECTION (self->priv->load_errors));
2651 #line 776 "fillmore.vala"
2652         g_signal_connect_object (MODEL_PROJECT (self->project), "closed", (GCallback) _recorder_on_project_close_model_project_closed, self, 0);
2653 #line 777 "fillmore.vala"
2654         g_signal_connect_object (self, "finished-closing", (GCallback) _recorder_on_project_open_finished_closing_recorder_finished_closing, self, 0);
2655 #line 778 "fillmore.vala"
2656         model_project_close (MODEL_PROJECT (self->project));
2657 #line 2575 "fillmore.c"
2658 }
2659
2660
2661 #line 781 "fillmore.vala"
2662 static void recorder_on_project_save_as (Recorder* self) {
2663 #line 781 "fillmore.vala"
2664         g_return_if_fail (IS_RECORDER (self));
2665 #line 782 "fillmore.vala"
2666         recorder_save_dialog (self);
2667 #line 2585 "fillmore.c"
2668 }
2669
2670
2671 #line 785 "fillmore.vala"
2672 static void recorder_on_project_save (Recorder* self) {
2673 #line 785 "fillmore.vala"
2674         g_return_if_fail (IS_RECORDER (self));
2675 #line 786 "fillmore.vala"
2676         recorder_do_save (self);
2677 #line 2595 "fillmore.c"
2678 }
2679
2680
2681 #line 789 "fillmore.vala"
2682 static void _recorder_on_save_new_file_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self) {
2683 #line 2601 "fillmore.c"
2684         recorder_on_save_new_file_finished_closing (self, project_did_close);
2685 }
2686
2687
2688 #line 789 "fillmore.vala"
2689 static void recorder_on_save_new_file_finished_closing (Recorder* self, gboolean did_close) {
2690 #line 2608 "fillmore.c"
2691         guint _tmp0_;
2692         guint _tmp1_;
2693         char* _tmp2_;
2694 #line 789 "fillmore.vala"
2695         g_return_if_fail (IS_RECORDER (self));
2696 #line 790 "fillmore.vala"
2697         g_signal_parse_name ("closed", MODEL_TYPE_PROJECT, &_tmp0_, NULL, FALSE);
2698 #line 790 "fillmore.vala"
2699         g_signal_handlers_disconnect_matched (MODEL_PROJECT (self->project), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _recorder_on_project_close_model_project_closed, self);
2700 #line 791 "fillmore.vala"
2701         g_signal_parse_name ("finished-closing", TYPE_RECORDER, &_tmp1_, NULL, FALSE);
2702 #line 791 "fillmore.vala"
2703         g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _recorder_on_save_new_file_finished_closing_recorder_finished_closing, self);
2704 #line 792 "fillmore.vala"
2705         model_project_load (MODEL_PROJECT (self->project), _tmp2_ = model_project_get_project_file (MODEL_PROJECT (self->project)));
2706 #line 2624 "fillmore.c"
2707         _g_free0 (_tmp2_);
2708 }
2709
2710
2711 #line 795 "fillmore.vala"
2712 static gboolean recorder_do_save (Recorder* self) {
2713 #line 2631 "fillmore.c"
2714         gboolean result = FALSE;
2715         char* _tmp0_;
2716         gboolean _tmp1_;
2717 #line 795 "fillmore.vala"
2718         g_return_val_if_fail (IS_RECORDER (self), FALSE);
2719 #line 796 "fillmore.vala"
2720         if ((_tmp1_ = (_tmp0_ = model_project_get_project_file (MODEL_PROJECT (self->project))) != NULL, _g_free0 (_tmp0_), _tmp1_)) {
2721 #line 797 "fillmore.vala"
2722                 model_project_save (MODEL_PROJECT (self->project), NULL);
2723 #line 2641 "fillmore.c"
2724                 result = TRUE;
2725 #line 798 "fillmore.vala"
2726                 return result;
2727 #line 2645 "fillmore.c"
2728         } else {
2729                 result = recorder_save_dialog (self);
2730 #line 801 "fillmore.vala"
2731                 return result;
2732 #line 2650 "fillmore.c"
2733         }
2734 }
2735
2736
2737 #line 805 "fillmore.vala"
2738 static gboolean recorder_save_dialog (Recorder* self) {
2739 #line 2657 "fillmore.c"
2740         gboolean result = FALSE;
2741         char* _tmp0_;
2742         gboolean _tmp1_;
2743         gboolean saving_new_file;
2744         char* filename;
2745         char* _tmp2_;
2746         gboolean _tmp3_;
2747         gboolean create_directory;
2748 #line 805 "fillmore.vala"
2749         g_return_val_if_fail (IS_RECORDER (self), FALSE);
2750 #line 806 "fillmore.vala"
2751         saving_new_file = (_tmp1_ = (_tmp0_ = model_project_get_project_file (MODEL_PROJECT (self->project))) == NULL, _g_free0 (_tmp0_), _tmp1_);
2752 #line 808 "fillmore.vala"
2753         filename = model_project_get_project_file (MODEL_PROJECT (self->project));
2754 #line 809 "fillmore.vala"
2755         create_directory = (_tmp3_ = (_tmp2_ = model_project_get_project_file (MODEL_PROJECT (self->project))) == NULL, _g_free0 (_tmp2_), _tmp3_);
2756 #line 810 "fillmore.vala"
2757         if (dialog_utils_save (GTK_WINDOW (self), "Save Project", create_directory, RECORDER_filters, G_N_ELEMENTS (RECORDER_filters), &filename)) {
2758 #line 2676 "fillmore.c"
2759                 gboolean _tmp4_ = FALSE;
2760 #line 811 "fillmore.vala"
2761                 model_project_save (MODEL_PROJECT (self->project), filename);
2762 #line 812 "fillmore.vala"
2763                 if (saving_new_file) {
2764 #line 2682 "fillmore.c"
2765                         char* _tmp5_;
2766 #line 812 "fillmore.vala"
2767                         _tmp4_ = (_tmp5_ = model_project_get_project_file (MODEL_PROJECT (self->project))) != NULL;
2768 #line 2686 "fillmore.c"
2769                         _g_free0 (_tmp5_);
2770                 } else {
2771 #line 812 "fillmore.vala"
2772                         _tmp4_ = FALSE;
2773 #line 2691 "fillmore.c"
2774                 }
2775 #line 812 "fillmore.vala"
2776                 if (_tmp4_) {
2777 #line 813 "fillmore.vala"
2778                         g_signal_connect_object (MODEL_PROJECT (self->project), "closed", (GCallback) _recorder_on_project_close_model_project_closed, self, 0);
2779 #line 814 "fillmore.vala"
2780                         g_signal_connect_object (self, "finished-closing", (GCallback) _recorder_on_save_new_file_finished_closing_recorder_finished_closing, self, 0);
2781 #line 815 "fillmore.vala"
2782                         model_project_close (MODEL_PROJECT (self->project));
2783 #line 2701 "fillmore.c"
2784                 }
2785                 result = TRUE;
2786                 _g_free0 (filename);
2787 #line 817 "fillmore.vala"
2788                 return result;
2789 #line 2707 "fillmore.c"
2790         }
2791         result = FALSE;
2792         _g_free0 (filename);
2793 #line 819 "fillmore.vala"
2794         return result;
2795 #line 2713 "fillmore.c"
2796 }
2797
2798
2799 #line 822 "fillmore.vala"
2800 static void recorder_on_properties (Recorder* self) {
2801 #line 2719 "fillmore.c"
2802         GError * _inner_error_;
2803         GtkBuilder* builder;
2804         ProjectProperties* properties;
2805         gint response;
2806 #line 822 "fillmore.vala"
2807         g_return_if_fail (IS_RECORDER (self));
2808 #line 2726 "fillmore.c"
2809         _inner_error_ = NULL;
2810 #line 823 "fillmore.vala"
2811         builder = gtk_builder_new ();
2812 #line 2730 "fillmore.c"
2813         {
2814                 char* _tmp2_;
2815                 char* _tmp1_;
2816                 GFile* _tmp0_;
2817 #line 825 "fillmore.vala"
2818                 gtk_builder_add_from_file (builder, _tmp2_ = g_strconcat (_tmp1_ = g_file_get_path (_tmp0_ = app_dirs_get_exec_dir ()), "/resources/fillmore.glade", NULL), &_inner_error_);
2819 #line 2737 "fillmore.c"
2820                 _g_free0 (_tmp2_);
2821                 _g_free0 (_tmp1_);
2822                 _g_object_unref0 (_tmp0_);
2823                 if (_inner_error_ != NULL) {
2824                         goto __catch6_g_error;
2825                 }
2826         }
2827         goto __finally6;
2828         __catch6_g_error:
2829         {
2830                 GError * e;
2831                 e = _inner_error_;
2832                 _inner_error_ = NULL;
2833                 {
2834 #line 829 "fillmore.vala"
2835                         fprintf (stdout, "%s\n", e->message);
2836 #line 2754 "fillmore.c"
2837                         _g_error_free0 (e);
2838                         _g_object_unref0 (builder);
2839 #line 830 "fillmore.vala"
2840                         return;
2841 #line 2759 "fillmore.c"
2842                 }
2843         }
2844         __finally6:
2845         if (_inner_error_ != NULL) {
2846                 _g_object_unref0 (builder);
2847                 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);
2848                 g_clear_error (&_inner_error_);
2849                 return;
2850         }
2851 #line 832 "fillmore.vala"
2852         gtk_builder_connect_signals (builder, NULL);
2853 #line 833 "fillmore.vala"
2854         properties = _g_object_ref0 (PROJECT_PROPERTIES (gtk_builder_get_object (builder, "projectproperties1")));
2855 #line 834 "fillmore.vala"
2856         project_properties_setup (properties, MODEL_PROJECT (self->project), builder);
2857 #line 836 "fillmore.vala"
2858         response = gtk_dialog_run (GTK_DIALOG (properties));
2859 #line 837 "fillmore.vala"
2860         if (response == GTK_RESPONSE_APPLY) {
2861 #line 2779 "fillmore.c"
2862                 char* description;
2863                 Fraction _tmp4_;
2864                 Fraction _tmp3_ = {0};
2865 #line 838 "fillmore.vala"
2866                 description = g_strdup ("Set Project Properties");
2867 #line 839 "fillmore.vala"
2868                 model_undo_manager_start_transaction (MODEL_PROJECT (self->project)->undo_manager, description);
2869 #line 840 "fillmore.vala"
2870                 model_project_set_bpm (MODEL_PROJECT (self->project), project_properties_get_tempo (properties));
2871 #line 841 "fillmore.vala"
2872                 model_project_set_time_signature (MODEL_PROJECT (self->project), (_tmp4_ = (project_properties_get_time_signature (properties, &_tmp3_), _tmp3_), &_tmp4_));
2873 #line 842 "fillmore.vala"
2874                 MODEL_PROJECT (self->project)->click_during_record = project_properties_during_record (properties);
2875 #line 843 "fillmore.vala"
2876                 MODEL_PROJECT (self->project)->click_during_play = project_properties_during_play (properties);
2877 #line 844 "fillmore.vala"
2878                 MODEL_PROJECT (self->project)->click_volume = project_properties_get_click_volume (properties);
2879 #line 845 "fillmore.vala"
2880                 model_undo_manager_end_transaction (MODEL_PROJECT (self->project)->undo_manager, description);
2881 #line 2799 "fillmore.c"
2882                 _g_free0 (description);
2883         }
2884 #line 847 "fillmore.vala"
2885         gtk_object_destroy (GTK_OBJECT (properties));
2886 #line 2804 "fillmore.c"
2887         _g_object_unref0 (builder);
2888         _g_object_unref0 (properties);
2889 }
2890
2891
2892 #line 850 "fillmore.vala"
2893 static void _recorder_on_quit_finished_closing_recorder_finished_closing (Recorder* _sender, gboolean project_did_close, gpointer self) {
2894 #line 2812 "fillmore.c"
2895         recorder_on_quit_finished_closing (self, project_did_close);
2896 }
2897
2898
2899 #line 850 "fillmore.vala"
2900 static void recorder_on_quit_finished_closing (Recorder* self, gboolean project_did_close) {
2901 #line 2819 "fillmore.c"
2902         guint _tmp0_;
2903         guint _tmp1_;
2904 #line 850 "fillmore.vala"
2905         g_return_if_fail (IS_RECORDER (self));
2906 #line 851 "fillmore.vala"
2907         g_signal_parse_name ("closed", MODEL_TYPE_PROJECT, &_tmp0_, NULL, FALSE);
2908 #line 851 "fillmore.vala"
2909         g_signal_handlers_disconnect_matched (MODEL_PROJECT (self->project), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _recorder_on_project_close_model_project_closed, self);
2910 #line 852 "fillmore.vala"
2911         g_signal_parse_name ("finished-closing", TYPE_RECORDER, &_tmp1_, NULL, FALSE);
2912 #line 852 "fillmore.vala"
2913         g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _recorder_on_quit_finished_closing_recorder_finished_closing, self);
2914 #line 853 "fillmore.vala"
2915         if (project_did_close) {
2916 #line 854 "fillmore.vala"
2917                 gtk_main_quit ();
2918 #line 2836 "fillmore.c"
2919         }
2920 }
2921
2922
2923 #line 858 "fillmore.vala"
2924 static void recorder_on_quit (Recorder* self) {
2925 #line 858 "fillmore.vala"
2926         g_return_if_fail (IS_RECORDER (self));
2927 #line 859 "fillmore.vala"
2928         if (!model_project_transport_is_recording (MODEL_PROJECT (self->project))) {
2929 #line 860 "fillmore.vala"
2930                 g_signal_connect_object (MODEL_PROJECT (self->project), "closed", (GCallback) _recorder_on_project_close_model_project_closed, self, 0);
2931 #line 861 "fillmore.vala"
2932                 g_signal_connect_object (self, "finished-closing", (GCallback) _recorder_on_quit_finished_closing_recorder_finished_closing, self, 0);
2933 #line 862 "fillmore.vala"
2934                 model_project_close (MODEL_PROJECT (self->project));
2935 #line 2853 "fillmore.c"
2936         }
2937 }
2938
2939
2940 #line 866 "fillmore.vala"
2941 static gboolean recorder_on_delete_event (Recorder* self) {
2942 #line 2860 "fillmore.c"
2943         gboolean result = FALSE;
2944 #line 866 "fillmore.vala"
2945         g_return_val_if_fail (IS_RECORDER (self), FALSE);
2946 #line 867 "fillmore.vala"
2947         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_delete_event");
2948 #line 868 "fillmore.vala"
2949         recorder_on_quit (self);
2950 #line 2868 "fillmore.c"
2951         result = TRUE;
2952 #line 869 "fillmore.vala"
2953         return result;
2954 #line 2872 "fillmore.c"
2955 }
2956
2957
2958 #line 872 "fillmore.vala"
2959 static void recorder_on_project_close (Recorder* self) {
2960 #line 872 "fillmore.vala"
2961         g_return_if_fail (IS_RECORDER (self));
2962 #line 873 "fillmore.vala"
2963         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_project_close");
2964 #line 874 "fillmore.vala"
2965         if (model_undo_manager_get_is_dirty (MODEL_PROJECT (self->project)->undo_manager)) {
2966 #line 875 "fillmore.vala"
2967                 switch (dialog_utils_save_close_cancel (GTK_WINDOW (self), NULL, "Save changes before closing?")) {
2968 #line 2886 "fillmore.c"
2969                         case GTK_RESPONSE_ACCEPT:
2970                         {
2971 #line 877 "fillmore.vala"
2972                                 if (!recorder_do_save (self)) {
2973 #line 878 "fillmore.vala"
2974                                         g_signal_emit_by_name (self, "finished-closing", FALSE);
2975 #line 879 "fillmore.vala"
2976                                         return;
2977 #line 2895 "fillmore.c"
2978                                 }
2979 #line 881 "fillmore.vala"
2980                                 break;
2981 #line 2899 "fillmore.c"
2982                         }
2983                         case GTK_RESPONSE_NO:
2984                         {
2985                                 char* _tmp0_;
2986                                 gboolean _tmp1_;
2987 #line 884 "fillmore.vala"
2988                                 if ((_tmp1_ = (_tmp0_ = model_project_get_project_file (MODEL_PROJECT (self->project))) == NULL, _g_free0 (_tmp0_), _tmp1_)) {
2989 #line 885 "fillmore.vala"
2990                                         model_project_save (MODEL_PROJECT (self->project), NULL);
2991 #line 2909 "fillmore.c"
2992                                 }
2993 #line 887 "fillmore.vala"
2994                                 break;
2995 #line 2913 "fillmore.c"
2996                         }
2997                         case GTK_RESPONSE_DELETE_EVENT:
2998                         case GTK_RESPONSE_CANCEL:
2999                         {
3000 #line 890 "fillmore.vala"
3001                                 g_signal_emit_by_name (self, "finished-closing", FALSE);
3002 #line 891 "fillmore.vala"
3003                                 return;
3004 #line 2922 "fillmore.c"
3005                         }
3006                         default:
3007                         {
3008 #line 893 "fillmore.vala"
3009                                 g_assert (FALSE);
3010 #line 894 "fillmore.vala"
3011                                 break;
3012 #line 2930 "fillmore.c"
3013                         }
3014                 }
3015         }
3016 #line 897 "fillmore.vala"
3017         g_signal_emit_by_name (self, "finished-closing", TRUE);
3018 #line 2936 "fillmore.c"
3019 }
3020
3021
3022 #line 901 "fillmore.vala"
3023 static void recorder_on_cut (Recorder* self) {
3024 #line 901 "fillmore.vala"
3025         g_return_if_fail (IS_RECORDER (self));
3026 #line 902 "fillmore.vala"
3027         time_line_do_cut (self->timeline);
3028 #line 2946 "fillmore.c"
3029 }
3030
3031
3032 #line 905 "fillmore.vala"
3033 static void recorder_on_copy (Recorder* self) {
3034 #line 905 "fillmore.vala"
3035         g_return_if_fail (IS_RECORDER (self));
3036 #line 906 "fillmore.vala"
3037         time_line_do_copy (self->timeline);
3038 #line 2956 "fillmore.c"
3039 }
3040
3041
3042 #line 909 "fillmore.vala"
3043 static void recorder_on_paste (Recorder* self) {
3044 #line 909 "fillmore.vala"
3045         g_return_if_fail (IS_RECORDER (self));
3046 #line 910 "fillmore.vala"
3047         time_line_paste (self->timeline);
3048 #line 2966 "fillmore.c"
3049 }
3050
3051
3052 #line 913 "fillmore.vala"
3053 static void recorder_on_undo (Recorder* self) {
3054 #line 913 "fillmore.vala"
3055         g_return_if_fail (IS_RECORDER (self));
3056 #line 914 "fillmore.vala"
3057         model_project_undo (MODEL_PROJECT (self->project));
3058 #line 2976 "fillmore.c"
3059 }
3060
3061
3062 #line 917 "fillmore.vala"
3063 static void recorder_on_delete (Recorder* self) {
3064 #line 917 "fillmore.vala"
3065         g_return_if_fail (IS_RECORDER (self));
3066 #line 918 "fillmore.vala"
3067         if (clip_library_view_has_selection (self->priv->library)) {
3068 #line 919 "fillmore.vala"
3069                 clip_library_view_delete_selection (self->priv->library);
3070 #line 2988 "fillmore.c"
3071         } else {
3072 #line 921 "fillmore.vala"
3073                 time_line_delete_selection (self->timeline);
3074 #line 2992 "fillmore.c"
3075         }
3076 }
3077
3078
3079 #line 925 "fillmore.vala"
3080 static void recorder_on_select_all (Recorder* self) {
3081 #line 925 "fillmore.vala"
3082         g_return_if_fail (IS_RECORDER (self));
3083 #line 926 "fillmore.vala"
3084         if (clip_library_view_has_selection (self->priv->library)) {
3085 #line 927 "fillmore.vala"
3086                 clip_library_view_select_all (self->priv->library);
3087 #line 3005 "fillmore.c"
3088         } else {
3089 #line 929 "fillmore.vala"
3090                 time_line_select_all (self->timeline);
3091 #line 3009 "fillmore.c"
3092         }
3093 }
3094
3095
3096 #line 933 "fillmore.vala"
3097 void recorder_on_split_at_playhead (Recorder* self) {
3098 #line 933 "fillmore.vala"
3099         g_return_if_fail (IS_RECORDER (self));
3100 #line 934 "fillmore.vala"
3101         model_project_split_at_playhead (MODEL_PROJECT (self->project));
3102 #line 3020 "fillmore.c"
3103 }
3104
3105
3106 #line 937 "fillmore.vala"
3107 void recorder_on_trim_to_playhead (Recorder* self) {
3108 #line 937 "fillmore.vala"
3109         g_return_if_fail (IS_RECORDER (self));
3110 #line 938 "fillmore.vala"
3111         model_project_trim_to_playhead (MODEL_PROJECT (self->project));
3112 #line 3030 "fillmore.c"
3113 }
3114
3115
3116 #line 941 "fillmore.vala"
3117 void recorder_on_clip_properties (Recorder* self) {
3118 #line 941 "fillmore.vala"
3119         g_return_if_fail (IS_RECORDER (self));
3120 #line 942 "fillmore.vala"
3121         if (clip_library_view_has_selection (self->priv->library)) {
3122 #line 3040 "fillmore.c"
3123                 GeeArrayList* files;
3124 #line 943 "fillmore.vala"
3125                 files = clip_library_view_get_selected_files (self->priv->library);
3126 #line 944 "fillmore.vala"
3127                 if (gee_collection_get_size (GEE_COLLECTION (files)) == 1) {
3128 #line 3046 "fillmore.c"
3129                         char* file_name;
3130                         ModelClipFile* clip_file;
3131 #line 945 "fillmore.vala"
3132                         file_name = (char*) gee_abstract_list_get (GEE_ABSTRACT_LIST (files), 0);
3133 #line 946 "fillmore.vala"
3134                         clip_file = model_project_find_clipfile (MODEL_PROJECT (self->project), file_name);
3135 #line 947 "fillmore.vala"
3136                         dialog_utils_show_clip_properties (GTK_WINDOW (self), NULL, clip_file, NULL);
3137 #line 3055 "fillmore.c"
3138                         _g_free0 (file_name);
3139                         _g_object_unref0 (clip_file);
3140                 }
3141                 _g_object_unref0 (files);
3142         } else {
3143                 GeeArrayList* clips;
3144 #line 950 "fillmore.vala"
3145                 clips = _g_object_ref0 (self->timeline->selected_clips);
3146 #line 951 "fillmore.vala"
3147                 if (gee_collection_get_size (GEE_COLLECTION (clips)) == 1) {
3148 #line 3066 "fillmore.c"
3149                         ClipView* clip_view;
3150 #line 952 "fillmore.vala"
3151                         clip_view = (ClipView*) gee_abstract_list_get (GEE_ABSTRACT_LIST (clips), 0);
3152 #line 953 "fillmore.vala"
3153                         dialog_utils_show_clip_properties (GTK_WINDOW (self), clip_view, NULL, NULL);
3154 #line 3072 "fillmore.c"
3155                         _g_object_unref0 (clip_view);
3156                 }
3157                 _g_object_unref0 (clips);
3158         }
3159 }
3160
3161
3162 #line 960 "fillmore.vala"
3163 static void recorder_on_track_new (Recorder* self) {
3164 #line 3082 "fillmore.c"
3165         UITrackInformation* dialog;
3166         char* _tmp0_;
3167 #line 960 "fillmore.vala"
3168         g_return_if_fail (IS_RECORDER (self));
3169 #line 961 "fillmore.vala"
3170         dialog = g_object_ref_sink (ui_track_information_new ());
3171 #line 962 "fillmore.vala"
3172         ui_track_information_set_track_name (dialog, _tmp0_ = recorder_get_default_track_name (self));
3173 #line 3091 "fillmore.c"
3174         _g_free0 (_tmp0_);
3175 #line 963 "fillmore.vala"
3176         if (recorder_track_name_dialog (self, dialog, NULL)) {
3177 #line 3095 "fillmore.c"
3178                 ModelAudioTrack* _tmp2_;
3179                 char* _tmp1_;
3180 #line 964 "fillmore.vala"
3181                 model_project_add_track (MODEL_PROJECT (self->project), MODEL_TRACK (_tmp2_ = model_audio_track_new (MODEL_PROJECT (self->project), _tmp1_ = ui_track_information_get_track_name (dialog))));
3182 #line 3100 "fillmore.c"
3183                 _g_object_unref0 (_tmp2_);
3184                 _g_free0 (_tmp1_);
3185         }
3186 #line 966 "fillmore.vala"
3187         gtk_object_destroy (GTK_OBJECT (dialog));
3188 #line 3106 "fillmore.c"
3189         _g_object_unref0 (dialog);
3190 }
3191
3192
3193 #line 969 "fillmore.vala"
3194 static void recorder_on_track_rename (Recorder* self) {
3195 #line 3113 "fillmore.c"
3196         UITrackInformation* dialog;
3197         ModelTrack* track;
3198         ModelTrack* _tmp0_;
3199 #line 969 "fillmore.vala"
3200         g_return_if_fail (IS_RECORDER (self));
3201 #line 970 "fillmore.vala"
3202         dialog = g_object_ref_sink (ui_track_information_new ());
3203 #line 971 "fillmore.vala"
3204         track = recorder_selected_track (self);
3205 #line 972 "fillmore.vala"
3206         gtk_window_set_title (GTK_WINDOW (dialog), "Rename Track");
3207 #line 973 "fillmore.vala"
3208         ui_track_information_set_track_name (dialog, (_tmp0_ = recorder_selected_track (self))->display_name);
3209 #line 3127 "fillmore.c"
3210         _g_object_unref0 (_tmp0_);
3211 #line 974 "fillmore.vala"
3212         if (recorder_track_name_dialog (self, dialog, track)) {
3213 #line 3131 "fillmore.c"
3214                 char* _tmp1_;
3215 #line 975 "fillmore.vala"
3216                 model_track_set_display_name (track, _tmp1_ = ui_track_information_get_track_name (dialog));
3217 #line 3135 "fillmore.c"
3218                 _g_free0 (_tmp1_);
3219         }
3220 #line 977 "fillmore.vala"
3221         gtk_object_destroy (GTK_OBJECT (dialog));
3222 #line 3140 "fillmore.c"
3223         _g_object_unref0 (dialog);
3224         _g_object_unref0 (track);
3225 }
3226
3227
3228 #line 980 "fillmore.vala"
3229 static gboolean recorder_track_name_dialog (Recorder* self, UITrackInformation* dialog, ModelTrack* track) {
3230 #line 3148 "fillmore.c"
3231         gboolean result = FALSE;
3232         GtkResponseType _result_;
3233         gboolean is_ok;
3234         gboolean _tmp2_ = FALSE;
3235 #line 980 "fillmore.vala"
3236         g_return_val_if_fail (IS_RECORDER (self), FALSE);
3237 #line 980 "fillmore.vala"
3238         g_return_val_if_fail (UI_IS_TRACK_INFORMATION (dialog), FALSE);
3239 #line 980 "fillmore.vala"
3240         g_return_val_if_fail ((track == NULL) || MODEL_IS_TRACK (track), FALSE);
3241 #line 981 "fillmore.vala"
3242         _result_ = GTK_RESPONSE_OK;
3243 #line 982 "fillmore.vala"
3244         is_ok = TRUE;
3245 #line 3163 "fillmore.c"
3246         {
3247                 gboolean _tmp0_;
3248 #line 983 "fillmore.vala"
3249                 _tmp0_ = TRUE;
3250 #line 983 "fillmore.vala"
3251                 while (TRUE) {
3252 #line 3170 "fillmore.c"
3253                         char* new_name;
3254 #line 983 "fillmore.vala"
3255                         if (!_tmp0_) {
3256 #line 3174 "fillmore.c"
3257                                 gboolean _tmp1_ = FALSE;
3258 #line 999 "fillmore.vala"
3259                                 if (_result_ == GTK_RESPONSE_OK) {
3260 #line 999 "fillmore.vala"
3261                                         _tmp1_ = !is_ok;
3262 #line 3180 "fillmore.c"
3263                                 } else {
3264 #line 999 "fillmore.vala"
3265                                         _tmp1_ = FALSE;
3266 #line 3184 "fillmore.c"
3267                                 }
3268 #line 999 "fillmore.vala"
3269                                 if (!_tmp1_) {
3270 #line 999 "fillmore.vala"
3271                                         break;
3272 #line 3190 "fillmore.c"
3273                                 }
3274                         }
3275 #line 983 "fillmore.vala"
3276                         _tmp0_ = FALSE;
3277 #line 984 "fillmore.vala"
3278                         _result_ = (GtkResponseType) gtk_dialog_run (GTK_DIALOG (dialog));
3279 #line 985 "fillmore.vala"
3280                         new_name = ui_track_information_get_track_name (dialog);
3281 #line 987 "fillmore.vala"
3282                         if (_result_ == GTK_RESPONSE_OK) {
3283 #line 988 "fillmore.vala"
3284                                 if (_vala_strcmp0 (new_name, "") == 0) {
3285 #line 989 "fillmore.vala"
3286                                         is_ok = FALSE;
3287 #line 990 "fillmore.vala"
3288                                         dialog_utils_error ("Invalid track name.", "The track name cannot be empty.");
3289 #line 3207 "fillmore.c"
3290                                 } else {
3291 #line 992 "fillmore.vala"
3292                                         is_ok = !model_project_is_duplicate_track_name (MODEL_PROJECT (self->project), track, new_name);
3293 #line 993 "fillmore.vala"
3294                                         if (!is_ok) {
3295 #line 994 "fillmore.vala"
3296                                                 dialog_utils_error ("Duplicate track name.", "A track with this name already exists.");
3297 #line 3215 "fillmore.c"
3298                                         }
3299                                 }
3300                         }
3301                         _g_free0 (new_name);
3302                 }
3303         }
3304 #line 1000 "fillmore.vala"
3305         if (_result_ == GTK_RESPONSE_OK) {
3306 #line 1000 "fillmore.vala"
3307                 _tmp2_ = is_ok;
3308 #line 3226 "fillmore.c"
3309         } else {
3310 #line 1000 "fillmore.vala"
3311                 _tmp2_ = FALSE;
3312 #line 3230 "fillmore.c"
3313         }
3314         result = _tmp2_;
3315 #line 1000 "fillmore.vala"
3316         return result;
3317 #line 3235 "fillmore.c"
3318 }
3319
3320
3321 #line 1003 "fillmore.vala"
3322 static void recorder_on_track_remove (Recorder* self) {
3323 #line 3241 "fillmore.c"
3324         ModelTrack* _tmp0_;
3325 #line 1003 "fillmore.vala"
3326         g_return_if_fail (IS_RECORDER (self));
3327 #line 1004 "fillmore.vala"
3328         model_project_remove_track (MODEL_PROJECT (self->project), _tmp0_ = recorder_selected_track (self));
3329 #line 3247 "fillmore.c"
3330         _g_object_unref0 (_tmp0_);
3331 }
3332
3333
3334 #line 1008 "fillmore.vala"
3335 static void recorder_on_zoom_in (Recorder* self) {
3336 #line 1008 "fillmore.vala"
3337         g_return_if_fail (IS_RECORDER (self));
3338 #line 1009 "fillmore.vala"
3339         recorder_do_zoom (self, 0.1f);
3340 #line 3258 "fillmore.c"
3341 }
3342
3343
3344 #line 1012 "fillmore.vala"
3345 static void recorder_on_zoom_out (Recorder* self) {
3346 #line 1012 "fillmore.vala"
3347         g_return_if_fail (IS_RECORDER (self));
3348 #line 1013 "fillmore.vala"
3349         recorder_do_zoom (self, -0.1f);
3350 #line 3268 "fillmore.c"
3351 }
3352
3353
3354 #line 1016 "fillmore.vala"
3355 static void recorder_on_zoom_to_project (Recorder* self) {
3356 #line 1016 "fillmore.vala"
3357         g_return_if_fail (IS_RECORDER (self));
3358 #line 1017 "fillmore.vala"
3359         time_line_zoom_to_project (self->timeline, gtk_adjustment_get_page_size (self->priv->h_adjustment));
3360 #line 3278 "fillmore.c"
3361 }
3362
3363
3364 #line 1020 "fillmore.vala"
3365 static void recorder_on_snap (Recorder* self) {
3366 #line 1020 "fillmore.vala"
3367         g_return_if_fail (IS_RECORDER (self));
3368 #line 1021 "fillmore.vala"
3369         MODEL_PROJECT (self->project)->snap_to_clip = !MODEL_PROJECT (self->project)->snap_to_clip;
3370 #line 3288 "fillmore.c"
3371 }
3372
3373
3374 #line 1024 "fillmore.vala"
3375 static void recorder_on_view_library (Recorder* self) {
3376 #line 1024 "fillmore.vala"
3377         g_return_if_fail (IS_RECORDER (self));
3378 #line 1025 "fillmore.vala"
3379         if (GTK_PANED (self->priv->timeline_library_pane)->child2 == GTK_WIDGET (self->priv->library_scrolled)) {
3380 #line 1026 "fillmore.vala"
3381                 gtk_container_remove (GTK_CONTAINER (self->priv->timeline_library_pane), GTK_WIDGET (self->priv->library_scrolled));
3382 #line 1027 "fillmore.vala"
3383                 MODEL_PROJECT (self->project)->library_visible = FALSE;
3384 #line 3302 "fillmore.c"
3385         } else {
3386 #line 1029 "fillmore.vala"
3387                 gtk_paned_add2 (GTK_PANED (self->priv->timeline_library_pane), GTK_WIDGET (self->priv->library_scrolled));
3388 #line 1030 "fillmore.vala"
3389                 gtk_widget_show_all (GTK_WIDGET (self->priv->timeline_library_pane));
3390 #line 1031 "fillmore.vala"
3391                 MODEL_PROJECT (self->project)->library_visible = TRUE;
3392 #line 3310 "fillmore.c"
3393         }
3394 }
3395
3396
3397 #line 1035 "fillmore.vala"
3398 static void recorder_on_library_size_allocate (Recorder* self, GdkRectangle* rectangle) {
3399 #line 3317 "fillmore.c"
3400         gboolean _tmp0_ = FALSE;
3401 #line 1035 "fillmore.vala"
3402         g_return_if_fail (IS_RECORDER (self));
3403 #line 1036 "fillmore.vala"
3404         if (!self->priv->loading) {
3405 #line 1036 "fillmore.vala"
3406                 _tmp0_ = GTK_PANED (self->priv->timeline_library_pane)->child2 == GTK_WIDGET (self->priv->library_scrolled);
3407 #line 3325 "fillmore.c"
3408         } else {
3409 #line 1036 "fillmore.vala"
3410                 _tmp0_ = FALSE;
3411 #line 3329 "fillmore.c"
3412         }
3413 #line 1036 "fillmore.vala"
3414         if (_tmp0_) {
3415 #line 1037 "fillmore.vala"
3416                 MODEL_PROJECT (self->project)->library_width = (*rectangle).width;
3417 #line 3335 "fillmore.c"
3418         }
3419 }
3420
3421
3422 #line 1043 "fillmore.vala"
3423 static void recorder_on_help_contents (Recorder* self) {
3424 #line 3342 "fillmore.c"
3425         GError * _inner_error_;
3426 #line 1043 "fillmore.vala"
3427         g_return_if_fail (IS_RECORDER (self));
3428 #line 3346 "fillmore.c"
3429         _inner_error_ = NULL;
3430         {
3431 #line 1045 "fillmore.vala"
3432                 gtk_show_uri (NULL, "http://trac.yorba.org/wiki/UsingFillmore0.1", (guint32) 0, &_inner_error_);
3433 #line 3351 "fillmore.c"
3434                 if (_inner_error_ != NULL) {
3435                         goto __catch7_g_error;
3436                 }
3437         }
3438         goto __finally7;
3439         __catch7_g_error:
3440         {
3441                 GError * e;
3442                 e = _inner_error_;
3443                 _inner_error_ = NULL;
3444                 {
3445                         _g_error_free0 (e);
3446                 }
3447         }
3448         __finally7:
3449         if (_inner_error_ != NULL) {
3450                 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);
3451                 g_clear_error (&_inner_error_);
3452                 return;
3453         }
3454 }
3455
3456
3457 #line 1050 "fillmore.vala"
3458 static void recorder_on_about (Recorder* self) {
3459 #line 3377 "fillmore.c"
3460         char* _tmp1_;
3461         char* _tmp0_;
3462 #line 1050 "fillmore.vala"
3463         g_return_if_fail (IS_RECORDER (self));
3464 #line 1051 "fillmore.vala"
3465         gtk_show_about_dialog (GTK_WINDOW (self), "version", _tmp0_ = model_project_get_version (MODEL_PROJECT (self->project)), "comments", "An audio editor and recorder", "copyright", "Copyright 2009-2010 Yorba Foundation", "website", "http://www.yorba.org", "license", _tmp1_ = model_project_get_license (MODEL_PROJECT (self->project)), "website-label", "Visit the Yorba web site", "authors", MODEL_PROJECT_authors, NULL);
3466 #line 3384 "fillmore.c"
3467         _g_free0 (_tmp1_);
3468         _g_free0 (_tmp0_);
3469 }
3470
3471
3472 #line 1062 "fillmore.vala"
3473 static void recorder_on_save_graph (Recorder* self) {
3474 #line 1062 "fillmore.vala"
3475         g_return_if_fail (IS_RECORDER (self));
3476 #line 1063 "fillmore.vala"
3477         model_project_print_graph (MODEL_PROJECT (self->project), GST_BIN (MODEL_PROJECT (self->project)->media_engine->pipeline), "save_graph");
3478 #line 3396 "fillmore.c"
3479 }
3480
3481
3482 #line 1068 "fillmore.vala"
3483 static void recorder_on_volume (Recorder* self) {
3484 #line 1068 "fillmore.vala"
3485         g_return_if_fail (IS_RECORDER (self));
3486 #line 3404 "fillmore.c"
3487 }
3488
3489
3490 #line 1072 "fillmore.vala"
3491 static void recorder_on_rewind (Recorder* self) {
3492 #line 1072 "fillmore.vala"
3493         g_return_if_fail (IS_RECORDER (self));
3494 #line 1073 "fillmore.vala"
3495         view_media_engine_go (MODEL_PROJECT (self->project)->media_engine, (gint64) 0);
3496 #line 1074 "fillmore.vala"
3497         recorder_scroll_to_beginning (self);
3498 #line 3416 "fillmore.c"
3499 }
3500
3501
3502 #line 1077 "fillmore.vala"
3503 static void recorder_on_end (Recorder* self) {
3504 #line 1077 "fillmore.vala"
3505         g_return_if_fail (IS_RECORDER (self));
3506 #line 1078 "fillmore.vala"
3507         model_project_go_end (MODEL_PROJECT (self->project));
3508 #line 1079 "fillmore.vala"
3509         recorder_scroll_to_end (self);
3510 #line 3428 "fillmore.c"
3511 }
3512
3513
3514 #line 1082 "fillmore.vala"
3515 static void recorder_on_play (Recorder* self) {
3516 #line 1082 "fillmore.vala"
3517         g_return_if_fail (IS_RECORDER (self));
3518 #line 1083 "fillmore.vala"
3519         if (model_project_transport_is_recording (MODEL_PROJECT (self->project))) {
3520 #line 1084 "fillmore.vala"
3521                 recorder_set_sensitive_group (self, self->priv->main_group, "Record", TRUE);
3522 #line 1085 "fillmore.vala"
3523                 gtk_toggle_button_set_active (self->priv->record_button, FALSE);
3524 #line 1086 "fillmore.vala"
3525                 gtk_toggle_button_set_active (self->priv->play_button, FALSE);
3526 #line 1087 "fillmore.vala"
3527                 view_media_engine_pause (MODEL_PROJECT (self->project)->media_engine);
3528 #line 3446 "fillmore.c"
3529         } else {
3530 #line 1088 "fillmore.vala"
3531                 if (gtk_toggle_button_get_active (self->priv->play_button)) {
3532 #line 1089 "fillmore.vala"
3533                         view_media_engine_do_play (MODEL_PROJECT (self->project)->media_engine, PLAY_STATE_PLAYING);
3534 #line 3452 "fillmore.c"
3535                 } else {
3536 #line 1091 "fillmore.vala"
3537                         view_media_engine_pause (MODEL_PROJECT (self->project)->media_engine);
3538 #line 3456 "fillmore.c"
3539                 }
3540         }
3541 }
3542
3543
3544 #line 1094 "fillmore.vala"
3545 static void recorder_on_record (Recorder* self) {
3546 #line 1094 "fillmore.vala"
3547         g_return_if_fail (IS_RECORDER (self));
3548 #line 1095 "fillmore.vala"
3549         if (gtk_toggle_button_get_active (self->priv->record_button)) {
3550 #line 3468 "fillmore.c"
3551                 ModelTrack* _tmp0_;
3552                 ModelAudioTrack* audio_track;
3553                 gint number_of_channels = 0;
3554 #line 1096 "fillmore.vala"
3555                 audio_track = (_tmp0_ = recorder_selected_track (self), MODEL_IS_AUDIO_TRACK (_tmp0_) ? ((ModelAudioTrack*) _tmp0_) : NULL);
3556 #line 1098 "fillmore.vala"
3557                 if (model_audio_track_get_num_channels (audio_track, &number_of_channels)) {
3558 #line 1099 "fillmore.vala"
3559                         if (number_of_channels > CHANNELS_PER_TRACK_RECORD) {
3560 #line 1100 "fillmore.vala"
3561                                 gtk_toggle_button_set_active (self->priv->record_button, FALSE);
3562 #line 1101 "fillmore.vala"
3563                                 recorder_on_error_occurred (self, "Can not record onto a stereo track", NULL);
3564 #line 3482 "fillmore.c"
3565                                 _g_object_unref0 (audio_track);
3566 #line 1102 "fillmore.vala"
3567                                 return;
3568 #line 3486 "fillmore.c"
3569                         }
3570                 }
3571 #line 1105 "fillmore.vala"
3572                 recorder_set_sensitive_group (self, self->priv->main_group, "Record", FALSE);
3573 #line 1106 "fillmore.vala"
3574                 recorder_set_sensitive_group (self, self->priv->main_group, "Play", FALSE);
3575 #line 1107 "fillmore.vala"
3576                 model_audio_project_record (self->project, audio_track);
3577 #line 3495 "fillmore.c"
3578                 _g_object_unref0 (audio_track);
3579         } else {
3580 #line 1110 "fillmore.vala"
3581                 recorder_on_play (self);
3582 #line 3500 "fillmore.c"
3583         }
3584 }
3585
3586
3587 #line 1114 "fillmore.vala"
3588 static void recorder_on_callback_pulse (Recorder* self) {
3589 #line 1114 "fillmore.vala"
3590         g_return_if_fail (IS_RECORDER (self));
3591 #line 1115 "fillmore.vala"
3592         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_callback_pulse");
3593 #line 1116 "fillmore.vala"
3594         if (model_project_transport_is_playing (MODEL_PROJECT (self->project))) {
3595 #line 1117 "fillmore.vala"
3596                 recorder_scroll_toward_center (self, model_time_system_time_to_xpos (self->priv->provider, MODEL_PROJECT (self->project)->media_engine->position));
3597 #line 3515 "fillmore.c"
3598         }
3599 #line 1119 "fillmore.vala"
3600         gtk_widget_queue_draw (GTK_WIDGET (self->timeline));
3601 #line 3519 "fillmore.c"
3602 }
3603
3604
3605 #line 1122 "fillmore.vala"
3606 static gint64 recorder_get_zoom_center_time (Recorder* self) {
3607 #line 3525 "fillmore.c"
3608         gint64 result = 0LL;
3609 #line 1122 "fillmore.vala"
3610         g_return_val_if_fail (IS_RECORDER (self), 0LL);
3611 #line 3529 "fillmore.c"
3612         result = model_project_transport_get_position (MODEL_PROJECT (self->project));
3613 #line 1123 "fillmore.vala"
3614         return result;
3615 #line 3533 "fillmore.c"
3616 }
3617
3618
3619 #line 1126 "fillmore.vala"
3620 static void recorder_do_zoom (Recorder* self, float increment) {
3621 #line 1126 "fillmore.vala"
3622         g_return_if_fail (IS_RECORDER (self));
3623 #line 1127 "fillmore.vala"
3624         self->priv->center_time = recorder_get_zoom_center_time (self);
3625 #line 1128 "fillmore.vala"
3626         time_line_zoom (self->timeline, increment);
3627 #line 3545 "fillmore.c"
3628 }
3629
3630
3631 #line 1131 "fillmore.vala"
3632 static void recorder_on_timeline_size_allocate (Recorder* self, GdkRectangle* rectangle) {
3633 #line 1131 "fillmore.vala"
3634         g_return_if_fail (IS_RECORDER (self));
3635 #line 1132 "fillmore.vala"
3636         if (self->priv->center_time != (-1)) {
3637 #line 3555 "fillmore.c"
3638                 gint new_center_pixel;
3639                 gint page_size;
3640 #line 1133 "fillmore.vala"
3641                 new_center_pixel = model_time_system_time_to_xpos (self->priv->provider, self->priv->center_time);
3642 #line 1134 "fillmore.vala"
3643                 page_size = (gint) (gtk_adjustment_get_page_size (self->priv->h_adjustment) / 2);
3644 #line 1135 "fillmore.vala"
3645                 gtk_adjustment_clamp_page (self->priv->h_adjustment, (double) (new_center_pixel - page_size), (double) (new_center_pixel + page_size));
3646 #line 1136 "fillmore.vala"
3647                 self->priv->center_time = (gint64) (-1);
3648 #line 3566 "fillmore.c"
3649         }
3650 }
3651
3652
3653 #line 1140 "fillmore.vala"
3654 static void recorder_on_timeline_selection_changed (Recorder* self, gboolean selected) {
3655 #line 1140 "fillmore.vala"
3656         g_return_if_fail (IS_RECORDER (self));
3657 #line 1141 "fillmore.vala"
3658         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_timeline_selection_changed");
3659 #line 1142 "fillmore.vala"
3660         if (selected) {
3661 #line 1143 "fillmore.vala"
3662                 clip_library_view_unselect_all (self->priv->library);
3663 #line 3581 "fillmore.c"
3664         }
3665 #line 1145 "fillmore.vala"
3666         recorder_update_menu (self);
3667 #line 3585 "fillmore.c"
3668 }
3669
3670
3671 #line 1148 "fillmore.vala"
3672 void recorder_on_library_selection_changed (Recorder* self, gboolean selected) {
3673 #line 1148 "fillmore.vala"
3674         g_return_if_fail (IS_RECORDER (self));
3675 #line 1149 "fillmore.vala"
3676         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_library_selection_changed");
3677 #line 1150 "fillmore.vala"
3678         if (selected) {
3679 #line 1151 "fillmore.vala"
3680                 time_line_deselect_all_clips (self->timeline);
3681 #line 1152 "fillmore.vala"
3682                 gtk_widget_queue_draw (GTK_WIDGET (self->timeline));
3683 #line 3601 "fillmore.c"
3684         }
3685 #line 1154 "fillmore.vala"
3686         recorder_update_menu (self);
3687 #line 3605 "fillmore.c"
3688 }
3689
3690
3691 #line 1206 "fillmore.vala"
3692 void recorder_do_error_dialog (const char* major_message, const char* minor_message) {
3693 #line 1206 "fillmore.vala"
3694         g_return_if_fail (major_message != NULL);
3695 #line 1207 "fillmore.vala"
3696         dialog_utils_error (major_message, minor_message);
3697 #line 3615 "fillmore.c"
3698 }
3699
3700
3701 #line 1210 "fillmore.vala"
3702 void recorder_on_load_error (Recorder* self, const char* message) {
3703 #line 1210 "fillmore.vala"
3704         g_return_if_fail (IS_RECORDER (self));
3705 #line 1210 "fillmore.vala"
3706         g_return_if_fail (message != NULL);
3707 #line 1211 "fillmore.vala"
3708         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_load_error");
3709 #line 1212 "fillmore.vala"
3710         gee_abstract_collection_add (GEE_ABSTRACT_COLLECTION (self->priv->load_errors), message);
3711 #line 3629 "fillmore.c"
3712 }
3713
3714
3715 #line 1215 "fillmore.vala"
3716 void recorder_on_load_complete (Recorder* self) {
3717 #line 3635 "fillmore.c"
3718         GtkAction* _tmp0_;
3719         GtkToggleAction* action;
3720         GtkToggleAction* _tmp2_;
3721         GtkAction* _tmp1_;
3722 #line 1215 "fillmore.vala"
3723         g_return_if_fail (IS_RECORDER (self));
3724 #line 1216 "fillmore.vala"
3725         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_load_complete");
3726 #line 1217 "fillmore.vala"
3727         gst_element_set_state (GST_ELEMENT (MODEL_PROJECT (self->project)->media_engine->pipeline), GST_STATE_PAUSED);
3728 #line 1218 "fillmore.vala"
3729         gtk_paned_set_position (GTK_PANED (self->priv->timeline_library_pane), MODEL_PROJECT (self->project)->library_width);
3730 #line 1220 "fillmore.vala"
3731         action = _g_object_ref0 ((_tmp0_ = gtk_action_group_get_action (self->priv->main_group, "Library"), GTK_IS_TOGGLE_ACTION (_tmp0_) ? ((GtkToggleAction*) _tmp0_) : NULL));
3732 #line 1221 "fillmore.vala"
3733         if (gtk_toggle_action_get_active (action) != MODEL_PROJECT (self->project)->library_visible) {
3734 #line 1222 "fillmore.vala"
3735                 gtk_toggle_action_set_active (action, MODEL_PROJECT (self->project)->library_visible);
3736 #line 3654 "fillmore.c"
3737         }
3738 #line 1225 "fillmore.vala"
3739         action = (_tmp2_ = _g_object_ref0 ((_tmp1_ = gtk_action_group_get_action (self->priv->main_group, "Snap"), GTK_IS_TOGGLE_ACTION (_tmp1_) ? ((GtkToggleAction*) _tmp1_) : NULL)), _g_object_unref0 (action), _tmp2_);
3740 #line 1226 "fillmore.vala"
3741         if (gtk_toggle_action_get_active (action) != MODEL_PROJECT (self->project)->snap_to_clip) {
3742 #line 1227 "fillmore.vala"
3743                 gtk_toggle_action_set_active (action, MODEL_PROJECT (self->project)->snap_to_clip);
3744 #line 3662 "fillmore.c"
3745         }
3746 #line 1230 "fillmore.vala"
3747         if (MODEL_PROJECT (self->project)->library_visible) {
3748 #line 1231 "fillmore.vala"
3749                 if (GTK_PANED (self->priv->timeline_library_pane)->child2 != GTK_WIDGET (self->priv->library_scrolled)) {
3750 #line 1232 "fillmore.vala"
3751                         gtk_paned_add2 (GTK_PANED (self->priv->timeline_library_pane), GTK_WIDGET (self->priv->library_scrolled));
3752 #line 3670 "fillmore.c"
3753                 }
3754         } else {
3755 #line 1235 "fillmore.vala"
3756                 if (GTK_PANED (self->priv->timeline_library_pane)->child2 == GTK_WIDGET (self->priv->library_scrolled)) {
3757 #line 1236 "fillmore.vala"
3758                         gtk_container_remove (GTK_CONTAINER (self->priv->timeline_library_pane), GTK_WIDGET (self->priv->library_scrolled));
3759 #line 3677 "fillmore.c"
3760                 }
3761         }
3762 #line 1240 "fillmore.vala"
3763         if (gee_collection_get_size (GEE_COLLECTION (self->priv->load_errors)) > 0) {
3764 #line 3682 "fillmore.c"
3765                 char* message;
3766 #line 1241 "fillmore.vala"
3767                 message = g_strdup ("");
3768 #line 3686 "fillmore.c"
3769                 {
3770                         GeeIterator* _s_it;
3771                         _s_it = gee_abstract_collection_iterator (GEE_ABSTRACT_COLLECTION (self->priv->load_errors));
3772 #line 1242 "fillmore.vala"
3773                         while (TRUE) {
3774 #line 3692 "fillmore.c"
3775                                 char* s;
3776                                 char* _tmp4_;
3777                                 char* _tmp3_;
3778 #line 1242 "fillmore.vala"
3779                                 if (!gee_iterator_next (_s_it)) {
3780 #line 1242 "fillmore.vala"
3781                                         break;
3782 #line 3700 "fillmore.c"
3783                                 }
3784 #line 1242 "fillmore.vala"
3785                                 s = (char*) gee_iterator_get (_s_it);
3786 #line 1243 "fillmore.vala"
3787                                 message = (_tmp4_ = g_strconcat (_tmp3_ = g_strconcat (message, s, NULL), "\n", NULL), _g_free0 (message), _tmp4_);
3788 #line 3706 "fillmore.c"
3789                                 _g_free0 (_tmp3_);
3790                                 _g_free0 (s);
3791                         }
3792                         _g_object_unref0 (_s_it);
3793                 }
3794 #line 1245 "fillmore.vala"
3795                 recorder_do_error_dialog ("An error occurred loading the project.", message);
3796 #line 3714 "fillmore.c"
3797                 _g_free0 (message);
3798         }
3799 #line 1248 "fillmore.vala"
3800         self->priv->loading = FALSE;
3801 #line 3719 "fillmore.c"
3802         _g_object_unref0 (action);
3803 }
3804
3805
3806 #line 1251 "fillmore.vala"
3807 static void recorder_on_name_changed (Recorder* self) {
3808 #line 3726 "fillmore.c"
3809         char* _tmp0_;
3810 #line 1251 "fillmore.vala"
3811         g_return_if_fail (IS_RECORDER (self));
3812 #line 1252 "fillmore.vala"
3813         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_name_changed");
3814 #line 1253 "fillmore.vala"
3815         gtk_window_set_title (GTK_WINDOW (self), _tmp0_ = model_project_get_file_display_name (MODEL_PROJECT (self->project)));
3816 #line 3734 "fillmore.c"
3817         _g_free0 (_tmp0_);
3818 }
3819
3820
3821 #line 1256 "fillmore.vala"
3822 static void recorder_on_dirty_changed (Recorder* self, gboolean isDirty) {
3823 #line 3741 "fillmore.c"
3824         GtkMenuItem* file_save;
3825 #line 1256 "fillmore.vala"
3826         g_return_if_fail (IS_RECORDER (self));
3827 #line 1257 "fillmore.vala"
3828         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_dirty_changed");
3829 #line 1258 "fillmore.vala"
3830         file_save = GTK_MENU_ITEM (recorder_get_widget (self, self->priv->manager, "/MenuBar/ProjectMenu/Save"));
3831 #line 1259 "fillmore.vala"
3832         g_assert (file_save != NULL);
3833 #line 1260 "fillmore.vala"
3834         gtk_widget_set_sensitive (GTK_WIDGET (file_save), isDirty);
3835 #line 3753 "fillmore.c"
3836         _g_object_unref0 (file_save);
3837 }
3838
3839
3840 #line 1263 "fillmore.vala"
3841 static void recorder_on_undo_changed (Recorder* self, gboolean can_undo) {
3842 #line 3760 "fillmore.c"
3843         GtkMenuItem* undo;
3844         gboolean _tmp0_ = FALSE;
3845 #line 1263 "fillmore.vala"
3846         g_return_if_fail (IS_RECORDER (self));
3847 #line 1264 "fillmore.vala"
3848         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_undo_changed");
3849 #line 1265 "fillmore.vala"
3850         undo = GTK_MENU_ITEM (recorder_get_widget (self, self->priv->manager, "/MenuBar/EditMenu/EditUndo"));
3851 #line 1266 "fillmore.vala"
3852         g_assert (undo != NULL);
3853 #line 1268 "fillmore.vala"
3854         if (transport_delegate_is_stopped (TRANSPORT_DELEGATE (self))) {
3855 #line 1268 "fillmore.vala"
3856                 _tmp0_ = model_undo_manager_get_can_undo (MODEL_PROJECT (self->project)->undo_manager);
3857 #line 3775 "fillmore.c"
3858         } else {
3859 #line 1268 "fillmore.vala"
3860                 _tmp0_ = FALSE;
3861 #line 3779 "fillmore.c"
3862         }
3863 #line 1268 "fillmore.vala"
3864         recorder_set_sensitive_group (self, self->priv->main_group, "Undo", _tmp0_);
3865 #line 3783 "fillmore.c"
3866         _g_object_unref0 (undo);
3867 }
3868
3869
3870 #line 1271 "fillmore.vala"
3871 static void recorder_on_playstate_changed (Recorder* self, PlayState playstate) {
3872 #line 1271 "fillmore.vala"
3873         g_return_if_fail (IS_RECORDER (self));
3874 #line 1272 "fillmore.vala"
3875         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_playstate_changed");
3876 #line 1273 "fillmore.vala"
3877         if (playstate == PLAY_STATE_STOPPED) {
3878 #line 1274 "fillmore.vala"
3879                 self->priv->cursor_pos = -1;
3880 #line 1275 "fillmore.vala"
3881                 gtk_toggle_button_set_active (self->priv->play_button, FALSE);
3882 #line 1276 "fillmore.vala"
3883                 recorder_set_sensitive_group (self, self->priv->main_group, "Export", model_project_can_export (MODEL_PROJECT (self->project)));
3884 #line 1277 "fillmore.vala"
3885                 recorder_update_menu (self);
3886 #line 3804 "fillmore.c"
3887         }
3888 }
3889
3890
3891 #line 1281 "fillmore.vala"
3892 static void recorder_on_error_occurred (Recorder* self, const char* major_message, const char* minor_message) {
3893 #line 1281 "fillmore.vala"
3894         g_return_if_fail (IS_RECORDER (self));
3895 #line 1281 "fillmore.vala"
3896         g_return_if_fail (major_message != NULL);
3897 #line 1282 "fillmore.vala"
3898         logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_error_occurred");
3899 #line 1283 "fillmore.vala"
3900         dialog_utils_error (major_message, minor_message);
3901 #line 3819 "fillmore.c"
3902 }
3903
3904
3905 #line 1286 "fillmore.vala"
3906 static char* recorder_get_fillmore_directory (Recorder* self) {
3907 #line 3825 "fillmore.c"
3908         char* result = NULL;
3909 #line 1286 "fillmore.vala"
3910         g_return_val_if_fail (IS_RECORDER (self), NULL);
3911 #line 3829 "fillmore.c"
3912         result = g_build_filename (g_get_home_dir (), ".fillmore", NULL);
3913 #line 1287 "fillmore.vala"
3914         return result;
3915 #line 3833 "fillmore.c"
3916 }
3917
3918
3919 #line 1291 "fillmore.vala"
3920 static gboolean recorder_real_is_playing (TransportDelegate* base) {
3921 #line 3839 "fillmore.c"
3922         Recorder * self;
3923         gboolean result = FALSE;
3924         self = RECORDER (base);
3925         result = model_project_transport_is_playing (MODEL_PROJECT (self->project));
3926 #line 1292 "fillmore.vala"
3927         return result;
3928 #line 3846 "fillmore.c"
3929 }
3930
3931
3932 #line 1295 "fillmore.vala"
3933 static gboolean recorder_real_is_recording (TransportDelegate* base) {
3934 #line 3852 "fillmore.c"
3935         Recorder * self;
3936         gboolean result = FALSE;
3937         self = RECORDER (base);
3938         result = model_project_transport_is_recording (MODEL_PROJECT (self->project));
3939 #line 1296 "fillmore.vala"
3940         return result;
3941 #line 3859 "fillmore.c"
3942 }
3943
3944
3945 #line 1299 "fillmore.vala"
3946 static gboolean recorder_real_is_stopped (TransportDelegate* base) {
3947 #line 3865 "fillmore.c"
3948         Recorder * self;
3949         gboolean result = FALSE;
3950         gboolean _tmp0_ = FALSE;
3951         self = RECORDER (base);
3952 #line 1300 "fillmore.vala"
3953         if (transport_delegate_is_playing (TRANSPORT_DELEGATE (self))) {
3954 #line 1300 "fillmore.vala"
3955                 _tmp0_ = TRUE;
3956 #line 3874 "fillmore.c"
3957         } else {
3958 #line 1300 "fillmore.vala"
3959                 _tmp0_ = transport_delegate_is_recording (TRANSPORT_DELEGATE (self));
3960 #line 3878 "fillmore.c"
3961         }
3962         result = !_tmp0_;
3963 #line 1300 "fillmore.vala"
3964         return result;
3965 #line 3883 "fillmore.c"
3966 }
3967
3968
3969 static void recorder_class_init (RecorderClass * klass) {
3970         recorder_parent_class = g_type_class_peek_parent (klass);
3971         g_type_class_add_private (klass, sizeof (RecorderPrivate));
3972         GTK_WIDGET_CLASS (klass)->key_press_event = recorder_real_key_press_event;
3973         G_OBJECT_CLASS (klass)->finalize = recorder_finalize;
3974         g_signal_new ("finished_closing", TYPE_RECORDER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
3975 }
3976
3977
3978 static void recorder_transport_delegate_interface_init (TransportDelegateIface * iface) {
3979         recorder_transport_delegate_parent_iface = g_type_interface_peek_parent (iface);
3980         iface->is_playing = recorder_real_is_playing;
3981         iface->is_recording = recorder_real_is_recording;
3982         iface->is_stopped = recorder_real_is_stopped;
3983 }
3984
3985
3986 static void recorder_instance_init (Recorder * self) {
3987         self->priv = RECORDER_GET_PRIVATE (self);
3988         self->priv->cursor_pos = -1;
3989         self->priv->center_time = (gint64) (-1);
3990         self->priv->scrollwin_pos_y = 0;
3991 }
3992
3993
3994 static void recorder_finalize (GObject* obj) {
3995         Recorder * self;
3996         self = RECORDER (obj);
3997         _g_object_unref0 (self->project);
3998         _g_object_unref0 (self->timeline);
3999         _g_object_unref0 (self->priv->click_track);
4000         _g_object_unref0 (self->priv->header_area);
4001         _g_object_unref0 (self->priv->library);
4002         _g_object_unref0 (self->priv->provider);
4003         _g_object_unref0 (self->priv->h_adjustment);
4004         _g_object_unref0 (self->priv->timeline_library_pane);
4005         _g_object_unref0 (self->priv->library_scrolled);
4006         _g_object_unref0 (self->priv->timeline_scrolled);
4007         _g_object_unref0 (self->priv->main_group);
4008         _g_object_unref0 (self->priv->play_button);
4009         _g_object_unref0 (self->priv->record_button);
4010         _g_object_unref0 (self->priv->addnew_button);
4011         _g_object_unref0 (self->priv->rewind_button);
4012         _g_object_unref0 (self->priv->forward_button);
4013         _g_object_unref0 (self->priv->zoomin_button);
4014         _g_object_unref0 (self->priv->zoomout_button);
4015         _g_object_unref0 (self->priv->volume_button);
4016         _g_object_unref0 (self->priv->scrollwin);
4017         _g_object_unref0 (self->priv->manager);
4018         _g_object_unref0 (self->priv->audio_export);
4019         _g_object_unref0 (self->priv->audio_output);
4020         _g_object_unref0 (self->priv->load_errors);
4021         G_OBJECT_CLASS (recorder_parent_class)->finalize (obj);
4022 }
4023
4024
4025 GType recorder_get_type (void) {
4026         static volatile gsize recorder_type_id__volatile = 0;
4027         if (g_once_init_enter (&recorder_type_id__volatile)) {
4028                 static const GTypeInfo g_define_type_info = { sizeof (RecorderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) recorder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Recorder), 0, (GInstanceInitFunc) recorder_instance_init, NULL };
4029                 static const GInterfaceInfo transport_delegate_info = { (GInterfaceInitFunc) recorder_transport_delegate_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
4030                 GType recorder_type_id;
4031                 recorder_type_id = g_type_register_static (GTK_TYPE_WINDOW, "Recorder", &g_define_type_info, 0);
4032                 g_type_add_interface_static (recorder_type_id, TYPE_TRANSPORT_DELEGATE, &transport_delegate_info);
4033                 g_once_init_leave (&recorder_type_id__volatile, recorder_type_id);
4034         }
4035         return recorder_type_id__volatile;
4036 }
4037
4038
4039 #line 1307 "fillmore.vala"
4040 void fillmore_run (Fillmore* self, char** args, int args_length1) {
4041 #line 3959 "fillmore.c"
4042         GError * _inner_error_;
4043         GOptionContext* context;
4044 #line 1307 "fillmore.vala"
4045         g_return_if_fail (IS_FILLMORE (self));
4046 #line 3964 "fillmore.c"
4047         _inner_error_ = NULL;
4048 #line 1308 "fillmore.vala"
4049         debug_level = -1;
4050 #line 1309 "fillmore.vala"
4051         context = g_option_context_new (" [project file] - Record and edit multitrack audio");
4052 #line 1311 "fillmore.vala"
4053         g_option_context_add_main_entries (context, options, NULL);
4054 #line 1312 "fillmore.vala"
4055         g_option_context_add_group (context, gst_init_get_option_group ());
4056 #line 3974 "fillmore.c"
4057         {
4058 #line 1315 "fillmore.vala"
4059                 g_option_context_parse (context, &args_length1, &args, &_inner_error_);
4060 #line 3978 "fillmore.c"
4061                 if (_inner_error_ != NULL) {
4062                         goto __catch8_g_error;
4063                 }
4064         }
4065         goto __finally8;
4066         __catch8_g_error:
4067         {
4068                 GError * arg_error;
4069                 arg_error = _inner_error_;
4070                 _inner_error_ = NULL;
4071                 {
4072 #line 1317 "fillmore.vala"
4073                         fprintf (stderr, "%s\n" \
4074 "Run 'fillmore --help' for a full list of available command line option" \
4075 "s.", arg_error->message);
4076 #line 3992 "fillmore.c"
4077                         _g_error_free0 (arg_error);
4078                         _g_option_context_free0 (context);
4079 #line 1319 "fillmore.vala"
4080                         return;
4081 #line 3997 "fillmore.c"
4082                 }
4083         }
4084         __finally8:
4085         if (_inner_error_ != NULL) {
4086                 _g_option_context_free0 (context);
4087                 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);
4088                 g_clear_error (&_inner_error_);
4089                 return;
4090         }
4091         {
4092                 GFile* _tmp1_;
4093                 GFile* _tmp0_;
4094                 char* _tmp2_;
4095                 char* rc_file;
4096                 char* project_file;
4097                 FillmoreClassFactory* _tmp6_;
4098                 Recorder* recorder;
4099 #line 1323 "fillmore.vala"
4100                 g_set_application_name ("Fillmore");
4101 #line 1324 "fillmore.vala"
4102                 if (debug_level > (-1)) {
4103 #line 1325 "fillmore.vala"
4104                         logging_set_logging_level ((LoggingLevel) debug_level);
4105 #line 4021 "fillmore.c"
4106                 }
4107 #line 1328 "fillmore.vala"
4108                 app_dirs_init (args[0], _PROGRAM_NAME);
4109 #line 1329 "fillmore.vala"
4110                 rc_file = (_tmp2_ = g_file_get_path (_tmp1_ = g_file_get_child (_tmp0_ = app_dirs_get_resources_dir (), "fillmore.rc")), _g_object_unref0 (_tmp1_), _g_object_unref0 (_tmp0_), _tmp2_);
4111 #line 1331 "fillmore.vala"
4112                 gtk_rc_parse (rc_file);
4113 #line 1334 "fillmore.vala"
4114                 project_file = NULL;
4115 #line 1335 "fillmore.vala"
4116                 if (args_length1 > 1) {
4117 #line 4033 "fillmore.c"
4118                         char* _tmp3_;
4119 #line 1336 "fillmore.vala"
4120                         project_file = (_tmp3_ = g_strdup (args[1]), _g_free0 (project_file), _tmp3_);
4121 #line 4037 "fillmore.c"
4122                         {
4123                                 char* _tmp4_;
4124                                 char* _tmp5_;
4125 #line 1338 "fillmore.vala"
4126                                 _tmp4_ = g_filename_from_uri (project_file, NULL, &_inner_error_);
4127 #line 4043 "fillmore.c"
4128                                 if (_inner_error_ != NULL) {
4129                                         goto __catch10_g_error;
4130                                 }
4131 #line 1338 "fillmore.vala"
4132                                 project_file = (_tmp5_ = _tmp4_, _g_free0 (project_file), _tmp5_);
4133 #line 4049 "fillmore.c"
4134                         }
4135                         goto __finally10;
4136                         __catch10_g_error:
4137                         {
4138                                 GError * e;
4139                                 e = _inner_error_;
4140                                 _inner_error_ = NULL;
4141                                 {
4142                                         _g_error_free0 (e);
4143                                 }
4144                         }
4145                         __finally10:
4146                         if (_inner_error_ != NULL) {
4147                                 _g_free0 (rc_file);
4148                                 _g_free0 (project_file);
4149                                 goto __catch9_g_error;
4150                         }
4151                 }
4152 #line 1342 "fillmore.vala"
4153                 class_factory_set_class_factory (CLASS_FACTORY (_tmp6_ = fillmore_class_factory_new ()));
4154 #line 4070 "fillmore.c"
4155                 _class_factory_unref0 (_tmp6_);
4156 #line 1343 "fillmore.vala"
4157                 view_media_engine_can_run (&_inner_error_);
4158 #line 4074 "fillmore.c"
4159                 if (_inner_error_ != NULL) {
4160                         _g_free0 (rc_file);
4161                         _g_free0 (project_file);
4162                         goto __catch9_g_error;
4163                 }
4164 #line 1345 "fillmore.vala"
4165                 recorder = g_object_ref_sink (recorder_new (project_file, &_inner_error_));
4166 #line 4082 "fillmore.c"
4167                 if (_inner_error_ != NULL) {
4168                         _g_free0 (rc_file);
4169                         _g_free0 (project_file);
4170                         goto __catch9_g_error;
4171                 }
4172 #line 1346 "fillmore.vala"
4173                 gtk_widget_show_all (GTK_WIDGET (recorder));
4174 #line 1347 "fillmore.vala"
4175                 gtk_main ();
4176 #line 4092 "fillmore.c"
4177                 _g_free0 (rc_file);
4178                 _g_free0 (project_file);
4179                 _g_object_unref0 (recorder);
4180         }
4181         goto __finally9;
4182         __catch9_g_error:
4183         {
4184                 GError * e;
4185                 e = _inner_error_;
4186                 _inner_error_ = NULL;
4187                 {
4188 #line 1349 "fillmore.vala"
4189                         recorder_do_error_dialog ("Could not start application.", e->message);
4190 #line 4106 "fillmore.c"
4191                         _g_error_free0 (e);
4192                 }
4193         }
4194         __finally9:
4195         if (_inner_error_ != NULL) {
4196                 _g_option_context_free0 (context);
4197                 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);
4198                 g_clear_error (&_inner_error_);
4199                 return;
4200         }
4201         _g_option_context_free0 (context);
4202 }
4203
4204
4205 #line 1304 "fillmore.vala"
4206 Fillmore* fillmore_construct (GType object_type) {
4207 #line 4123 "fillmore.c"
4208         Fillmore * self;
4209         self = g_object_newv (object_type, 0, NULL);
4210         return self;
4211 }
4212
4213
4214 #line 1304 "fillmore.vala"
4215 Fillmore* fillmore_new (void) {
4216 #line 1304 "fillmore.vala"
4217         return fillmore_construct (TYPE_FILLMORE);
4218 #line 4134 "fillmore.c"
4219 }
4220
4221
4222 static GObject * fillmore_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
4223         GObject * obj;
4224         GObjectClass * parent_class;
4225         Fillmore * self;
4226         parent_class = G_OBJECT_CLASS (fillmore_parent_class);
4227         obj = parent_class->constructor (type, n_construct_properties, construct_properties);
4228         self = FILLMORE (obj);
4229         {
4230         }
4231         return obj;
4232 }
4233
4234
4235 static void fillmore_class_init (FillmoreClass * klass) {
4236         fillmore_parent_class = g_type_class_peek_parent (klass);
4237         G_OBJECT_CLASS (klass)->constructor = fillmore_constructor;
4238 }
4239
4240
4241 static void fillmore_instance_init (Fillmore * self) {
4242 }
4243
4244
4245 GType fillmore_get_type (void) {
4246         static volatile gsize fillmore_type_id__volatile = 0;
4247         if (g_once_init_enter (&fillmore_type_id__volatile)) {
4248                 static const GTypeInfo g_define_type_info = { sizeof (FillmoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fillmore_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Fillmore), 0, (GInstanceInitFunc) fillmore_instance_init, NULL };
4249                 GType fillmore_type_id;
4250                 fillmore_type_id = g_type_register_static (HILDON_TYPE_PROGRAM, "Fillmore", &g_define_type_info, 0);
4251                 g_once_init_leave (&fillmore_type_id__volatile, fillmore_type_id);
4252         }
4253         return fillmore_type_id__volatile;
4254 }
4255
4256
4257 #line 1354 "fillmore.vala"
4258 gint _vala_main (char** args, int args_length1) {
4259 #line 4175 "fillmore.c"
4260         gint result = 0;
4261         Fillmore* fillmore;
4262 #line 1355 "fillmore.vala"
4263         gtk_init (&args_length1, &args);
4264 #line 1356 "fillmore.vala"
4265         gst_init (&args_length1, &args);
4266 #line 1357 "fillmore.vala"
4267         fillmore = fillmore_new ();
4268 #line 1358 "fillmore.vala"
4269         fillmore_run (fillmore, args, args_length1);
4270 #line 4186 "fillmore.c"
4271         result = 0;
4272         _g_object_unref0 (fillmore);
4273 #line 1359 "fillmore.vala"
4274         return result;
4275 #line 4191 "fillmore.c"
4276 }
4277
4278
4279 #line 1354 "fillmore.vala"
4280 int main (int argc, char ** argv) {
4281 #line 4197 "fillmore.c"
4282         g_thread_init (NULL);
4283 #line 1354 "fillmore.vala"
4284         g_type_init ();
4285 #line 1354 "fillmore.vala"
4286         return _vala_main (argv, argc);
4287 #line 4203 "fillmore.c"
4288 }
4289
4290
4291 #line 1362 "fillmore.vala"
4292 void NO_main (char** args, int args_length1) {
4293 #line 4209 "fillmore.c"
4294         GError * _inner_error_;
4295         GOptionContext* context;
4296         _inner_error_ = NULL;
4297 #line 1363 "fillmore.vala"
4298         hildon_gtk_init (&args_length1, &args);
4299 #line 1364 "fillmore.vala"
4300         debug_level = -1;
4301 #line 1365 "fillmore.vala"
4302         context = g_option_context_new (" [project file] - Record and edit multitrack audio");
4303 #line 1367 "fillmore.vala"
4304         g_option_context_add_main_entries (context, options, NULL);
4305 #line 1368 "fillmore.vala"
4306         g_option_context_add_group (context, gst_init_get_option_group ());
4307 #line 4223 "fillmore.c"
4308         {
4309 #line 1371 "fillmore.vala"
4310                 g_option_context_parse (context, &args_length1, &args, &_inner_error_);
4311 #line 4227 "fillmore.c"
4312                 if (_inner_error_ != NULL) {
4313                         goto __catch11_g_error;
4314                 }
4315         }
4316         goto __finally11;
4317         __catch11_g_error:
4318         {
4319                 GError * arg_error;
4320                 arg_error = _inner_error_;
4321                 _inner_error_ = NULL;
4322                 {
4323 #line 1373 "fillmore.vala"
4324                         fprintf (stderr, "%s\n" \
4325 "Run 'fillmore --help' for a full list of available command line option" \
4326 "s.", arg_error->message);
4327 #line 4241 "fillmore.c"
4328                         _g_error_free0 (arg_error);
4329                         _g_option_context_free0 (context);
4330 #line 1375 "fillmore.vala"
4331                         return;
4332 #line 4246 "fillmore.c"
4333                 }
4334         }
4335         __finally11:
4336         if (_inner_error_ != NULL) {
4337                 _g_option_context_free0 (context);
4338                 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);
4339                 g_clear_error (&_inner_error_);
4340                 return;
4341         }
4342 #line 1377 "fillmore.vala"
4343         gtk_init (&args_length1, &args);
4344 #line 4258 "fillmore.c"
4345         {
4346                 GFile* _tmp1_;
4347                 GFile* _tmp0_;
4348                 char* _tmp2_;
4349                 char* rc_file;
4350                 char* project_file;
4351                 FillmoreClassFactory* _tmp6_;
4352                 Recorder* recorder;
4353 #line 1379 "fillmore.vala"
4354                 g_set_application_name ("Fillmore");
4355 #line 1380 "fillmore.vala"
4356                 if (debug_level > (-1)) {
4357 #line 1381 "fillmore.vala"
4358                         logging_set_logging_level ((LoggingLevel) debug_level);
4359 #line 4273 "fillmore.c"
4360                 }
4361 #line 1384 "fillmore.vala"
4362                 app_dirs_init (args[0], _PROGRAM_NAME);
4363 #line 1385 "fillmore.vala"
4364                 rc_file = (_tmp2_ = g_file_get_path (_tmp1_ = g_file_get_child (_tmp0_ = app_dirs_get_resources_dir (), "fillmore.rc")), _g_object_unref0 (_tmp1_), _g_object_unref0 (_tmp0_), _tmp2_);
4365 #line 1387 "fillmore.vala"
4366                 gtk_rc_parse (rc_file);
4367 #line 1388 "fillmore.vala"
4368                 gst_init (&args_length1, &args);
4369 #line 1390 "fillmore.vala"
4370                 project_file = NULL;
4371 #line 1391 "fillmore.vala"
4372                 if (args_length1 > 1) {
4373 #line 4287 "fillmore.c"
4374                         char* _tmp3_;
4375 #line 1392 "fillmore.vala"
4376                         project_file = (_tmp3_ = g_strdup (args[1]), _g_free0 (project_file), _tmp3_);
4377 #line 4291 "fillmore.c"
4378                         {
4379                                 char* _tmp4_;
4380                                 char* _tmp5_;
4381 #line 1394 "fillmore.vala"
4382                                 _tmp4_ = g_filename_from_uri (project_file, NULL, &_inner_error_);
4383 #line 4297 "fillmore.c"
4384                                 if (_inner_error_ != NULL) {
4385                                         goto __catch13_g_error;
4386                                 }
4387 #line 1394 "fillmore.vala"
4388                                 project_file = (_tmp5_ = _tmp4_, _g_free0 (project_file), _tmp5_);
4389 #line 4303 "fillmore.c"
4390                         }
4391                         goto __finally13;
4392                         __catch13_g_error:
4393                         {
4394                                 GError * e;
4395                                 e = _inner_error_;
4396                                 _inner_error_ = NULL;
4397                                 {
4398                                         _g_error_free0 (e);
4399                                 }
4400                         }
4401                         __finally13:
4402                         if (_inner_error_ != NULL) {
4403                                 _g_free0 (rc_file);
4404                                 _g_free0 (project_file);
4405                                 goto __catch12_g_error;
4406                         }
4407                 }
4408 #line 1398 "fillmore.vala"
4409                 class_factory_set_class_factory (CLASS_FACTORY (_tmp6_ = fillmore_class_factory_new ()));
4410 #line 4324 "fillmore.c"
4411                 _class_factory_unref0 (_tmp6_);
4412 #line 1399 "fillmore.vala"
4413                 view_media_engine_can_run (&_inner_error_);
4414 #line 4328 "fillmore.c"
4415                 if (_inner_error_ != NULL) {
4416                         _g_free0 (rc_file);
4417                         _g_free0 (project_file);
4418                         goto __catch12_g_error;
4419                 }
4420 #line 1401 "fillmore.vala"
4421                 recorder = g_object_ref_sink (recorder_new (project_file, &_inner_error_));
4422 #line 4336 "fillmore.c"
4423                 if (_inner_error_ != NULL) {
4424                         _g_free0 (rc_file);
4425                         _g_free0 (project_file);
4426                         goto __catch12_g_error;
4427                 }
4428 #line 1402 "fillmore.vala"
4429                 gtk_widget_show_all (GTK_WIDGET (recorder));
4430 #line 1403 "fillmore.vala"
4431                 gtk_main ();
4432 #line 4346 "fillmore.c"
4433                 _g_free0 (rc_file);
4434                 _g_free0 (project_file);
4435                 _g_object_unref0 (recorder);
4436         }
4437         goto __finally12;
4438         __catch12_g_error:
4439         {
4440                 GError * e;
4441                 e = _inner_error_;
4442                 _inner_error_ = NULL;
4443                 {
4444 #line 1405 "fillmore.vala"
4445                         recorder_do_error_dialog ("Could not start application.", e->message);
4446 #line 4360 "fillmore.c"
4447                         _g_error_free0 (e);
4448                 }
4449         }
4450         __finally12:
4451         if (_inner_error_ != NULL) {
4452                 _g_option_context_free0 (context);
4453                 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);
4454                 g_clear_error (&_inner_error_);
4455                 return;
4456         }
4457         _g_option_context_free0 (context);
4458 }
4459
4460
4461 static int _vala_strcmp0 (const char * str1, const char * str2) {
4462         if (str1 == NULL) {
4463                 return -(str1 != str2);
4464         }
4465         if (str2 == NULL) {
4466                 return str1 != str2;
4467         }
4468         return strcmp (str1, str2);
4469 }
4470
4471
4472
4473