Skip to content

Commit

Permalink
Support loading multiple images or folders from command line.
Browse files Browse the repository at this point in the history
  • Loading branch information
christte committed Oct 6, 2012
1 parent acc6b13 commit 324e20f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/common/darktable.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ int dt_init(int argc, char *argv[], const int init_gui)
darktable.num_openmp_threads = omp_get_num_procs();
#endif
darktable.unmuted = 0;
char *image_to_load = NULL;
GSList *images_to_load = NULL;
for(int k=1; k<argc; k++)
{
if(argv[k][0] == '-')
Expand Down Expand Up @@ -489,7 +489,7 @@ int dt_init(int argc, char *argv[], const int init_gui)
}
else
{
image_to_load = argv[k];
images_to_load = g_slist_append(images_to_load, argv[k]);
}
}

Expand Down Expand Up @@ -679,9 +679,18 @@ int dt_init(int argc, char *argv[], const int init_gui)
gtk_accel_map_save(keyfile); // Save the default keymap if none is present
}

if(init_gui && dt_load_from_string(image_to_load, TRUE) == 0)
{
dt_ctl_switch_mode_to(DT_LIBRARY);
if(init_gui && images_to_load) {
// If only one image is listed, attempt to load it in darkroom
gboolean load_in_dr = (g_slist_next(images_to_load) == NULL);
GSList *p = images_to_load;
do {
dt_load_from_string((gchar*)p->data, load_in_dr);
} while((p = g_slist_next(p))!= NULL);

if (!load_in_dr) {
dt_ctl_switch_mode_to(DT_LIBRARY);
}
g_slist_free(images_to_load);
}

/* start the indexer background job */
Expand Down

0 comments on commit 324e20f

Please sign in to comment.