Commit ba9c900fcf2a9a193614857c85c5ce347b282c6f

Authored by Perry Werneck
1 parent 0b04128a

Incluindo parâmetro para definir quebra de linha na requisição via D-Bus.

src/plugins/dbus3270/gobject.c
@@ -314,7 +314,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus @@ -314,7 +314,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
314 } 314 }
315 } 315 }
316 316
317 - void pw3270_dbus_get_text(PW3270Dbus *object, int offset, int len, DBusGMethodInvocation *context) 317 + void pw3270_dbus_get_text(PW3270Dbus *object, int offset, int len, char lf, DBusGMethodInvocation *context)
318 { 318 {
319 gchar * text; 319 gchar * text;
320 H3270 * hSession = pw3270_dbus_get_session_handle(object); 320 H3270 * hSession = pw3270_dbus_get_session_handle(object);
@@ -323,7 +323,11 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus @@ -323,7 +323,11 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
323 if(pw3270_dbus_check_valid_state(object,context)) 323 if(pw3270_dbus_check_valid_state(object,context))
324 return; 324 return;
325 325
326 - text = lib3270_get_text(hSession,offset,len,'\n'); 326 + if(len < 0) {
  327 + len = lib3270_get_length(hSession);
  328 + }
  329 +
  330 + text = lib3270_get_text(hSession,offset,len,lf);
327 if(!text) 331 if(!text)
328 { 332 {
329 GError *error = pw3270_dbus_get_error_from_errno(errno); 333 GError *error = pw3270_dbus_get_error_from_errno(errno);
@@ -336,6 +340,8 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus @@ -336,6 +340,8 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
336 340
337 lib3270_free(text); 341 lib3270_free(text);
338 342
  343 + debug("\n%s\n",utftext);
  344 +
339 dbus_g_method_return(context,utftext); 345 dbus_g_method_return(context,utftext);
340 346
341 g_free(utftext); 347 g_free(utftext);
src/plugins/dbus3270/pw3270dbus.xml
@@ -79,6 +79,7 @@ @@ -79,6 +79,7 @@
79 <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> 79 <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
80 <arg type="i" name="addr" direction="in" /> 80 <arg type="i" name="addr" direction="in" />
81 <arg type="i" name="len" direction="in" /> 81 <arg type="i" name="len" direction="in" />
  82 + <arg type="y" name="lf" direction="in" />
82 <arg type="s" name="text" direction="out" /> 83 <arg type="s" name="text" direction="out" />
83 </method> 84 </method>
84 <method name="setClipboard"> 85 <method name="setClipboard">
src/plugins/dbus3270/service.h
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context); 113 void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context);
114 void pw3270_dbus_set_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context); 114 void pw3270_dbus_set_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context);
115 void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context); 115 void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context);
116 - void pw3270_dbus_get_text(PW3270Dbus *object, int offset, int len, DBusGMethodInvocation *context); 116 + void pw3270_dbus_get_text(PW3270Dbus *object, int offset, int len, char lf, DBusGMethodInvocation *context);
117 void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context); 117 void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context);
118 void pw3270_dbus_input(PW3270Dbus *object, const gchar *utftext, DBusGMethodInvocation *context); 118 void pw3270_dbus_input(PW3270Dbus *object, const gchar *utftext, DBusGMethodInvocation *context);
119 119
src/plugins/dbus3270/test.sh
@@ -41,6 +41,10 @@ run_command() @@ -41,6 +41,10 @@ run_command()
41 dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getScreenContents 41 dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getScreenContents
42 ;; 42 ;;
43 43
  44 + gettext)
  45 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getText int32:1 int32:-1 byte:0
  46 + ;;
  47 +
44 protect) 48 protect)
45 dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getIsProtectedAt int32:$2 int32:$3 49 dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getIsProtectedAt int32:$2 int32:$3
46 ;; 50 ;;