Commit b7cc91ca9019231adc232377060bd499f820d6c4

Authored by perry.werneck@gmail.com
1 parent 96ed31d5

Incluindo método para setar string no plugin dbus

src/plugins/dbus3270/gobject.c
@@ -198,3 +198,19 @@ void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context) @@ -198,3 +198,19 @@ void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context)
198 return; 198 return;
199 dbus_g_method_return(context,lib3270_enter(pw3270_dbus_get_session_handle(object))); 199 dbus_g_method_return(context,lib3270_enter(pw3270_dbus_get_session_handle(object)));
200 } 200 }
  201 +
  202 +void pw3270_dbus_set_text_at(PW3270Dbus *object, int row, int col, const gchar *utftext, DBusGMethodInvocation *context)
  203 +{
  204 + gchar * text;
  205 + H3270 * hSession = pw3270_dbus_get_session_handle(object);
  206 +
  207 + trace("%s object=%p context=%p",__FUNCTION__,object,context);
  208 + if(pw3270_dbus_check_valid_state(object,context))
  209 + return;
  210 +
  211 + text = g_convert_with_fallback(utftext,-1,lib3270_get_charset(hSession),"UTF-8","?",NULL,NULL,NULL);
  212 +
  213 + dbus_g_method_return(context,lib3270_set_string_at(hSession,row,col,(const unsigned char *) text));
  214 +
  215 + g_free(text);
  216 +}
src/plugins/dbus3270/pw3270dbus.xml
@@ -30,5 +30,11 @@ @@ -30,5 +30,11 @@
30 <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> 30 <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
31 <arg type="i" name="result" direction="out" /> 31 <arg type="i" name="result" direction="out" />
32 </method> 32 </method>
  33 + <method name="setTextAt">
  34 + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
  35 + <arg type="i" name="row" direction="in" />
  36 + <arg type="i" name="col" direction="in" />
  37 + <arg type="s" name="text" direction="in" />
  38 + </method>
33 </interface> 39 </interface>
34 </node> 40 </node>
src/plugins/dbus3270/service.h
@@ -77,6 +77,7 @@ @@ -77,6 +77,7 @@
77 77
78 // Actions 78 // Actions
79 void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context); 79 void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context);
  80 + void pw3270_dbus_set_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context);
80 81
81 82
82 G_END_DECLS 83 G_END_DECLS
src/plugins/dbus3270/test.sh
@@ -26,6 +26,10 @@ case $1 in @@ -26,6 +26,10 @@ case $1 in
26 dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getScreenContents 26 dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.getScreenContents
27 ;; 27 ;;
28 28
  29 + set)
  30 + dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.setTextAt int32:$2 int32:$3 string:$4
  31 + ;;
  32 +
29 enter) 33 enter)
30 dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.enter 34 dbus-send --session --print-reply --dest=br.com.bb.pw3270 /br/com/bb/pw3270 br.com.bb.pw3270.enter
31 ;; 35 ;;