Commit 854943ad97c5b1c5e34774f612a4c647245444d2
1 parent
054cdd23
Exists in
master
and in
5 other branches
Implementando plugin dbus, adicionando funcoes para obter e testar conteudo da t…
…ela pela posição em linha/coluna, incluindo projeto codeblocks do sample no pacote devel
Showing
12 changed files
with
171 additions
and
44 deletions
Show diff stats
Makefile.in
| @@ -305,6 +305,7 @@ install-sdk: | @@ -305,6 +305,7 @@ install-sdk: | ||
| 305 | 305 | ||
| 306 | @$(MKDIR) $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample | 306 | @$(MKDIR) $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample |
| 307 | @$(INSTALL_DATA) src/sample/Makefile $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample | 307 | @$(INSTALL_DATA) src/sample/Makefile $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample |
| 308 | + @$(INSTALL_DATA) src/sample/sample.cbp $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample | ||
| 308 | @$(INSTALL_DATA) src/sample/*.c $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample | 309 | @$(INSTALL_DATA) src/sample/*.c $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample |
| 309 | 310 | ||
| 310 | clean: | 311 | clean: |
configure.ac
| @@ -349,10 +349,14 @@ AC_SUBST(GLIB_CFLAGS) | @@ -349,10 +349,14 @@ AC_SUBST(GLIB_CFLAGS) | ||
| 349 | 349 | ||
| 350 | #--[ Check DBUS ]--------------------------------------------------------------------------------------------------------------------------------------------- | 350 | #--[ Check DBUS ]--------------------------------------------------------------------------------------------------------------------------------------------- |
| 351 | 351 | ||
| 352 | -PKG_CHECK_MODULES( [DBUS], [dbus-glib-1], AC_DEFINE(HAVE_DBUS), AC_MSG_NOTICE([No DBUS support.]) ) | 352 | +PKG_CHECK_MODULES( [DBUS], [dbus-glib-1], app_cv_dbus=yes, AC_MSG_NOTICE([No DBUS support.]) ) |
| 353 | AC_SUBST(DBUS_LIBS) | 353 | AC_SUBST(DBUS_LIBS) |
| 354 | AC_SUBST(DBUS_CFLAGS) | 354 | AC_SUBST(DBUS_CFLAGS) |
| 355 | 355 | ||
| 356 | +#if test "$app_cv_dbus" == "yes"; then | ||
| 357 | +# PLUGINS="$PLUGINS dbus3270" | ||
| 358 | +#fi | ||
| 359 | + | ||
| 356 | #--[ SSL ]---------------------------------------------------------------------------------------------------------------------------------------------------- | 360 | #--[ SSL ]---------------------------------------------------------------------------------------------------------------------------------------------------- |
| 357 | 361 | ||
| 358 | PKG_CHECK_MODULES( [LIBSSL], [libssl], AC_DEFINE(HAVE_LIBSSL), AC_MSG_NOTICE([libssl not present.]) ) | 362 | PKG_CHECK_MODULES( [LIBSSL], [libssl], AC_DEFINE(HAVE_LIBSSL), AC_MSG_NOTICE([libssl not present.]) ) |
po/pt_BR.po
| @@ -5,7 +5,7 @@ msgid "" | @@ -5,7 +5,7 @@ msgid "" | ||
| 5 | msgstr "" | 5 | msgstr "" |
| 6 | "Project-Id-Version: pw3270 5.0\n" | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | "Report-Msgid-Bugs-To: \n" | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2013-02-19 17:42-0300\n" | 8 | +"POT-Creation-Date: 2013-02-21 10:43-0300\n" |
| 9 | "PO-Revision-Date: 2013-01-14 09:49-0200\n" | 9 | "PO-Revision-Date: 2013-01-14 09:49-0200\n" |
| 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | "Language-Team: Português <>\n" | 11 | "Language-Team: Português <>\n" |
| @@ -38,7 +38,7 @@ msgstr "Ação %s precisa de um valor válido" | @@ -38,7 +38,7 @@ msgstr "Ação %s precisa de um valor válido" | ||
| 38 | msgid "%s action needs src attribute" | 38 | msgid "%s action needs src attribute" |
| 39 | msgstr "Ação %s precisa do atributo src" | 39 | msgstr "Ação %s precisa do atributo src" |
| 40 | 40 | ||
| 41 | -#: main.c:76 | 41 | +#: main.c:86 |
| 42 | #, c-format | 42 | #, c-format |
| 43 | msgid "%s requires GTK version %d.%d.%d" | 43 | msgid "%s requires GTK version %d.%d.%d" |
| 44 | msgstr "%s requer GTK versão %d.%d.%d" | 44 | msgstr "%s requer GTK versão %d.%d.%d" |
| @@ -83,7 +83,7 @@ msgstr "%s: Familia %d é inválida" | @@ -83,7 +83,7 @@ msgstr "%s: Familia %d é inválida" | ||
| 83 | msgid "%s:%d" | 83 | msgid "%s:%d" |
| 84 | msgstr "%s:%d" | 84 | msgstr "%s:%d" |
| 85 | 85 | ||
| 86 | -#: main.c:259 | 86 | +#: main.c:318 |
| 87 | msgid "- 3270 Emulator for Gtk" | 87 | msgid "- 3270 Emulator for Gtk" |
| 88 | msgstr "- Emulador 3270 para GTK" | 88 | msgstr "- Emulador 3270 para GTK" |
| 89 | 89 | ||
| @@ -164,7 +164,7 @@ msgstr "" | @@ -164,7 +164,7 @@ msgstr "" | ||
| 164 | msgid "<b>SSL state is undefined</b>Unexpected SSL status %ld" | 164 | msgid "<b>SSL state is undefined</b>Unexpected SSL status %ld" |
| 165 | msgstr "<b>Estado do SSL é indefinido</b>Estado SSL inesperado %ld" | 165 | msgstr "<b>Estado do SSL é indefinido</b>Estado SSL inesperado %ld" |
| 166 | 166 | ||
| 167 | -#: main.c:279 | 167 | +#: main.c:338 |
| 168 | msgid "" | 168 | msgid "" |
| 169 | "<b>Valid options:</b>\n" | 169 | "<b>Valid options:</b>\n" |
| 170 | "\n" | 170 | "\n" |
| @@ -217,7 +217,7 @@ msgid "An error occurred trying to allocate memory. This should never happen." | @@ -217,7 +217,7 @@ msgid "An error occurred trying to allocate memory. This should never happen." | ||
| 217 | msgstr "" | 217 | msgstr "" |
| 218 | "Ocorreu um erro ao tentar alocar memória. Isso nunca deveria acontecer." | 218 | "Ocorreu um erro ao tentar alocar memória. Isso nunca deveria acontecer." |
| 219 | 219 | ||
| 220 | -#: main.c:246 main.c:248 | 220 | +#: main.c:302 main.c:304 |
| 221 | msgid "Application name" | 221 | msgid "Application name" |
| 222 | msgstr "Nome da aplicação" | 222 | msgstr "Nome da aplicação" |
| 223 | 223 | ||
| @@ -334,7 +334,7 @@ msgstr "Não foi possível conectar ao servidor" | @@ -334,7 +334,7 @@ msgstr "Não foi possível conectar ao servidor" | ||
| 334 | msgid "Can't convert line %d from %s to %s" | 334 | msgid "Can't convert line %d from %s to %s" |
| 335 | msgstr "Não foi possível converter a linha %d de %s para %s" | 335 | msgstr "Não foi possível converter a linha %d de %s para %s" |
| 336 | 336 | ||
| 337 | -#: selection.c:601 | 337 | +#: selection.c:631 |
| 338 | msgid "Can't cut rectangular regions" | 338 | msgid "Can't cut rectangular regions" |
| 339 | msgstr "Recortar não permitido em seleção retangular" | 339 | msgstr "Recortar não permitido em seleção retangular" |
| 340 | 340 | ||
| @@ -723,7 +723,7 @@ msgstr "Tela cheia" | @@ -723,7 +723,7 @@ msgstr "Tela cheia" | ||
| 723 | msgid "Function bar" | 723 | msgid "Function bar" |
| 724 | msgstr "Barra de funções" | 724 | msgstr "Barra de funções" |
| 725 | 725 | ||
| 726 | -#: main.c:80 main.c:312 | 726 | +#: main.c:90 main.c:379 |
| 727 | msgid "GTK Version mismatch" | 727 | msgid "GTK Version mismatch" |
| 728 | msgstr "Divergência de versão GTK" | 728 | msgstr "Divergência de versão GTK" |
| 729 | 729 | ||
| @@ -792,11 +792,11 @@ msgstr "Servidor rejeitou o tipo de dispositivo ou requisição" | @@ -792,11 +792,11 @@ msgstr "Servidor rejeitou o tipo de dispositivo ou requisição" | ||
| 792 | msgid "Host rejected resource(s)" | 792 | msgid "Host rejected resource(s)" |
| 793 | msgstr "Servidor rejeitou recurso(s)" | 793 | msgstr "Servidor rejeitou recurso(s)" |
| 794 | 794 | ||
| 795 | -#: main.c:254 | 795 | +#: main.c:310 |
| 796 | msgid "Host system type" | 796 | msgid "Host system type" |
| 797 | msgstr "Tipo do sistema no servidor" | 797 | msgstr "Tipo do sistema no servidor" |
| 798 | 798 | ||
| 799 | -#: main.c:252 | 799 | +#: main.c:308 |
| 800 | msgid "Host to connect" | 800 | msgid "Host to connect" |
| 801 | msgstr "Servidor a conectar" | 801 | msgstr "Servidor a conectar" |
| 802 | 802 | ||
| @@ -855,7 +855,7 @@ msgstr "Invalid CGCSGID '%s', ignoring" | @@ -855,7 +855,7 @@ msgstr "Invalid CGCSGID '%s', ignoring" | ||
| 855 | msgid "Invalid charset entry '%s' (#%d)" | 855 | msgid "Invalid charset entry '%s' (#%d)" |
| 856 | msgstr "Invalid charset entry '%s' (#%d)" | 856 | msgstr "Invalid charset entry '%s' (#%d)" |
| 857 | 857 | ||
| 858 | -#: selection.c:601 | 858 | +#: selection.c:631 |
| 859 | msgid "Invalid cut action" | 859 | msgid "Invalid cut action" |
| 860 | msgstr "Ação recortar inválida" | 860 | msgstr "Ação recortar inválida" |
| 861 | 861 | ||
| @@ -961,7 +961,7 @@ msgstr "Normal/Protegido" | @@ -961,7 +961,7 @@ msgstr "Normal/Protegido" | ||
| 961 | msgid "Normal/Unprotected" | 961 | msgid "Normal/Unprotected" |
| 962 | msgstr "Normal/Desprotegido" | 962 | msgstr "Normal/Desprotegido" |
| 963 | 963 | ||
| 964 | -#: selection.c:601 | 964 | +#: selection.c:631 |
| 965 | msgid "Not available" | 965 | msgid "Not available" |
| 966 | msgstr "Não disponível" | 966 | msgstr "Não disponível" |
| 967 | 967 | ||
| @@ -1126,7 +1126,7 @@ msgstr "PF8" | @@ -1126,7 +1126,7 @@ msgstr "PF8" | ||
| 1126 | msgid "PF9" | 1126 | msgid "PF9" |
| 1127 | msgstr "PF9" | 1127 | msgstr "PF9" |
| 1128 | 1128 | ||
| 1129 | -#: main.c:277 | 1129 | +#: main.c:336 |
| 1130 | msgid "Parse error" | 1130 | msgid "Parse error" |
| 1131 | msgstr "Erro de interpretação" | 1131 | msgstr "Erro de interpretação" |
| 1132 | 1132 | ||
| @@ -1163,7 +1163,7 @@ msgstr "Colar com margem esquerda" | @@ -1163,7 +1163,7 @@ msgstr "Colar com margem esquerda" | ||
| 1163 | msgid "Path length constraint exceeded" | 1163 | msgid "Path length constraint exceeded" |
| 1164 | msgstr "Path length constraint exceeded" | 1164 | msgstr "Path length constraint exceeded" |
| 1165 | 1165 | ||
| 1166 | -#: main.c:249 | 1166 | +#: main.c:305 |
| 1167 | msgid "Path to application data files" | 1167 | msgid "Path to application data files" |
| 1168 | msgstr "Path to application data files" | 1168 | msgstr "Path to application data files" |
| 1169 | 1169 | ||
| @@ -1580,11 +1580,15 @@ msgstr "Enviar arquivo" | @@ -1580,11 +1580,15 @@ msgstr "Enviar arquivo" | ||
| 1580 | msgid "Send file to host" | 1580 | msgid "Send file to host" |
| 1581 | msgstr "Enviar arquivo para o servidor" | 1581 | msgstr "Enviar arquivo para o servidor" |
| 1582 | 1582 | ||
| 1583 | +#: main.c:312 | ||
| 1584 | +msgid "Send messages to syslog" | ||
| 1585 | +msgstr "Send messages to syslog" | ||
| 1586 | + | ||
| 1583 | #: ui/00default.xml:276 | 1587 | #: ui/00default.xml:276 |
| 1584 | msgid "Send/Receive" | 1588 | msgid "Send/Receive" |
| 1585 | msgstr "Enviar/Receber" | 1589 | msgstr "Enviar/Receber" |
| 1586 | 1590 | ||
| 1587 | -#: main.c:251 | 1591 | +#: main.c:307 |
| 1588 | msgid "Session name" | 1592 | msgid "Session name" |
| 1589 | msgstr "Nome da sessão" | 1593 | msgstr "Nome da sessão" |
| 1590 | 1594 | ||
| @@ -1592,7 +1596,7 @@ msgstr "Nome da sessão" | @@ -1592,7 +1596,7 @@ msgstr "Nome da sessão" | ||
| 1592 | msgid "Set hostname" | 1596 | msgid "Set hostname" |
| 1593 | msgstr "Selecione servidor" | 1597 | msgstr "Selecione servidor" |
| 1594 | 1598 | ||
| 1595 | -#: main.c:253 | 1599 | +#: main.c:309 |
| 1596 | msgid "Set reported colors (8/16)" | 1600 | msgid "Set reported colors (8/16)" |
| 1597 | msgstr "Define número de cores informadas (8/16)" | 1601 | msgstr "Define número de cores informadas (8/16)" |
| 1598 | 1602 | ||
| @@ -1871,7 +1875,7 @@ msgstr "" | @@ -1871,7 +1875,7 @@ msgstr "" | ||
| 1871 | "programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple " | 1875 | "programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple " |
| 1872 | "Place, Suite 330, Boston, MA, 02111-1307, USA" | 1876 | "Place, Suite 330, Boston, MA, 02111-1307, USA" |
| 1873 | 1877 | ||
| 1874 | -#: main.c:308 | 1878 | +#: main.c:375 |
| 1875 | #, c-format | 1879 | #, c-format |
| 1876 | msgid "This program requires GTK version %d.%d.%d" | 1880 | msgid "This program requires GTK version %d.%d.%d" |
| 1877 | msgstr "Este programa precisa do GTK versão %d.%d.%d" | 1881 | msgstr "Este programa precisa do GTK versão %d.%d.%d" |
| @@ -2008,7 +2012,7 @@ msgstr "Atributo %s inesperado ou inválido: \"%s\"" | @@ -2008,7 +2012,7 @@ msgstr "Atributo %s inesperado ou inválido: \"%s\"" | ||
| 2008 | msgid "Unexpected or invalid attribute value \"%s\"" | 2012 | msgid "Unexpected or invalid attribute value \"%s\"" |
| 2009 | msgstr "Valor de attributo inesperado ou inválido: \"%s\"" | 2013 | msgstr "Valor de attributo inesperado ou inválido: \"%s\"" |
| 2010 | 2014 | ||
| 2011 | -#: main.c:181 | 2015 | +#: main.c:191 |
| 2012 | #, c-format | 2016 | #, c-format |
| 2013 | msgid "Unexpected or invalid color value \"%s\"" | 2017 | msgid "Unexpected or invalid color value \"%s\"" |
| 2014 | msgstr "Valor de cor inválido ou inesperado: \"%s\"" | 2018 | msgstr "Valor de cor inválido ou inesperado: \"%s\"" |
pw3270.cbp
| @@ -220,16 +220,6 @@ | @@ -220,16 +220,6 @@ | ||
| 220 | <Unit filename="src/lib3270/winversc.h" /> | 220 | <Unit filename="src/lib3270/winversc.h" /> |
| 221 | <Unit filename="src/lib3270/xioc.h" /> | 221 | <Unit filename="src/lib3270/xioc.h" /> |
| 222 | <Unit filename="src/lib3270/xl.h" /> | 222 | <Unit filename="src/lib3270/xl.h" /> |
| 223 | - <Unit filename="src/plugins/dbus/daemon.c"> | ||
| 224 | - <Option compilerVar="CC" /> | ||
| 225 | - </Unit> | ||
| 226 | - <Unit filename="src/plugins/dbus/gobject.c"> | ||
| 227 | - <Option compilerVar="CC" /> | ||
| 228 | - </Unit> | ||
| 229 | - <Unit filename="src/plugins/dbus/main.c"> | ||
| 230 | - <Option compilerVar="CC" /> | ||
| 231 | - </Unit> | ||
| 232 | - <Unit filename="src/plugins/dbus/service.h" /> | ||
| 233 | <Unit filename="src/plugins/dbus3270/Makefile.in" /> | 223 | <Unit filename="src/plugins/dbus3270/Makefile.in" /> |
| 234 | <Unit filename="src/plugins/dbus3270/daemon.c"> | 224 | <Unit filename="src/plugins/dbus3270/daemon.c"> |
| 235 | <Option compilerVar="CC" /> | 225 | <Option compilerVar="CC" /> |
src/include/lib3270.h
| @@ -806,6 +806,33 @@ | @@ -806,6 +806,33 @@ | ||
| 806 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len); | 806 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len); |
| 807 | 807 | ||
| 808 | /** | 808 | /** |
| 809 | + * Get text at requested position | ||
| 810 | + * | ||
| 811 | + * @param h Session Handle. | ||
| 812 | + * @param row Desired row. | ||
| 813 | + * @param col Desired col. | ||
| 814 | + * @param length Text length | ||
| 815 | + * | ||
| 816 | + * @return Contents at position if available, or NULL. Release it with lib3270_free() | ||
| 817 | + * | ||
| 818 | + */ | ||
| 819 | + LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len); | ||
| 820 | + | ||
| 821 | + /** | ||
| 822 | + * Check for text at requested position | ||
| 823 | + * | ||
| 824 | + * @param h Session Handle. | ||
| 825 | + * @param row Desired row. | ||
| 826 | + * @param col Desired col. | ||
| 827 | + * @param text Text to check. | ||
| 828 | + * | ||
| 829 | + * @return Test result from strcmp | ||
| 830 | + * | ||
| 831 | + */ | ||
| 832 | + LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text); | ||
| 833 | + | ||
| 834 | + | ||
| 835 | + /** | ||
| 809 | * Get contents of the field at position. | 836 | * Get contents of the field at position. |
| 810 | * | 837 | * |
| 811 | * @param h Session Handle. | 838 | * @param h Session Handle. |
src/lib3270/selection.c
| @@ -465,6 +465,8 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -465,6 +465,8 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
| 465 | return NULL; | 465 | return NULL; |
| 466 | 466 | ||
| 467 | maxlen = (h->rows * (h->cols+1)) - offset; | 467 | maxlen = (h->rows * (h->cols+1)) - offset; |
| 468 | + if(maxlen <= 0) | ||
| 469 | + return NULL; | ||
| 468 | 470 | ||
| 469 | if(len < 0 || len > maxlen) | 471 | if(len < 0 || len > maxlen) |
| 470 | len = maxlen; | 472 | len = maxlen; |
| @@ -500,6 +502,34 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -500,6 +502,34 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
| 500 | return buffer; | 502 | return buffer; |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 505 | +LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) | ||
| 506 | +{ | ||
| 507 | + CHECK_SESSION_HANDLE(h); | ||
| 508 | + | ||
| 509 | + if(!lib3270_connected(h)) | ||
| 510 | + return NULL; | ||
| 511 | + | ||
| 512 | + return lib3270_get_text(h, ((row) * h->cols) + col, len); | ||
| 513 | +} | ||
| 514 | + | ||
| 515 | +LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text) | ||
| 516 | +{ | ||
| 517 | + int rc; | ||
| 518 | + size_t sz = strlen(text); | ||
| 519 | + char * contents; | ||
| 520 | + | ||
| 521 | + contents = lib3270_get_text_at(h,row,col,sz); | ||
| 522 | + if(!contents) | ||
| 523 | + return -1; | ||
| 524 | + | ||
| 525 | + rc = strncmp(contents,text,sz); | ||
| 526 | + | ||
| 527 | + lib3270_free(contents); | ||
| 528 | + | ||
| 529 | + return rc; | ||
| 530 | +} | ||
| 531 | + | ||
| 532 | + | ||
| 503 | /** | 533 | /** |
| 504 | * Get field contents | 534 | * Get field contents |
| 505 | * | 535 | * |
src/plugins/dbus3270/Makefile.in
| @@ -110,7 +110,7 @@ Release: $(BINRLS)/plugins/$(MODULE_NAME).so | @@ -110,7 +110,7 @@ Release: $(BINRLS)/plugins/$(MODULE_NAME).so | ||
| 110 | $(BINRLS)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) | 110 | $(BINRLS)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) |
| 111 | @echo " CCLD `basename $@`" | 111 | @echo " CCLD `basename $@`" |
| 112 | @$(MKDIR) `dirname $@` | 112 | @$(MKDIR) `dirname $@` |
| 113 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(PW3270_LIBS) $(GLIB_LIBS) $(GTK_LIBS) | 113 | + @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(PW3270_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(DBUS_LIBS) |
| 114 | 114 | ||
| 115 | #---[ Debug targets ]---------------------------------------------------------- | 115 | #---[ Debug targets ]---------------------------------------------------------- |
| 116 | 116 | ||
| @@ -119,7 +119,7 @@ Debug: $(BINDBG)/plugins/$(MODULE_NAME).so | @@ -119,7 +119,7 @@ Debug: $(BINDBG)/plugins/$(MODULE_NAME).so | ||
| 119 | $(BINDBG)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) | 119 | $(BINDBG)/plugins/$(MODULE_NAME).so: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) |
| 120 | @echo " CCLD `basename $@`" | 120 | @echo " CCLD `basename $@`" |
| 121 | @$(MKDIR) `dirname $@` | 121 | @$(MKDIR) `dirname $@` |
| 122 | - @$(LD) $(DLL_FLAGS) @DBGRPATH@ -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(PW3270_LIBS) $(GLIB_LIBS) $(GTK_LIBS) | 122 | + @$(LD) $(DLL_FLAGS) @DBGRPATH@ -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(PW3270_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(DBUS_LIBS) |
| 123 | 123 | ||
| 124 | #---[ Misc targets ]----------------------------------------------------------- | 124 | #---[ Misc targets ]----------------------------------------------------------- |
| 125 | 125 |
src/plugins/dbus3270/daemon.c
| @@ -41,6 +41,10 @@ | @@ -41,6 +41,10 @@ | ||
| 41 | #include "daemon.h" | 41 | #include "daemon.h" |
| 42 | #include "dbus-glue.h" | 42 | #include "dbus-glue.h" |
| 43 | 43 | ||
| 44 | +#define PW3270_DBUS_SERVICE_PATH "/br/com/bb/pw3270" | ||
| 45 | +#define PW3270_DBUS_SERVICE "br.com.bb.pw3270" | ||
| 46 | + | ||
| 47 | + | ||
| 44 | /*---[ Globals ]---------------------------------------------------------------------------------*/ | 48 | /*---[ Globals ]---------------------------------------------------------------------------------*/ |
| 45 | 49 | ||
| 46 | static DBusGConnection * connection = NULL; | 50 | static DBusGConnection * connection = NULL; |
src/plugins/dbus3270/main.c
| @@ -47,12 +47,14 @@ | @@ -47,12 +47,14 @@ | ||
| 47 | static DBusGConnection * connection = NULL; | 47 | static DBusGConnection * connection = NULL; |
| 48 | static DBusGProxy * proxy = NULL; | 48 | static DBusGProxy * proxy = NULL; |
| 49 | 49 | ||
| 50 | + | ||
| 50 | /*---[ Implement ]-------------------------------------------------------------------------------*/ | 51 | /*---[ Implement ]-------------------------------------------------------------------------------*/ |
| 51 | 52 | ||
| 52 | LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) | 53 | LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) |
| 53 | { | 54 | { |
| 54 | 55 | ||
| 55 | - GError * error = NULL; | 56 | + GError * error = NULL; |
| 57 | + gchar * service_path = NULL; | ||
| 56 | guint result; | 58 | guint result; |
| 57 | 59 | ||
| 58 | connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); | 60 | connection = dbus_g_bus_get_private(DBUS_BUS_SESSION, g_main_context_default(), &error); |
| @@ -77,10 +79,22 @@ | @@ -77,10 +79,22 @@ | ||
| 77 | return -1; | 79 | return -1; |
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | - | ||
| 81 | proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | 82 | proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); |
| 82 | 83 | ||
| 83 | - org_freedesktop_DBus_request_name(proxy, PW3270_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | 84 | + { |
| 85 | + gchar * service_name = g_strdup_printf("br.com.bb.%s",pw3270_get_session_name(window)); | ||
| 86 | + | ||
| 87 | + service_path = g_strdup_printf("/br/com/bb/%s",pw3270_get_session_name(window)); | ||
| 88 | + | ||
| 89 | + trace("DBUS service path is %s",service_path); | ||
| 90 | + trace("DBUS service name is %s",service_name); | ||
| 91 | + | ||
| 92 | + org_freedesktop_DBus_request_name(proxy, service_name, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | ||
| 93 | + | ||
| 94 | + g_free(service_name); | ||
| 95 | + | ||
| 96 | + } | ||
| 97 | + | ||
| 84 | if(error) | 98 | if(error) |
| 85 | { | 99 | { |
| 86 | GtkWidget *dialog = gtk_message_dialog_new( | 100 | GtkWidget *dialog = gtk_message_dialog_new( |
| @@ -102,13 +116,25 @@ | @@ -102,13 +116,25 @@ | ||
| 102 | return -1; | 116 | return -1; |
| 103 | } | 117 | } |
| 104 | 118 | ||
| 105 | - pw3270_dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,PW3270_DBUS_SERVICE_PATH); | 119 | + pw3270_dbus_register_object(connection,proxy,PW3270_TYPE_DBUS,&dbus_glib_pw3270_dbus_object_info,service_path); |
| 120 | + | ||
| 121 | + g_free(service_path); | ||
| 106 | 122 | ||
| 107 | return 0; | 123 | return 0; |
| 108 | } | 124 | } |
| 109 | 125 | ||
| 110 | LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) | 126 | LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) |
| 111 | { | 127 | { |
| 112 | - | ||
| 113 | return 0; | 128 | return 0; |
| 114 | } | 129 | } |
| 130 | + | ||
| 131 | + void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
| 132 | + { | ||
| 133 | + gtk_main_quit(); | ||
| 134 | + dbus_g_method_return(context,0); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | +H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object) | ||
| 138 | +{ | ||
| 139 | + return lib3270_get_default_session_handle(); | ||
| 140 | +} |
src/plugins/dbus3270/service.h
| @@ -38,9 +38,6 @@ | @@ -38,9 +38,6 @@ | ||
| 38 | 38 | ||
| 39 | #include "globals.h" | 39 | #include "globals.h" |
| 40 | 40 | ||
| 41 | - #define PW3270_DBUS_SERVICE_PATH "/br/com/bb/pw3270" | ||
| 42 | - #define PW3270_DBUS_SERVICE "br.com.bb.pw3270" | ||
| 43 | - | ||
| 44 | #define PW3270_TYPE_DBUS (pw3270_dbus_get_type ()) | 41 | #define PW3270_TYPE_DBUS (pw3270_dbus_get_type ()) |
| 45 | #define PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PW3270_TYPE_DBUS, PW3270Dbus)) | 42 | #define PW3270_DBUS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PW3270_TYPE_DBUS, PW3270Dbus)) |
| 46 | #define PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PW3270_TYPE_DBUS, PW3270DbusClass)) | 43 | #define PW3270_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PW3270_TYPE_DBUS, PW3270DbusClass)) |
src/pw3270/print.c
| @@ -437,7 +437,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -437,7 +437,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
| 437 | gtk_list_store_append((GtkListStore *) model,&iter); | 437 | gtk_list_store_append((GtkListStore *) model,&iter); |
| 438 | gtk_list_store_set((GtkListStore *) model, &iter,0, name, -1); | 438 | gtk_list_store_set((GtkListStore *) model, &iter,0, name, -1); |
| 439 | 439 | ||
| 440 | - if(!g_strcasecmp(name,info->font)) | 440 | + if(!g_ascii_strcasecmp(name,info->font)) |
| 441 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter); | 441 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter); |
| 442 | } | 442 | } |
| 443 | } | 443 | } |
src/sample/connect.c
| @@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
| 33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
| 34 | #include <string.h> | 34 | #include <string.h> |
| 35 | #include <lib3270.h> | 35 | #include <lib3270.h> |
| 36 | + #include <lib3270/actions.h> | ||
| 36 | 37 | ||
| 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 38 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 38 | 39 | ||
| @@ -60,24 +61,67 @@ | @@ -60,24 +61,67 @@ | ||
| 60 | 61 | ||
| 61 | printf("Connected to LU %s\n",lib3270_get_luname(hSession)); | 62 | printf("Connected to LU %s\n",lib3270_get_luname(hSession)); |
| 62 | 63 | ||
| 63 | - /* Wait until the host is ready for commands */ | 64 | + // Wait until the host is ready for commands |
| 64 | rc = lib3270_wait_for_ready(hSession,60); | 65 | rc = lib3270_wait_for_ready(hSession,60); |
| 65 | if(rc) | 66 | if(rc) |
| 66 | { | 67 | { |
| 67 | fprintf(stderr,"Error waiting for session negotiation: %s\n",strerror(rc)); | 68 | fprintf(stderr,"Error waiting for session negotiation: %s\n",strerror(rc)); |
| 68 | return rc; | 69 | return rc; |
| 69 | } | 70 | } |
| 70 | - else | 71 | + |
| 72 | + while(lib3270_wait_for_ready(hSession,60)) | ||
| 73 | + { | ||
| 74 | + char * screen_id = lib3270_get_text(hSession,1,9); | ||
| 75 | + | ||
| 76 | + printf("Screen-id: [%s]",screen_id); | ||
| 77 | + | ||
| 78 | + if(!strcasecmp(screen_id)," ") | ||
| 79 | + { | ||
| 80 | +/* | ||
| 81 | + select | ||
| 82 | + when host~queryStringAt(16,34,"Tecle ENTER") | ||
| 83 | + then host~sendEnterKey() | ||
| 84 | + | ||
| 85 | + when host~queryStringAt(2,24,"Conexoes Externas ao SISBB") | ||
| 86 | + then host~sendEnterKey() | ||
| 87 | + | ||
| 88 | + when host~queryStringAt(15,2,"Aplicativo :") then | ||
| 89 | + do | ||
| 90 | + if host~queryStringAt(15,21,app) = 0 then | ||
| 91 | + do | ||
| 92 | + host~setStringAt(15,21,aplic) | ||
| 93 | + host~setCursorPosition(13,21) | ||
| 94 | + end | ||
| 95 | + end | ||
| 96 | + | ||
| 97 | + otherwise | ||
| 98 | + end | ||
| 99 | +*/ | ||
| 100 | + } | ||
| 101 | + else | ||
| 102 | + { | ||
| 103 | + fprintf(stderr,"Tela desconhecida [%s], abortando\n",screen_id); | ||
| 104 | + break; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + | ||
| 108 | + lib3270_free(screen_id); | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | +/* | ||
| 113 | + | ||
| 114 | + rc = lib3270_enter(hSession); | ||
| 115 | + rc = lib3270_wait_for_ready(hSession,60); | ||
| 116 | + | ||
| 71 | { | 117 | { |
| 72 | - /* Host is ready, get screen contents */ | ||
| 73 | char *text = lib3270_get_text(hSession,0,-1); | 118 | char *text = lib3270_get_text(hSession,0,-1); |
| 74 | 119 | ||
| 75 | printf("\nScreen contents:\n%s\n",text); | 120 | printf("\nScreen contents:\n%s\n",text); |
| 76 | 121 | ||
| 77 | lib3270_free(text); | 122 | lib3270_free(text); |
| 78 | } | 123 | } |
| 79 | - | ||
| 80 | - | 124 | +*/ |
| 81 | 125 | ||
| 82 | 126 | ||
| 83 | /* Release session handle */ | 127 | /* Release session handle */ |