Commit db83d6d46b12ffa372f724a89b753ef92acb6eb8
1 parent
a7858626
Exists in
master
and in
4 other branches
Update PA/PF key actions.
Showing
4 changed files
with
41 additions
and
64 deletions
Show diff stats
src/objects/actions/lib3270/pakey.c
| ... | ... | @@ -34,36 +34,25 @@ |
| 34 | 34 | |
| 35 | 35 | #include "../private.h" |
| 36 | 36 | #include <v3270.h> |
| 37 | + #include <v3270/actions.h> | |
| 37 | 38 | |
| 38 | - #define PW3270_TYPE_PAKEY_ACTION (Lib3270PaAction_get_type()) | |
| 39 | - #define PW3270_LIB3270_PAKEY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), PW3270_TYPE_PAKEY_ACTION, Lib3270PaAction)) | |
| 40 | - #define PW3270_IS_LIB3270_PAKEY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), PW3270_TYPE_PAKEY_ACTION)) | |
| 39 | + #define LIB3270_TYPE_PA_ACTION (Lib3270PaAction_get_type()) | |
| 40 | + #define LIB3270_PA_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), LIB3270_TYPE_PA_ACTION, Lib3270PaAction)) | |
| 41 | + #define LIB3270_IS_PA_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), LIB3270_TYPE_PA_ACTION)) | |
| 41 | 42 | |
| 42 | 43 | typedef struct _Lib3270PaActionClass { |
| 43 | - pw3270ActionClass parent_class; | |
| 44 | + V3270ActionClass parent_class; | |
| 44 | 45 | |
| 45 | 46 | } Lib3270PaActionClass; |
| 46 | 47 | |
| 47 | 48 | typedef struct _Lib3270PaAction { |
| 48 | - pw3270Action parent; | |
| 49 | - | |
| 49 | + V3270Action parent; | |
| 50 | 50 | } Lib3270PaAction; |
| 51 | 51 | |
| 52 | 52 | static void Lib3270PaAction_class_init(Lib3270PaActionClass *klass); |
| 53 | 53 | static void Lib3270PaAction_init(Lib3270PaAction *action); |
| 54 | 54 | |
| 55 | - G_DEFINE_TYPE(Lib3270PaAction, Lib3270PaAction, PW3270_TYPE_ACTION); | |
| 56 | - | |
| 57 | - static gboolean get_enabled(GAction G_GNUC_UNUSED(*action), GtkWidget *terminal) { | |
| 58 | - | |
| 59 | -// debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action)); | |
| 60 | - | |
| 61 | - if(terminal) | |
| 62 | - return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE; | |
| 63 | - | |
| 64 | - return FALSE; | |
| 65 | - | |
| 66 | - } | |
| 55 | + G_DEFINE_TYPE(Lib3270PaAction, Lib3270PaAction, V3270_TYPE_ACTION); | |
| 67 | 56 | |
| 68 | 57 | static void activate(GAction *action, GVariant *parameter, GtkWidget *terminal) { |
| 69 | 58 | |
| ... | ... | @@ -93,22 +82,22 @@ |
| 93 | 82 | |
| 94 | 83 | } |
| 95 | 84 | |
| 96 | - void Lib3270PaAction_class_init(Lib3270PaActionClass *klass) { | |
| 97 | - | |
| 98 | - klass->parent_class.get_enabled = get_enabled; | |
| 99 | - | |
| 85 | + void Lib3270PaAction_class_init(Lib3270PaActionClass G_GNUC_UNUSED(*klass)) { | |
| 100 | 86 | } |
| 101 | 87 | |
| 102 | - void Lib3270PaAction_init(Lib3270PaAction G_GNUC_UNUSED(*object)) { | |
| 103 | - } | |
| 88 | + void Lib3270PaAction_init(Lib3270PaAction *action) { | |
| 104 | 89 | |
| 90 | + static const LIB3270_PROPERTY info = { | |
| 91 | + .name = "pakey", | |
| 92 | + .group = LIB3270_ACTION_GROUP_ONLINE | |
| 93 | + }; | |
| 105 | 94 | |
| 106 | - GAction * pw3270_action_new_pakey(void) { | |
| 107 | - pw3270Action * action = PW3270_ACTION(g_object_new(PW3270_TYPE_PAKEY_ACTION, NULL)); | |
| 95 | + action->parent.activate = activate; | |
| 96 | + action->parent.info = &info; | |
| 108 | 97 | |
| 109 | - action->activate = activate; | |
| 110 | - action->name = "pakey"; | |
| 98 | + } | |
| 111 | 99 | |
| 112 | - return G_ACTION(action); | |
| 100 | + GAction * v3270_pakey_action_new(void) { | |
| 101 | + return G_ACTION(g_object_new(LIB3270_TYPE_PA_ACTION, NULL)); | |
| 113 | 102 | } |
| 114 | 103 | ... | ... |
src/objects/actions/lib3270/pfkey.c
| ... | ... | @@ -28,42 +28,31 @@ |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @brief Implement GAction "wrapper" for lib3270's PFs. | |
| 31 | + * @brief Implement GAction "wrapper" for lib3270's PAs. | |
| 32 | 32 | * |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | 35 | #include "../private.h" |
| 36 | 36 | #include <v3270.h> |
| 37 | + #include <v3270/actions.h> | |
| 37 | 38 | |
| 38 | - #define PW3270_TYPE_PFKEY_ACTION (Lib3270PfAction_get_type()) | |
| 39 | - #define PW3270_LIB3270_PFKEY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), PW3270_TYPE_PFKEY_ACTION, Lib3270PfAction)) | |
| 40 | - #define PW3270_IS_LIB3270_PFKEY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), PW3270_TYPE_PFKEY_ACTION)) | |
| 39 | + #define LIB3270_TYPE_PF_ACTION (Lib3270PfAction_get_type()) | |
| 40 | + #define LIB3270_PF_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), LIB3270_TYPE_PF_ACTION, Lib3270PfAction)) | |
| 41 | + #define LIB3270_IS_PF_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), LIB3270_TYPE_PF_ACTION)) | |
| 41 | 42 | |
| 42 | 43 | typedef struct _Lib3270PfActionClass { |
| 43 | - pw3270ActionClass parent_class; | |
| 44 | + V3270ActionClass parent_class; | |
| 44 | 45 | |
| 45 | 46 | } Lib3270PfActionClass; |
| 46 | 47 | |
| 47 | 48 | typedef struct _Lib3270PfAction { |
| 48 | - pw3270Action parent; | |
| 49 | - | |
| 49 | + V3270Action parent; | |
| 50 | 50 | } Lib3270PfAction; |
| 51 | 51 | |
| 52 | 52 | static void Lib3270PfAction_class_init(Lib3270PfActionClass *klass); |
| 53 | 53 | static void Lib3270PfAction_init(Lib3270PfAction *action); |
| 54 | 54 | |
| 55 | - G_DEFINE_TYPE(Lib3270PfAction, Lib3270PfAction, PW3270_TYPE_ACTION); | |
| 56 | - | |
| 57 | - static gboolean get_enabled(GAction G_GNUC_UNUSED(*action), GtkWidget *terminal) { | |
| 58 | - | |
| 59 | -// debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action)); | |
| 60 | - | |
| 61 | - if(terminal) | |
| 62 | - return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE; | |
| 63 | - | |
| 64 | - return FALSE; | |
| 65 | - | |
| 66 | - } | |
| 55 | + G_DEFINE_TYPE(Lib3270PfAction, Lib3270PfAction, V3270_TYPE_ACTION); | |
| 67 | 56 | |
| 68 | 57 | static void activate(GAction *action, GVariant *parameter, GtkWidget *terminal) { |
| 69 | 58 | |
| ... | ... | @@ -93,23 +82,22 @@ |
| 93 | 82 | |
| 94 | 83 | } |
| 95 | 84 | |
| 96 | - void Lib3270PfAction_class_init(Lib3270PfActionClass *klass) { | |
| 97 | - | |
| 98 | - klass->parent_class.get_enabled = get_enabled; | |
| 99 | - | |
| 100 | - } | |
| 101 | - | |
| 102 | - void Lib3270PfAction_init(Lib3270PfAction G_GNUC_UNUSED(*action)) { | |
| 85 | + void Lib3270PfAction_class_init(Lib3270PfActionClass G_GNUC_UNUSED(*klass)) { | |
| 103 | 86 | } |
| 104 | 87 | |
| 105 | - GAction * pw3270_action_new_pfkey(void) { | |
| 88 | + void Lib3270PfAction_init(Lib3270PfAction *action) { | |
| 106 | 89 | |
| 107 | - pw3270Action * action = PW3270_ACTION(g_object_new(PW3270_TYPE_PFKEY_ACTION, NULL)); | |
| 90 | + static const LIB3270_PROPERTY info = { | |
| 91 | + .name = "pfkey", | |
| 92 | + .group = LIB3270_ACTION_GROUP_ONLINE | |
| 93 | + }; | |
| 108 | 94 | |
| 109 | - action->activate = activate; | |
| 110 | - action->name = "pfkey"; | |
| 95 | + action->parent.activate = activate; | |
| 96 | + action->parent.info = &info; | |
| 111 | 97 | |
| 112 | - return G_ACTION(action); | |
| 113 | 98 | } |
| 114 | 99 | |
| 100 | + GAction * v3270_pfkey_action_new(void) { | |
| 101 | + return G_ACTION(g_object_new(LIB3270_TYPE_PF_ACTION, NULL)); | |
| 102 | + } | |
| 115 | 103 | ... | ... |
src/objects/actions/private.h
| ... | ... | @@ -51,8 +51,8 @@ |
| 51 | 51 | /* not really I18N-related, but also a string marker macro */ |
| 52 | 52 | #define I_(string) g_intern_static_string (string) |
| 53 | 53 | |
| 54 | - G_GNUC_INTERNAL GAction * pw3270_action_new_pfkey(void); | |
| 55 | - G_GNUC_INTERNAL GAction * pw3270_action_new_pakey(void); | |
| 54 | + G_GNUC_INTERNAL GAction * v3270_pfkey_action_new(void); | |
| 55 | + G_GNUC_INTERNAL GAction * v3270_pakey_action_new(void); | |
| 56 | 56 | |
| 57 | 57 | G_GNUC_INTERNAL void pw3270_action_set_name(GAction *object, const gchar *name); |
| 58 | 58 | ... | ... |
src/objects/actions/window.c
| ... | ... | @@ -84,8 +84,8 @@ |
| 84 | 84 | // Map special actions |
| 85 | 85 | { |
| 86 | 86 | GAction * actions[] = { |
| 87 | - pw3270_action_new_pfkey(), | |
| 88 | - pw3270_action_new_pakey(), | |
| 87 | + v3270_pfkey_action_new(), | |
| 88 | + v3270_pakey_action_new(), | |
| 89 | 89 | // pw3270_action_connect_new(), |
| 90 | 90 | // pw3270_action_copy_new(), |
| 91 | 91 | // pw3270_action_cut_new(), | ... | ... |