ges-ui: implement save as command in gtk demo

This commit is contained in:
Brandon Lewis 2010-10-11 11:53:35 +01:00 committed by Edward Hervey
parent ae098803fc
commit c91d1dd32d
2 changed files with 33 additions and 0 deletions

View file

@ -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)
{

View file

@ -86,6 +86,8 @@
<property name="label">gtk-save-as</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="visible">True</property>
<signal name="activate" handler="save_as_activate_cb"/>
</object>
</child>
</object>