Commit dbbac7ef52ee1389a2c2cde4f257cdff4bcaafc3
1 parent
825ada0c
Exists in
master
and in
2 other branches
Toolbar visual adjustments.
Showing
11 changed files
with
45 additions
and
30 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(GAction *action); | 90 | + GtkWidget * pw3270_settings_dialog_new(GAction *action, gboolean has_subtitle); |
91 | 91 | ||
92 | G_END_DECLS | 92 | G_END_DECLS |
93 | 93 |
src/objects/actions/save.c
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | action->name = "save.session.as"; | 49 | action->name = "save.session.as"; |
50 | action->label = _("Save As"); | 50 | action->label = _("Save As"); |
51 | action->icon_name = "document-save-as"; | 51 | action->icon_name = "document-save-as"; |
52 | - action->tooltip = _("Save session properties"); | 52 | + action->tooltip = _("Save session preferences"); |
53 | 53 | ||
54 | return G_ACTION(action); | 54 | return G_ACTION(action); |
55 | 55 |
src/objects/application/actions/preferences.c
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | 38 | ||
39 | size_t ix; | 39 | size_t ix; |
40 | GtkWindow * window = gtk_application_get_active_window(application); | 40 | GtkWindow * window = gtk_application_get_active_window(application); |
41 | - GtkWidget * dialog = pw3270_settings_dialog_new(G_ACTION(action)); | 41 | + GtkWidget * dialog = pw3270_settings_dialog_new(G_ACTION(action),TRUE); |
42 | 42 | ||
43 | gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); | 43 | gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
44 | gtk_window_set_attached_to(GTK_WINDOW(dialog), GTK_WIDGET(window)); | 44 | gtk_window_set_attached_to(GTK_WINDOW(dialog), GTK_WIDGET(window)); |
@@ -75,6 +75,7 @@ | @@ -75,6 +75,7 @@ | ||
75 | action->name = "preferences"; | 75 | action->name = "preferences"; |
76 | action->label = _("Application preferences"); | 76 | action->label = _("Application preferences"); |
77 | action->icon_name = "preferences-system"; | 77 | action->icon_name = "preferences-system"; |
78 | + action->tooltip = _("Change the application preferences"); | ||
78 | 79 | ||
79 | return G_ACTION(action); | 80 | return G_ACTION(action); |
80 | } | 81 | } |
src/objects/application/open.c
@@ -118,8 +118,6 @@ | @@ -118,8 +118,6 @@ | ||
118 | 118 | ||
119 | if(filename) { | 119 | if(filename) { |
120 | 120 | ||
121 | - g_message("Using \"%s\" for session properties",filename); | ||
122 | - | ||
123 | if(!window) { | 121 | if(!window) { |
124 | window = pw3270_application_window_new(GTK_APPLICATION(application), filename); | 122 | window = pw3270_application_window_new(GTK_APPLICATION(application), filename); |
125 | } else { | 123 | } else { |
src/objects/settings/dialog.c
@@ -97,7 +97,7 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) | @@ -97,7 +97,7 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) | ||
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | -GtkWidget * pw3270_settings_dialog_new(GAction *action) { | 100 | +GtkWidget * pw3270_settings_dialog_new(GAction *action, gboolean has_subtitle) { |
101 | 101 | ||
102 | #ifdef _WIN32 | 102 | #ifdef _WIN32 |
103 | 103 | ||
@@ -110,7 +110,7 @@ GtkWidget * pw3270_settings_dialog_new(GAction *action) { | @@ -110,7 +110,7 @@ GtkWidget * pw3270_settings_dialog_new(GAction *action) { | ||
110 | 110 | ||
111 | #elif GTK_CHECK_VERSION(3,12,0) | 111 | #elif GTK_CHECK_VERSION(3,12,0) |
112 | 112 | ||
113 | - gboolean use_header; | 113 | + gboolean use_header = FALSE; |
114 | g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL); | 114 | g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL); |
115 | 115 | ||
116 | GtkWidget * dialog = | 116 | GtkWidget * dialog = |
@@ -126,6 +126,8 @@ GtkWidget * pw3270_settings_dialog_new(GAction *action) { | @@ -126,6 +126,8 @@ GtkWidget * pw3270_settings_dialog_new(GAction *action) { | ||
126 | 126 | ||
127 | #endif // GTK 3.12 | 127 | #endif // GTK 3.12 |
128 | 128 | ||
129 | + GTK_PW3270_SETTINGS_DIALOG(dialog)->has_subtitle = has_subtitle; | ||
130 | + | ||
129 | if(action) { | 131 | if(action) { |
130 | 132 | ||
131 | if(PW3270_IS_ACTION(action)) { | 133 | if(PW3270_IS_ACTION(action)) { |
@@ -214,7 +216,7 @@ void switch_page(GtkNotebook *notebook, PW3270Settings *page, guint G_GNUC_UNUSE | @@ -214,7 +216,7 @@ void switch_page(GtkNotebook *notebook, PW3270Settings *page, guint G_GNUC_UNUSE | ||
214 | 216 | ||
215 | GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); | 217 | GtkWidget * header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); |
216 | 218 | ||
217 | - if(header_bar) { | 219 | + if(header_bar && dialog->has_subtitle) { |
218 | gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); | 220 | gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),page->title); |
219 | } | 221 | } |
220 | 222 |
src/objects/toolbar/actions.c
@@ -65,24 +65,35 @@ | @@ -65,24 +65,35 @@ | ||
65 | 65 | ||
66 | if(!action) { | 66 | if(!action) { |
67 | const gchar *ptr = strchr(name,'.'); | 67 | const gchar *ptr = strchr(name,'.'); |
68 | - | ||
69 | if(ptr) { | 68 | if(ptr) { |
70 | action = g_action_map_lookup_action(G_ACTION_MAP(window), ptr+1); | 69 | action = g_action_map_lookup_action(G_ACTION_MAP(window), ptr+1); |
71 | } | 70 | } |
71 | + } | ||
72 | 72 | ||
73 | + if(!action) { | ||
74 | + action = g_action_map_lookup_action(G_ACTION_MAP(g_application_get_default()),name); | ||
75 | + } | ||
76 | + | ||
77 | + if(!action) { | ||
78 | + const gchar *ptr = strchr(name,'.'); | ||
79 | + if(ptr) { | ||
80 | + action = g_action_map_lookup_action(G_ACTION_MAP(g_application_get_default()), ptr+1); | ||
81 | + } | ||
73 | } | 82 | } |
74 | 83 | ||
75 | debug("%s(%s)=%p",__FUNCTION__,name,action); | 84 | debug("%s(%s)=%p",__FUNCTION__,name,action); |
76 | 85 | ||
77 | - if(action) { | ||
78 | - debug("Creating button \"%s\" from action \"%s\"",name,g_action_get_name(G_ACTION(action))); | ||
79 | - item = gtk_tool_button_new_from_action( | ||
80 | - action, | ||
81 | - GTK_ICON_SIZE_LARGE_TOOLBAR, | ||
82 | - pw3270_toolbar_get_icon_type(GTK_TOOLBAR(toolbar)) == 1 | ||
83 | - ); | 86 | + if(!action) { |
87 | + g_warning("Can't find action \"%s\"",name); | ||
88 | + return NULL; | ||
84 | } | 89 | } |
85 | 90 | ||
91 | + item = gtk_tool_button_new_from_action( | ||
92 | + action, | ||
93 | + GTK_ICON_SIZE_LARGE_TOOLBAR, | ||
94 | + pw3270_toolbar_get_icon_type(GTK_TOOLBAR(toolbar)) == 1 | ||
95 | + ); | ||
96 | + | ||
86 | if(item) { | 97 | if(item) { |
87 | 98 | ||
88 | gtk_widget_show_all(GTK_WIDGET(item)); | 99 | gtk_widget_show_all(GTK_WIDGET(item)); |
src/objects/toolbar/toolbar.c
@@ -257,10 +257,10 @@ | @@ -257,10 +257,10 @@ | ||
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | - static void open_properties(GtkMenuItem G_GNUC_UNUSED(*menuitem), GtkWidget *toolbar) { | 260 | + static void open_preferences(GtkMenuItem G_GNUC_UNUSED(*menuitem), GtkWidget *toolbar) { |
261 | 261 | ||
262 | GtkWidget * window = gtk_widget_get_toplevel(toolbar); | 262 | GtkWidget * window = gtk_widget_get_toplevel(toolbar); |
263 | - GtkWidget * dialog = pw3270_settings_dialog_new(NULL); | 263 | + GtkWidget * dialog = pw3270_settings_dialog_new(NULL,FALSE); |
264 | 264 | ||
265 | gtk_container_add(GTK_CONTAINER(dialog),pw3270_toolbar_settings_new()); | 265 | gtk_container_add(GTK_CONTAINER(dialog),pw3270_toolbar_settings_new()); |
266 | 266 | ||
@@ -269,6 +269,8 @@ | @@ -269,6 +269,8 @@ | ||
269 | gtk_window_set_attached_to(GTK_WINDOW(dialog), window); | 269 | gtk_window_set_attached_to(GTK_WINDOW(dialog), window); |
270 | gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(window)); | 270 | gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(window)); |
271 | 271 | ||
272 | + gtk_window_set_title(GTK_WINDOW(dialog),_("Setup toolbar")); | ||
273 | + | ||
272 | gtk_widget_show_all(dialog); | 274 | gtk_widget_show_all(dialog); |
273 | 275 | ||
274 | } | 276 | } |
@@ -325,11 +327,11 @@ | @@ -325,11 +327,11 @@ | ||
325 | 327 | ||
326 | } | 328 | } |
327 | 329 | ||
328 | - // Toolbar properties. | 330 | + // Toolbar preferences. |
329 | { | 331 | { |
330 | - GtkWidget * item = gtk_menu_item_new_with_mnemonic( _("_Properties") ); | 332 | + GtkWidget * item = gtk_menu_item_new_with_mnemonic( _("_Preferences") ); |
331 | gtk_menu_shell_append(GTK_MENU_SHELL(widget->popup.menu),item); | 333 | gtk_menu_shell_append(GTK_MENU_SHELL(widget->popup.menu),item); |
332 | - g_signal_connect(item, "activate", G_CALLBACK(open_properties), widget); | 334 | + g_signal_connect(item, "activate", G_CALLBACK(open_preferences), widget); |
333 | } | 335 | } |
334 | 336 | ||
335 | // gtk_container_set_border_width(GTK_CONTAINER(widget->popup_menu),6); | 337 | // gtk_container_set_border_width(GTK_CONTAINER(widget->popup_menu),6); |
src/objects/window/actions/sessionproperties.c
@@ -43,7 +43,8 @@ | @@ -43,7 +43,8 @@ | ||
43 | 43 | ||
44 | action->name = "session.properties"; | 44 | action->name = "session.properties"; |
45 | action->icon_name = "preferences-other"; | 45 | action->icon_name = "preferences-other"; |
46 | - action->label = _("Session properties"); | 46 | + action->label = _("Session preferences"); |
47 | + action->tooltip = _("Change the preferences for the active session"); | ||
47 | 48 | ||
48 | return G_ACTION(action); | 49 | return G_ACTION(action); |
49 | } | 50 | } |
src/objects/window/keyfile.c
@@ -97,7 +97,7 @@ | @@ -97,7 +97,7 @@ | ||
97 | if(!g_key_file_load_from_file(new_session->key_file,new_session->filename,G_KEY_FILE_NONE,error)) { | 97 | if(!g_key_file_load_from_file(new_session->key_file,new_session->filename,G_KEY_FILE_NONE,error)) { |
98 | g_warning("Can't load \"%s\"",new_session->filename); | 98 | g_warning("Can't load \"%s\"",new_session->filename); |
99 | } else { | 99 | } else { |
100 | - g_message("Loading session properties from %s",new_session->filename); | 100 | + g_message("Loading session preferences from %s",new_session->filename); |
101 | } | 101 | } |
102 | 102 | ||
103 | } else { | 103 | } else { |
@@ -109,7 +109,7 @@ | @@ -109,7 +109,7 @@ | ||
109 | if(!g_key_file_load_from_file(new_session->key_file,default_settings,G_KEY_FILE_NONE,error)) { | 109 | if(!g_key_file_load_from_file(new_session->key_file,default_settings,G_KEY_FILE_NONE,error)) { |
110 | g_warning("Can't load \"%s\"",default_settings); | 110 | g_warning("Can't load \"%s\"",default_settings); |
111 | } else { | 111 | } else { |
112 | - g_message("Loading session properties from %s",default_settings); | 112 | + g_message("Loading session preferences from %s",default_settings); |
113 | } | 113 | } |
114 | } else { | 114 | } else { |
115 | #ifdef DEBUG | 115 | #ifdef DEBUG |
ui/application.xml
@@ -160,7 +160,7 @@ | @@ -160,7 +160,7 @@ | ||
160 | </item> | 160 | </item> |
161 | 161 | ||
162 | <item> | 162 | <item> |
163 | - <attribute name="label" translatable="yes">Session properties</attribute> | 163 | + <attribute name="label" translatable="yes">Session preferences</attribute> |
164 | <attribute name="action">win.save.session.as</attribute> | 164 | <attribute name="action">win.save.session.as</attribute> |
165 | </item> | 165 | </item> |
166 | 166 |
ui/window.xml
@@ -95,7 +95,7 @@ | @@ -95,7 +95,7 @@ | ||
95 | </item> | 95 | </item> |
96 | 96 | ||
97 | <item> | 97 | <item> |
98 | - <attribute name="label" translatable="yes">Session properties</attribute> | 98 | + <attribute name="label" translatable="yes">Session preferences</attribute> |
99 | <attribute name="action">win.save.session.as</attribute> | 99 | <attribute name="action">win.save.session.as</attribute> |
100 | </item> | 100 | </item> |
101 | 101 | ||
@@ -381,7 +381,7 @@ | @@ -381,7 +381,7 @@ | ||
381 | <attribute name="label" translatable="yes">Dynamic font spacing</attribute> | 381 | <attribute name="label" translatable="yes">Dynamic font spacing</attribute> |
382 | <attribute name="action">win.dynamic-font-spacing</attribute> | 382 | <attribute name="action">win.dynamic-font-spacing</attribute> |
383 | </item> | 383 | </item> |
384 | - | 384 | + |
385 | <section> | 385 | <section> |
386 | 386 | ||
387 | <item> | 387 | <item> |
@@ -460,7 +460,7 @@ | @@ -460,7 +460,7 @@ | ||
460 | </item> | 460 | </item> |
461 | 461 | ||
462 | </section> | 462 | </section> |
463 | - | 463 | + |
464 | </menu> | 464 | </menu> |
465 | 465 | ||
466 | <menu id="popup-over-oia"> | 466 | <menu id="popup-over-oia"> |
@@ -527,7 +527,7 @@ | @@ -527,7 +527,7 @@ | ||
527 | 527 | ||
528 | </submenu> | 528 | </submenu> |
529 | 529 | ||
530 | - <submenu id="view-when-offline-placeholder"> | 530 | + <submenu id="view-when-offline-placeholder"> |
531 | 531 | ||
532 | <attribute name='label' translatable='yes'>View</attribute> | 532 | <attribute name='label' translatable='yes'>View</attribute> |
533 | 533 | ||
@@ -551,7 +551,7 @@ | @@ -551,7 +551,7 @@ | ||
551 | </item> | 551 | </item> |
552 | 552 | ||
553 | <item> | 553 | <item> |
554 | - <attribute name="label" translatable="yes">Session properties</attribute> | 554 | + <attribute name="label" translatable="yes">Session preferences</attribute> |
555 | <attribute name="action">win.session.properties</attribute> | 555 | <attribute name="action">win.session.properties</attribute> |
556 | </item> | 556 | </item> |
557 | 557 |