From c91d1dd32d09801c8ad6f48f77286d6a53c956d7 Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Mon, 11 Oct 2010 11:53:35 +0100 Subject: [PATCH] ges-ui: implement save as command in gtk demo --- tests/examples/ges-ui.c | 31 +++++++++++++++++++++++++++++++ tests/examples/ges-ui.glade | 2 ++ 2 files changed, 33 insertions(+) diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index 0365d4ac76..e767839779 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -100,6 +100,7 @@ gboolean window_delete_event_cb (GtkObject * window, GdkEvent * event, App * app); 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 quit_item_activate_cb (GtkMenuItem * item, App * app); void delete_activate_cb (GtkAction * item, App * app); void play_activate_cb (GtkAction * item, App * app); @@ -1019,6 +1020,12 @@ app_add_transition (App * app) (app->layer), obj, -1); } +static void +app_save_to_uri (App * app, gchar * uri) +{ + ges_timeline_save_to_uri (app->timeline, uri); +} + static void app_dispose (App * app) { @@ -1175,6 +1182,30 @@ open_activate_cb (GtkMenuItem * item, App * app) gtk_widget_destroy ((GtkWidget *) dlg); } +void +save_as_activate_cb (GtkMenuItem * item, App * app) +{ + GtkFileChooserDialog *dlg; + + GST_DEBUG ("save as signal handler"); + + dlg = (GtkFileChooserDialog *) + gtk_file_chooser_dialog_new ("Save project as...", + GTK_WINDOW (app->main_window), GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_OK, + NULL); + + 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)); + app_save_to_uri (app, uri); + g_free (uri); + } + gtk_widget_destroy ((GtkWidget *) dlg); +} + void quit_item_activate_cb (GtkMenuItem * item, App * app) { diff --git a/tests/examples/ges-ui.glade b/tests/examples/ges-ui.glade index f8f52e7ea5..9bfd0004b7 100644 --- a/tests/examples/ges-ui.glade +++ b/tests/examples/ges-ui.glade @@ -86,6 +86,8 @@ gtk-save-as True True + True +