[PATCH 2/2] Print dialog: Fix inaccessible controls on Windows

Lubomir I. Ivanov neolit123 at gmail.com
Tue Mar 26 11:59:08 PDT 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

The window which holds the custom print options tab appears to have
unchangeable dimensions on Windows OS (unless hacked in some way).
This makes the sliders in the custom tab not accessible unless
we add the entire dialog into a GtkScrolledWindow and return that
for the "create-custom-widget" event.

The patch also makes the contents of the "Layout Options" frame
packed vertically (with a GtkVBox) instead of horizontally, so that
the entire tab contents are "mostly" scrollable vertically instead
of horizontally.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 print.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/print.c b/print.c
index beb6bcc..73d1114 100644
--- a/print.c
+++ b/print.c
@@ -934,11 +934,14 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
 	*frame, *frame1, *frame2,
 	*box, *box1, *box2, *box3, *box4,
 	*button, *colorButton, *label1, *label2, *label3,
-	*scale_prof_hscale, *scale_tanks_hscale, *scale_notes_hscale;
+	*scale_prof_hscale, *scale_tanks_hscale, *scale_notes_hscale, *scrolled_window;
 	int dives;
 	gtk_print_operation_set_custom_tab_label(operation, _("Print type"));
 
+	scrolled_window = gtk_scrolled_window_new(0, 0);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	vbox = gtk_vbox_new(FALSE, 5);
+	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), vbox);
 
 	frame = gtk_frame_new(_("Print type"));
 	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
@@ -981,7 +984,7 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
 	}
 	frame = gtk_frame_new(_("Layout Options"));
 	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
-	box = gtk_hbox_new(FALSE, 5);
+	box = gtk_vbox_new(FALSE, 5);
 	gtk_container_add(GTK_CONTAINER(frame), box);
 	colorButton = gtk_check_button_new_with_label(_("Print in color"));
 	g_signal_connect(G_OBJECT(colorButton), "toggled",
@@ -1050,7 +1053,7 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
 	gtk_box_pack_start (GTK_BOX(box4), scale_notes_hscale, TRUE, TRUE, 5);
 
 	gtk_widget_show_all(vbox);
-	return vbox;
+	return scrolled_window;
 }
 
 static gboolean paginate(GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data)
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list