Commit aacf668284e813375efc52b3f6d6337b9ce0ebec
1 parent
89ca5628
Exists in
master
and in
1 other branch
Settings dialog sections should have diferent settings on windows.
Showing
4 changed files
with
52 additions
and
13 deletions
Show diff stats
src/dialogs/save/save.c
@@ -324,6 +324,10 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | @@ -324,6 +324,10 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | ||
324 | if(filename) | 324 | if(filename) |
325 | gtk_entry_set_text(GTK_ENTRY(dialog->filename),filename); | 325 | gtk_entry_set_text(GTK_ENTRY(dialog->filename),filename); |
326 | 326 | ||
327 | +#ifdef G_OS_UNIX | ||
328 | + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); | ||
329 | +#endif // G_OS_UNIX | ||
330 | + | ||
327 | gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget))); | 331 | gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget))); |
328 | gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); | 332 | gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
329 | gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); | 333 | gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); |
src/dialogs/settings/host.c
@@ -436,7 +436,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -436,7 +436,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
436 | 436 | ||
437 | gtk_grid_attach( | 437 | gtk_grid_attach( |
438 | GTK_GRID(widget), | 438 | GTK_GRID(widget), |
439 | - v3270_dialog_create_frame(grids[CONNECTION],_("Connection")), | 439 | + v3270_dialog_section_new(_("Connection"),_("Network connection settings"),grids[CONNECTION]), |
440 | 0,0,10,5 | 440 | 0,0,10,5 |
441 | ); | 441 | ); |
442 | 442 | ||
@@ -446,7 +446,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -446,7 +446,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
446 | 446 | ||
447 | gtk_grid_attach( | 447 | gtk_grid_attach( |
448 | GTK_GRID(widget), | 448 | GTK_GRID(widget), |
449 | - v3270_dialog_create_frame(grids[EMULATION],_("Emulation")), | 449 | + v3270_dialog_section_new(_("Emulation"),_("TN3270 Emulation settings"),grids[EMULATION]), |
450 | 0,6,10,5 | 450 | 0,6,10,5 |
451 | ); | 451 | ); |
452 | 452 |
src/dialogs/tools.c
@@ -44,27 +44,60 @@ | @@ -44,27 +44,60 @@ | ||
44 | return grid; | 44 | return grid; |
45 | } | 45 | } |
46 | 46 | ||
47 | - GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title) | ||
48 | - { | ||
49 | - GtkFrame * frame = GTK_FRAME(gtk_frame_new("")); | ||
50 | - g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title); | ||
51 | - GtkWidget * label = gtk_label_new(NULL); | 47 | + GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child) { |
48 | + | ||
49 | + // https://developer.gnome.org/hig/stable/visual-layout.html.en | ||
50 | + | ||
51 | + GtkFrame * frame = GTK_FRAME(gtk_frame_new("")); | ||
52 | + GtkWidget * label = gtk_label_new(NULL); | ||
53 | + | ||
54 | +#ifdef G_OS_UNIX | ||
55 | + { | ||
56 | + // Unix/Linux version, follow gnome guidelines | ||
57 | + g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title); | ||
58 | + gtk_label_set_markup(GTK_LABEL(label),markup); | ||
59 | + | ||
60 | + g_object_set(G_OBJECT(frame),"margin-top",6,NULL); | ||
61 | + | ||
62 | + gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); | ||
63 | + | ||
64 | + } | ||
65 | +#else | ||
66 | + { | ||
67 | + // Non Unix/Linux, use the windows style. | ||
68 | + gtk_label_set_text(GTK_LABEL(label),title); | ||
69 | + } | ||
70 | +#endif // G_OS_UNIX | ||
52 | 71 | ||
53 | - gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); | ||
54 | - gtk_label_set_markup(GTK_LABEL(label),markup); | ||
55 | gtk_frame_set_label_widget(GTK_FRAME(frame),label); | 72 | gtk_frame_set_label_widget(GTK_FRAME(frame),label); |
56 | - gtk_container_set_border_width(GTK_CONTAINER(child),12); | ||
57 | 73 | ||
58 | - gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child)); | 74 | + if(child) { |
75 | + gtk_container_set_border_width(GTK_CONTAINER(child),12); | ||
76 | + gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child)); | ||
77 | + | ||
78 | + if(GTK_IS_GRID(child)) { | ||
79 | + gtk_grid_set_row_spacing(GTK_GRID(child),6); | ||
80 | + gtk_grid_set_column_spacing(GTK_GRID(child),12); | ||
81 | + } | ||
82 | + | ||
83 | + } | ||
59 | 84 | ||
60 | - g_object_set(G_OBJECT(frame),"margin-top",6,NULL); | 85 | + if(tooltip) { |
86 | + gtk_widget_set_tooltip_markup(label,tooltip); | ||
87 | + } | ||
61 | 88 | ||
62 | return GTK_WIDGET(frame); | 89 | return GTK_WIDGET(frame); |
90 | + | ||
91 | + } | ||
92 | + | ||
93 | + | ||
94 | + GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title) { | ||
95 | + return v3270_dialog_section_new(title,NULL,child); | ||
63 | } | 96 | } |
64 | 97 | ||
65 | GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, const gchar *tooltip, GtkAlign align, gboolean expand, gboolean fill, guint padding) | 98 | GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, const gchar *tooltip, GtkAlign align, gboolean expand, gboolean fill, guint padding) |
66 | { | 99 | { |
67 | - GtkWidget * frame = v3270_dialog_create_frame(child,title); | 100 | + GtkWidget * frame = v3270_dialog_section_new(title,NULL,child); |
68 | gtk_widget_set_halign(GTK_WIDGET(frame),align); | 101 | gtk_widget_set_halign(GTK_WIDGET(frame),align); |
69 | gtk_box_pack_start(GTK_BOX(box),frame,expand,fill,padding); | 102 | gtk_box_pack_start(GTK_BOX(box),frame,expand,fill,padding); |
70 | 103 |
src/include/v3270/dialogs.h
@@ -38,6 +38,8 @@ | @@ -38,6 +38,8 @@ | ||
38 | LIB3270_EXPORT GtkWidget * v3270_dialog_new_with_buttons(const gchar *title, GtkWidget *widget, const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED; | 38 | LIB3270_EXPORT GtkWidget * v3270_dialog_new_with_buttons(const gchar *title, GtkWidget *widget, const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED; |
39 | LIB3270_EXPORT GtkWidget * v3270_dialog_set_content_area(GtkWidget *dialog, GtkWidget *content_area); | 39 | LIB3270_EXPORT GtkWidget * v3270_dialog_set_content_area(GtkWidget *dialog, GtkWidget *content_area); |
40 | 40 | ||
41 | + LIB3270_EXPORT GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child); | ||
42 | + | ||
41 | LIB3270_EXPORT void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body); | 43 | LIB3270_EXPORT void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body); |
42 | 44 | ||
43 | LIB3270_EXPORT GtkWidget * v3270_save_dialog_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode, const gchar *filename); | 45 | LIB3270_EXPORT GtkWidget * v3270_save_dialog_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode, const gchar *filename); |