@@ -69,7 +69,7 @@ typedef struct dt_lib_export_t
69
69
GtkWidget * upscale , * profile , * intent , * style , * style_mode ;
70
70
dt_gui_collapsible_section_t cs ;
71
71
GtkWidget * batch_treeview ;
72
- GtkButton * export_button ;
72
+ GtkButton * export_button , * batch_export_button ;
73
73
GtkWidget * storage_extra_container , * format_extra_container ;
74
74
GtkWidget * high_quality ;
75
75
GtkWidget * export_masks ;
@@ -100,7 +100,6 @@ static void _get_max_output_dimension(dt_lib_export_t *d,
100
100
uint32_t * height );
101
101
static void _resync_print_dimensions (dt_lib_export_t * self );
102
102
static void _resync_pixel_dimensions (dt_lib_export_t * self );
103
- static gboolean _batch_preset_active (dt_lib_module_t * self );
104
103
105
104
#define INCH_TO_CM (2.54f)
106
105
@@ -217,7 +216,7 @@ void gui_update(dt_lib_module_t *self)
217
216
has_act_on
218
217
&& format_index != -1
219
218
&& storage_index != -1
220
- && ( export_enabled || _batch_preset_active ( self )) );
219
+ && export_enabled );
221
220
}
222
221
223
222
static void _image_selection_changed_callback (gpointer instance ,
@@ -456,12 +455,16 @@ static void _export_with_preset(const gchar *preset_name, dt_lib_module_t *self)
456
455
}
457
456
458
457
static void _export_button_clicked (GtkWidget * widget , dt_lib_module_t * self )
458
+ {
459
+ _export_with_current_settings (self );
460
+ }
461
+
462
+ static void _batch_export_button_clicked (GtkWidget * widget , dt_lib_module_t * self )
459
463
{
460
464
dt_lib_export_t * d = (dt_lib_export_t * )self -> data ;
461
465
462
466
GtkTreeModel * model = gtk_tree_view_get_model (GTK_TREE_VIEW (d -> batch_treeview ));
463
467
GtkTreeIter iter ;
464
- gboolean batch_used = FALSE;
465
468
466
469
gboolean valid = gtk_tree_model_get_iter_first (model , & iter );
467
470
while (valid )
@@ -475,16 +478,10 @@ static void _export_button_clicked(GtkWidget *widget, dt_lib_module_t *self)
475
478
-1 );
476
479
477
480
if (active )
478
- {
479
481
_export_with_preset (preset_name , self );
480
- batch_used = TRUE;
481
- }
482
482
483
483
valid = gtk_tree_model_iter_next (model , & iter );
484
484
}
485
-
486
- if (!batch_used )
487
- _export_with_current_settings (self );
488
485
}
489
486
490
487
static void _scale_changed (GtkEntry * spin ,
@@ -1291,22 +1288,6 @@ static gboolean _batch_preset_active(dt_lib_module_t *self)
1291
1288
return batch_preset_active ;
1292
1289
}
1293
1290
1294
- static void _set_export_button_label (dt_lib_module_t * self )
1295
- {
1296
- dt_lib_export_t * d = self -> data ;
1297
-
1298
- if (_batch_preset_active (self ))
1299
- {
1300
- gtk_button_set_label (d -> export_button , _ ("batch export" ));
1301
- gtk_widget_set_tooltip_text (GTK_WIDGET (d -> export_button ), _ ("batch export with all selected presets" ));
1302
- }
1303
- else
1304
- {
1305
- gtk_button_set_label (d -> export_button , _ ("export" ));
1306
- gtk_widget_set_tooltip_text (GTK_WIDGET (d -> export_button ), _ ("export with current settings" ));
1307
- }
1308
- }
1309
-
1310
1291
static void _batch_export_toggled_callback (GtkCellRendererToggle * cell_renderer ,
1311
1292
gchar * path_str ,
1312
1293
gpointer user_data )
@@ -1331,8 +1312,8 @@ static void _batch_export_toggled_callback(GtkCellRendererToggle *cell_renderer,
1331
1312
gchar * setting = g_strdup_printf (CONFIG_PREFIX "batch_%s" , name );
1332
1313
dt_conf_set_bool (setting , toggle );
1333
1314
g_free (setting );
1334
- _set_export_button_label ( self );
1335
- dt_lib_gui_queue_update ( self );
1315
+
1316
+ gtk_widget_set_sensitive ( GTK_WIDGET ( d -> batch_export_button ), _batch_preset_active ( self ));
1336
1317
}
1337
1318
1338
1319
static void _fill_batch_export_list (dt_lib_module_t * self )
@@ -1342,6 +1323,7 @@ static void _fill_batch_export_list(dt_lib_module_t *self)
1342
1323
GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (d -> batch_treeview )));
1343
1324
gtk_list_store_clear (store );
1344
1325
GtkTreeIter iter ;
1326
+ gboolean has_active = FALSE;
1345
1327
1346
1328
sqlite3_stmt * stmt ;
1347
1329
DT_DEBUG_SQLITE3_PREPARE_V2 (
@@ -1365,9 +1347,11 @@ static void _fill_batch_export_list(dt_lib_module_t *self)
1365
1347
DT_EXPORT_BATCH_COL_ACTIVE , active ,
1366
1348
DT_EXPORT_BATCH_COL_NAME , name ,
1367
1349
-1 );
1350
+ has_active |= active ;
1368
1351
}
1369
1352
sqlite3_finalize (stmt );
1370
- _set_export_button_label (self );
1353
+
1354
+ gtk_widget_set_sensitive (GTK_WIDGET (d -> batch_export_button ), has_active );
1371
1355
}
1372
1356
1373
1357
static void _export_presets_changed_callback (gpointer instance , gpointer module , dt_lib_module_t * self )
@@ -1661,22 +1645,10 @@ void gui_init(dt_lib_module_t *self)
1661
1645
g_signal_connect (G_OBJECT (d -> profile ), "value-changed" ,
1662
1646
G_CALLBACK (_profile_changed ), (gpointer )d );
1663
1647
1664
-
1665
- GtkBox * hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL , 0 ));
1666
- gtk_box_pack_end (GTK_BOX (self -> widget ), GTK_WIDGET (hbox ), FALSE, TRUE, 0 );
1667
-
1668
- // Export button
1669
- d -> export_button = GTK_BUTTON (dt_action_button_new
1670
- (self , NC_ ("actionbutton" , "export" ),
1671
- _export_button_clicked , self ,
1672
- NULL ,
1673
- GDK_KEY_e , GDK_CONTROL_MASK ));
1674
- gtk_box_pack_start (hbox , GTK_WIDGET (d -> export_button ), TRUE, TRUE, 0 );
1675
-
1676
1648
// batch export
1677
1649
dt_gui_new_collapsible_section (& d -> cs ,
1678
1650
"plugins/lighttable/export/batch_export_expanded" ,
1679
- _ ("batch presets " ),
1651
+ _ ("batch export " ),
1680
1652
GTK_BOX (self -> widget ),
1681
1653
DT_ACTION (self ));
1682
1654
gtk_widget_set_tooltip_text (d -> cs .expander , _ ("export the selected images with multiple presets" ));
@@ -1704,9 +1676,28 @@ void gui_init(dt_lib_module_t *self)
1704
1676
gtk_tree_view_column_add_attribute (column , renderer , "text" , DT_EXPORT_BATCH_COL_NAME );
1705
1677
1706
1678
gtk_box_pack_start (d -> cs .container , view , FALSE, FALSE, 0 );
1679
+
1680
+ // Batch export button
1681
+ GtkBox * hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL , 0 ));
1682
+ gtk_box_pack_start (GTK_BOX (d -> cs .container ), GTK_WIDGET (hbox ), FALSE, TRUE, 0 );
1683
+ d -> batch_export_button = GTK_BUTTON (gtk_button_new_with_label (_ ("export" )));
1684
+ gtk_box_pack_start (hbox , GTK_WIDGET (d -> batch_export_button ), TRUE, TRUE, 0 );
1685
+ g_signal_connect (G_OBJECT (d -> batch_export_button ), "clicked" ,
1686
+ G_CALLBACK (_batch_export_button_clicked ), self );
1687
+
1707
1688
d -> batch_treeview = view ;
1708
1689
_fill_batch_export_list (self );
1709
1690
1691
+ // Export button
1692
+ hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL , 0 ));
1693
+ gtk_box_pack_end (GTK_BOX (self -> widget ), GTK_WIDGET (hbox ), FALSE, TRUE, 0 );
1694
+ d -> export_button = GTK_BUTTON (dt_action_button_new
1695
+ (self , NC_ ("actionbutton" , "export" ),
1696
+ _export_button_clicked , self ,
1697
+ NULL ,
1698
+ GDK_KEY_e , GDK_CONTROL_MASK ));
1699
+ gtk_box_pack_start (hbox , GTK_WIDGET (d -> export_button ), TRUE, TRUE, 0 );
1700
+
1710
1701
gtk_widget_add_events (d -> width , GDK_BUTTON_PRESS_MASK );
1711
1702
gtk_widget_add_events (d -> height , GDK_BUTTON_PRESS_MASK );
1712
1703
gtk_widget_add_events (d -> print_width , GDK_BUTTON_PRESS_MASK );
0 commit comments