diff --git a/src/dialogs/save/save.c b/src/dialogs/save/save.c index 21f04f4..c5c29b2 100644 --- a/src/dialogs/save/save.c +++ b/src/dialogs/save/save.c @@ -324,6 +324,10 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ if(filename) gtk_entry_set_text(GTK_ENTRY(dialog->filename),filename); +#ifdef G_OS_UNIX + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); +#endif // G_OS_UNIX + gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget))); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); diff --git a/src/dialogs/settings/host.c b/src/dialogs/settings/host.c index a3916ee..59bde96 100644 --- a/src/dialogs/settings/host.c +++ b/src/dialogs/settings/host.c @@ -436,7 +436,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) gtk_grid_attach( GTK_GRID(widget), - v3270_dialog_create_frame(grids[CONNECTION],_("Connection")), + v3270_dialog_section_new(_("Connection"),_("Network connection settings"),grids[CONNECTION]), 0,0,10,5 ); @@ -446,7 +446,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) gtk_grid_attach( GTK_GRID(widget), - v3270_dialog_create_frame(grids[EMULATION],_("Emulation")), + v3270_dialog_section_new(_("Emulation"),_("TN3270 Emulation settings"),grids[EMULATION]), 0,6,10,5 ); diff --git a/src/dialogs/tools.c b/src/dialogs/tools.c index ee8e92c..801fa3d 100644 --- a/src/dialogs/tools.c +++ b/src/dialogs/tools.c @@ -44,27 +44,60 @@ return grid; } - GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title) - { - GtkFrame * frame = GTK_FRAME(gtk_frame_new("")); - g_autofree gchar * markup = g_strdup_printf("%s",title); - GtkWidget * label = gtk_label_new(NULL); + GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child) { + + // https://developer.gnome.org/hig/stable/visual-layout.html.en + + GtkFrame * frame = GTK_FRAME(gtk_frame_new("")); + GtkWidget * label = gtk_label_new(NULL); + +#ifdef G_OS_UNIX + { + // Unix/Linux version, follow gnome guidelines + g_autofree gchar * markup = g_strdup_printf("%s",title); + gtk_label_set_markup(GTK_LABEL(label),markup); + + g_object_set(G_OBJECT(frame),"margin-top",6,NULL); + + gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); + + } +#else + { + // Non Unix/Linux, use the windows style. + gtk_label_set_text(GTK_LABEL(label),title); + } +#endif // G_OS_UNIX - gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); - gtk_label_set_markup(GTK_LABEL(label),markup); gtk_frame_set_label_widget(GTK_FRAME(frame),label); - gtk_container_set_border_width(GTK_CONTAINER(child),12); - gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child)); + if(child) { + gtk_container_set_border_width(GTK_CONTAINER(child),12); + gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child)); + + if(GTK_IS_GRID(child)) { + gtk_grid_set_row_spacing(GTK_GRID(child),6); + gtk_grid_set_column_spacing(GTK_GRID(child),12); + } + + } - g_object_set(G_OBJECT(frame),"margin-top",6,NULL); + if(tooltip) { + gtk_widget_set_tooltip_markup(label,tooltip); + } return GTK_WIDGET(frame); + + } + + + GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title) { + return v3270_dialog_section_new(title,NULL,child); } GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, const gchar *tooltip, GtkAlign align, gboolean expand, gboolean fill, guint padding) { - GtkWidget * frame = v3270_dialog_create_frame(child,title); + GtkWidget * frame = v3270_dialog_section_new(title,NULL,child); gtk_widget_set_halign(GTK_WIDGET(frame),align); gtk_box_pack_start(GTK_BOX(box),frame,expand,fill,padding); diff --git a/src/include/v3270/dialogs.h b/src/include/v3270/dialogs.h index 7a37d6c..da893b0 100644 --- a/src/include/v3270/dialogs.h +++ b/src/include/v3270/dialogs.h @@ -38,6 +38,8 @@ LIB3270_EXPORT GtkWidget * v3270_dialog_new_with_buttons(const gchar *title, GtkWidget *widget, const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED; LIB3270_EXPORT GtkWidget * v3270_dialog_set_content_area(GtkWidget *dialog, GtkWidget *content_area); + LIB3270_EXPORT GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child); + LIB3270_EXPORT void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body); LIB3270_EXPORT GtkWidget * v3270_save_dialog_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode, const gchar *filename); -- libgit2 0.21.2