void dt_control_remove_images() { if(dt_conf_get_bool("ask_before_remove")) { GtkWidget *dialog; GtkWidget *win = dt_ui_main_window(darktable.gui->ui); int number = dt_collection_get_selected_count(darktable.collection); // Do not show the dialog if no image is selected: if(number == 0) return; dialog = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, ngettext("do you really want to remove %d selected image from the collection?", "do you really want to remove %d selected images from the collection?", number), number); gtk_window_set_title(GTK_WINDOW(dialog), _("remove images?")); gint res = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if(res != GTK_RESPONSE_YES) return; } dt_job_t j; dt_control_remove_images_job_init(&j); dt_control_add_job(darktable.control, &j); }
void dt_control_remove_images() { if(dt_conf_get_bool("ask_before_remove")) { GtkWidget *dialog; GtkWidget *win = dt_ui_main_window(darktable.gui->ui); sqlite3_stmt *stmt = NULL; int number = 0; DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select count(imgid) from selected_images", -1, &stmt, NULL); if(sqlite3_step(stmt) == SQLITE_ROW) { number = sqlite3_column_int(stmt, 0); } dialog = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, ngettext("do you really want to remove %d selected image from the collection?", "do you really want to remove %d selected images from the collection?", number), number); gtk_window_set_title(GTK_WINDOW(dialog), _("remove images?")); gint res = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if(res != GTK_RESPONSE_YES) return; } dt_job_t j; dt_control_remove_images_job_init(&j); dt_control_add_job(darktable.control, &j); }