Commit 26bed00af5513eb0cb612b184f0819ebe18f7030

Authored by Perry Werneck
1 parent 8be1f955
Exists in master and in 1 other branch develop

Changing dialogs to follow the gnome visual layout.

src/dialogs/colors.c
@@ -194,8 +194,9 @@ @@ -194,8 +194,9 @@
194 194
195 static void V3270ColorSelection_init(V3270ColorSelection *widget) 195 static void V3270ColorSelection_init(V3270ColorSelection *widget)
196 { 196 {
197 - gtk_grid_set_row_spacing(GTK_GRID(widget),5);  
198 - gtk_grid_set_column_spacing(GTK_GRID(widget),5); 197 + // https://developer.gnome.org/hig/stable/visual-layout.html.en
  198 + gtk_grid_set_row_spacing(GTK_GRID(widget),6);
  199 + gtk_grid_set_column_spacing(GTK_GRID(widget),12);
199 200
200 { 201 {
201 // Create colors list view. 202 // Create colors list view.
src/dialogs/commondialog.c
@@ -52,16 +52,21 @@ static GtkWidget * create_button(GtkWidget *dialog, const gchar *mnemonic, GCall @@ -52,16 +52,21 @@ static GtkWidget * create_button(GtkWidget *dialog, const gchar *mnemonic, GCall
52 52
53 LIB3270_EXPORT GtkWidget * v3270_dialog_new(const gchar *title, GtkWindow *parent, const gchar *apply) 53 LIB3270_EXPORT GtkWidget * v3270_dialog_new(const gchar *title, GtkWindow *parent, const gchar *apply)
54 { 54 {
  55 + gboolean use_header;
  56 + g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);
  57 +
55 GtkWidget * dialog = 58 GtkWidget * dialog =
56 GTK_WIDGET(g_object_new( 59 GTK_WIDGET(g_object_new(
57 GTK_TYPE_DIALOG, 60 GTK_TYPE_DIALOG,
58 - "use-header-bar", 1, 61 + "use-header-bar", (use_header ? 1 : 0),
59 NULL 62 NULL
60 )); 63 ));
61 64
62 gtk_window_set_title(GTK_WINDOW(dialog), title); 65 gtk_window_set_title(GTK_WINDOW(dialog), title);
63 gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); 66 gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
64 - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),10); 67 +
  68 + // https://developer.gnome.org/hig/stable/visual-layout.html.en
  69 + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),18);
65 70
66 if(parent) 71 if(parent)
67 { 72 {
@@ -72,9 +77,20 @@ LIB3270_EXPORT GtkWidget * v3270_dialog_new(const gchar *title, GtkWindow *paren @@ -72,9 +77,20 @@ LIB3270_EXPORT GtkWidget * v3270_dialog_new(const gchar *title, GtkWindow *paren
72 77
73 GtkWidget * header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); 78 GtkWidget * header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
74 79
75 - // Cancel button  
76 - gtk_header_bar_pack_start(GTK_HEADER_BAR(header),create_button(dialog,_("_Cancel"),G_CALLBACK(cancel_clicked)));  
77 - gtk_header_bar_pack_end(GTK_HEADER_BAR(header),create_button(dialog,apply,G_CALLBACK(apply_clicked))); 80 + if(header)
  81 + {
  82 + gtk_header_bar_pack_start(GTK_HEADER_BAR(header),create_button(dialog,_("_Cancel"),G_CALLBACK(cancel_clicked)));
  83 + gtk_header_bar_pack_end(GTK_HEADER_BAR(header),create_button(dialog,apply,G_CALLBACK(apply_clicked)));
  84 + }
  85 + else
  86 + {
  87 + gtk_dialog_add_buttons(
  88 + GTK_DIALOG (dialog),
  89 + _("_Cancel"), GTK_RESPONSE_CANCEL,
  90 + apply, GTK_RESPONSE_APPLY,
  91 + NULL
  92 + );
  93 + }
78 94
79 return dialog; 95 return dialog;
80 } 96 }
src/dialogs/hostselect.c
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 ENTRY_COUNT 51 ENTRY_COUNT
52 }; 52 };
53 53
54 - static const gchar *comboLabel[] = { N_("System _type:"), N_("_Color table:") }; 54 + static const gchar *comboLabel[] = { N_("System _type"), N_("_Color table") };
55 55
56 struct _V3270HostSelectWidget 56 struct _V3270HostSelectWidget
57 { 57 {
@@ -118,22 +118,22 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -118,22 +118,22 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
118 { 118 {
119 int f; 119 int f;
120 120
121 - gtk_container_set_border_width(GTK_CONTAINER(widget),10);  
122 -  
123 - gtk_grid_set_row_spacing(GTK_GRID(widget),5);  
124 - gtk_grid_set_column_spacing(GTK_GRID(widget),10); 121 + // https://developer.gnome.org/hig/stable/visual-layout.html.en
  122 + gtk_container_set_border_width(GTK_CONTAINER(widget),18);
  123 + gtk_grid_set_row_spacing(GTK_GRID(widget),6);
  124 + gtk_grid_set_column_spacing(GTK_GRID(widget),12);
125 125
126 // Entry fields 126 // Entry fields
127 GtkWidget * label[ENTRY_COUNT] = 127 GtkWidget * label[ENTRY_COUNT] =
128 { 128 {
129 - gtk_label_new_with_mnemonic( _( "_Host:" ) ),  
130 - gtk_label_new_with_mnemonic( _( "_Service:" ) ) 129 + gtk_label_new_with_mnemonic( _( "_Host" ) ),
  130 + gtk_label_new_with_mnemonic( _( "_Service" ) )
131 }; 131 };
132 132
133 for(f=0;f<ENTRY_COUNT;f++) 133 for(f=0;f<ENTRY_COUNT;f++)
134 { 134 {
135 widget->input.entry[f] = GTK_ENTRY(gtk_entry_new()); 135 widget->input.entry[f] = GTK_ENTRY(gtk_entry_new());
136 - gtk_widget_set_halign(label[f],GTK_ALIGN_START); 136 + gtk_widget_set_halign(label[f],GTK_ALIGN_END);
137 gtk_label_set_mnemonic_widget(GTK_LABEL(label[f]),GTK_WIDGET(widget->input.entry[f])); 137 gtk_label_set_mnemonic_widget(GTK_LABEL(label[f]),GTK_WIDGET(widget->input.entry[f]));
138 } 138 }
139 139
@@ -213,7 +213,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -213,7 +213,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
213 for(f=0;f< (int) G_N_ELEMENTS(comboLabel);f++) 213 for(f=0;f< (int) G_N_ELEMENTS(comboLabel);f++)
214 { 214 {
215 GtkWidget *label = gtk_label_new_with_mnemonic(gettext(comboLabel[f])); 215 GtkWidget *label = gtk_label_new_with_mnemonic(gettext(comboLabel[f]));
216 - gtk_widget_set_halign(label,GTK_ALIGN_START); 216 + gtk_widget_set_halign(label,GTK_ALIGN_END);
217 gtk_grid_attach(GTK_GRID(widget),label,0,f+2,1,1); 217 gtk_grid_attach(GTK_GRID(widget),label,0,f+2,1,1);
218 gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.combo[f]),1,f+2,2,1); 218 gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.combo[f]),1,f+2,2,1);
219 } 219 }
src/dialogs/print/print.c
@@ -84,8 +84,8 @@ @@ -84,8 +84,8 @@
84 { 84 {
85 static const gchar * text[] = 85 static const gchar * text[] =
86 { 86 {
87 - N_( "_Font:" ),  
88 - N_( "C_olor scheme:" ) 87 + N_( "_Font" ),
  88 + N_( "C_olor scheme" )
89 }; 89 };
90 90
91 size_t f; 91 size_t f;
@@ -102,9 +102,10 @@ @@ -102,9 +102,10 @@
102 GtkWidget * color = v3270_color_scheme_new(); 102 GtkWidget * color = v3270_color_scheme_new();
103 GtkWidget * selected = gtk_check_button_new_with_label( _("Print selection box") ); 103 GtkWidget * selected = gtk_check_button_new_with_label( _("Print selection box") );
104 104
105 - gtk_container_set_border_width(GTK_CONTAINER(grid),10);  
106 - gtk_grid_set_row_spacing(grid,5);  
107 - gtk_grid_set_column_spacing(grid,5); 105 + // https://developer.gnome.org/hig/stable/visual-layout.html.en
  106 + gtk_container_set_border_width(GTK_CONTAINER(grid),18);
  107 + gtk_grid_set_row_spacing(grid,6);
  108 + gtk_grid_set_column_spacing(grid,12);
108 109
109 v3270_color_scheme_set_rgba(color,operation->colors); 110 v3270_color_scheme_set_rgba(color,operation->colors);
110 g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),operation); 111 g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),operation);
@@ -115,7 +116,7 @@ @@ -115,7 +116,7 @@
115 for(f=0;f<G_N_ELEMENTS(text);f++) 116 for(f=0;f<G_N_ELEMENTS(text);f++)
116 { 117 {
117 GtkWidget *label = gtk_label_new_with_mnemonic(gettext(text[f])); 118 GtkWidget *label = gtk_label_new_with_mnemonic(gettext(text[f]));
118 - gtk_label_set_xalign(GTK_LABEL(label),0); 119 + gtk_widget_set_halign(label,GTK_ALIGN_END);
119 gtk_grid_attach(grid,label,0,f,1,1); 120 gtk_grid_attach(grid,label,0,f,1,1);
120 } 121 }
121 122