Commit 8cfde5757d308839a3f139ba433c4342b9f41bb0
1 parent
92d516aa
Exists in
master
and in
4 other branches
Implementing GActio<->Lib3270 adapters.
Showing
3 changed files
with
22 additions
and
13 deletions
Show diff stats
src/actions/abstract.c
| ... | ... | @@ -198,7 +198,7 @@ |
| 198 | 198 | |
| 199 | 199 | void pw3270_action_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { |
| 200 | 200 | |
| 201 | - debug("%s(%d)",__FUNCTION__,prop_id); | |
| 201 | +// debug("%s(%d)",__FUNCTION__,prop_id); | |
| 202 | 202 | |
| 203 | 203 | GAction *action = G_ACTION(object); |
| 204 | 204 | |
| ... | ... | @@ -234,7 +234,7 @@ |
| 234 | 234 | |
| 235 | 235 | pw3270Action * action = PW3270_ACTION(object); |
| 236 | 236 | |
| 237 | - debug("%s %s -> %s", __FUNCTION__, action->name, name); | |
| 237 | +// debug("%s %s -> %s", __FUNCTION__, action->name, name); | |
| 238 | 238 | |
| 239 | 239 | if(action->name) |
| 240 | 240 | g_free(action->name); |
| ... | ... | @@ -251,7 +251,7 @@ |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | const GVariantType * pw3270_action_get_parameter_type(GAction *action) { |
| 254 | - debug("%s",__FUNCTION__); | |
| 254 | +// debug("%s",__FUNCTION__); | |
| 255 | 255 | return NULL; |
| 256 | 256 | } |
| 257 | 257 | |
| ... | ... | @@ -333,7 +333,7 @@ |
| 333 | 333 | |
| 334 | 334 | pw3270Action * action = PW3270_ACTION(object); |
| 335 | 335 | |
| 336 | - debug("%s: terminal=%p",__FUNCTION__,action->terminal); | |
| 336 | +// debug("%s: terminal=%p",__FUNCTION__,action->terminal); | |
| 337 | 337 | |
| 338 | 338 | if(action && action->terminal) { |
| 339 | 339 | ... | ... |
src/actions/lib3270/toggle.c
| ... | ... | @@ -59,7 +59,7 @@ |
| 59 | 59 | G_DEFINE_TYPE(Lib3270ToggleAction, Lib3270ToggleAction, PW3270_TYPE_ACTION); |
| 60 | 60 | |
| 61 | 61 | static void change_state(H3270 *hSession, LIB3270_TOGGLE_ID id, char state, void * action) { |
| 62 | - pw3270_action_change_state_boolean(PW3270_ACTION(action), state == 0 ? FALSE : TRUE); | |
| 62 | + pw3270_action_change_state_boolean((GAction *) action, state == 0 ? FALSE : TRUE); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | static void change_widget(GAction *object, GtkWidget *from, GtkWidget *to) { |
| ... | ... | @@ -79,7 +79,16 @@ |
| 79 | 79 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + static void activate(GAction *action, GVariant *parameter, GtkWidget *terminal) { | |
| 83 | + lib3270_toggle(v3270_get_session(terminal),PW3270_LIB3270_TOGGLE_ACTION(action)->definition->id); | |
| 84 | + } | |
| 85 | + | |
| 82 | 86 | void Lib3270ToggleAction_class_init(Lib3270ToggleActionClass *klass) { |
| 87 | + | |
| 88 | + pw3270ActionClass * action = PW3270_ACTION_CLASS(klass); | |
| 89 | + action->activate = activate; | |
| 90 | + action->change_widget = change_widget; | |
| 91 | + | |
| 83 | 92 | } |
| 84 | 93 | |
| 85 | 94 | void Lib3270ToggleAction_init(Lib3270ToggleAction *action) { | ... | ... |
src/actions/window.c
| ... | ... | @@ -34,14 +34,15 @@ |
| 34 | 34 | |
| 35 | 35 | #include "private.h" |
| 36 | 36 | #include <lib3270/actions.h> |
| 37 | + #include <pw3270/window.h> | |
| 37 | 38 | |
| 38 | 39 | void pw3270_window_add_actions(GtkWidget * appwindow) { |
| 39 | 40 | |
| 40 | 41 | GActionMap * map = G_ACTION_MAP(appwindow); |
| 41 | 42 | GtkWidget * terminal = pw3270_window_get_terminal_widget(appwindow); |
| 43 | + size_t ix; | |
| 42 | 44 | |
| 43 | - // g_action_map_add_action(map,pw3270_action_new_from_lib3270(lib3270_action_get_by_name("testpattern"), appwindow)); | |
| 44 | - | |
| 45 | + /* | |
| 45 | 46 | GAction *action = pw3270_action_new_from_lib3270(lib3270_action_get_by_name("testpattern")); |
| 46 | 47 | pw3270_action_set_terminal_widget(action,terminal); |
| 47 | 48 | |
| ... | ... | @@ -50,22 +51,21 @@ |
| 50 | 51 | g_action_map_add_action(map,action); |
| 51 | 52 | |
| 52 | 53 | debug("--> \"%s\"",pw3270_action_get_name(action)); |
| 54 | + */ | |
| 53 | 55 | |
| 54 | - /* | |
| 55 | - size_t ix; | |
| 56 | 56 | |
| 57 | 57 | // Map lib3270 actions |
| 58 | 58 | const LIB3270_ACTION * actions = lib3270_get_actions(); |
| 59 | 59 | |
| 60 | 60 | for(ix = 0; actions[ix].name; ix++) { |
| 61 | 61 | |
| 62 | - // g_autofree gchar * name = g_strconcat("win.", actions[ix].name, NULL); | |
| 63 | - debug("Creating action %s", actions[ix].name); | |
| 64 | - g_action_map_add_action(map,pw3270_action_new_from_lib3270(&actions[ix],appwindow)); | |
| 62 | + GAction *action = pw3270_action_new_from_lib3270(&actions[ix]); | |
| 63 | + pw3270_action_set_terminal_widget(action,terminal); | |
| 64 | + g_action_map_add_action(map,action); | |
| 65 | 65 | |
| 66 | 66 | } |
| 67 | - */ | |
| 68 | 67 | |
| 68 | + // Map toggles | |
| 69 | 69 | |
| 70 | 70 | debug("%s ends",__FUNCTION__); |
| 71 | 71 | } | ... | ... |