void init(dt_view_t *self) { self->data = malloc(sizeof(dt_capture_t)); memset(self->data,0,sizeof(dt_capture_t)); dt_capture_t *lib = (dt_capture_t *)self->data; // initialize capture data struct const int i = dt_conf_get_int("plugins/capture/mode"); lib->mode = i; // Setup variable expanding, shares configuration as camera import uses... dt_variables_params_init(&lib->vp); lib->basedirectory = dt_conf_get_string("plugins/capture/storage/basedirectory"); lib->subdirectory = dt_conf_get_string("plugins/capture/storage/subpath"); lib->filenamepattern = dt_conf_get_string("plugins/capture/storage/namepattern"); // prefetch next few from first selected image on. dt_view_filmstrip_prefetch(); /* setup the tethering view proxy */ darktable.view_manager->proxy.tethering.view = self; darktable.view_manager->proxy.tethering.get_film_id = _capture_view_get_film_id; darktable.view_manager->proxy.tethering.get_session_filename = _capture_view_get_session_filename; darktable.view_manager->proxy.tethering.get_session_path = _capture_view_get_session_path; darktable.view_manager->proxy.tethering.get_job_code = _capture_view_get_jobcode; darktable.view_manager->proxy.tethering.set_job_code = _capture_view_set_jobcode; darktable.view_manager->proxy.tethering.get_selected_imgid = _capture_view_get_selected_imgid; }
void* get_params(dt_imageio_module_storage_t *self) { dt_imageio_disk_t *d = (dt_imageio_disk_t *)malloc(sizeof(dt_imageio_disk_t)); memset(d, 0, sizeof(dt_imageio_disk_t)); disk_t *g = (disk_t *)self->gui_data; d->vp = NULL; dt_variables_params_init(&d->vp); const char *text = gtk_entry_get_text(GTK_ENTRY(g->entry)); g_strlcpy(d->filename, text, DT_MAX_PATH_LEN); dt_conf_set_string("plugins/imageio/storage/disk/file_directory", d->filename); return d; }
struct dt_import_session_t * dt_import_session_new() { dt_import_session_t *is; is = (dt_import_session_t *)g_malloc0(sizeof(dt_import_session_t)); dt_variables_params_init(&is->vp); /* migrate old configuration */ _import_session_migrate_old_config(); return is; }
void* get_params(dt_imageio_module_storage_t *self, int* size) { dt_imageio_disk_t *d = (dt_imageio_disk_t *)malloc(sizeof(dt_imageio_disk_t)); memset(d, 0, sizeof(dt_imageio_disk_t)); // have to return the size of the struct to store (i.e. without all the variable pointers at the end) *size = sizeof(dt_imageio_disk_t) - sizeof(void *); disk_t *g = (disk_t *)self->gui_data; d->vp = NULL; dt_variables_params_init(&d->vp); const char *text = gtk_entry_get_text(GTK_ENTRY(g->entry)); g_strlcpy(d->filename, text, 1024); dt_conf_set_string("plugins/imageio/storage/disk/file_directory", d->filename); return d; }
void *get_params(dt_imageio_module_storage_t *self) { dt_imageio_disk_t *d = (dt_imageio_disk_t *)calloc(1, sizeof(dt_imageio_disk_t)); char *text = dt_conf_get_string("plugins/imageio/storage/disk/file_directory"); g_strlcpy(d->filename, text, sizeof(d->filename)); g_free(text); d->overwrite = dt_conf_get_bool("plugins/imageio/storage/disk/overwrite"); d->vp = NULL; dt_variables_params_init(&d->vp); return d; }
void dt_camera_import_job_init(dt_job_t *job,char *jobcode, char *path,char *filename,GList *images, struct dt_camera_t *camera, time_t time_override) { dt_control_job_init(job, "import selected images from camera"); job->execute = &dt_camera_import_job_run; dt_camera_import_t *t = (dt_camera_import_t *)job->param; dt_variables_params_init(&t->vp); if(time_override != 0) dt_variables_set_time(t->vp, time_override); t->fraction=0; t->images=g_list_copy(images); t->camera=camera; t->vp->jobcode=g_strdup(jobcode); t->path=g_strdup(path); t->filename=g_strdup(filename); t->import_count=0; }
void *get_params(dt_imageio_module_storage_t *self) { dt_imageio_gallery_t *d = (dt_imageio_gallery_t *)calloc(1, sizeof(dt_imageio_gallery_t)); d->vp = NULL; d->l = NULL; dt_variables_params_init(&d->vp); char *text = dt_conf_get_string("plugins/imageio/storage/gallery/file_directory"); g_strlcpy(d->filename, text, sizeof(d->filename)); g_free(text); text = dt_conf_get_string("plugins/imageio/storage/gallery/title"); g_strlcpy(d->title, text, sizeof(d->title)); g_free(text); return d; }
void _camera_import_dialog_new(_camera_import_dialog_t *data) { data->dialog=gtk_dialog_new_with_buttons(_("import images from camera"),NULL,GTK_DIALOG_MODAL,_("cancel"),GTK_RESPONSE_NONE,C_("camera import", "import"),GTK_RESPONSE_ACCEPT,NULL); GtkWidget *content = gtk_dialog_get_content_area (GTK_DIALOG (data->dialog)); // List - setup store data->store = gtk_list_store_new (2,GDK_TYPE_PIXBUF,G_TYPE_STRING); // Setup variables dt_variables_params_init(&data->vp); data->vp->jobcode=_("my jobcode"); data->vp->filename="DSC_0235.JPG"; // IMPORT PAGE data->import.page=gtk_vbox_new(FALSE,5); gtk_container_set_border_width(GTK_CONTAINER(data->import.page),5); // Top info data->import.info=gtk_label_new( _("please wait while prefetching thumbnails of images from camera...") ); gtk_label_set_single_line_mode( GTK_LABEL(data->import.info) , FALSE ); gtk_misc_set_alignment(GTK_MISC(data->import.info), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(data->import.page),data->import.info,FALSE,FALSE,0); // jobcode data->import.jobname=_camera_import_gconf_widget(data,_("jobcode"),"plugins/capture/camera/import/jobcode"); gtk_box_pack_start(GTK_BOX(data->import.page),GTK_WIDGET(data->import.jobname->widget),FALSE,FALSE,0); // Create the treview with list model data store data->import.treeview=gtk_scrolled_window_new(NULL,NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(data->import.treeview),GTK_POLICY_NEVER,GTK_POLICY_ALWAYS); gtk_container_add(GTK_CONTAINER(data->import.treeview), gtk_tree_view_new()); GtkTreeView *treeview=GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(data->import.treeview))); GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new( ); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes( _("thumbnail") , renderer,"pixbuf",0, (char *)NULL); gtk_tree_view_append_column( treeview , column); renderer = gtk_cell_renderer_text_new( ); column = gtk_tree_view_column_new_with_attributes( _("storage file"), renderer, "text", 1, (char *)NULL); gtk_tree_view_append_column( treeview , column); gtk_tree_view_column_set_expand( column, TRUE); GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview); gtk_tree_selection_set_mode(selection,GTK_SELECTION_MULTIPLE); gtk_tree_view_set_model(treeview,GTK_TREE_MODEL(data->store)); gtk_tree_view_set_headers_visible(treeview,FALSE); gtk_box_pack_start(GTK_BOX(data->import.page),data->import.treeview,TRUE,TRUE,0); // SETTINGS PAGE data->settings.page=gtk_vbox_new(FALSE,5); gtk_container_set_border_width(GTK_CONTAINER(data->settings.page),5); // general settings gtk_box_pack_start(GTK_BOX(data->settings.page),dtgtk_label_new(_("general"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT),FALSE,FALSE,0); // ignoring of jpegs. hack while we don't handle raw+jpeg in the same directories. data->settings.general.ignore_jpeg = gtk_check_button_new_with_label (_("ignore JPEG files")); g_object_set(data->settings.general.ignore_jpeg, "tooltip-text", _("do not load files with an extension of .jpg or .jpeg. this can be useful when there are raw+JPEG in a directory."), NULL); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->settings.general.ignore_jpeg), dt_conf_get_bool("ui_last/import_ignore_jpegs")); gtk_box_pack_start(GTK_BOX(data->settings.page), data->settings.general.ignore_jpeg, FALSE, FALSE, 0); g_signal_connect (G_OBJECT(data->settings.general.ignore_jpeg), "clicked",G_CALLBACK (_check_button_callback),data); GtkWidget *hbox=gtk_hbox_new(FALSE,5); data->settings.general.date_override=gtk_check_button_new_with_label(_("override today's date")); gtk_box_pack_start(GTK_BOX(hbox),data->settings.general.date_override,FALSE,FALSE,0); g_object_set(data->settings.general.date_override,"tooltip-text",_("check this, if you want to override the timestamp used when expanding variables:\n$(YEAR), $(MONTH), $(DAY),\n$(HOUR), $(MINUTE), $(SECONDS)"),(char *)NULL); data->settings.general.date_entry=gtk_entry_new(); gtk_widget_set_sensitive( data->settings.general.date_entry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->settings.general.date_override))); gtk_box_pack_start(GTK_BOX(hbox),data->settings.general.date_entry,TRUE,TRUE,0); g_signal_connect (G_OBJECT (data->settings.general.date_override), "clicked",G_CALLBACK (_check_button_callback),data); gtk_box_pack_start(GTK_BOX(data->settings.page),hbox,FALSE,FALSE,0); // Storage structure gtk_box_pack_start(GTK_BOX(data->settings.page),dtgtk_label_new(_("storage structure"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT),FALSE,FALSE,0); GtkWidget *l=gtk_label_new(_("the following three settings describe the directory structure and file renaming for import storage and images; if you don't know how to use this, keep the default settings.")); gtk_label_set_line_wrap(GTK_LABEL(l),TRUE); gtk_widget_set_size_request(l,400,-1); gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(data->settings.page),l,FALSE,FALSE,0); data->settings.basedirectory=_camera_import_gconf_widget(data,_("storage directory"),"plugins/capture/storage/basedirectory"); gtk_box_pack_start(GTK_BOX(data->settings.page),GTK_WIDGET(data->settings.basedirectory->widget),FALSE,FALSE,0); data->settings.subdirectory=_camera_import_gconf_widget(data,_("directory structure"),"plugins/capture/storage/subpath"); gtk_box_pack_start(GTK_BOX(data->settings.page),GTK_WIDGET(data->settings.subdirectory->widget),FALSE,FALSE,0); data->settings.namepattern=_camera_import_gconf_widget(data,_("filename structure"),"plugins/capture/storage/namepattern"); gtk_box_pack_start(GTK_BOX(data->settings.page),GTK_WIDGET(data->settings.namepattern->widget),FALSE,FALSE,0); // Add example l=gtk_label_new(_("above settings expands to:")); gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(data->settings.page),l,FALSE,FALSE,0); data->settings.example=gtk_label_new(""); gtk_label_set_line_wrap(GTK_LABEL(data->settings.example),TRUE); gtk_widget_set_size_request(data->settings.example,400,-1); gtk_misc_set_alignment(GTK_MISC(data->settings.example), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(data->settings.page),data->settings.example,FALSE,FALSE,0); // External backup gtk_box_pack_start(GTK_BOX(data->settings.page),dtgtk_label_new(_("external backup"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT),FALSE,FALSE,0); l=gtk_label_new(_("external backup is an option to automatic do a backup of the imported image(s) to another physical location, when activated it does looks for specified backup foldername of mounted devices on your system... each found folder is used as basedirectory in the above storage structure and when a image are downloaded from camera it is replicated to found backup destinations.")); gtk_label_set_line_wrap(GTK_LABEL(l),TRUE); gtk_widget_set_size_request(l,400,-1); gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(data->settings.page),l,FALSE,FALSE,0); data->settings.backup.enable=gtk_check_button_new_with_label(_("enable backup")); gtk_box_pack_start(GTK_BOX(data->settings.page),data->settings.backup.enable,FALSE,FALSE,0); g_object_set(data->settings.backup.enable,"tooltip-text",_("check this option to enable automatic backup of imported images"),(char *)NULL); data->settings.backup.warn=gtk_check_button_new_with_label(_("warn if no backup destinations are present")); gtk_box_pack_start(GTK_BOX(data->settings.page),data->settings.backup.warn,FALSE,FALSE,0); g_object_set(data->settings.backup.warn,"tooltip-text",_("check this option to get an interactive warning if no backupdestinations are present"),(char *)NULL); data->settings.backup.foldername=(_camera_import_gconf_widget(data,_("backup foldername"),"plugins/capture/camera/backup/foldername"))->widget; gtk_box_pack_start(GTK_BOX(data->settings.page),data->settings.backup.foldername,FALSE,FALSE,0); g_object_set(data->settings.backup.foldername,"tooltip-text",_("this is the name of folder that indicates a backup destination,\nif such a folder is found in any mounter media it is used as a backup destination."),(char *)NULL); if( dt_conf_get_bool("plugins/capture/backup/enable") ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( data->settings.backup.enable ), TRUE); else { gtk_widget_set_sensitive( data->settings.backup.warn, FALSE); gtk_widget_set_sensitive( data->settings.backup.foldername, FALSE); } if( dt_conf_get_bool("plugins/capture/backup/warn") ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( data->settings.backup.warn ), TRUE); g_signal_connect (G_OBJECT (data->settings.backup.enable), "clicked",G_CALLBACK (_check_button_callback),data); g_signal_connect (G_OBJECT(data->settings.backup.warn), "clicked",G_CALLBACK (_check_button_callback),data); // THE NOTEBOOK data->notebook=gtk_notebook_new(); gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook),data->import.page,gtk_label_new(_("images"))); gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook),data->settings.page,gtk_label_new(_("settings"))); // end gtk_box_pack_start(GTK_BOX(content),data->notebook,TRUE,TRUE,0); //gtk_widget_set_size_request(content,400,400); _update_example(data); }