allow multiple files to be added

This commit is contained in:
Brandon Lewis 2010-07-22 18:07:26 +02:00 committed by Edward Hervey
parent a0be0475c5
commit 91d8591a1e

View file

@ -137,11 +137,15 @@ add_file_activate_cb (GtkAction * item, App * app)
GTK_STOCK_CANCEL, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
g_object_set (G_OBJECT (dlg), "select-multiple", TRUE, NULL);
if (gtk_dialog_run ((GtkDialog *) dlg) == GTK_RESPONSE_OK) { if (gtk_dialog_run ((GtkDialog *) dlg) == GTK_RESPONSE_OK) {
gchar *filename; GSList *uris;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); GSList *cur;
app_add_file (app, filename); uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dlg));
g_free (filename); for (cur = uris; cur; cur = cur->next)
app_add_file (app, cur->data);
g_slist_free (uris);
} }
gtk_widget_destroy ((GtkWidget *) dlg); gtk_widget_destroy ((GtkWidget *) dlg);
} }
@ -279,21 +283,13 @@ app_delete_objects (App * app, GList * objects)
} }
void void
app_add_file (App * app, gchar * filename) app_add_file (App * app, gchar * uri)
{ {
gchar *uri;
GESTimelineObject *obj; GESTimelineObject *obj;
GST_DEBUG ("adding file %s", filename); GST_DEBUG ("adding file %s", uri);
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
/* TODO: error notification in UI */
return;
}
uri = g_strdup_printf ("file://%s", filename);
obj = GES_TIMELINE_OBJECT (ges_timeline_filesource_new (uri)); obj = GES_TIMELINE_OBJECT (ges_timeline_filesource_new (uri));
g_free (uri);
ges_timeline_layer_add_object (app->layer, obj); ges_timeline_layer_add_object (app->layer, obj);
} }