Commit 4be60cbe2de31d0623ab0d919670a30cb359566f
1 parent
7c91971f
Exists in
master
and in
4 other branches
Small fixes in the application settings dialogs.
Showing
3 changed files
with
29 additions
and
8 deletions
Show diff stats
src/include/pw3270/settings.h
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | typedef struct _PW3270SettingsDialogClass PW3270SettingsDialogClass; | 87 | typedef struct _PW3270SettingsDialogClass PW3270SettingsDialogClass; |
88 | 88 | ||
89 | GType PW3270SettingsDialog_get_type(void); | 89 | GType PW3270SettingsDialog_get_type(void); |
90 | - GtkWidget * pw3270_settings_dialog_new(); | 90 | + GtkWidget * pw3270_settings_dialog_new(GAction *action); |
91 | 91 | ||
92 | G_END_DECLS | 92 | G_END_DECLS |
93 | 93 |
src/objects/application/actions/preferences.c
@@ -34,10 +34,13 @@ | @@ -34,10 +34,13 @@ | ||
34 | #include <pw3270/settings.h> | 34 | #include <pw3270/settings.h> |
35 | #include <pw3270/toolbar.h> | 35 | #include <pw3270/toolbar.h> |
36 | 36 | ||
37 | - static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication G_GNUC_UNUSED(*application)) { | 37 | + |
38 | +// gtk_window_set_title(GTK_WINDOW(dialog),action->label); | ||
39 | + | ||
40 | + static GtkWidget * factory(PW3270Action * action, GtkApplication G_GNUC_UNUSED(*application)) { | ||
38 | 41 | ||
39 | size_t ix; | 42 | size_t ix; |
40 | - GtkWidget * dialog = pw3270_settings_dialog_new(); | 43 | + GtkWidget * dialog = pw3270_settings_dialog_new(G_ACTION(action)); |
41 | 44 | ||
42 | GtkWidget * pages[] = { | 45 | GtkWidget * pages[] = { |
43 | pw3270_toolbar_settings_new() | 46 | pw3270_toolbar_settings_new() |
src/objects/settings/dialog.c
@@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
29 | 29 | ||
30 | #include <pw3270.h> | 30 | #include <pw3270.h> |
31 | #include <pw3270/settings.h> | 31 | #include <pw3270/settings.h> |
32 | + #include <pw3270/actions.h> | ||
32 | #include <lib3270.h> | 33 | #include <lib3270.h> |
33 | #include <lib3270/log.h> | 34 | #include <lib3270/log.h> |
34 | 35 | ||
@@ -93,7 +94,7 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) | @@ -93,7 +94,7 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) | ||
93 | 94 | ||
94 | } | 95 | } |
95 | 96 | ||
96 | -GtkWidget * pw3270_settings_dialog_new() { | 97 | +GtkWidget * pw3270_settings_dialog_new(GAction *action) { |
97 | #if GTK_CHECK_VERSION(3,12,0) | 98 | #if GTK_CHECK_VERSION(3,12,0) |
98 | 99 | ||
99 | gboolean use_header; | 100 | gboolean use_header; |
@@ -112,6 +113,14 @@ GtkWidget * pw3270_settings_dialog_new() { | @@ -112,6 +113,14 @@ GtkWidget * pw3270_settings_dialog_new() { | ||
112 | 113 | ||
113 | #endif // GTK 3.12 | 114 | #endif // GTK 3.12 |
114 | 115 | ||
116 | + if(action) { | ||
117 | + | ||
118 | + if(PW3270_IS_ACTION(action)) { | ||
119 | + gtk_window_set_title(GTK_WINDOW(dialog),PW3270_ACTION(action)->label); | ||
120 | + } | ||
121 | + | ||
122 | + } | ||
123 | + | ||
115 | return dialog; | 124 | return dialog; |
116 | 125 | ||
117 | } | 126 | } |
@@ -187,13 +196,22 @@ void page_changed(GtkNotebook *notebook, GtkWidget G_GNUC_UNUSED(*child), guint | @@ -187,13 +196,22 @@ void page_changed(GtkNotebook *notebook, GtkWidget G_GNUC_UNUSED(*child), guint | ||
187 | gtk_notebook_set_show_tabs(notebook,gtk_notebook_get_n_pages(notebook) > 1); | 196 | gtk_notebook_set_show_tabs(notebook,gtk_notebook_get_n_pages(notebook) > 1); |
188 | } | 197 | } |
189 | 198 | ||
190 | -void switch_page(GtkNotebook G_GNUC_UNUSED(*notebook), PW3270Settings *page, guint G_GNUC_UNUSED(page_num), PW3270SettingsDialog *dialog) { | 199 | +void switch_page(GtkNotebook *notebook, PW3270Settings *page, guint G_GNUC_UNUSED(page_num), PW3270SettingsDialog *dialog) { |
200 | + | ||
201 | + if(gtk_notebook_get_n_pages(notebook) > 1) { | ||
191 | 202 | ||
192 | - GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); | 203 | + GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); |
204 | + | ||
205 | + if(header_bar) { | ||
206 | + gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); | ||
207 | + } | ||
208 | + | ||
209 | + } else if(page->title) { | ||
210 | + | ||
211 | + gtk_window_set_title(GTK_WINDOW(dialog),page->title); | ||
193 | 212 | ||
194 | - if(header_bar) { | ||
195 | - gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); | ||
196 | } | 213 | } |
197 | 214 | ||
215 | + | ||
198 | } | 216 | } |
199 | 217 |