Commit b573200e8dba4633ed63030b9f9f2461e73b4740
1 parent
1e786740
Exists in
master
and in
5 other branches
Corrigindo fontes editados em windows e desenho do spinner da OIA
Showing
4 changed files
with
250 additions
and
231 deletions
Show diff stats
po/pt_BR.po
| ... | ... | @@ -5,7 +5,7 @@ msgid "" |
| 5 | 5 | msgstr "" |
| 6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2013-06-12 09:54-0300\n" | |
| 8 | +"POT-Creation-Date: 2013-06-17 11:06-0300\n" | |
| 9 | 9 | "PO-Revision-Date: 2013-05-08 14:30-0300\n" |
| 10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | 11 | "Language-Team: Português <>\n" |
| ... | ... | @@ -96,7 +96,7 @@ msgstr "- Emulador 3270 para GTK" |
| 96 | 96 | msgid "16 colors" |
| 97 | 97 | msgstr "16 cores" |
| 98 | 98 | |
| 99 | -#: screen.c:691 screen.c:721 screen.c:735 screen.c:854 | |
| 99 | +#: screen.c:691 screen.c:721 screen.c:735 screen.c:860 | |
| 100 | 100 | msgid "3270 Error" |
| 101 | 101 | msgstr "Erro 3270" |
| 102 | 102 | |
| ... | ... | @@ -632,7 +632,7 @@ msgstr "Apagar até o final do campo" |
| 632 | 632 | msgid "Erase to end of line" |
| 633 | 633 | msgstr "Apagar até o final da linha" |
| 634 | 634 | |
| 635 | -#: print.c:238 v3270/widget.c:215 util.c:1009 | |
| 635 | +#: print.c:238 v3270/widget.c:215 util.c:1018 | |
| 636 | 636 | msgid "Error" |
| 637 | 637 | msgstr "Erro" |
| 638 | 638 | |
| ... | ... | @@ -2070,7 +2070,7 @@ msgstr "Alvo inesperado \"%s\"" |
| 2070 | 2070 | msgid "Unexpected type %d in typeahead queue" |
| 2071 | 2071 | msgstr "Tipo inesperado %d na fila de teclado" |
| 2072 | 2072 | |
| 2073 | -#: ctlr.c:583 | |
| 2073 | +#: ctlr.c:588 | |
| 2074 | 2074 | #, c-format |
| 2075 | 2075 | msgid "Unknown 3270 Data Stream command: 0x%X" |
| 2076 | 2076 | msgstr "Unknown 3270 Data Stream command: 0x%X" | ... | ... |
src/plugins/rx3270/pluginmain.cc
| ... | ... | @@ -48,6 +48,14 @@ |
| 48 | 48 | #include <lib3270/actions.h> |
| 49 | 49 | #include <lib3270/log.h> |
| 50 | 50 | |
| 51 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
| 52 | + | |
| 53 | +#if GTK_CHECK_VERSION(2,32,0) | |
| 54 | + static GMutex mutex; | |
| 55 | +#else | |
| 56 | + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; | |
| 57 | +#endif // GTK_CHECK_VERSION | |
| 58 | + | |
| 51 | 59 | /*--[ Rexx application data block ]--------------------------------------------------------------------------*/ |
| 52 | 60 | |
| 53 | 61 | struct rexx_application_data |
| ... | ... | @@ -58,6 +66,223 @@ |
| 58 | 66 | }; |
| 59 | 67 | |
| 60 | 68 | |
| 69 | +/*--[ Running rexx scripts ]---------------------------------------------------------------------------------*/ | |
| 70 | + | |
| 71 | + static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) | |
| 72 | + { | |
| 73 | + trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); | |
| 74 | + | |
| 75 | + if(subfunction == RXSIOSAY) | |
| 76 | + { | |
| 77 | + GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(((struct rexx_application_data * )context->GetApplicationData())->widget)), | |
| 78 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 79 | + GTK_MESSAGE_INFO, | |
| 80 | + GTK_BUTTONS_OK_CANCEL, | |
| 81 | + "%s", (((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr ); | |
| 82 | + | |
| 83 | + gtk_window_set_title(GTK_WINDOW(dialog), _( "Script message" ) ); | |
| 84 | + | |
| 85 | + if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL) | |
| 86 | + context->RaiseException0(Rexx_Error_Program_interrupted); | |
| 87 | + | |
| 88 | + gtk_widget_destroy(dialog); | |
| 89 | + | |
| 90 | + return RXEXIT_HANDLED; | |
| 91 | + } | |
| 92 | + | |
| 93 | + return RXEXIT_NOT_HANDLED; | |
| 94 | + } | |
| 95 | + | |
| 96 | + static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename) | |
| 97 | + { | |
| 98 | + const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args"); | |
| 99 | + | |
| 100 | + struct rexx_application_data appdata = { action, widget, filename }; | |
| 101 | + | |
| 102 | + RexxInstance * instance; | |
| 103 | + RexxThreadContext * threadContext; | |
| 104 | + RexxOption options[25]; | |
| 105 | + RexxContextExit exits[2]; | |
| 106 | + | |
| 107 | + memset(options,0,sizeof(options)); | |
| 108 | + memset(exits,0,sizeof(exits)); | |
| 109 | + | |
| 110 | + exits[0].sysexit_code = RXSIO; | |
| 111 | + exits[0].handler = Rexx_IO_exit; | |
| 112 | + | |
| 113 | + options[0].optionName = DIRECT_EXITS; | |
| 114 | + options[0].option = (void *) exits; | |
| 115 | + | |
| 116 | + options[1].optionName = APPLICATION_DATA; | |
| 117 | + options[1].option = (void *) &appdata; | |
| 118 | + | |
| 119 | + if(!RexxCreateInterpreter(&instance, &threadContext, options)) | |
| 120 | + { | |
| 121 | + GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 122 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 123 | + GTK_MESSAGE_ERROR, | |
| 124 | + GTK_BUTTONS_CANCEL, | |
| 125 | + _( "Can't start %s script" ), "rexx" ); | |
| 126 | + | |
| 127 | + gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
| 128 | + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),_( "Can't create %s interpreter instance" ), "rexx"); | |
| 129 | + | |
| 130 | + gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 131 | + gtk_widget_destroy(dialog); | |
| 132 | + } | |
| 133 | + else | |
| 134 | + { | |
| 135 | + RexxArrayObject rxArgs; | |
| 136 | + | |
| 137 | + trace("%s start",__FUNCTION__); | |
| 138 | + | |
| 139 | + if(args) | |
| 140 | + { | |
| 141 | + gchar **arg = g_strsplit(args,",",-1); | |
| 142 | + size_t sz = g_strv_length(arg); | |
| 143 | + | |
| 144 | + rxArgs = threadContext->NewArray(sz); | |
| 145 | + for(unsigned int i = 0; i<sz; i++) | |
| 146 | + threadContext->ArrayPut(rxArgs, threadContext->String(arg[i]), i + 1); | |
| 147 | + | |
| 148 | + g_strfreev(arg); | |
| 149 | + } | |
| 150 | + else | |
| 151 | + { | |
| 152 | + rxArgs = threadContext->NewArray(1); | |
| 153 | + threadContext->ArrayPut(rxArgs, threadContext->String(""),1); | |
| 154 | + } | |
| 155 | + | |
| 156 | + v3270_set_script(widget,'R',TRUE); | |
| 157 | + RexxObjectPtr result = threadContext->CallProgram(filename, rxArgs); | |
| 158 | + v3270_set_script(widget,'R',FALSE); | |
| 159 | + | |
| 160 | + if (threadContext->CheckCondition()) | |
| 161 | + { | |
| 162 | + RexxCondition condition; | |
| 163 | + | |
| 164 | + // retrieve the error information and get it into a decoded form | |
| 165 | + RexxDirectoryObject cond = threadContext->GetConditionInfo(); | |
| 166 | + threadContext->DecodeConditionInfo(cond, &condition); | |
| 167 | + // display the errors | |
| 168 | + GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 169 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 170 | + GTK_MESSAGE_ERROR, | |
| 171 | + GTK_BUTTONS_CANCEL, | |
| 172 | + _( "%s script failed" ), "Rexx" ); | |
| 173 | + | |
| 174 | + gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
| 175 | + | |
| 176 | + gtk_message_dialog_format_secondary_text( | |
| 177 | + GTK_MESSAGE_DIALOG(dialog), | |
| 178 | + _( "%s error %d: %s\n%s" ), | |
| 179 | + "Rexx", | |
| 180 | + (int) condition.code, | |
| 181 | + threadContext->CString(condition.errortext), | |
| 182 | + threadContext->CString(condition.message) | |
| 183 | + | |
| 184 | + ); | |
| 185 | + | |
| 186 | + gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 187 | + gtk_widget_destroy(dialog); | |
| 188 | + | |
| 189 | + } | |
| 190 | + else if (result != NULLOBJECT) | |
| 191 | + { | |
| 192 | + CSTRING resultString = threadContext->CString(result); | |
| 193 | + lib3270_write_log(NULL,"REXX","%s exits with rc=%s",filename,resultString); | |
| 194 | + } | |
| 195 | + | |
| 196 | + instance->Terminate(); | |
| 197 | + | |
| 198 | + trace("%s ends",__FUNCTION__); | |
| 199 | + } | |
| 200 | + | |
| 201 | + } | |
| 202 | + | |
| 203 | + | |
| 204 | +extern "C" | |
| 205 | +{ | |
| 206 | + LIB3270_EXPORT void pw3270_action_rexx_activated(GtkAction *action, GtkWidget *widget) | |
| 207 | + { | |
| 208 | + gchar *filename = (gchar *) g_object_get_data(G_OBJECT(action),"src"); | |
| 209 | + | |
| 210 | + lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p",gtk_action_get_name(action),widget); | |
| 211 | + | |
| 212 | +#if GTK_CHECK_VERSION(2,32,0) | |
| 213 | + if(!g_mutex_trylock(&mutex)) | |
| 214 | +#else | |
| 215 | + if(!g_static_mutex_trylock(&mutex)) | |
| 216 | +#endif // GTK_CHECK_VERSION | |
| 217 | + { | |
| 218 | + GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 219 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 220 | + GTK_MESSAGE_ERROR, | |
| 221 | + GTK_BUTTONS_CANCEL, | |
| 222 | + "%s", _( "Can't start script" )); | |
| 223 | + | |
| 224 | + gtk_window_set_title(GTK_WINDOW(dialog),_( "System busy" )); | |
| 225 | + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",_( "Please, try again in a few moments" )); | |
| 226 | + | |
| 227 | + gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 228 | + gtk_widget_destroy(dialog); | |
| 229 | + return; | |
| 230 | + } | |
| 231 | + | |
| 232 | + gtk_action_set_sensitive(action,FALSE); | |
| 233 | + | |
| 234 | + if(filename) | |
| 235 | + { | |
| 236 | + // Has filename, call it directly | |
| 237 | + call_rexx_script(action,widget,filename); | |
| 238 | + } | |
| 239 | + else | |
| 240 | + { | |
| 241 | + // No filename, ask user | |
| 242 | + static const struct _list | |
| 243 | + { | |
| 244 | + const gchar *name; | |
| 245 | + const gchar *pattern; | |
| 246 | + } list[] = | |
| 247 | + { | |
| 248 | + { N_( "Rexx script file" ), "*.rex" }, | |
| 249 | + { N_( "Rexx class file" ), "*.cls" } | |
| 250 | + }; | |
| 251 | + | |
| 252 | + GtkFileFilter * filter[G_N_ELEMENTS(list)+1]; | |
| 253 | + unsigned int f; | |
| 254 | + | |
| 255 | + memset(filter,0,sizeof(filter)); | |
| 256 | + | |
| 257 | + for(f=0;f<G_N_ELEMENTS(list);f++) | |
| 258 | + { | |
| 259 | + filter[f] = gtk_file_filter_new(); | |
| 260 | + gtk_file_filter_set_name(filter[f],gettext(list[f].name)); | |
| 261 | + gtk_file_filter_add_pattern(filter[f],list[f].pattern); | |
| 262 | + } | |
| 263 | + | |
| 264 | + filename = pw3270_get_filename(widget,"rexx","script",filter,_( "Select script to run" )); | |
| 265 | + | |
| 266 | + if(filename) | |
| 267 | + { | |
| 268 | + call_rexx_script(action,widget,filename); | |
| 269 | + g_free(filename); | |
| 270 | + } | |
| 271 | + | |
| 272 | + | |
| 273 | + } | |
| 274 | + | |
| 275 | + gtk_action_set_sensitive(action,TRUE); | |
| 276 | +#if GTK_CHECK_VERSION(2,32,0) | |
| 277 | + g_mutex_unlock(&mutex); | |
| 278 | +#else | |
| 279 | + g_static_mutex_unlock(&mutex); | |
| 280 | +#endif // GTK_CHECK_VERSION | |
| 281 | + | |
| 282 | + } | |
| 283 | + | |
| 284 | +} | |
| 285 | + | |
| 61 | 286 | /*--[ Plugin session object ]--------------------------------------------------------------------------------*/ |
| 62 | 287 | |
| 63 | 288 | class plugin : public rx3270 |
| ... | ... | @@ -116,11 +341,6 @@ |
| 116 | 341 | |
| 117 | 342 | }; |
| 118 | 343 | |
| 119 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
| 120 | - | |
| 121 | -#if GTK_CHECK_VERSION(2,32,0) | |
| 122 | - static GMutex mutex; #else static GStaticMutex mutex = G_STATIC_MUTEX_INIT; #endif // GTK_CHECK_VERSION | |
| 123 | - | |
| 124 | 344 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 125 | 345 | |
| 126 | 346 | static rx3270 * factory(const char *name) |
| ... | ... | @@ -132,7 +352,8 @@ |
| 132 | 352 | { |
| 133 | 353 | trace("%s",__FUNCTION__); |
| 134 | 354 | #if GTK_CHECK_VERSION(2,32,0) |
| 135 | - g_mutex_init(&mutex); #endif // GTK_CHECK_VERSION | |
| 355 | + g_mutex_init(&mutex); | |
| 356 | +#endif // GTK_CHECK_VERSION | |
| 136 | 357 | rx3270::set_plugin(factory); |
| 137 | 358 | return 0; |
| 138 | 359 | } |
| ... | ... | @@ -140,7 +361,8 @@ |
| 140 | 361 | LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window) |
| 141 | 362 | { |
| 142 | 363 | #if GTK_CHECK_VERSION(2,32,0) |
| 143 | - g_mutex_clear(&mutex); #endif // GTK_CHECK_VERSION | |
| 364 | + g_mutex_clear(&mutex); | |
| 365 | +#endif // GTK_CHECK_VERSION | |
| 144 | 366 | trace("%s",__FUNCTION__); |
| 145 | 367 | return 0; |
| 146 | 368 | } |
| ... | ... | @@ -324,212 +546,3 @@ int plugin::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mess |
| 324 | 546 | return 0; |
| 325 | 547 | } |
| 326 | 548 | |
| 327 | - static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) | |
| 328 | - { | |
| 329 | - trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); | |
| 330 | - | |
| 331 | - if(subfunction == RXSIOSAY) | |
| 332 | - { | |
| 333 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(((struct rexx_application_data * )context->GetApplicationData())->widget)), | |
| 334 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 335 | - GTK_MESSAGE_INFO, | |
| 336 | - GTK_BUTTONS_OK_CANCEL, | |
| 337 | - "%s", (((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr ); | |
| 338 | - | |
| 339 | - gtk_window_set_title(GTK_WINDOW(dialog), _( "Script message" ) ); | |
| 340 | - | |
| 341 | - if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL) | |
| 342 | - context->RaiseException0(Rexx_Error_Program_interrupted); | |
| 343 | - | |
| 344 | - gtk_widget_destroy(dialog); | |
| 345 | - | |
| 346 | - return RXEXIT_HANDLED; | |
| 347 | - } | |
| 348 | - | |
| 349 | - return RXEXIT_NOT_HANDLED; | |
| 350 | - } | |
| 351 | - | |
| 352 | - static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename) | |
| 353 | - { | |
| 354 | - const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args"); | |
| 355 | - | |
| 356 | - struct rexx_application_data appdata = { action, widget, filename }; | |
| 357 | - | |
| 358 | - RexxInstance * instance; | |
| 359 | - RexxThreadContext * threadContext; | |
| 360 | - RexxOption options[25]; | |
| 361 | - RexxContextExit exits[2]; | |
| 362 | - | |
| 363 | - memset(options,0,sizeof(options)); | |
| 364 | - memset(exits,0,sizeof(exits)); | |
| 365 | - | |
| 366 | - exits[0].sysexit_code = RXSIO; | |
| 367 | - exits[0].handler = Rexx_IO_exit; | |
| 368 | - | |
| 369 | - options[0].optionName = DIRECT_EXITS; | |
| 370 | - options[0].option = (void *) exits; | |
| 371 | - | |
| 372 | - options[1].optionName = APPLICATION_DATA; | |
| 373 | - options[1].option = (void *) &appdata; | |
| 374 | - | |
| 375 | - if(!RexxCreateInterpreter(&instance, &threadContext, options)) | |
| 376 | - { | |
| 377 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 378 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 379 | - GTK_MESSAGE_ERROR, | |
| 380 | - GTK_BUTTONS_CANCEL, | |
| 381 | - _( "Can't start %s script" ), "rexx" ); | |
| 382 | - | |
| 383 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
| 384 | - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),_( "Can't create %s interpreter instance" ), "rexx"); | |
| 385 | - | |
| 386 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 387 | - gtk_widget_destroy(dialog); | |
| 388 | - } | |
| 389 | - else | |
| 390 | - { | |
| 391 | - RexxArrayObject rxArgs; | |
| 392 | - | |
| 393 | - trace("%s start",__FUNCTION__); | |
| 394 | - | |
| 395 | - if(args) | |
| 396 | - { | |
| 397 | - gchar **arg = g_strsplit(args,",",-1); | |
| 398 | - size_t sz = g_strv_length(arg); | |
| 399 | - | |
| 400 | - rxArgs = threadContext->NewArray(sz); | |
| 401 | - for(unsigned int i = 0; i<sz; i++) | |
| 402 | - threadContext->ArrayPut(rxArgs, threadContext->String(arg[i]), i + 1); | |
| 403 | - | |
| 404 | - g_strfreev(arg); | |
| 405 | - } | |
| 406 | - else | |
| 407 | - { | |
| 408 | - rxArgs = threadContext->NewArray(1); | |
| 409 | - threadContext->ArrayPut(rxArgs, threadContext->String(""),1); | |
| 410 | - } | |
| 411 | - | |
| 412 | - v3270_set_script(widget,'R',TRUE); | |
| 413 | - RexxObjectPtr result = threadContext->CallProgram(filename, rxArgs); | |
| 414 | - v3270_set_script(widget,'R',FALSE); | |
| 415 | - | |
| 416 | - if (threadContext->CheckCondition()) | |
| 417 | - { | |
| 418 | - RexxCondition condition; | |
| 419 | - | |
| 420 | - // retrieve the error information and get it into a decoded form | |
| 421 | - RexxDirectoryObject cond = threadContext->GetConditionInfo(); | |
| 422 | - threadContext->DecodeConditionInfo(cond, &condition); | |
| 423 | - // display the errors | |
| 424 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 425 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 426 | - GTK_MESSAGE_ERROR, | |
| 427 | - GTK_BUTTONS_CANCEL, | |
| 428 | - _( "%s script failed" ), "Rexx" ); | |
| 429 | - | |
| 430 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
| 431 | - | |
| 432 | - gtk_message_dialog_format_secondary_text( | |
| 433 | - GTK_MESSAGE_DIALOG(dialog), | |
| 434 | - _( "%s error %d: %s\n%s" ), | |
| 435 | - "Rexx", | |
| 436 | - (int) condition.code, | |
| 437 | - threadContext->CString(condition.errortext), | |
| 438 | - threadContext->CString(condition.message) | |
| 439 | - | |
| 440 | - ); | |
| 441 | - | |
| 442 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 443 | - gtk_widget_destroy(dialog); | |
| 444 | - | |
| 445 | - } | |
| 446 | - else if (result != NULLOBJECT) | |
| 447 | - { | |
| 448 | - CSTRING resultString = threadContext->CString(result); | |
| 449 | - lib3270_write_log(NULL,"REXX","%s exits with rc=%s",filename,resultString); | |
| 450 | - } | |
| 451 | - | |
| 452 | - instance->Terminate(); | |
| 453 | - | |
| 454 | - trace("%s ends",__FUNCTION__); | |
| 455 | - } | |
| 456 | - | |
| 457 | - } | |
| 458 | - | |
| 459 | - | |
| 460 | -extern "C" | |
| 461 | -{ | |
| 462 | - LIB3270_EXPORT void pw3270_action_rexx_activated(GtkAction *action, GtkWidget *widget) | |
| 463 | - { | |
| 464 | - gchar *filename = (gchar *) g_object_get_data(G_OBJECT(action),"src"); | |
| 465 | - | |
| 466 | - lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p",gtk_action_get_name(action),widget); | |
| 467 | - | |
| 468 | -#if GTK_CHECK_VERSION(2,32,0) | |
| 469 | - if(!g_mutex_trylock(&mutex)) #else if(!g_static_mutex_trylock(&mutex)) #endif // GTK_CHECK_VERSION | |
| 470 | - { | |
| 471 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 472 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 473 | - GTK_MESSAGE_ERROR, | |
| 474 | - GTK_BUTTONS_CANCEL, | |
| 475 | - "%s", _( "Can't start script" )); | |
| 476 | - | |
| 477 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "System busy" )); | |
| 478 | - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",_( "Please, try again in a few moments" )); | |
| 479 | - | |
| 480 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 481 | - gtk_widget_destroy(dialog); | |
| 482 | - return; | |
| 483 | - } | |
| 484 | - | |
| 485 | - gtk_action_set_sensitive(action,FALSE); | |
| 486 | - | |
| 487 | - if(filename) | |
| 488 | - { | |
| 489 | - // Has filename, call it directly | |
| 490 | - call_rexx_script(action,widget,filename); | |
| 491 | - } | |
| 492 | - else | |
| 493 | - { | |
| 494 | - // No filename, ask user | |
| 495 | - static const struct _list | |
| 496 | - { | |
| 497 | - const gchar *name; | |
| 498 | - const gchar *pattern; | |
| 499 | - } list[] = | |
| 500 | - { | |
| 501 | - { N_( "Rexx script file" ), "*.rex" }, | |
| 502 | - { N_( "Rexx class file" ), "*.cls" } | |
| 503 | - }; | |
| 504 | - | |
| 505 | - GtkFileFilter * filter[G_N_ELEMENTS(list)+1]; | |
| 506 | - unsigned int f; | |
| 507 | - | |
| 508 | - memset(filter,0,sizeof(filter)); | |
| 509 | - | |
| 510 | - for(f=0;f<G_N_ELEMENTS(list);f++) | |
| 511 | - { | |
| 512 | - filter[f] = gtk_file_filter_new(); | |
| 513 | - gtk_file_filter_set_name(filter[f],gettext(list[f].name)); | |
| 514 | - gtk_file_filter_add_pattern(filter[f],list[f].pattern); | |
| 515 | - } | |
| 516 | - | |
| 517 | - filename = pw3270_get_filename(widget,"rexx","script",filter,_( "Select script to run" )); | |
| 518 | - | |
| 519 | - if(filename) | |
| 520 | - { | |
| 521 | - call_rexx_script(action,widget,filename); | |
| 522 | - g_free(filename); | |
| 523 | - } | |
| 524 | - | |
| 525 | - | |
| 526 | - } | |
| 527 | - | |
| 528 | - gtk_action_set_sensitive(action,TRUE); | |
| 529 | -#if GTK_CHECK_VERSION(2,32,0) | |
| 530 | - g_mutex_unlock(&mutex); #else g_static_mutex_unlock(&mutex); #endif // GTK_CHECK_VERSION | |
| 531 | - | |
| 532 | - } | |
| 533 | - | |
| 534 | -} | |
| 535 | - | ... | ... |
src/pw3270/main.c
src/pw3270/v3270/oia.c
| ... | ... | @@ -100,9 +100,9 @@ static gint draw_spinner(cairo_t *cr, GdkRectangle *r, GdkRGBA *color, gint step |
| 100 | 100 | cairo_save(cr); |
| 101 | 101 | |
| 102 | 102 | cairo_set_source_rgba (cr, |
| 103 | - color[V3270_COLOR_OIA_SPINNER].red / 65535., | |
| 104 | - color[V3270_COLOR_OIA_SPINNER].green / 65535., | |
| 105 | - color[V3270_COLOR_OIA_SPINNER].blue / 65535., | |
| 103 | + color[V3270_COLOR_OIA_SPINNER].red, | |
| 104 | + color[V3270_COLOR_OIA_SPINNER].green, | |
| 105 | + color[V3270_COLOR_OIA_SPINNER].blue, | |
| 106 | 106 | t); |
| 107 | 107 | |
| 108 | 108 | cairo_set_line_width (cr, 2.0); |
| ... | ... | @@ -953,20 +953,24 @@ static gboolean update_timer(struct timer_info *info) |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | #ifdef HAVE_LIBM |
| 956 | - rect = info->terminal->oia_rect + V3270_OIA_SPINNER; | |
| 956 | + | |
| 957 | + rect = info->terminal->oia_rect + V3270_OIA_SPINNER; | |
| 957 | 958 | |
| 958 | 959 | #ifdef DEBUG |
| 959 | - cairo_set_source_rgb(cr,0.1,0.1,0.1); | |
| 960 | + cairo_set_source_rgb(cr,0.1,0.1,0.1); | |
| 960 | 961 | #else |
| 961 | - gdk_cairo_set_source_rgba(cr,info->terminal->color+V3270_COLOR_OIA_BACKGROUND); | |
| 962 | + gdk_cairo_set_source_rgba(cr,info->terminal->color+V3270_COLOR_OIA_BACKGROUND); | |
| 962 | 963 | #endif |
| 963 | - cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); | |
| 964 | - cairo_fill(cr); | |
| 965 | 964 | |
| 966 | - gdk_cairo_set_source_rgba(cr,info->terminal->color+V3270_COLOR_OIA_FOREGROUND); | |
| 965 | + cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); | |
| 966 | + cairo_fill(cr); | |
| 967 | + | |
| 968 | + gdk_cairo_set_source_rgba(cr,info->terminal->color+V3270_COLOR_OIA_FOREGROUND); | |
| 969 | + | |
| 970 | + info->step = draw_spinner(cr, rect, info->terminal->color, info->step); | |
| 971 | + | |
| 972 | + gtk_widget_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); | |
| 967 | 973 | |
| 968 | - info->step = draw_spinner(cr, rect, info->terminal->color, info->step); | |
| 969 | - gtk_widget_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); | |
| 970 | 974 | #endif // HAVE_LIBM |
| 971 | 975 | |
| 972 | 976 | cairo_destroy(cr); | ... | ... |