From dc851660d2cf8d162ac1e9de703ca7cf78be2595 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 17 Dec 2013 20:07:12 +0000 Subject: [PATCH] Incluindo notificacao quando da mudanca de um toggle --- src/include/lib3270.h | 2 +- src/lib3270/toggles.c | 62 +++++++++++++++++++++++++++++++------------------------------- src/pw3270/v3270/widget.c | 55 +++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 69 insertions(+), 50 deletions(-) diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 7a24880..7d66e8c 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -641,7 +641,7 @@ * @return Constant string with the toggle name. * */ - LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix); + LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix); /** * Revert toggle status. diff --git a/src/lib3270/toggles.c b/src/lib3270/toggles.c index e7371ab..da0c4c8 100644 --- a/src/lib3270/toggles.c +++ b/src/lib3270/toggles.c @@ -58,36 +58,36 @@ static const struct _toggle { const char *name; - const char *descr; + const char *description; } toggle_info[LIB3270_TOGGLE_COUNT] = { - { "monocase", "" }, - { "cursorblink", "" }, - { "showtiming", "" }, - { "cursorpos", "" }, - { "dstrace", "" }, - { "linewrap", "" }, - { "blankfill", "" }, - { "screentrace", "" }, - { "eventtrace", "" }, - { "marginedpaste", "" }, - { "rectselect", "" }, - { "crosshair", "" }, - { "fullscreen", "" }, - { "reconnect", "" }, - { "insert", "" }, - { "smartpaste", "" }, - { "bold", "" }, - { "keepselected", "" }, - { "underline", "" }, - { "autoconnect", "" }, - { "kpalternative", "" }, /**< Keypad +/- move to next/previous field */ - { "beep", "" }, /**< Beep on errors */ - { "fieldattr", "" }, /**< View Field attribute */ - { "altscreen", "" }, /**< auto resize on altscreen */ - { "keepalive", "" }, /**< Enable network keep-alive with SO_KEEPALIVE */ - { "nettrace", "" }, /**< Enable network in/out trace */ + { "monocase", N_( "" ) }, + { "cursorblink", N_( "" ) }, + { "showtiming", N_( "" ) }, + { "cursorpos", N_( "" ) }, + { "dstrace", N_( "" ) }, + { "linewrap", N_( "" ) }, + { "blankfill", N_( "" ) }, + { "screentrace", N_( "" ) }, + { "eventtrace", N_( "" ) }, + { "marginedpaste", N_( "" ) }, + { "rectselect", N_( "" ) }, + { "crosshair", N_( "" ) }, + { "fullscreen", N_( "" ) }, + { "reconnect", N_( "" ) }, + { "insert", N_( "" ) }, + { "smartpaste", N_( "" ) }, + { "bold", N_( "" ) }, + { "keepselected", N_( "" ) }, + { "underline", N_( "" ) }, + { "autoconnect", N_( "" ) }, + { "kpalternative", N_( "Keypad +/- move to next/previous field" ) }, + { "beep", N_( "Beep on errors" ) }, + { "fieldattr", N_( "Show Field attribute" ) }, + { "altscreen", N_( "Auto resize on altscreen" ) }, + { "keepalive", N_( "Enable network keep-alive with SO_KEEPALIVE" ) }, + { "nettrace", N_( "Enable network in/out trace" ) }, }; LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) @@ -109,7 +109,7 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG t->upcall(session, t, TT_INTERACTIVE); if(session->update_toggle) - session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_names[ix]); + session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); } @@ -244,14 +244,14 @@ void shutdown_toggles(H3270 *session) LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix) { if(ix < N_TOGGLES) - return toggle_names[ix]; + return toggle_info[ix].description; return ""; } LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix) { if(ix < N_TOGGLES) - return toggle_names[ix]; + return toggle_info[ix].name; return ""; } @@ -262,7 +262,7 @@ LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name) int f; for(f=0;fhost,prop_id - PROP_TOGGLE, (int) g_value_get_boolean (value)); + return; + } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } +static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec) +{ + v3270 *window = GTK_V3270(object); + + switch (prop_id) + { + case PROP_FULLSCREEN: + #warning Get the correct value + g_value_set_boolean(value,FALSE); + break; + + default: + if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) + { + g_value_set_boolean(value,lib3270_get_toggle(window->host,prop_id - PROP_TOGGLE) ? TRUE : FALSE ); + return; + } + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + static void v3270_class_init(v3270Class *klass) { GObjectClass * gobject_class = G_OBJECT_CLASS(klass); @@ -598,14 +628,10 @@ static void v3270_class_init(v3270Class *klass) // Properties gobject_class->set_property = v3270_set_property; + gobject_class->get_property = v3270_get_property; - g_object_class_install_property( - gobject_class, - PROP_FULLSCREEN, - g_param_spec_boolean("fullscreen", - "Fullscreen","If TRUE, the toplevel window was set to fullscreen", - FALSE, - G_PARAM_WRITABLE|G_PARAM_READABLE)); + v3270_properties[PROP_FULLSCREEN] = g_param_spec_boolean("fullscreen","Fullscreen","If TRUE, the toplevel window was set to fullscreen",FALSE,G_PARAM_WRITABLE|G_PARAM_READABLE); + g_object_class_install_property(gobject_class,PROP_FULLSCREEN,v3270_properties[PROP_FULLSCREEN]); // Toggle properties @@ -613,18 +639,10 @@ static void v3270_class_init(v3270Class *klass) for(f=0;fwidget), v3270_properties[PROP_TOGGLE+ix]); g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); } -- libgit2 0.21.2