summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/examples/ges-ui.c75
-rw-r--r--tests/examples/ges-ui.glade36
2 files changed, 100 insertions, 11 deletions
diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c
index 89a02e1c..be0c1364 100644
--- a/tests/examples/ges-ui.c
+++ b/tests/examples/ges-ui.c
@@ -112,6 +112,7 @@ gboolean window_delete_event_cb (GtkObject * window, GdkEvent * event,
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);
@@ -452,6 +453,24 @@ pipeline_state_changed_cb (App * app)
}
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)
{
const GstStructure *s;
@@ -1149,6 +1168,33 @@ app_add_file (App * app, gchar * uri)
}
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)
{
GESTimelineObject *obj;
@@ -1372,6 +1418,35 @@ new_activate_cb (GtkMenuItem * item, App * app)
}
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)
{
GtkFileChooserDialog *dlg;
diff --git a/tests/examples/ges-ui.glade b/tests/examples/ges-ui.glade
index b91cbe03..4ce11df6 100644
--- a/tests/examples/ges-ui.glade
+++ b/tests/examples/ges-ui.glade
@@ -90,6 +90,16 @@
<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>
@@ -271,8 +281,8 @@
<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>
@@ -284,8 +294,8 @@
<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>
@@ -306,8 +316,8 @@
<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>
@@ -328,8 +338,8 @@
<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>
@@ -341,8 +351,8 @@
<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>
@@ -354,8 +364,8 @@
<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>
@@ -367,8 +377,8 @@
<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>
@@ -402,8 +412,8 @@
<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>
@@ -415,8 +425,8 @@
<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>
@@ -437,8 +447,8 @@
<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>
@@ -450,8 +460,8 @@
<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>
@@ -1013,6 +1023,10 @@
<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"/>