Commit 5e533e4a4960bd11412aa541f553e387b8c3a197

Authored by Perry Werneck
1 parent ab27b847
Exists in master and in 1 other branch develop

+ Introspecting actions from lib3270's macros

Showing 1 changed file with 25 additions and 0 deletions   Show diff stats
src/linux/gobject.c
@@ -76,6 +76,28 @@ GObject * ipc3270_new(GtkWidget *window, GtkWidget *terminal) { @@ -76,6 +76,28 @@ GObject * ipc3270_new(GtkWidget *window, GtkWidget *terminal) {
76 76
77 void ipc3270_set_session(GObject *object, H3270 *hSession, const char *name, GError **error) { 77 void ipc3270_set_session(GObject *object, H3270 *hSession, const char *name, GError **error) {
78 78
  79 + #define DECLARE_LIB3270_ACTION( name ) \
  80 + g_string_append_printf(introspection, \
  81 + " <method name='%s'>" \
  82 + " </method>", #name);
  83 +
  84 + #define DECLARE_LIB3270_KEY_ACTION( name ) \
  85 + g_string_append_printf(introspection, \
  86 + " <method name='%s'>" \
  87 + " </method>", #name);
  88 +
  89 + #define DECLARE_LIB3270_CURSOR_ACTION( name ) \
  90 + g_string_append_printf(introspection, \
  91 + " <method name='%s'>" \
  92 + " </method>", #name);
  93 +
  94 + #define DECLARE_LIB3270_FKEY_ACTION( name ) \
  95 + g_string_append_printf(introspection, \
  96 + " <method name='%s'>" \
  97 + " <arg type='i' name='keycode' direction='in'/>" \
  98 + " </method>", # name);
  99 +
  100 +
79 char id; 101 char id;
80 int ix; 102 int ix;
81 103
@@ -147,6 +169,9 @@ void ipc3270_set_session(GObject *object, H3270 *hSession, const char *name, GEr @@ -147,6 +169,9 @@ void ipc3270_set_session(GObject *object, H3270 *hSession, const char *name, GEr
147 " </method>" 169 " </method>"
148 ); 170 );
149 171
  172 + // Constrói métodos usando as macros
  173 + #include <lib3270/action_table.h>
  174 +
150 // Inclui toggles 175 // Inclui toggles
151 for(ix = 0; ix < (int) LIB3270_TOGGLE_COUNT; ix++) { 176 for(ix = 0; ix < (int) LIB3270_TOGGLE_COUNT; ix++) {
152 g_string_append_printf(introspection, " <property type='i' name='%s' access='readwrite'/>", lib3270_get_toggle_name((LIB3270_TOGGLE) ix)); 177 g_string_append_printf(introspection, " <property type='i' name='%s' access='readwrite'/>", lib3270_get_toggle_name((LIB3270_TOGGLE) ix));