Commit 7b2c2b0308f194e9b6f0bb923daccd5ef8ee1ba4
1 parent
390db0b4
Exists in
master
and in
4 other branches
Implementing toolbar actions edit dialog.
Showing
8 changed files
with
57 additions
and
11 deletions
Show diff stats
src/include/pw3270/actions.h
... | ... | @@ -264,6 +264,7 @@ |
264 | 264 | void pw3270_action_view_set_actions(GtkWidget *view, Pw3270ActionList *list); |
265 | 265 | void pw3270_action_view_move_selected(GtkWidget *from, GtkWidget *to); |
266 | 266 | void pw3270_action_view_append(GtkWidget *widget, const gchar *label, GdkPixbuf *pixbuf, const gchar *action_name, gint flags); |
267 | + gchar * pw3270_action_view_get_action_names(GtkWidget *widget); | |
267 | 268 | |
268 | 269 | Pw3270ActionList * pw3270_action_list_move_action(Pw3270ActionList *action_list, const gchar *action_name, GtkWidget *view); |
269 | 270 | ... | ... |
src/objects/actions/save.c
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | |
67 | 67 | action->group.id = LIB3270_ACTION_GROUP_ONLINE; |
68 | 68 | action->parent.name = "save"; |
69 | + action->icon_name = "document-save"; | |
69 | 70 | action->label = N_( "_Save" ); |
70 | 71 | action->tooltip = N_( "Save terminal contents." ); |
71 | 72 | |
... | ... | @@ -81,6 +82,7 @@ |
81 | 82 | |
82 | 83 | action->group.id = LIB3270_ACTION_GROUP_ONLINE; |
83 | 84 | action->parent.name = "save.screen"; |
85 | + action->icon_name = "document-save"; | |
84 | 86 | action->label = N_( "Save screen" ); |
85 | 87 | |
86 | 88 | return G_ACTION(action); |
... | ... | @@ -95,6 +97,7 @@ |
95 | 97 | |
96 | 98 | action->group.id = LIB3270_ACTION_GROUP_SELECTION; |
97 | 99 | action->parent.name = "save.selected"; |
100 | + action->icon_name = "document-save"; | |
98 | 101 | action->label = N_( "Save selected" ); |
99 | 102 | |
100 | 103 | return G_ACTION(action); | ... | ... |
src/objects/actions/view.c
... | ... | @@ -171,6 +171,7 @@ |
171 | 171 | &iter, |
172 | 172 | COLUMN_PIXBUF, element->pixbuf, |
173 | 173 | COLUMN_LABEL, (label ? label : g_action_get_name(element->action)), |
174 | + COLUMN_ACTION_NAME, element->name, | |
174 | 175 | COLUMN_FLAGS, 3, |
175 | 176 | -1 |
176 | 177 | ); |
... | ... | @@ -382,5 +383,31 @@ |
382 | 383 | |
383 | 384 | } |
384 | 385 | |
386 | + } | |
387 | + | |
388 | + gboolean get_action_name(GtkTreeModel *model, GtkTreePath G_GNUC_UNUSED(*path), GtkTreeIter *iter, GString *str) { | |
389 | + | |
390 | + GValue value = G_VALUE_INIT; | |
391 | + gtk_tree_model_get_value(model,iter,COLUMN_ACTION_NAME,&value); | |
385 | 392 | |
393 | + if(*str->str) | |
394 | + g_string_append(str,","); | |
395 | + | |
396 | + g_string_append(str,g_value_get_string(&value)); | |
397 | + | |
398 | + g_value_unset(&value); | |
399 | + return FALSE; | |
386 | 400 | } |
401 | + | |
402 | + gchar * pw3270_action_view_get_action_names(GtkWidget *widget) { | |
403 | + | |
404 | + GString *str = g_string_new(""); | |
405 | + | |
406 | + gtk_tree_model_foreach( | |
407 | + gtk_tree_view_get_model(GTK_TREE_VIEW(widget)), | |
408 | + (GtkTreeModelForeachFunc) get_action_name, | |
409 | + str ); | |
410 | + | |
411 | + return g_string_free(str,FALSE); | |
412 | + } | |
413 | + | ... | ... |
src/objects/actions/window.c
... | ... | @@ -72,10 +72,10 @@ |
72 | 72 | pw3270_action_copy_new(), |
73 | 73 | pw3270_action_cut_new(), |
74 | 74 | pw3270_action_paste_new(), |
75 | - pw3270_action_save_new(), | |
76 | 75 | |
77 | - pw3270_action_save_screen_new(), | |
78 | - pw3270_action_save_selected_new(), | |
76 | +// pw3270_action_save_new(), | |
77 | +// pw3270_action_save_screen_new(), | |
78 | +// pw3270_action_save_selected_new(), | |
79 | 79 | |
80 | 80 | pw3270_action_print_screen_new(), |
81 | 81 | pw3270_action_print_selected_new(), | ... | ... |
src/objects/application/actions/preferences.c
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | GSList * pages; |
41 | 41 | } Pw3270SettingsDialog; |
42 | 42 | |
43 | - static void on_destroy(GtkWidget *dialog, Pw3270SettingsDialog *settings) { | |
43 | + static void on_destroy(GtkWidget G_GNUC_UNUSED(*dialog), Pw3270SettingsDialog *settings) { | |
44 | 44 | settings->dialog = NULL; |
45 | 45 | g_slist_free_full(settings->pages,g_free); |
46 | 46 | g_free(settings); |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | gtk_widget_destroy(GTK_WIDGET(dialog)); |
67 | 67 | } |
68 | 68 | |
69 | - static void on_page_added(GtkNotebook *notebook, GtkWidget *widget, guint page_num, Pw3270SettingsDialog * settings) { | |
69 | + static void on_page_added(GtkNotebook G_GNUC_UNUSED(*notebook), GtkWidget *widget, guint G_GNUC_UNUSED(page_num), Pw3270SettingsDialog G_GNUC_UNUSED(*settings)) { | |
70 | 70 | |
71 | 71 | // https://developer.gnome.org/hig/stable/visual-layout.html.en |
72 | 72 | |
... | ... | @@ -83,6 +83,9 @@ |
83 | 83 | |
84 | 84 | static void on_switch_page(GtkNotebook G_GNUC_UNUSED(*notebook), GtkWidget *widget, guint G_GNUC_UNUSED(page_num), Pw3270SettingsDialog * settings) |
85 | 85 | { |
86 | + | |
87 | + debug("%s: %p",__FUNCTION__,settings->dialog); | |
88 | + | |
86 | 89 | if(!settings->dialog) |
87 | 90 | return; |
88 | 91 | |
... | ... | @@ -92,7 +95,7 @@ |
92 | 95 | GSList * page; |
93 | 96 | for(page = settings->pages;page;page = page->next) { |
94 | 97 | Pw3270SettingsPage * pg = (Pw3270SettingsPage *) page->data; |
95 | - if(pg->widget == pg) { | |
98 | + if(pg->widget == widget) { | |
96 | 99 | if(pg->title) |
97 | 100 | gtk_header_bar_set_subtitle(GTK_HEADER_BAR(header_bar),pg->title); |
98 | 101 | return; | ... | ... |
src/objects/application/application.c
... | ... | @@ -315,6 +315,7 @@ |
315 | 315 | const gchar * label; |
316 | 316 | const gchar * tooltip; |
317 | 317 | const gchar * action_name; |
318 | + const gchar * icon_name; | |
318 | 319 | const gchar * property_name; |
319 | 320 | void (*activate)(GAction *action, GVariant *parameter, GtkWidget *terminal); |
320 | 321 | } conditional_actions[] = { |
... | ... | @@ -337,8 +338,9 @@ |
337 | 338 | pw3270SimpleAction * action = PW3270_SIMPLE_ACTION(v3270_conditional_action_new(terminal,conditional_actions[ix].property_name)); |
338 | 339 | |
339 | 340 | action->parent.name = conditional_actions[ix].action_name; |
340 | - action->label = conditional_actions[ix].label; | |
341 | + action->label = conditional_actions[ix].label; | |
341 | 342 | action->tooltip = conditional_actions[ix].tooltip; |
343 | + action->icon_name = conditional_actions[ix].icon_name; | |
342 | 344 | PW3270_ACTION(action)->activate = conditional_actions[ix].activate; |
343 | 345 | |
344 | 346 | g_action_map_add_action( | ... | ... |
src/objects/toolbar/settings.c
... | ... | @@ -79,8 +79,15 @@ |
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - static void apply(Pw3270SettingsPage *pg, GtkApplication *application, GSettings *settings) { | |
82 | + static void apply(Pw3270SettingsPage *pg, GtkApplication G_GNUC_UNUSED(*application), GSettings *settings) { | |
83 | + | |
83 | 84 | debug("%s",__FUNCTION__); |
85 | + | |
86 | + g_autofree gchar * action_names = pw3270_action_view_get_action_names(((ToolbarSettingsPage *) pg)->views[0]); | |
87 | + g_settings_set_string(settings,"toolbar-action-names",action_names); | |
88 | + | |
89 | + debug("[%s]",action_names); | |
90 | + | |
84 | 91 | } |
85 | 92 | |
86 | 93 | static void selection_changed(GtkTreeSelection *selection, GtkWidget *button) { |
... | ... | @@ -107,7 +114,7 @@ |
107 | 114 | page->parent.load = load; |
108 | 115 | page->parent.apply = apply; |
109 | 116 | page->parent.label = _("Toolbar"); |
110 | - page->parent.title = _("Setup toolbar action elements"); | |
117 | + page->parent.title = _("Setup toolbar"); | |
111 | 118 | |
112 | 119 | page->parent.widget = gtk_grid_new(); |
113 | 120 | gtk_grid_set_row_homogeneous(GTK_GRID(page->parent.widget),FALSE); |
... | ... | @@ -120,6 +127,9 @@ |
120 | 127 | |
121 | 128 | for(ix = 0; ix < G_N_ELEMENTS(page->views); ix++) { |
122 | 129 | |
130 | + GtkWidget * label = gtk_label_new(gettext(labels[ix])); | |
131 | + gtk_label_set_xalign(GTK_LABEL(label),0); | |
132 | + | |
123 | 133 | page->views[ix] = pw3270_action_view_new(); |
124 | 134 | |
125 | 135 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(page->views[ix])); |
... | ... | @@ -127,7 +137,7 @@ |
127 | 137 | |
128 | 138 | gtk_grid_attach( |
129 | 139 | GTK_GRID(page->parent.widget), |
130 | - gtk_label_new(gettext(labels[ix])), | |
140 | + label, | |
131 | 141 | ix * 3,0,2,1 |
132 | 142 | ); |
133 | 143 | ... | ... |
src/objects/window/actions/sessionproperties.c