void new_activate_cb (GtkMenuItem * item, App * app);
void open_activate_cb (GtkMenuItem * item, App * app);
void save_as_activate_cb (GtkMenuItem * item, App * app);
+void launch_pitivi_project_activate_cb (GtkMenuItem * item, App * app);
void quit_item_activate_cb (GtkMenuItem * item, App * app);
void delete_activate_cb (GtkAction * item, App * app);
void play_activate_cb (GtkAction * item, App * app);
gtk_widget_set_sensitive (app->properties, !playing_or_paused);
}
+static void
+project_bus_message_cb (GstBus * bus, GstMessage * message,
+ GMainLoop * mainloop)
+{
+ switch (GST_MESSAGE_TYPE (message)) {
+ case GST_MESSAGE_ERROR:
+ g_printerr ("ERROR\n");
+ g_main_loop_quit (mainloop);
+ break;
+ case GST_MESSAGE_EOS:
+ g_printerr ("Done\n");
+ g_main_loop_quit (mainloop);
+ break;
+ default:
+ break;
+ }
+}
+
static void
bus_message_cb (GstBus * bus, GstMessage * message, App * app)
{
obj, -1);
}
+static void
+app_launch_project (App * app, gchar * uri)
+{
+ GESTimeline *timeline;
+ GMainLoop *mainloop;
+ GESTimelinePipeline *pipeline;
+ GstBus *bus;
+ GESFormatter *formatter;
+
+ uri = g_strsplit (uri, "//", 2)[1];
+ printf ("we will launch this uri : %s\n", uri);
+ formatter = GES_FORMATTER (ges_pitivi_formatter_new ());
+ timeline = ges_timeline_new ();
+ pipeline = ges_timeline_pipeline_new ();
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ mainloop = g_main_loop_new (NULL, FALSE);
+
+ ges_timeline_pipeline_add_timeline (pipeline, timeline);
+ ges_formatter_load_from_uri (formatter, timeline, uri);
+ ges_timeline_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW_VIDEO);
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+ gst_bus_add_signal_watch (bus);
+ g_signal_connect (bus, "message", G_CALLBACK (project_bus_message_cb),
+ mainloop);
+ g_main_loop_run (mainloop);
+}
+
static void
app_add_title (App * app)
{
app_new ();
}
+void
+launch_pitivi_project_activate_cb (GtkMenuItem * item, App * app)
+{
+ GtkFileChooserDialog *dlg;
+ GtkFileFilter *filter;
+
+ GST_DEBUG ("add file signal handler");
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, "pitivi projects");
+ gtk_file_filter_add_pattern (filter, "*.xptv");
+ dlg = (GtkFileChooserDialog *)
+ gtk_file_chooser_dialog_new ("Preview Project...",
+ GTK_WINDOW (app->main_window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dlg), filter);
+
+ g_object_set (G_OBJECT (dlg), "select-multiple", FALSE, NULL);
+
+ if (gtk_dialog_run ((GtkDialog *) dlg) == GTK_RESPONSE_OK) {
+ gchar *uri;
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dlg));
+ gtk_widget_destroy ((GtkWidget *) dlg);
+ app_launch_project (app, uri);
+ }
+}
+
void
open_activate_cb (GtkMenuItem * item, App * app)
{
<signal name="activate" handler="save_as_activate_cb"/>
</object>
</child>
+ <child>
+ <object class="GtkImageMenuItem" id="launch_pitivi_project">
+ <property name="label" translatable="yes">Preview Pitivi Project</property>
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">Launches a .xptv project</property>
+ <property name="image">image1</property>
+ <property name="use_stock">False</property>
+ <signal name="activate" handler="launch_pitivi_project_activate_cb"/>
+ </object>
+ </child>
</object>
</child>
</object>
<child>
<object class="GtkToolButton" id="play_button">
<property name="visible">True</property>
- <property name="related_action">play</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">play</property>
<property name="label" translatable="yes">toolbutton1</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton6">
<property name="visible">True</property>
- <property name="related_action">stop</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">stop</property>
<property name="label" translatable="yes">toolbutton6</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="delete_button">
<property name="visible">True</property>
- <property name="related_action">delete</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">delete</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="add_button">
<property name="visible">True</property>
- <property name="related_action">add_file</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">add_file</property>
<property name="label" translatable="yes">toolbutton1</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton2">
<property name="visible">True</property>
- <property name="related_action">add_text</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">add_text</property>
<property name="label" translatable="yes">toolbutton2</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton4">
<property name="visible">True</property>
- <property name="related_action">add_test</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">add_test</property>
<property name="label" translatable="yes">toolbutton4</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton5">
<property name="visible">True</property>
- <property name="related_action">add_transition</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">add_transition</property>
<property name="label" translatable="yes">toolbutton5</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton8">
<property name="visible">True</property>
- <property name="related_action">move_up</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">move_up</property>
<property name="label" translatable="yes">toolbutton8</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToolButton" id="toolbutton9">
<property name="visible">True</property>
- <property name="related_action">move_down</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">move_down</property>
<property name="label" translatable="yes">toolbutton9</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToggleToolButton" id="toolbutton11">
<property name="visible">True</property>
- <property name="related_action">audio_track</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">audio_track</property>
<property name="label" translatable="yes">toolbutton11</property>
<property name="use_underline">True</property>
</object>
<child>
<object class="GtkToggleToolButton" id="toolbutton12">
<property name="visible">True</property>
- <property name="related_action">video_track</property>
<property name="use_action_appearance">True</property>
+ <property name="related_action">video_track</property>
<property name="label" translatable="yes">toolbutton12</property>
<property name="use_underline">True</property>
</object>
<action-widget response="0">button1</action-widget>
</action-widgets>
</object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-floppy</property>
+ </object>
<object class="GtkSizeGroup" id="LabelSizeGroup">
<widgets>
<widget name="label4"/>