summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--file.c2
-rw-r--r--macos.c3
-rw-r--r--parse-xml.c2
-rw-r--r--print.c35
4 files changed, 35 insertions, 7 deletions
diff --git a/file.c b/file.c
index da498995c..b9a598e2a 100644
--- a/file.c
+++ b/file.c
@@ -197,7 +197,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
struct sample *sample;
errno = 0;
- val = strtod(p,&end);
+ val = g_ascii_strtod(p,&end);
if (end == p)
break;
if (errno)
diff --git a/macos.c b/macos.c
index 1b7da1ec6..20445c808 100644
--- a/macos.c
+++ b/macos.c
@@ -98,6 +98,9 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
gtk_widget_hide (menubar);
gtk_osxapplication_set_menu_bar(osx_app, GTK_MENU_SHELL(menubar));
+ sep = gtk_ui_manager_get_widget(ui_manager, "/MainMenu/FileMenu/Separator1");
+ if (sep)
+ gtk_widget_destroy(sep);
sep = gtk_ui_manager_get_widget(ui_manager, "/MainMenu/FileMenu/Separator2");
if (sep)
gtk_widget_destroy(sep);
diff --git a/parse-xml.c b/parse-xml.c
index a1eb21070..1c4db7d9d 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -289,7 +289,7 @@ static enum number_type integer_or_float(char *buffer, union int_or_float *res)
/* Looks like it might be floating point? */
if (*end == '.') {
errno = 0;
- fp = strtod(buffer, &end);
+ fp = g_ascii_strtod(buffer, &end);
if (!errno) {
res->fp = fp;
return FLOAT;
diff --git a/print.c b/print.c
index 0e49bc9c3..b30a8d029 100644
--- a/print.c
+++ b/print.c
@@ -434,12 +434,11 @@ static void begin_print(GtkPrintOperation *operation, gpointer user_data)
int dives_per_page;
dives = nr_selected_dives();
- print_options.print_selected = dives > 1;
- if (dives <= 1)
+ if (!print_options.print_selected)
dives = dive_table.nr;
if (print_options.type == PRETTY) {
- dives_per_page = 6;
+ dives_per_page = 6;
} else {
dives_per_page = 25;
}
@@ -458,9 +457,19 @@ static void name(GtkWidget *w, gpointer data) \
OPTIONCALLBACK(set_pretty, type, PRETTY)
OPTIONCALLBACK(set_table, type, TABLE)
+#define OPTIONSELECTEDCALLBACK(name, option) \
+static void name(GtkWidget *w, gpointer data) \
+{ \
+ option = GTK_TOGGLE_BUTTON(w)->active; \
+}
+
+OPTIONSELECTEDCALLBACK(print_selection_toggle, print_options.print_selected)
+
+
static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
{
GtkWidget *vbox, *radio1, *radio2, *frame, *box;
+ int dives;
gtk_print_operation_set_custom_tab_label(operation, "Dive details");
vbox = gtk_vbox_new(TRUE, 5);
@@ -484,6 +493,22 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
g_signal_connect(radio1, "toggled", G_CALLBACK(set_pretty), NULL);
g_signal_connect(radio2, "toggled", G_CALLBACK(set_table), NULL);
+ dives = nr_selected_dives();
+ print_options.print_selected = dives >= 1;
+ if (print_options.print_selected) {
+ frame = gtk_frame_new("Print selection");
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
+ box = gtk_hbox_new(FALSE, 1);
+ gtk_container_add(GTK_CONTAINER(frame), box);
+ GtkWidget *button;
+ button = gtk_check_button_new_with_label("Print only selected dives");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
+ print_options.print_selected);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(button), "toggled",
+ G_CALLBACK(print_selection_toggle), NULL);
+ }
+
gtk_widget_show_all(vbox);
return vbox;
}
@@ -491,8 +516,8 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
static void print_dialog_apply(GtkPrintOperation *operation, GtkWidget *widget, gpointer user_data)
{
if (print_options.type == PRETTY) {
- g_signal_connect(operation, "draw_page",
- G_CALLBACK(draw_page), NULL);
+ g_signal_connect(operation, "draw_page",
+ G_CALLBACK(draw_page), NULL);
} else {
g_signal_connect(operation, "draw_page",
G_CALLBACK(draw_table), NULL);