Commit 92790c48459458fcea97a673f9c766722d212f74
1 parent
bb522ebf
Exists in
master
and in
4 other branches
Adjustments in dialog actions.
Showing
8 changed files
with
26 additions
and
63 deletions
Show diff stats
src/include/pw3270/actions.h
@@ -193,7 +193,7 @@ | @@ -193,7 +193,7 @@ | ||
193 | typedef struct _pw3270DialogAction pw3270DialogAction; | 193 | typedef struct _pw3270DialogAction pw3270DialogAction; |
194 | typedef struct _pw3270DialogActionClass pw3270DialogActionClass; | 194 | typedef struct _pw3270DialogActionClass pw3270DialogActionClass; |
195 | 195 | ||
196 | - pw3270SimpleAction * pw3270_dialog_action_new(GtkWidget * (*factory)(GtkWidget *)); | 196 | + pw3270SimpleAction * pw3270_dialog_action_new(GtkWidget * (*factory)(pw3270SimpleAction *action, GtkWidget *)); |
197 | 197 | ||
198 | // | 198 | // |
199 | // V3270 Property Action | 199 | // V3270 Property Action |
src/objects/actions/dialog.c
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | pw3270SimpleAction parent; | 45 | pw3270SimpleAction parent; |
46 | 46 | ||
47 | GtkWidget * dialog; | 47 | GtkWidget * dialog; |
48 | - GtkWidget * (*factory)(GtkWidget *); | 48 | + GtkWidget * (*factory)(pw3270SimpleAction *, GtkWidget *); |
49 | 49 | ||
50 | }; | 50 | }; |
51 | 51 | ||
@@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | - pw3270SimpleAction * pw3270_dialog_action_new(GtkWidget * (*factory)(GtkWidget *)) { | 85 | + pw3270SimpleAction * pw3270_dialog_action_new(GtkWidget * (*factory)(pw3270SimpleAction *, GtkWidget *)) { |
86 | 86 | ||
87 | pw3270DialogAction * action = (pw3270DialogAction *) g_object_new(PW3270_TYPE_DIALOG_ACTION, NULL); | 87 | pw3270DialogAction * action = (pw3270DialogAction *) g_object_new(PW3270_TYPE_DIALOG_ACTION, NULL); |
88 | action->factory = factory; | 88 | action->factory = factory; |
@@ -109,7 +109,7 @@ | @@ -109,7 +109,7 @@ | ||
109 | if(action->dialog || !action->factory) | 109 | if(action->dialog || !action->factory) |
110 | return; | 110 | return; |
111 | 111 | ||
112 | - action->dialog = action->factory(terminal); | 112 | + action->dialog = action->factory((pw3270SimpleAction *) object, terminal); |
113 | pw3270_action_notify_enabled(G_ACTION(action)); | 113 | pw3270_action_notify_enabled(G_ACTION(action)); |
114 | 114 | ||
115 | if(action->dialog) { | 115 | if(action->dialog) { |
src/objects/actions/save.c
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | #include <pw3270/application.h> | 38 | #include <pw3270/application.h> |
39 | 39 | ||
40 | 40 | ||
41 | - static GtkWidget * factory(GtkWidget *terminal); | 41 | + static GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal); |
42 | static void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal); | 42 | static void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal); |
43 | 43 | ||
44 | GAction * pw3270_action_save_session_as_new(void) { | 44 | GAction * pw3270_action_save_session_as_new(void) { |
@@ -46,19 +46,19 @@ | @@ -46,19 +46,19 @@ | ||
46 | pw3270SimpleAction * action = pw3270_dialog_action_new(factory); | 46 | pw3270SimpleAction * action = pw3270_dialog_action_new(factory); |
47 | 47 | ||
48 | action->parent.name = "save.session.as"; | 48 | action->parent.name = "save.session.as"; |
49 | - action->label = N_("Save As"); | 49 | + action->label = _("Save As"); |
50 | action->icon_name = "document-save-as"; | 50 | action->icon_name = "document-save-as"; |
51 | - action->tooltip = N_("Save session properties to file"); | 51 | + action->tooltip = _("Save session properties"); |
52 | 52 | ||
53 | return G_ACTION(action); | 53 | return G_ACTION(action); |
54 | 54 | ||
55 | } | 55 | } |
56 | 56 | ||
57 | - GtkWidget * factory(GtkWidget *terminal) { | 57 | + GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal) { |
58 | 58 | ||
59 | GtkWidget * dialog = | 59 | GtkWidget * dialog = |
60 | gtk_file_chooser_dialog_new( | 60 | gtk_file_chooser_dialog_new( |
61 | - _("Save session properties"), | 61 | + action->tooltip, |
62 | GTK_WINDOW(gtk_widget_get_toplevel(terminal)), | 62 | GTK_WINDOW(gtk_widget_get_toplevel(terminal)), |
63 | GTK_FILE_CHOOSER_ACTION_SAVE, | 63 | GTK_FILE_CHOOSER_ACTION_SAVE, |
64 | _("Save"), GTK_RESPONSE_OK, | 64 | _("Save"), GTK_RESPONSE_OK, |
src/objects/application/actions/open.c
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | return filename; | 63 | return filename; |
64 | } | 64 | } |
65 | 65 | ||
66 | - void pw3270_application_open_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | 66 | + void pw3270_application_open_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer G_GNUC_UNUSED(application)) { |
67 | 67 | ||
68 | debug("%s",__FUNCTION__); | 68 | debug("%s",__FUNCTION__); |
69 | g_simple_action_set_enabled(action,FALSE); | 69 | g_simple_action_set_enabled(action,FALSE); |
@@ -71,22 +71,28 @@ | @@ -71,22 +71,28 @@ | ||
71 | g_simple_action_set_enabled(action,TRUE); | 71 | g_simple_action_set_enabled(action,TRUE); |
72 | } | 72 | } |
73 | 73 | ||
74 | - void pw3270_application_open_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | 74 | + void pw3270_application_open_tab_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer application) { |
75 | 75 | ||
76 | debug("%s",__FUNCTION__); | 76 | debug("%s",__FUNCTION__); |
77 | g_simple_action_set_enabled(action,FALSE); | 77 | g_simple_action_set_enabled(action,FALSE); |
78 | g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new tab")); | 78 | g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new tab")); |
79 | 79 | ||
80 | + if(session_file_name) { | ||
81 | + pw3270_terminal_new(GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application))), session_file_name); | ||
82 | + } | ||
80 | 83 | ||
81 | g_simple_action_set_enabled(action,TRUE); | 84 | g_simple_action_set_enabled(action,TRUE); |
82 | } | 85 | } |
83 | 86 | ||
84 | - void pw3270_application_open_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | 87 | + void pw3270_application_open_window_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer application) { |
85 | 88 | ||
86 | debug("%s",__FUNCTION__); | 89 | debug("%s",__FUNCTION__); |
87 | g_simple_action_set_enabled(action,FALSE); | 90 | g_simple_action_set_enabled(action,FALSE); |
88 | g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new window")); | 91 | g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new window")); |
89 | 92 | ||
93 | + if(session_file_name) { | ||
94 | +// pw3270_terminal_new(pw3270_application_window_new(GTK_APPLICATION(application)), session_file_name); | ||
95 | + } | ||
90 | 96 | ||
91 | g_simple_action_set_enabled(action,TRUE); | 97 | g_simple_action_set_enabled(action,TRUE); |
92 | } | 98 | } |
src/objects/application/application.c
@@ -310,49 +310,6 @@ | @@ -310,49 +310,6 @@ | ||
310 | 310 | ||
311 | } | 311 | } |
312 | 312 | ||
313 | - /* | ||
314 | - // Create conditional actions. | ||
315 | - static const struct { | ||
316 | - const gchar * label; | ||
317 | - const gchar * tooltip; | ||
318 | - const gchar * action_name; | ||
319 | - const gchar * icon_name; | ||
320 | - const gchar * property_name; | ||
321 | - void (*activate)(GAction *action, GVariant *parameter, GtkWidget *terminal); | ||
322 | - } conditional_actions[] = { | ||
323 | - { | ||
324 | - .label = N_("Save copy"), | ||
325 | - .action_name = "save.copy", | ||
326 | - .property_name = "has_copy", | ||
327 | - .activate = pw3270_application_save_copy_activated | ||
328 | - }, | ||
329 | - { | ||
330 | - .label = N_("Print copy"), | ||
331 | - .action_name = "print.copy", | ||
332 | - .icon_name = "printer", | ||
333 | - .property_name = "has_copy", | ||
334 | - .activate = pw3270_application_print_copy_activated | ||
335 | - } | ||
336 | - }; | ||
337 | - | ||
338 | - for(ix = 0; ix < G_N_ELEMENTS(conditional_actions); ix++) { | ||
339 | - | ||
340 | - pw3270SimpleAction * action = PW3270_SIMPLE_ACTION(v3270_conditional_action_new(terminal,conditional_actions[ix].property_name)); | ||
341 | - | ||
342 | - action->parent.name = conditional_actions[ix].action_name; | ||
343 | - action->label = conditional_actions[ix].label; | ||
344 | - action->tooltip = conditional_actions[ix].tooltip; | ||
345 | - action->icon_name = conditional_actions[ix].icon_name; | ||
346 | - PW3270_ACTION(action)->activate = conditional_actions[ix].activate; | ||
347 | - | ||
348 | - g_action_map_add_action( | ||
349 | - G_ACTION_MAP(window), | ||
350 | - G_ACTION(action) | ||
351 | - ); | ||
352 | - | ||
353 | - } | ||
354 | - */ | ||
355 | - | ||
356 | // Present the new window | 313 | // Present the new window |
357 | pw3270_window_set_current_page(window,0); | 314 | pw3270_window_set_current_page(window,0); |
358 | gtk_window_present(GTK_WINDOW(window)); | 315 | gtk_window_present(GTK_WINDOW(window)); |
src/objects/window/actions/hostproperties.c
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | #include <v3270/settings.h> | 33 | #include <v3270/settings.h> |
34 | #include <v3270/dialogs.h> | 34 | #include <v3270/dialogs.h> |
35 | 35 | ||
36 | - static GtkWidget * factory(GtkWidget *terminal); | 36 | + static GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal); |
37 | 37 | ||
38 | GAction * pw3270_action_host_properties_new(void) { | 38 | GAction * pw3270_action_host_properties_new(void) { |
39 | 39 | ||
@@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
47 | return G_ACTION(action); | 47 | return G_ACTION(action); |
48 | } | 48 | } |
49 | 49 | ||
50 | - GtkWidget * factory(GtkWidget *terminal) { | 50 | + GtkWidget * factory(pw3270SimpleAction G_GNUC_UNUSED(*action), GtkWidget *terminal) { |
51 | 51 | ||
52 | GtkWidget * dialog = v3270_settings_dialog_new(); | 52 | GtkWidget * dialog = v3270_settings_dialog_new(); |
53 | V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_settings_new()); | 53 | V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_settings_new()); |
src/objects/window/actions/sessionproperties.c
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | #include <v3270/dialogs.h> | 34 | #include <v3270/dialogs.h> |
35 | #include <v3270/colorscheme.h> | 35 | #include <v3270/colorscheme.h> |
36 | 36 | ||
37 | - static GtkWidget * factory(GtkWidget *terminal); | 37 | + static GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal); |
38 | 38 | ||
39 | GAction * pw3270_action_session_properties_new(void) { | 39 | GAction * pw3270_action_session_properties_new(void) { |
40 | 40 | ||
@@ -42,20 +42,20 @@ | @@ -42,20 +42,20 @@ | ||
42 | 42 | ||
43 | action->parent.name = "session.properties"; | 43 | action->parent.name = "session.properties"; |
44 | action->icon_name = "preferences-other"; | 44 | action->icon_name = "preferences-other"; |
45 | - action->label = N_("Session properties"); | 45 | + action->label = _("Session properties"); |
46 | 46 | ||
47 | return G_ACTION(action); | 47 | return G_ACTION(action); |
48 | 48 | ||
49 | 49 | ||
50 | } | 50 | } |
51 | 51 | ||
52 | - GtkWidget * factory(GtkWidget *terminal) { | 52 | + GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal) { |
53 | 53 | ||
54 | size_t ix; | 54 | size_t ix; |
55 | 55 | ||
56 | GtkWidget * dialog = v3270_settings_dialog_new(); | 56 | GtkWidget * dialog = v3270_settings_dialog_new(); |
57 | 57 | ||
58 | - gtk_window_set_title(GTK_WINDOW(dialog), _("Session properties")); | 58 | + gtk_window_set_title(GTK_WINDOW(dialog), action->label); |
59 | 59 | ||
60 | // Add settings pages. | 60 | // Add settings pages. |
61 | GtkWidget * elements[] = { | 61 | GtkWidget * elements[] = { |
src/objects/window/actions/setcolors.c
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | #include <v3270/dialogs.h> | 34 | #include <v3270/dialogs.h> |
35 | #include <v3270/colorscheme.h> | 35 | #include <v3270/colorscheme.h> |
36 | 36 | ||
37 | - static GtkWidget * factory(GtkWidget *terminal); | 37 | + static GtkWidget * factory(pw3270SimpleAction *action, GtkWidget *terminal); |
38 | 38 | ||
39 | GAction * pw3270_set_color_action_new(void) { | 39 | GAction * pw3270_set_color_action_new(void) { |
40 | 40 | ||
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | - GtkWidget * factory(GtkWidget *terminal) { | 51 | + GtkWidget * factory(pw3270SimpleAction G_GNUC_UNUSED(*action), GtkWidget *terminal) { |
52 | 52 | ||
53 | return v3270_settings_get_edit_dialog(v3270_color_settings_new(),terminal,FALSE); | 53 | return v3270_settings_get_edit_dialog(v3270_color_settings_new(),terminal,FALSE); |
54 | 54 |