diff --git a/src/include/pw3270/settings.h b/src/include/pw3270/settings.h index 49b1df4..e3942b8 100644 --- a/src/include/pw3270/settings.h +++ b/src/include/pw3270/settings.h @@ -87,7 +87,7 @@ typedef struct _PW3270SettingsDialogClass PW3270SettingsDialogClass; GType PW3270SettingsDialog_get_type(void); - GtkWidget * pw3270_settings_dialog_new(); + GtkWidget * pw3270_settings_dialog_new(GAction *action); G_END_DECLS diff --git a/src/objects/application/actions/preferences.c b/src/objects/application/actions/preferences.c index 0b26052..b1a3c33 100644 --- a/src/objects/application/actions/preferences.c +++ b/src/objects/application/actions/preferences.c @@ -34,10 +34,13 @@ #include #include - static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication G_GNUC_UNUSED(*application)) { + +// gtk_window_set_title(GTK_WINDOW(dialog),action->label); + + static GtkWidget * factory(PW3270Action * action, GtkApplication G_GNUC_UNUSED(*application)) { size_t ix; - GtkWidget * dialog = pw3270_settings_dialog_new(); + GtkWidget * dialog = pw3270_settings_dialog_new(G_ACTION(action)); GtkWidget * pages[] = { pw3270_toolbar_settings_new() diff --git a/src/objects/settings/dialog.c b/src/objects/settings/dialog.c index 1b0d390..31ac88c 100644 --- a/src/objects/settings/dialog.c +++ b/src/objects/settings/dialog.c @@ -29,6 +29,7 @@ #include #include + #include #include #include @@ -93,7 +94,7 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) } -GtkWidget * pw3270_settings_dialog_new() { +GtkWidget * pw3270_settings_dialog_new(GAction *action) { #if GTK_CHECK_VERSION(3,12,0) gboolean use_header; @@ -112,6 +113,14 @@ GtkWidget * pw3270_settings_dialog_new() { #endif // GTK 3.12 + if(action) { + + if(PW3270_IS_ACTION(action)) { + gtk_window_set_title(GTK_WINDOW(dialog),PW3270_ACTION(action)->label); + } + + } + return dialog; } @@ -187,13 +196,22 @@ void page_changed(GtkNotebook *notebook, GtkWidget G_GNUC_UNUSED(*child), guint gtk_notebook_set_show_tabs(notebook,gtk_notebook_get_n_pages(notebook) > 1); } -void switch_page(GtkNotebook G_GNUC_UNUSED(*notebook), PW3270Settings *page, guint G_GNUC_UNUSED(page_num), PW3270SettingsDialog *dialog) { +void switch_page(GtkNotebook *notebook, PW3270Settings *page, guint G_GNUC_UNUSED(page_num), PW3270SettingsDialog *dialog) { + + if(gtk_notebook_get_n_pages(notebook) > 1) { - GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); + GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); + + if(header_bar) { + gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); + } + + } else if(page->title) { + + gtk_window_set_title(GTK_WINDOW(dialog),page->title); - if(header_bar) { - gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); } + } -- libgit2 0.21.2