diff --git a/frontends/gtk-old/src/callbacks.c b/frontends/gtk-old/src/callbacks.c index 6dd48ab31..31c60c48d 100644 --- a/frontends/gtk-old/src/callbacks.c +++ b/frontends/gtk-old/src/callbacks.c @@ -186,9 +186,20 @@ void open_directory() { debug_print("open directory"); } +void toggle_sensitivity (GtkWidget *button, gpointer data) { + + GtkWidget *widget = (GtkWidget*)data; + + if (GTK_WIDGET_SENSITIVE(widget)) + gtk_widget_set_sensitive(widget, FALSE); + else + gtk_widget_set_sensitive(widget, TRUE); +} + void save_selected_photo() { - GtkWidget *icon_list, *window, *ok, *cancel, *hbox, *label, *prefix; + GtkWidget *icon_list, *window, *ok, *cancel, *hbox, *label, *prefix, + *use_camera_filename; GtkIconListItem *item; GList *child; int num=0, x; @@ -211,6 +222,7 @@ void save_selected_photo() { window = create_save_window(); ok = GTK_FILE_SELECTION(window)->ok_button; cancel = GTK_FILE_SELECTION(window)->cancel_button; + use_camera_filename = (GtkWidget*)lookup_widget(window, "use_camera_filename"); if (num > 1) { gtk_widget_hide(GTK_FILE_SELECTION(window)->selection_entry); @@ -223,18 +235,26 @@ void save_selected_photo() { child = gtk_container_children( GTK_CONTAINER(child->next->next->data)); gtk_widget_hide(GTK_WIDGET(child->next->data)); + + /* Create the hbox to hold the filename prefix label and entry */ hbox = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(window)->main_vbox),hbox, TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(GTK_FILE_SELECTION(window)->main_vbox), hbox, 256); + + gtk_signal_connect(GTK_OBJECT(use_camera_filename), "clicked", + GTK_SIGNAL_FUNC(toggle_sensitivity), hbox); + label = gtk_label_new("Filename prefix:"); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox),label, FALSE, FALSE, 0); prefix = gtk_entry_new(); gtk_widget_show(prefix); gtk_box_pack_start(GTK_BOX(hbox), prefix, TRUE, TRUE, 0); + gtk_widget_set_sensitive(hbox, FALSE); + } if (wait_for_hide(window, ok, cancel)==0) diff --git a/frontends/gtk-old/src/callbacks.h b/frontends/gtk-old/src/callbacks.h index 1ce3c5f8f..4f89c74e3 100644 --- a/frontends/gtk-old/src/callbacks.h +++ b/frontends/gtk-old/src/callbacks.h @@ -4,6 +4,7 @@ /* ------------------------------------------------------*/ int main_quit(GtkWidget *widget, gpointer data); gboolean toggle_icon (GtkWidget *icon_list, gpointer data); +void toggle_sensitivity (GtkWidget *button, gpointer data); void debug_print (char *message); void idle(); void icon_resize(GtkWidget *window); diff --git a/frontends/gtk-old/src/interface.c b/frontends/gtk-old/src/interface.c index 6d5629328..1e3ff8bbb 100644 --- a/frontends/gtk-old/src/interface.c +++ b/frontends/gtk-old/src/interface.c @@ -107,7 +107,7 @@ GtkWidget* create_save_window (void) { - GtkWidget *save_window, *hbox, *frame, *photos, *thumbs; + GtkWidget *save_window, *hbox, *frame, *photos, *thumbs, *override; GtkTooltips *tooltip; char buf[1024]; @@ -134,7 +134,7 @@ create_save_window (void) gtk_widget_show(hbox); gtk_container_add(GTK_CONTAINER(frame), hbox); - photos = gtk_toggle_button_new_with_label("Save Photos"); + photos = gtk_check_button_new_with_label("Save Photos"); gtk_widget_ref(photos); gtk_object_set_data_full (GTK_OBJECT (save_window), "photos", photos, (GtkDestroyNotify) gtk_widget_unref); @@ -142,19 +142,35 @@ create_save_window (void) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(photos), TRUE); tooltip = gtk_tooltips_new(); gtk_tooltips_set_tip (tooltip, photos, - _("Photos will be saved if this button is pressed in."), NULL); + _("Photos will be saved if this is checked."), NULL); gtk_box_pack_start(GTK_BOX(hbox), photos, TRUE, TRUE, 0); - thumbs = gtk_toggle_button_new_with_label("Save Thumbnails"); + thumbs = gtk_check_button_new_with_label("Save Thumbnails"); gtk_widget_ref(thumbs); gtk_object_set_data_full (GTK_OBJECT (save_window), "thumbs", thumbs, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show(thumbs); tooltip = gtk_tooltips_new(); gtk_tooltips_set_tip (tooltip, thumbs, - _("Thumbnails will be saved if this button is pressed in."), NULL); + _("Thumbnails will be saved if this is checked."), NULL); gtk_box_pack_start(GTK_BOX(hbox), thumbs, TRUE, TRUE, 0); + /* Create the filename override button */ + override = gtk_check_button_new_with_label("Use camera-suggested filenames"); + gtk_widget_ref(override); + gtk_object_set_data_full (GTK_OBJECT (save_window), "use_camera_filename", override, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show(override); + gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(save_window)->main_vbox),override, + TRUE, TRUE, 0); + tooltip = gtk_tooltips_new(); + gtk_tooltips_set_tip (tooltip, override, + _("Choose whether to use the filename provided by the camera"), NULL); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(override), TRUE); + gtk_widget_set_sensitive(GTK_FILE_SELECTION(save_window)->selection_entry, FALSE); + gtk_signal_connect(GTK_OBJECT(override), "clicked", + GTK_SIGNAL_FUNC(toggle_sensitivity), GTK_FILE_SELECTION(save_window)->selection_entry); + return (save_window); }