Commit 2a2345a6de2aaf60df13b6ec9961be2c44b4d607

Authored by Perry Werneck
1 parent c62a3222

Adding valgrind support.

Refactoring toggle action.
configure.ac
... ... @@ -120,6 +120,7 @@ AC_PATH_TOOL([MSGCAT], [msgcat], [no])
120 120 AC_PATH_TOOL([MSGINIT], [msginit], [no])
121 121 AC_PATH_TOOL([MSGMERGE], [msgmerge], [no])
122 122 AC_PATH_TOOL([MSGFMT], [msgfmt], [no])
  123 +AC_PATH_TOOL([VALGRIND], [valgrind], [no])
123 124  
124 125 AC_PATH_TOOL([DESKTOP_INSTALL],[desktop-file-install],[no])
125 126  
... ...
src/objects/actions/lib3270/toggle.c
... ... @@ -42,12 +42,12 @@
42 42 #define LIB3270_IS_TOGGLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), LIB3270_TYPE_TOGGLE_ACTION))
43 43  
44 44 typedef struct _Lib3270ToggleActionClass {
45   - pw3270ActionClass parent_class;
  45 + V3270ActionClass parent_class;
46 46  
47 47 } Lib3270ToggleActionClass;
48 48  
49 49 typedef struct _Lib3270ToggleAction {
50   - pw3270Action parent;
  50 + V3270Action parent;
51 51  
52 52 const LIB3270_TOGGLE * definition;
53 53 const void * listener;
... ... @@ -57,10 +57,10 @@
57 57 static void Lib3270ToggleAction_class_init(Lib3270ToggleActionClass *klass);
58 58 static void Lib3270ToggleAction_init(Lib3270ToggleAction *action);
59 59  
60   - G_DEFINE_TYPE(Lib3270ToggleAction, Lib3270ToggleAction, PW3270_TYPE_ACTION);
  60 + G_DEFINE_TYPE(Lib3270ToggleAction, Lib3270ToggleAction, V3270_TYPE_ACTION);
61 61  
62 62 static void change_state(H3270 G_GNUC_UNUSED(*hSession), LIB3270_TOGGLE_ID G_GNUC_UNUSED(id), char G_GNUC_UNUSED(state), void G_GNUC_UNUSED(*action)) {
63   - pw3270_action_notify_state(G_ACTION(action));
  63 + v3270_action_notify_state(G_ACTION(action));
64 64 }
65 65  
66 66 static void change_widget(GAction *object, GtkWidget *from, GtkWidget *to) {
... ... @@ -73,7 +73,7 @@
73 73 if(to)
74 74 action->listener = lib3270_register_toggle_listener(v3270_get_session(to),action->definition->id,change_state,object);
75 75  
76   - PW3270_ACTION_CLASS(Lib3270ToggleAction_parent_class)->change_widget(object,from,to);
  76 + V3270_ACTION_CLASS(Lib3270ToggleAction_parent_class)->change_widget(object,from,to);
77 77  
78 78 }
79 79  
... ... @@ -103,6 +103,8 @@
103 103  
104 104 static GVariant * get_state_property(GAction *action, GtkWidget *terminal) {
105 105  
  106 + debug("%s(%s)",__FUNCTION__,g_action_get_name(action));
  107 +
106 108 return g_variant_new_boolean(
107 109 lib3270_get_toggle(
108 110 v3270_get_session(terminal),
... ... @@ -117,7 +119,7 @@
117 119 action->definition = NULL;
118 120 action->listener = NULL;
119 121  
120   - action->parent.name = "toggle";
  122 +// action->parent.name = "toggle";
121 123  
122 124 action->parent.get_state_property = get_state_property;
123 125 action->parent.activate = activate;
... ... @@ -130,8 +132,9 @@
130 132  
131 133 Lib3270ToggleAction * action = (Lib3270ToggleAction *) g_object_new(LIB3270_TYPE_TOGGLE_ACTION, NULL);
132 134  
  135 + action->parent.info = (const LIB3270_PROPERTY *) definition;
  136 +
133 137 action->definition = definition;
134   - action->parent.name = definition->name;
135 138  
136 139 return G_ACTION(action);
137 140  
... ...