diff --git a/po/pt_BR.po b/po/pt_BR.po index 35d209e..b7ba3a4 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-17 11:06-0300\n" +"POT-Creation-Date: 2013-06-18 07:49-0300\n" "PO-Revision-Date: 2013-05-08 14:30-0300\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português <>\n" @@ -88,7 +88,7 @@ msgstr "%s: Familia %d é inválida" msgid "%s:%d" msgstr "%s:%d" -#: main.c:339 +#: main.c:341 msgid "- 3270 Emulator for Gtk" msgstr "- Emulador 3270 para GTK" @@ -169,7 +169,7 @@ msgstr "" msgid "SSL state is undefinedUnexpected SSL status %ld" msgstr "Estado do SSL é indefinidoEstado SSL inesperado %ld" -#: main.c:359 +#: main.c:361 msgid "" "Valid options:\n" "\n" @@ -222,7 +222,7 @@ msgid "An error occurred trying to allocate memory. This should never happen." msgstr "" "Ocorreu um erro ao tentar alocar memória. Isso nunca deveria acontecer." -#: main.c:319 main.c:321 +#: main.c:321 main.c:323 msgid "Application name" msgstr "Nome da aplicação" @@ -731,7 +731,7 @@ msgstr "Tela cheia" msgid "Function bar" msgstr "Barra de funções" -#: main.c:93 main.c:406 +#: main.c:93 main.c:408 msgid "GTK Version mismatch" msgstr "Divergência de versão GTK" @@ -800,11 +800,11 @@ msgstr "Servidor rejeitou o tipo de dispositivo ou requisição" msgid "Host rejected resource(s)" msgstr "Servidor rejeitou recurso(s)" -#: main.c:327 +#: main.c:329 msgid "Host system type" msgstr "Tipo do sistema no servidor" -#: main.c:325 +#: main.c:327 msgid "Host to connect" msgstr "Servidor a conectar" @@ -900,7 +900,7 @@ msgstr "LRECL:" msgid "Lateral keypad" msgstr "Barra lateral" -#: main.c:334 +#: main.c:336 #, fuzzy msgid "Log to file" msgstr "Salvar cópia para arquivo" @@ -1139,7 +1139,7 @@ msgstr "PF8" msgid "PF9" msgstr "PF9" -#: main.c:357 +#: main.c:359 msgid "Parse error" msgstr "Erro de interpretação" @@ -1176,7 +1176,7 @@ msgstr "Colar com margem esquerda" msgid "Path length constraint exceeded" msgstr "Path length constraint exceeded" -#: main.c:322 +#: main.c:324 msgid "Path to application data files" msgstr "Caminho para os arquivos de dados da aplicação" @@ -1593,7 +1593,7 @@ msgstr "Enviar arquivo" msgid "Send file to host" msgstr "Enviar arquivo para o servidor" -#: main.c:332 +#: main.c:334 msgid "Send messages to syslog" msgstr "Enviar mensagens para o log do sistema" @@ -1601,7 +1601,7 @@ msgstr "Enviar mensagens para o log do sistema" msgid "Send/Receive" msgstr "Enviar/Receber" -#: main.c:324 +#: main.c:326 msgid "Session name" msgstr "Nome da sessão" @@ -1609,15 +1609,15 @@ msgstr "Nome da sessão" msgid "Set hostname" msgstr "Selecione servidor" -#: main.c:326 +#: main.c:328 msgid "Set reported colors (8/16)" msgstr "Define número de cores informadas (8/16)" -#: main.c:329 +#: main.c:331 msgid "Set toggles OFF" msgstr "Desativa toggles" -#: main.c:328 +#: main.c:330 msgid "Set toggles ON" msgstr "Ativa toggles" @@ -1901,7 +1901,7 @@ msgstr "" "programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple " "Place, Suite 330, Boston, MA, 02111-1307, USA" -#: main.c:402 +#: main.c:404 #, c-format msgid "This program requires GTK version %d.%d.%d" msgstr "Este programa precisa do GTK versão %d.%d.%d" diff --git a/src/include/pw3270.h b/src/include/pw3270.h index dc1c5f9..1beef0f 100644 --- a/src/include/pw3270.h +++ b/src/include/pw3270.h @@ -85,6 +85,8 @@ LIB3270_EXPORT gchar * pw3270_get_datadir(const gchar *first_element, ...); + LIB3270_EXPORT gchar * pw3270_file_chooser(GtkFileChooserAction action, const gchar *name, const gchar *title, const gchar *file, const gchar *ext); + typedef enum pw3270_src { PW3270_SRC_ALL, /**< Screen contents */ diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 785fd8b..825ae94 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -51,11 +51,13 @@ /*--[ Globals ]--------------------------------------------------------------------------------------*/ #if GTK_CHECK_VERSION(2,32,0) - static GMutex mutex; + static GMutex mutex; #else static GStaticMutex mutex = G_STATIC_MUTEX_INIT; #endif // GTK_CHECK_VERSION + static gchar * script_name = NULL; + /*--[ Rexx application data block ]--------------------------------------------------------------------------*/ struct rexx_application_data @@ -65,6 +67,65 @@ const gchar * filename; }; +/*--[ Plugin session object ]--------------------------------------------------------------------------------*/ + + class plugin : public rx3270 + { + public: + plugin(H3270 *hSession); + virtual ~plugin(); + + void free(void *ptr); + + char * get_version(void); + LIB3270_CSTATE get_cstate(void); + int disconnect(void); + int connect(const char *uri, bool wait = true); + bool is_connected(void); + bool is_ready(void); + + void logva(const char *fmt, va_list args); + + int iterate(bool wait); + int wait(int seconds); + int wait_for_ready(int seconds); + + char * get_text(int baddr, size_t len); + char * get_text_at(int row, int col, size_t sz); + int cmp_text_at(int row, int col, const char *text); + int set_text_at(int row, int col, const char *str); + + int set_cursor_position(int row, int col); + int set_cursor_addr(int addr); + int get_cursor_addr(void); + int emulate_input(const char *str); + + int set_toggle(LIB3270_TOGGLE ix, bool value); + + int enter(void); + int pfkey(int key); + int pakey(int key); + + int get_field_start(int baddr = -1); + int get_field_len(int baddr = -1); + int get_next_unprotected(int baddr = -1); + + int set_copy(const char *text); + char * get_copy(void); + + char * get_clipboard(void); + int set_clipboard(const char *text); + + int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); + char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); + + protected: + + private: + H3270 * hSession; + + }; + /*--[ Running rexx scripts ]---------------------------------------------------------------------------------*/ @@ -166,7 +227,10 @@ } v3270_set_script(widget,'R',TRUE); + script_name = g_path_get_basename(filename); RexxObjectPtr result = threadContext->CallProgram(filename, rxArgs); + g_free(script_name); + script_name = NULL; v3270_set_script(widget,'R',FALSE); if (threadContext->CheckCondition()) @@ -297,64 +361,6 @@ extern "C" } -/*--[ Plugin session object ]--------------------------------------------------------------------------------*/ - - class plugin : public rx3270 - { - public: - plugin(H3270 *hSession); - virtual ~plugin(); - - void free(void *ptr); - - char * get_version(void); - LIB3270_CSTATE get_cstate(void); - int disconnect(void); - int connect(const char *uri, bool wait = true); - bool is_connected(void); - bool is_ready(void); - - void logva(const char *fmt, va_list args); - - int iterate(bool wait); - int wait(int seconds); - int wait_for_ready(int seconds); - - char * get_text(int baddr, size_t len); - char * get_text_at(int row, int col, size_t sz); - int cmp_text_at(int row, int col, const char *text); - int set_text_at(int row, int col, const char *str); - - int set_cursor_position(int row, int col); - int set_cursor_addr(int addr); - int get_cursor_addr(void); - int emulate_input(const char *str); - - int set_toggle(LIB3270_TOGGLE ix, bool value); - - int enter(void); - int pfkey(int key); - int pakey(int key); - - int get_field_start(int baddr = -1); - int get_field_len(int baddr = -1); - int get_next_unprotected(int baddr = -1); - - int set_copy(const char *text); - char * get_copy(void); - - char * get_clipboard(void); - int set_clipboard(const char *text); - - int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); - - protected: - - private: - H3270 * hSession; - - }; - /*--[ Implement ]------------------------------------------------------------------------------------*/ static rx3270 * factory(const char *name) @@ -560,3 +566,7 @@ int plugin::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mess return 0; } +char * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) +{ + return pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); +} diff --git a/src/plugins/rx3270/rexx_methods.cc b/src/plugins/rx3270/rexx_methods.cc index 0618d0b..079e0cc 100644 --- a/src/plugins/rx3270/rexx_methods.cc +++ b/src/plugins/rx3270/rexx_methods.cc @@ -552,6 +552,7 @@ RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CST if(!strcasecmp(action_name,action[f].action_name)) { id = action[f].id; + break; } } diff --git a/src/pw3270/dialog.c b/src/pw3270/dialog.c index b24a5ea..0e1c01b 100644 --- a/src/pw3270/dialog.c +++ b/src/pw3270/dialog.c @@ -214,9 +214,9 @@ } - static GtkFileChooserConfirmation confirm_overwrite(GtkFileChooser *chooser, GtkAction *action) + static GtkFileChooserConfirmation confirm_overwrite(GtkFileChooser *chooser, GObject *action) { - const gchar * attr = g_object_get_data(G_OBJECT(action),"overwrite"); + const gchar * attr = g_object_get_data(action,"overwrite"); GtkFileChooserConfirmation ret = GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME; GtkWidget * dialog; @@ -269,7 +269,7 @@ NULL ); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); - g_signal_connect(GTK_FILE_CHOOSER(dialog), "confirm-overwrite", G_CALLBACK(confirm_overwrite), action); + g_signal_connect(GTK_FILE_CHOOSER(dialog), "confirm-overwrite", G_CALLBACK(confirm_overwrite), G_OBJECT(action)); add_option_menus(dialog, action, &encattr); @@ -520,82 +520,70 @@ g_free(info); } -/* - G_GNUC_INTERNAL void run_security_dialog(GtkWidget *widget) + LIB3270_EXPORT gchar * pw3270_file_chooser(GtkFileChooserAction action, const gchar *name, const gchar *title, const gchar *file, const gchar *ext) { - GtkWidget * dialog; - H3270 * hSession = pw3270_get_session(widget); - - trace("%s(%p)",__FUNCTION__,widget); - -#ifdef HAVE_LIBSSL - if(lib3270_get_secure(hSession) == LIB3270_SSL_UNSECURE) -#endif // HAVE_LIBSSL - { - // Connection is insecure, show simple dialog with host and info - - dialog = gtk_message_dialog_new( - GTK_WINDOW(widget), - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_CLOSE, - pw3270_get_host(widget) - ); - - gtk_message_dialog_format_secondary_markup( - GTK_MESSAGE_DIALOG(dialog), - "%s", _( "Identity not verified\nThe connection is insecure" )); - - } -#ifdef HAVE_LIBSSL - else - { - long id = lib3270_get_SSL_verify_result(hSession); - const gchar * title = N_( "Unexpected SSL error"); - const gchar * text = NULL; - const gchar * icon = GTK_STOCK_DIALOG_ERROR; - int f; - - for(f=0;f%ld",id); - gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),text); - g_free(str); - } + if(action == GTK_FILE_CHOOSER_ACTION_SAVE) + { + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); + g_signal_connect(GTK_FILE_CHOOSER(dialog), "confirm-overwrite", G_CALLBACK(confirm_overwrite), G_OBJECT(dialog)); + } - } -#endif // HAVE_LIBSSL + if(file) + { + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),file); + } + else + { + ptr = get_string_from_config("files",name,""); + if(*ptr) + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr); + else + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); + g_free(ptr); + } - gtk_window_set_title(GTK_WINDOW(dialog),_("About security")); + if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + if(filename) + set_string_to_config("files",name,"%s",filename); + } - gtk_widget_show_all(GTK_WIDGET(dialog)); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(GTK_WIDGET(dialog)); + gtk_widget_destroy(dialog); + return filename; } -*/ -- libgit2 0.21.2