Commit b2e581193f1e04ccd6088ad9caa84e324e013647
1 parent
21daedae
Exists in
master
and in
1 other branch
Adjustments in the v3270 action object.
Showing
2 changed files
with
13 additions
and
25 deletions
Show diff stats
src/include/v3270/actions.h
| ... | ... | @@ -128,12 +128,6 @@ |
| 128 | 128 | /// @brief Activation method. |
| 129 | 129 | void (*activate)(GAction *action, GVariant *parameter, GtkWidget *terminal); |
| 130 | 130 | |
| 131 | - /// @brief Get State method. | |
| 132 | - GVariant * (*get_state_property)(GAction *action, GtkWidget *terminal); | |
| 133 | - | |
| 134 | - /// @brief Get state hint. | |
| 135 | - GVariant * (*get_state_hint)(GAction *action, GtkWidget *terminal); | |
| 136 | - | |
| 137 | 131 | } V3270Action; |
| 138 | 132 | |
| 139 | 133 | typedef struct _V3270ActionClass { |
| ... | ... | @@ -148,6 +142,9 @@ |
| 148 | 142 | void (*change_widget)(GAction *action, GtkWidget *from, GtkWidget *to); |
| 149 | 143 | gboolean (*get_enabled)(GAction *action, GtkWidget *terminal); |
| 150 | 144 | |
| 145 | + GVariant * (*get_state)(GAction *action, GtkWidget *terminal); | |
| 146 | + GVariant * (*get_state_hint)(GAction *action, GtkWidget *terminal); | |
| 147 | + | |
| 151 | 148 | } V3270ActionClass; |
| 152 | 149 | |
| 153 | 150 | LIB3270_EXPORT GType V3270Action_get_type(void) G_GNUC_CONST; | ... | ... |
src/terminal/actions/action.c
| ... | ... | @@ -53,9 +53,10 @@ |
| 53 | 53 | static const GVariantType * get_state_type(GAction *action); |
| 54 | 54 | static GVariant * get_state_property(GAction *action); |
| 55 | 55 | |
| 56 | - static GVariant * internal_get_state_property(GAction *action, GtkWidget *terminal); | |
| 57 | 56 | static gboolean internal_get_enabled(GAction *action, GtkWidget *terminal); |
| 58 | 57 | static void internal_activate(GAction *action, GVariant *parameter, GtkWidget *terminal); |
| 58 | + | |
| 59 | + static GVariant * internal_get_state(GAction *action, GtkWidget *terminal); | |
| 59 | 60 | static GVariant * internal_get_state_hint(GAction *action, GtkWidget *terminal); |
| 60 | 61 | |
| 61 | 62 | static const GVariantType * get_parameter_type(GAction *action); |
| ... | ... | @@ -97,6 +98,9 @@ |
| 97 | 98 | |
| 98 | 99 | klass->change_widget = change_widget; |
| 99 | 100 | klass->get_enabled = internal_get_enabled; |
| 101 | + klass->get_state = internal_get_state; | |
| 102 | + klass->get_state_hint = internal_get_state_hint; | |
| 103 | + | |
| 100 | 104 | |
| 101 | 105 | object_class->finalize = finalize; |
| 102 | 106 | object_class->get_property = get_property; |
| ... | ... | @@ -187,8 +191,8 @@ |
| 187 | 191 | action->types.parameter = NULL; |
| 188 | 192 | |
| 189 | 193 | action->activate = internal_activate; |
| 190 | - action->get_state_property = internal_get_state_property; | |
| 191 | - action->get_state_hint = internal_get_state_hint; | |
| 194 | +// action->get_state_property = internal_get_state_property; | |
| 195 | +// action->get_state_hint = internal_get_state_hint; | |
| 192 | 196 | |
| 193 | 197 | } |
| 194 | 198 | |
| ... | ... | @@ -262,7 +266,7 @@ |
| 262 | 266 | return NULL; |
| 263 | 267 | } |
| 264 | 268 | |
| 265 | - GVariant * internal_get_state_property(GAction *object, GtkWidget G_GNUC_UNUSED(*terminal)) { | |
| 269 | + GVariant * internal_get_state(GAction *object, GtkWidget G_GNUC_UNUSED(*terminal)) { | |
| 266 | 270 | |
| 267 | 271 | V3270Action * action = V3270_ACTION(object); |
| 268 | 272 | |
| ... | ... | @@ -273,19 +277,7 @@ |
| 273 | 277 | } |
| 274 | 278 | |
| 275 | 279 | GVariant * get_state_property(GAction *object) { |
| 276 | - | |
| 277 | - V3270Action * action = V3270_ACTION(object); | |
| 278 | - GVariant * state; | |
| 279 | - | |
| 280 | - if(action->terminal) | |
| 281 | - state = action->get_state_property(object,action->terminal); | |
| 282 | - else | |
| 283 | - state = internal_get_state_property(object,NULL); | |
| 284 | - | |
| 285 | - if(state) | |
| 286 | - g_variant_ref(state); | |
| 287 | - | |
| 288 | - return state; | |
| 280 | + return V3270_ACTION_GET_CLASS(object)->get_state(object,V3270_ACTION(object)->terminal); | |
| 289 | 281 | } |
| 290 | 282 | |
| 291 | 283 | const GVariantType * get_parameter_type(GAction *action) { |
| ... | ... | @@ -297,8 +289,7 @@ |
| 297 | 289 | } |
| 298 | 290 | |
| 299 | 291 | GVariant * get_state_hint(GAction *object) { |
| 300 | - V3270Action *action = V3270_ACTION(object); | |
| 301 | - return action->get_state_hint(object,action->terminal); | |
| 292 | + return V3270_ACTION_GET_CLASS(object)->get_state_hint(object,V3270_ACTION(object)->terminal); | |
| 302 | 293 | } |
| 303 | 294 | |
| 304 | 295 | void change_state(GAction G_GNUC_UNUSED(*object), GVariant G_GNUC_UNUSED(*value)) { | ... | ... |