Commit b9c4d07f4169a6fb43783fab72ec8879f0d63c12

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

Using subtitles in the settings dialog.

src/dialogs/settings/accelerator.c
... ... @@ -234,7 +234,7 @@ LIB3270_EXPORT GtkWidget * v3270_accelerator_settings_new()
234 234 {
235 235 V3270Settings * settings = GTK_V3270_SETTINGS(g_object_new(GTK_TYPE_V3270_ACCELERATOR_SETTINGS, NULL));
236 236  
237   - settings->title = _("Accelerator properties");
  237 + settings->title = _("Keyboard accelerators");
238 238 settings->label = _("Accelerators");
239 239  
240 240 return GTK_WIDGET(settings);
... ...
src/dialogs/settings/dialog.c
... ... @@ -37,7 +37,8 @@
37 37  
38 38 /*--[ Implement ]------------------------------------------------------------------------------------*/
39 39  
40   -static gboolean on_tab_focus(V3270Settings *settings, GdkEvent G_GNUC_UNUSED(*event), GtkWindow *dialog)
  40 +/*
  41 +static gboolean on_tab_focus(V3270Settings *settings, GdkEvent G_GNUC_UNUSED(*event), V3270SettingsDialog *dialog)
41 42 {
42 43 debug("title: %s",settings->title);
43 44 debug("label: %s",settings->label);
... ... @@ -47,6 +48,21 @@ static gboolean on_tab_focus(V3270Settings *settings, GdkEvent G_GNUC_UNUSED(*ev
47 48  
48 49 return FALSE;
49 50 }
  51 +*/
  52 +
  53 +void on_switch_page(GtkNotebook *notebook, V3270Settings *settings, guint page_num, V3270SettingsDialog *dialog)
  54 +{
  55 + debug("title: %s",settings->title);
  56 + debug("label: %s",settings->label);
  57 +
  58 + if(dialog->has_subtitle) {
  59 + GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
  60 + if(header_bar) {
  61 + gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),settings->title);
  62 + }
  63 + }
  64 +
  65 +}
50 66  
51 67 static void check_valid(GtkWidget *widget, gboolean *valid)
52 68 {
... ... @@ -85,7 +101,7 @@ static void add(GtkContainer *container, GtkWidget *widget)
85 101 {
86 102 g_return_if_fail(GTK_IS_V3270_SETTINGS(widget));
87 103  
88   - debug("Added settings dialog %p",widget);
  104 + debug("*************************** Added settings dialog %p",widget);
89 105  
90 106 // https://developer.gnome.org/hig/stable/visual-layout.html.en
91 107 gtk_container_set_border_width(GTK_CONTAINER(widget),18);
... ... @@ -106,7 +122,7 @@ static void add(GtkContainer *container, GtkWidget *widget)
106 122 label
107 123 );
108 124  
109   - g_signal_connect(G_OBJECT(widget), "focus-in-event", G_CALLBACK(on_tab_focus), container);
  125 +// g_signal_connect(G_OBJECT(widget), "focus-in-event", G_CALLBACK(on_tab_focus), container);
110 126 g_signal_connect(G_OBJECT(widget), "validity", G_CALLBACK(on_validity), container);
111 127  
112 128  
... ... @@ -183,6 +199,9 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog)
183 199 {
184 200 GtkWidget * content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
185 201  
  202 + // Get use of header bar.
  203 + g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &dialog->has_subtitle, NULL);
  204 +
186 205 // https://developer.gnome.org/hig/stable/visual-layout.html.en
187 206 //gtk_box_set_spacing(GTK_BOX(content_area),18);
188 207 //gtk_container_set_border_width(GTK_CONTAINER(content_area),18);
... ... @@ -205,8 +224,10 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog)
205 224 gtk_notebook_set_show_border(dialog->tabs, FALSE);
206 225 g_signal_connect(G_OBJECT(dialog->tabs), "page-added", G_CALLBACK(on_page_changed), dialog);
207 226 g_signal_connect(G_OBJECT(dialog->tabs), "page-removed", G_CALLBACK(on_page_changed), dialog);
  227 + g_signal_connect(G_OBJECT(dialog->tabs), "switch-page", G_CALLBACK(on_switch_page), dialog);
208 228 gtk_box_pack_start(GTK_BOX(content_area),GTK_WIDGET(dialog->tabs),TRUE,TRUE,0);
209 229  
  230 +
210 231 }
211 232  
212 233 GtkWidget * v3270_settings_dialog_new()
... ... @@ -254,6 +275,12 @@ void v3270_settings_dialog_set_terminal_widget(GtkWidget *widget, GtkWidget *ter
254 275 );
255 276 }
256 277  
  278 +void v3270_settings_dialog_set_has_subtitle(GtkWidget *widget, gboolean has_subtitle)
  279 +{
  280 + g_return_if_fail(GTK_IS_V3270_SETTINGS_DIALOG(widget));
  281 + GTK_V3270_SETTINGS_DIALOG(widget)->has_subtitle = has_subtitle;
  282 +}
  283 +
257 284 void v3270_setttings_dialog_response(GtkDialog *dialog, gint response_id, GtkWidget G_GNUC_UNUSED(*terminal))
258 285 {
259 286 switch(response_id)
... ...
src/dialogs/settings/host.c
... ... @@ -610,7 +610,7 @@ LIB3270_EXPORT GtkWidget * v3270_host_settings_new()
610 610 {
611 611 V3270Settings * settings = GTK_V3270_SETTINGS(g_object_new(GTK_TYPE_V3270HostSelectWidget, NULL));
612 612  
613   - settings->title = _("Host properties");
  613 + settings->title = _("Host settings");
614 614 settings->label = _("Host");
615 615  
616 616 return GTK_WIDGET(settings);
... ... @@ -628,6 +628,8 @@ LIB3270_EXPORT void v3270_select_host(GtkWidget *widget)
628 628 GtkWidget * dialog = v3270_settings_dialog_new();
629 629 GtkWidget * settings = v3270_host_settings_new();
630 630  
  631 + v3270_settings_dialog_set_has_subtitle(dialog,FALSE);
  632 +
631 633 gtk_window_set_title(GTK_WINDOW(dialog), v3270_settings_get_title(settings));
632 634 gtk_container_add(GTK_CONTAINER(dialog), settings);
633 635  
... ...
src/include/v3270/settings.h
... ... @@ -117,6 +117,7 @@
117 117 GtkDialog parent;
118 118 GtkNotebook * tabs;
119 119 GtkWidget * terminal;
  120 + gboolean has_subtitle;
120 121 } V3270SettingsDialog;
121 122  
122 123 typedef struct _V3270SettingsDialogClass {
... ... @@ -127,6 +128,7 @@
127 128  
128 129 LIB3270_EXPORT GtkWidget * v3270_settings_dialog_new();
129 130 LIB3270_EXPORT void v3270_settings_dialog_set_terminal_widget(GtkWidget *widget, GtkWidget *terminal);
  131 + LIB3270_EXPORT void v3270_settings_dialog_set_has_subtitle(GtkWidget *widget, gboolean has_subtitle);
130 132  
131 133 /// @brief Process GtkDialog's "response" signal.
132 134 LIB3270_EXPORT void v3270_setttings_dialog_response(GtkDialog *dialog, gint response_id, GtkWidget *terminal);
... ...