Commit 167179985c6f3ab674ab4a4898e41b5801cf6259
1 parent
8b1d37dc
Exists in
master
and in
4 other branches
Fixing "close-window" action.
Showing
3 changed files
with
35 additions
and
9 deletions
Show diff stats
src/objects/window/actions/close.c
@@ -27,12 +27,41 @@ | @@ -27,12 +27,41 @@ | ||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | - #include "../private.h" | 30 | + #include <pw3270.h> |
31 | + #include <pw3270/actions.h> | ||
32 | + #include <lib3270.h> | ||
33 | + #include <lib3270/log.h> | ||
31 | 34 | ||
35 | + /* | ||
32 | void pw3270_window_close_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer window) { | 36 | void pw3270_window_close_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer window) { |
33 | 37 | ||
34 | debug("%s(%p)",__FUNCTION__,window); | 38 | debug("%s(%p)",__FUNCTION__,window); |
35 | gtk_window_close(GTK_WINDOW(window)); | 39 | gtk_window_close(GTK_WINDOW(window)); |
36 | 40 | ||
37 | } | 41 | } |
42 | + */ | ||
43 | + | ||
44 | + static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { | ||
45 | + | ||
46 | + debug("%s","Window close action was activated"); | ||
47 | + gtk_window_close(GTK_WINDOW(gtk_widget_get_toplevel(terminal))); | ||
48 | + | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + GAction * pw3270_action_window_close_new(void) { | ||
53 | + | ||
54 | + pw3270SimpleAction * action = pw3270_simple_action_new(); | ||
55 | + | ||
56 | + action->parent.activate = activate; | ||
57 | + action->parent.name = "close"; | ||
58 | + action->icon_name = "window-close"; | ||
59 | + action->label = N_("Close window"); | ||
60 | + action->tooltip = N_("Close the window"); | ||
61 | + | ||
62 | + return G_ACTION(action); | ||
63 | + | ||
64 | + | ||
65 | + } | ||
66 | + | ||
38 | 67 |
src/objects/window/private.h
@@ -80,6 +80,7 @@ | @@ -80,6 +80,7 @@ | ||
80 | G_GNUC_INTERNAL GAction * pw3270_action_host_properties_new(void); | 80 | G_GNUC_INTERNAL GAction * pw3270_action_host_properties_new(void); |
81 | G_GNUC_INTERNAL GAction * pw3270_set_color_action_new(void); | 81 | G_GNUC_INTERNAL GAction * pw3270_set_color_action_new(void); |
82 | G_GNUC_INTERNAL GAction * pw3270_file_transfer_action_new(void); | 82 | G_GNUC_INTERNAL GAction * pw3270_file_transfer_action_new(void); |
83 | + G_GNUC_INTERNAL GAction * pw3270_action_window_close_new(void); | ||
83 | 84 | ||
84 | GAction * pw3270_action_session_properties_new(void); | 85 | GAction * pw3270_action_session_properties_new(void); |
85 | 86 |
src/objects/window/window.c
@@ -150,7 +150,8 @@ | @@ -150,7 +150,8 @@ | ||
150 | pw3270_action_host_properties_new(), | 150 | pw3270_action_host_properties_new(), |
151 | pw3270_set_color_action_new(), | 151 | pw3270_set_color_action_new(), |
152 | pw3270_action_session_properties_new(), | 152 | pw3270_action_session_properties_new(), |
153 | - pw3270_file_transfer_action_new() | 153 | + pw3270_file_transfer_action_new(), |
154 | + pw3270_action_window_close_new() | ||
154 | }; | 155 | }; |
155 | 156 | ||
156 | for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { | 157 | for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { |
@@ -160,6 +161,7 @@ | @@ -160,6 +161,7 @@ | ||
160 | 161 | ||
161 | } | 162 | } |
162 | 163 | ||
164 | + /* | ||
163 | // | 165 | // |
164 | // Setup Window actions. | 166 | // Setup Window actions. |
165 | // | 167 | // |
@@ -183,6 +185,7 @@ | @@ -183,6 +185,7 @@ | ||
183 | G_N_ELEMENTS(actions), | 185 | G_N_ELEMENTS(actions), |
184 | widget | 186 | widget |
185 | ); | 187 | ); |
188 | + */ | ||
186 | 189 | ||
187 | // | 190 | // |
188 | // Setup toolbar | 191 | // Setup toolbar |
@@ -190,13 +193,6 @@ | @@ -190,13 +193,6 @@ | ||
190 | 193 | ||
191 | { | 194 | { |
192 | 195 | ||
193 | - /* | ||
194 | - pw3270_toolbar_set_actions( | ||
195 | - GTK_WIDGET(widget->toolbar), | ||
196 | - "win.copy,win.paste,win.select-all,separator,win.connect,win.disconnect,separator,win.session.properties,win.file.transfer,win.print,app.quit" | ||
197 | - ); | ||
198 | - */ | ||
199 | - | ||
200 | g_action_map_add_action( | 196 | g_action_map_add_action( |
201 | G_ACTION_MAP(widget), | 197 | G_ACTION_MAP(widget), |
202 | G_ACTION(g_property_action_new("toolbar", widget->toolbar, "visible")) | 198 | G_ACTION(g_property_action_new("toolbar", widget->toolbar, "visible")) |