Commit 9b571be365028d8c004e17f09853b73da94c4a6b

Authored by Perry Werneck
Committed by GitHub
2 parents 7daf2ea7 bd12ab9a
Exists in master and in 1 other branch develop

Merge pull request #14 from PerryWerneck/develop

Updating master after testing the develop version.
README.md
... ... @@ -39,36 +39,36 @@ For the supported distributions get the install repositories and instructions fr
39 39 1. Add the MinGW Repositories
40 40  
41 41 ```
42   - $ sudo zypper ar obs://windows:mingw:win32 mingw32
43   - $ sudo zypper ar obs://windows:mingw:win64 mingw64
44   - $ sudo zypper ar obs://home:PerryWerneck:pw3270 pw3270
45   - $ sudo zypper ref
  42 + sudo zypper ar obs://windows:mingw:win32 mingw32
  43 + sudo zypper ar obs://windows:mingw:win64 mingw64
  44 + sudo zypper ar obs://home:PerryWerneck:pw3270 pw3270
  45 + sudo zypper ref
46 46 ```
47 47  
48 48 2. Get libv3270 sources from git
49 49  
50 50 ```
51   - $ git clone https://github.com/PerryWerneck/libv3270.git ./v3270
  51 + git clone https://github.com/PerryWerneck/libv3270.git ./v3270
52 52 ```
53 53  
54 54 3. Install 64 bits cross compilers
55 55  
56 56 ```
57   - $ ./v3270/win/install-cross.sh --64
  57 + ./v3270/win/install-cross.sh --64
58 58 ```
59 59  
60 60 4. Configure 64 bits build environment
61 61  
62 62 ```
63   - $ ./v3270/win/win-configure.sh --64
  63 + ./v3270/win/win-configure.sh --64
64 64 ```
65 65  
66 66 5. Build
67 67  
68 68 ```
69   - $ cd v3270
70   - $ make clean
71   - $ make all
  69 + cd v3270
  70 + make clean
  71 + make all
72 72 ```
73 73  
74 74 ### Windows native with MSYS2
... ... @@ -78,21 +78,21 @@ For the supported distributions get the install repositories and instructions fr
78 78 2. Install the required libraries
79 79  
80 80 ```
81   - $ pacman -S mingw-w64-x86_64-gtk3
  81 + pacman -S mingw-w64-x86_64-gtk3
82 82 ```
83 83  
84 84 2. Get libv3270 sources from git
85 85  
86 86 ```
87   - $ git clone https://github.com/PerryWerneck/libv3270.git ./libv3270
  87 + git clone https://github.com/PerryWerneck/libv3270.git ./libv3270
88 88 ```
89 89  
90 90 4. Build library using the mingw shell
91 91  
92 92 ```
93   - $ cd libv3270
94   - $ ./autogen.sh
95   - $ make all
  93 + cd libv3270
  94 + ./autogen.sh
  95 + make all
96 96 ```
97 97  
98 98 ## Building for macOS (using homebrew)
... ... @@ -102,15 +102,15 @@ For the supported distributions get the install repositories and instructions fr
102 102 2. Install additional dependencies
103 103  
104 104 ```shell
105   - $ brew install gtk+3
  105 + brew install gtk+3
106 106 ```
107 107  
108 108 3. Configure, build and install
109 109  
110 110 ```shell
111   - $ ./autogen.sh --prefix="$(brew --cellar)/libv3270/5.3"
112   - $ make all && make install
113   - $ brew link libv3270
  111 + ./autogen.sh --prefix="$(brew --cellar)/libv3270/5.3"
  112 + make all && make install
  113 + brew link libv3270
114 114 ```
115 115  
116 116 ### Uninstalling
... ... @@ -118,7 +118,7 @@ For the supported distributions get the install repositories and instructions fr
118 118 1. To uninstall
119 119  
120 120 ```shell
121   - $ brew unlink libv3270
122   - $ rm -fr "$(brew --cellar)/libv3270"
  121 + brew unlink libv3270
  122 + rm -fr "$(brew --cellar)/libv3270"
123 123 ```
124 124  
... ...
locale/pt_BR.po
... ... @@ -6,7 +6,7 @@ msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8 8 "POT-Creation-Date: 2021-04-19 00:14-0300\n"
9   -"PO-Revision-Date: 2021-04-19 00:49-0300\n"
  9 +"PO-Revision-Date: 2021-09-01 23:54-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <perry.werneck@gmail.com>\n"
12 12 "Language: pt_BR\n"
... ... @@ -886,11 +886,11 @@ msgstr &quot;Operação de impressão falhou&quot;
886 886  
887 887 #: src/terminal/actions/table.c:312
888 888 msgid "Print screen"
889   -msgstr "Imrpimir tela"
  889 +msgstr "Imprimir tela"
890 890  
891 891 #: src/terminal/actions/table.c:302
892 892 msgid "Print screen or selection"
893   -msgstr "Imrpimir tela ou seleção"
  893 +msgstr "Imprimir tela ou seleção"
894 894  
895 895 #: src/terminal/actions/table.c:323
896 896 msgid "Print selected"
... ... @@ -906,7 +906,7 @@ msgstr &quot;Imprimir marca de seleção&quot;
906 906  
907 907 #: src/terminal/actions/table.c:313
908 908 msgid "Print the entire screen"
909   -msgstr "Imrpimir toda a tela"
  909 +msgstr "Imprimir toda a tela"
910 910  
911 911 #: src/filetransfer/v3270ftprogress.c:407
912 912 msgid "Progress"
... ... @@ -1513,7 +1513,6 @@ msgid &quot;UTF-8&quot;
1513 1513 msgstr "UTF-8"
1514 1514  
1515 1515 #: src/selection/linux/paste.c:116
1516   -#, fuzzy
1517 1516 msgid "Unable to paste formatted data."
1518 1517 msgstr "Incapaz de colar dados formatados."
1519 1518  
... ...
src/dialogs/dialog.c
... ... @@ -80,9 +80,9 @@
80 80 // Setup window
81 81 gtk_window_set_title(GTK_WINDOW(dialog),title);
82 82 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
83   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
84   - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
85 83  
  84 + gtk_dialog_set_toplevel(dialog,widget);
  85 + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
86 86  
87 87 g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
88 88  
... ...
src/dialogs/load.c
... ... @@ -246,7 +246,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
246 246 if(filename && *filename)
247 247 gtk_entry_set_text(GTK_ENTRY(dialog->filename),filename);
248 248  
249   - gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  249 + gtk_dialog_set_toplevel(GTK_WIDGET(dialog),widget);
250 250 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
251 251 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
252 252  
... ...
src/dialogs/popups.c
... ... @@ -47,14 +47,19 @@
47 47 // https://developer.gnome.org/hig/stable/dialogs.html.en
48 48 // https://developer.gnome.org/hig/stable/visual-layout.html.en
49 49  
  50 + // For some reason we can't pass 'null' to gtk_message_dialog_new_with_markup!!
50 51 g_return_val_if_fail(GTK_IS_WIDGET(widget),GTK_RESPONSE_NONE);
51 52  
52 53 // Check if the dialog is enabled
53   - gboolean allow_disabling = (popup->name && GTK_IS_V3270(widget));
  54 + gboolean allow_disabling = FALSE;
  55 +
  56 + if(widget && GTK_IS_WIDGET(widget)) {
  57 + allow_disabling = (popup->name && GTK_IS_V3270(widget));
  58 + }
54 59  
55 60 debug("%s: name=%s allow-disabling: %s", __FUNCTION__, popup->name, allow_disabling ? "Yes" : "No");
56 61  
57   - if(allow_disabling) {
  62 + if(widget && allow_disabling) {
58 63  
59 64 GtkResponseType response = 0;
60 65  
... ... @@ -109,11 +114,19 @@
109 114  
110 115 };
111 116  
  117 + // Get toplevel
  118 + GtkDialogFlags flags = 0;
  119 + GtkWindow *window = NULL;
  120 + if(widget) {
  121 + flags = GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT;
  122 + window = GTK_WINDOW(gtk_widget_get_toplevel(widget));
  123 + }
  124 +
112 125 // Create dialog
113 126 GtkWidget * dialog =
114 127 gtk_message_dialog_new_with_markup(
115   - GTK_WINDOW(gtk_widget_get_toplevel(widget)),
116   - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
  128 + window,
  129 + flags,
117 130 settings[popup->type].type,
118 131 GTK_BUTTONS_NONE,
119 132 (popup->body ? "<b><big>%s</big></b>" : "%s"),
... ...
src/dialogs/print/settingsdialog.c
... ... @@ -463,7 +463,7 @@ LIB3270_EXPORT GtkWidget * v3270_ft_settings_dialog_new(GtkWidget *parent)
463 463  
464 464 if(parent)
465 465 {
466   - gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(parent)));
  466 + gtk_dialog_set_toplevel(dialog,parent);
467 467 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
468 468 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
469 469 }
... ...
src/dialogs/save/save.c
... ... @@ -386,7 +386,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
386 386 gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
387 387 #endif // G_OS_UNIX
388 388  
389   - gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  389 + gtk_dialog_set_toplevel(dialog,widget);
390 390 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
391 391 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
392 392  
... ...
src/dialogs/security.c
... ... @@ -36,6 +36,7 @@
36 36 #include <glib/gi18n-lib.h>
37 37 #include <internals.h>
38 38 #include <lib3270/ssl.h>
  39 + #include <v3270/tools.h>
39 40  
40 41 #include <v3270.h>
41 42  
... ... @@ -237,7 +238,7 @@
237 238  
238 239 gtk_window_set_title(GTK_WINDOW(dialog),_("About security"));
239 240 gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 500);
240   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  241 + gtk_dialog_set_toplevel(dialog,widget);
241 242 gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
242 243  
243 244 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),v3270_security_dialog_new(widget),TRUE,TRUE,2);
... ...
src/dialogs/settings/dialog.c
... ... @@ -344,7 +344,7 @@ void v3270_settings_popup_dialog(GtkWidget *widget, GtkWidget *terminal, gboolea
344 344 gtk_window_set_title(GTK_WINDOW(dialog),settings->title);
345 345  
346 346 gtk_container_add(GTK_CONTAINER(dialog), widget);
347   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  347 + gtk_dialog_set_toplevel(dialog,terminal);
348 348  
349 349 gtk_window_set_modal(GTK_WINDOW(dialog),modal);
350 350  
... ... @@ -368,7 +368,7 @@ GtkWidget * v3270_settings_get_edit_dialog(GtkWidget *settings, GtkWidget *termi
368 368  
369 369 gtk_container_add(GTK_CONTAINER(dialog), settings);
370 370  
371   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  371 + gtk_dialog_set_toplevel(dialog,terminal);
372 372 gtk_window_set_modal(GTK_WINDOW(dialog),modal);
373 373 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
374 374  
... ...
src/dialogs/settings/host.c
... ... @@ -599,7 +599,7 @@ LIB3270_EXPORT void v3270_select_host(GtkWidget *widget)
599 599 gtk_window_set_title(GTK_WINDOW(dialog), v3270_settings_get_title(settings));
600 600 gtk_container_add(GTK_CONTAINER(dialog), settings);
601 601  
602   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  602 + gtk_dialog_set_toplevel(dialog,widget);
603 603 gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
604 604  
605 605 v3270_settings_dialog_set_terminal_widget(dialog, widget);
... ...
src/dialogs/settings/url.c
... ... @@ -346,7 +346,8 @@
346 346 V3270URLEdit *edit = GTK_V3270URLEdit(widget);
347 347  
348 348 if(edit->url) {
349   - return edit->url;
  349 + g_free(edit->url);
  350 + edit->url = NULL;
350 351 }
351 352  
352 353 const gchar *host = gtk_entry_get_text(GTK_ENTRY(edit->entry.host));
... ...
src/dialogs/transfer.c
... ... @@ -188,7 +188,7 @@ LIB3270_EXPORT gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION opt
188 188 g_signal_connect(save_button,"clicked",G_CALLBACK(save_activity_clicked),activity);
189 189 }
190 190  
191   - gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  191 + gtk_dialog_set_toplevel(dialog,widget);
192 192 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
193 193 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
194 194  
... ...
src/filetransfer/transfer.c
... ... @@ -30,6 +30,7 @@
30 30  
31 31 #include <v3270.h>
32 32 #include "private.h"
  33 + #include <v3270/tools.h>
33 34  
34 35  
35 36 /*--[ Statics ]--------------------------------------------------------------------------------------*/
... ... @@ -138,8 +139,7 @@ LIB3270_EXPORT gint v3270ft_transfer(GtkWidget *dialog, H3270 *session) {
138 139 GtkWidget * progress = v3270ftprogress_new();
139 140 gint rc = GTK_RESPONSE_NONE;
140 141  
141   - gtk_window_set_transient_for(GTK_WINDOW(progress),GTK_WINDOW(dialog));
142   -// gtk_window_set_deletable(progress,FALSE);
  142 + gtk_dialog_set_toplevel(progress,dialog);
143 143  
144 144 v3270ft_select_first(dialog);
145 145 v3270ftprogress_set_session(progress,session);
... ...
src/filetransfer/v3270ft.c
... ... @@ -37,6 +37,7 @@
37 37  
38 38 #include <limits.h>
39 39 #include <internals.h>
  40 + #include <v3270/tools.h>
40 41  
41 42 #include "private.h"
42 43  
... ... @@ -743,7 +744,7 @@ LIB3270_EXPORT GtkWidget * v3270ft_new(GtkWidget *parent) {
743 744  
744 745 #endif
745 746  
746   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(parent)));
  747 + gtk_dialog_set_toplevel(dialog,parent);
747 748  
748 749 return dialog;
749 750 }
... ...
src/include/terminal.h
... ... @@ -89,7 +89,6 @@ G_BEGIN_DECLS
89 89 guint integer;
90 90 guint uint;
91 91 guint str;
92   -// guint responses;
93 92 } type;
94 93  
95 94 } properties;
... ...
src/include/v3270/tools.h
... ... @@ -43,6 +43,10 @@
43 43 /// @brief Bind file chooser with entry field.
44 44 LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);
45 45  
  46 + /// @brief Bind dialog with toplevel
  47 + LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget);
  48 +
  49 +
46 50 G_END_DECLS
47 51  
48 52 #endif // V3270_TOOLS_H_INCLUDED
... ...
src/terminal/actions.c
... ... @@ -31,6 +31,7 @@
31 31 #include <terminal.h>
32 32 #include <lib3270/actions.h>
33 33 #include <v3270/settings.h>
  34 + #include <v3270/tools.h>
34 35  
35 36 /*--[ Implement ]------------------------------------------------------------------------------------*/
36 37  
... ... @@ -71,7 +72,7 @@ void v3270_activate(GtkWidget *widget) {
71 72 gtk_container_add(GTK_CONTAINER(dialog), v3270_host_settings_new());
72 73 gtk_window_set_title(GTK_WINDOW(dialog),_("Setup host properties"));
73 74  
74   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  75 + gtk_dialog_set_toplevel(dialog,widget);
75 76  
76 77 v3270_settings_dialog_set_terminal_widget(dialog, widget);
77 78 g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
... ...
src/terminal/actions/dialog.c
... ... @@ -36,6 +36,7 @@
36 36 #include <v3270.h>
37 37 #include <v3270/settings.h>
38 38 #include <v3270/actions.h>
  39 + #include <v3270/tools.h>
39 40  
40 41 #define V3270_TYPE_DIALOG_ACTION (V3270DialogAction_get_type())
41 42 #define V3270_DIALOG_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), V3270_TYPE_DIALOG_ACTION, V3270DialogAction))
... ... @@ -125,8 +126,9 @@
125 126  
126 127 GtkWidget * window = gtk_widget_get_toplevel(terminal);
127 128 if(window) {
  129 + gtk_dialog_set_toplevel(action->dialog,window);
128 130 gtk_window_set_attached_to(GTK_WINDOW(action->dialog), window);
129   - gtk_window_set_transient_for(GTK_WINDOW(action->dialog),GTK_WINDOW(window));
  131 + gtk_dialog_set_toplevel(action->dialog,window);
130 132 }
131 133  
132 134 g_signal_connect(action->dialog,"destroy",G_CALLBACK(on_destroy),action);
... ...
src/terminal/properties/get.c
... ... @@ -39,12 +39,6 @@
39 39  
40 40 // debug("%s(%u,%s)",__FUNCTION__,prop_id,g_param_spec_get_name(pspec));
41 41  
42   - /*
43   - if(prop_id >= klass->properties.type.responses)
44   - {
45   - g_value_set_int(value,(int) window->responses[prop_id - klass->properties.type.responses]);
46   - }
47   - else */
48 42 if(prop_id >= klass->properties.type.str)
49 43 {
50 44 const LIB3270_STRING_PROPERTY * prop = (lib3270_get_string_properties_list()+(prop_id - klass->properties.type.str));
... ...
src/terminal/properties/init.c
... ... @@ -373,7 +373,7 @@
373 373 for(ix = 0; str_props[ix].name; ix++)
374 374 {
375 375  
376   -// debug("Property %u=%s (String)",(unsigned int) klass->properties.type.str + ix, str_props[ix].name);
  376 + // debug("Property %u=%s (String)",(unsigned int) klass->properties.type.str + ix, str_props[ix].name);
377 377  
378 378 spec = g_param_spec_string(
379 379 str_props[ix].name,
... ...
src/terminal/widget.c
... ... @@ -78,6 +78,8 @@ static const gchar *persistent_properties[] = {
78 78 "auto_disconnect",
79 79 "colors",
80 80 "selection_flags",
  81 + "logfile",
  82 + "tracefile",
81 83 NULL
82 84 };
83 85  
... ...
src/testprogram/toolbar.c
... ... @@ -35,6 +35,7 @@
35 35 #include <v3270/dialogs.h>
36 36 #include <v3270/settings.h>
37 37 #include <v3270/selection.h>
  38 + #include <v3270/tools.h>
38 39 #include <v3270/trace.h>
39 40 #include <lib3270/log.h>
40 41 #include <lib3270/popup.h>
... ... @@ -49,25 +50,6 @@
49 50 v3270_print(terminal,NULL);
50 51 }
51 52  
52   - /*
53   - static void host_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
54   - {
55   - v3270_select_host(terminal);
56   - }
57   - */
58   -
59   - /*
60   - static void font_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
61   - {
62   - v3270_settings_popup_dialog(
63   - v3270_font_settings_new(),
64   - terminal,
65   - FALSE
66   - );
67   -
68   - }
69   - */
70   -
71 53 static void preferences_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
72 54 {
73 55 size_t ix;
... ... @@ -87,7 +69,7 @@
87 69 gtk_container_add(GTK_CONTAINER(dialog), widgets[ix]);
88 70 }
89 71  
90   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  72 + gtk_dialog_set_toplevel(dialog,terminal);
91 73  
92 74 v3270_settings_dialog_set_terminal_widget(dialog, terminal);
93 75  
... ...
src/tools/dialog.c 0 → 100644
... ... @@ -0,0 +1,57 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + /**
  31 + * @brief Usefull extensions for GtkDialog.
  32 + *
  33 + */
  34 +
  35 + #include <internals.h>
  36 + #include <v3270/tools.h>
  37 + #include <string.h>
  38 +
  39 + LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget) {
  40 +
  41 + if(widget) {
  42 +
  43 + GtkWidget * toplevel = GTK_WINDOW(gtk_widget_get_toplevel(widget));
  44 +
  45 + gtk_window_set_transient_for(
  46 + GTK_WINDOW(dialog),
  47 + toplevel
  48 + );
  49 +
  50 + gtk_window_set_icon(
  51 + GTK_WINDOW(dialog),
  52 + gtk_window_get_icon(toplevel)
  53 + );
  54 +
  55 + }
  56 +
  57 + }
... ...
src/trace/trace.c
... ... @@ -85,8 +85,8 @@
85 85  
86 86 /// @brief lib3270's saved trace handler.
87 87 struct {
88   - void (*handler)(H3270 *session, void *userdata, const char *fmt, va_list args);
89   - void *userdata;
  88 + LIB3270_TRACE_HANDLER handler;
  89 + void *userdata;
90 90 } trace;
91 91  
92 92 };
... ... @@ -97,13 +97,11 @@
97 97  
98 98 /*--[ Implement ]------------------------------------------------------------------------------------*/
99 99  
100   - static void trace_handler(H3270 *hSession, void *userdata, const char *fmt, va_list args)
  100 + static int trace_handler(const H3270 *hSession, void *userdata, const char *message)
101 101 {
102   - g_autofree gchar *ptr = g_strdup_vprintf(fmt,args);
103   - g_autofree gchar * utftext = g_convert_with_fallback(ptr,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL);
104   -
  102 + g_autofree gchar * utftext = g_convert_with_fallback(message,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL);
105 103 v3270_trace_append_text(GTK_WIDGET(userdata),utftext);
106   -
  104 + return 0;
107 105 }
108 106  
109 107 static void set_session(V3270Trace *widget, H3270 *hSession)
... ... @@ -153,6 +151,7 @@
153 151 for(ix = 0; ix < G_N_ELEMENTS(toggles); ix++)
154 152 {
155 153 // TODO: Use button "destroy" signal to cleanup.
  154 + lib3270_set_toggle(trace->hSession,toggles[ix],0);
156 155 trace->buttons.widgets[ix] = NULL;
157 156 }
158 157  
... ...
src/trace/tracewindow.c
... ... @@ -38,6 +38,7 @@
38 38  
39 39 #include <config.h>
40 40 #include <gtk/gtk.h>
  41 + #include <v3270/tools.h>
41 42  
42 43 #define ENABLE_NLS
43 44  
... ... @@ -89,7 +90,7 @@
89 90 GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
90 91 GtkWidget * trace = v3270_trace_new(widget);
91 92  
92   - gtk_window_set_transient_for(GTK_WINDOW(window),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  93 + gtk_dialog_set_toplevel(window,widget);
93 94 gtk_window_set_destroy_with_parent(GTK_WINDOW(window),TRUE);
94 95  
95 96 // Set window title and default size
... ...
v3270.cbp
... ... @@ -409,6 +409,9 @@
409 409 <Unit filename="src/testprogram/toolbar.c">
410 410 <Option compilerVar="CC" />
411 411 </Unit>
  412 + <Unit filename="src/tools/dialog.c">
  413 + <Option compilerVar="CC" />
  414 + </Unit>
412 415 <Unit filename="src/tools/entry.c">
413 416 <Option compilerVar="CC" />
414 417 </Unit>
... ...
win/configure.sh
1 1 #!/bin/bash
  2 +cd $(dirname $(dirname $(readlink -f ${0})))
2 3  
3 4 aclocal
4 5 if test $? != 0 ; then
... ...
win/install-cross.sh
1 1 #!/bin/bash
  2 +myDIR=$(dirname $(readlink -f ${0}))
2 3  
3 4 install_packages() {
4 5  
5   -TEMPFILE=$(mktemp)
6   -
7   -cat > ${TEMPFILE} << EOF
8   -cross-binutils
9   -cross-gcc
10   -cross-gcc-c++
11   -cross-pkg-config
12   -filesystem
13   -libopenssl
14   -libopenssl-devel
15   -libintl-devel
16   -win_iconv-devel
17   -zlib-devel
18   -winpthreads-devel
19   -cross-cpp
20   -gettext-tools
21   -headers
22   -libepoxy0
23   -libgdk_pixbuf-2_0-0
24   -atk-devel
25   -pango-devel
26   -win_iconv-devel
27   -pixman-devel
28   -glib2-devel
29   -cairo-devel
30   -freetype-devel
31   -gtk3-devel
32   -filesystem
33   -gettext-tools
34   -gtk3-data
35   -gtk3-tools
36   -gnome-icon-theme
37   -hicolor-icon-theme
38   -gdk-pixbuf-loader-rsvg
39   -gdk-pixbuf-query-loaders
40   -lib3270-5_2-devel
41   -EOF
42   -
43   -# Instala apicativos e temas necessários
44   -sudo zypper --non-interactive in \
45   - adwaita-icon-theme \
46   - gettext-tools \
47   - glib2-devel \
48   - optipng \
49   - ImageMagick
50   -
51   -while read FILE
52   -do
53   - sudo zypper --non-interactive in ${1}-${FILE}
54   -done < ${TEMPFILE}
55   -
56   -rm -f ${TEMPFILE}
  6 + TEMPFILE=$(mktemp)
  7 +
  8 + for spec in $(find ${myDIR} -name "${1}*.spec")
  9 + do
  10 + echo "Parsing ${spec}"
  11 + grep -i "^Requires:" "${spec}" | grep -v "%" | cut -d: -f2- | tr -d '[:blank:]' | cut -d'>' -f1 >> ${TEMPFILE}
  12 + grep -i "^BuildRequires:" "${spec}" | grep -v "%" | cut -d: -f2- | tr -d '[:blank:]' | cut -d'>' -f1 >> ${TEMPFILE}
  13 + done
  14 +
  15 + cat ${TEMPFILE} \
  16 + | sort --unique \
  17 + | xargs sudo zypper --non-interactive --verbose in
  18 +
  19 + rm -f ${TEMPFILE}
57 20  
58 21 }
59 22  
60 23 if [ -z ${1} ]; then
61   - echo "Use ${0} --32 for 32 bits cross-compiler"
62   - echo "Use ${0} --64 for 64 bits cross-compiler"
  24 + echo "${0} [options]"
  25 + echo ""
  26 + echo "Options:"
  27 + echo ""
  28 +
  29 + echo " --ar Install required OBS repositories for zypper"
  30 + echo " --32 Install cross compiler for 32 bits windows using zypper"
  31 + echo " --64 Install cross compiler for 64 bits windows using zypper"
  32 + echo " --all Install cross compiler for 32 and 64 bits windows using zypper"
63 33 exit -1
64 34 fi
65 35  
... ... @@ -73,9 +43,11 @@ do
73 43  
74 44 case $parameter in
75 45  
76   - ar)
77   - zypper ar --refresh http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_42.3/ mingw32
78   - zypper ar --refresh http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_42.3/ mingw64
  46 + AR)
  47 + echo "Adding required repositories"
  48 + sudo zypper ar obs://windows:mingw:win32 windows_mingw_win32
  49 + sudo zypper ar obs://windows:mingw:win64 windows_mingw_win64
  50 + sudo zypper ar obs://home:PerryWerneck:pw3270 home_PerryWerneck_pw3270
79 51 ;;
80 52  
81 53 32)
... ...
win/x86_32/mingw32-libv3270.spec
... ... @@ -32,7 +32,7 @@ Name: mingw32-libv3270
32 32 Version: 5.2
33 33  
34 34 %define MAJOR_VERSION %(echo %{version} | cut -d. -f1)
35   -%define MINOR_VERSION %(echo %{version} | cut -d. -f2)
  35 +%define MINOR_VERSION %(echo %{version} | cut -d. -f2 | cut -d+ -f1)
36 36 %define _libvrs %{MAJOR_VERSION}_%{MINOR_VERSION}
37 37 %define _product %(i686-w64-mingw32-pkg-config --variable=product_name lib3270)
38 38  
... ... @@ -48,8 +48,12 @@ BuildRoot: /var/tmp/%{name}-%{version}
48 48  
49 49 Provides: mingw32(lib:v3270)
50 50  
  51 +Requires: mingw32(libgdk_pixbuf-2.0-0.dll)
  52 +BuildRequires: mingw32(pkg:gdk-pixbuf-2.0)
  53 +
51 54 BuildRequires: autoconf
52 55 BuildRequires: automake
  56 +BuildRequires: libtool
53 57 BuildRequires: gettext-tools
54 58 BuildRequires: pkgconfig(glib-2.0)
55 59  
... ... @@ -129,7 +133,7 @@ make all
129 133  
130 134 %install
131 135 %{_mingw32_makeinstall}
132   -%_mingw32_find_lang libv3270 langfiles
  136 +%_mingw32_find_lang libv3270-%{MAJOR_VERSION}.%{MINOR_VERSION} langfiles
133 137  
134 138 %clean
135 139 rm -rf %{buildroot}
... ... @@ -141,6 +145,9 @@ rm -rf %{buildroot}
141 145 %doc AUTHORS LICENSE README.md
142 146  
143 147 %{_mingw32_bindir}/*.dll
  148 +%{_mingw32_datadir}/%{_product}/colors.conf
  149 +%dir %{_mingw32_datadir}/%{_product}/remap
  150 +%{_mingw32_datadir}/%{_product}/remap/*.xml
144 151  
145 152 %files devel
146 153 %defattr(-,root,root)
... ... @@ -151,11 +158,6 @@ rm -rf %{buildroot}
151 158 %{_mingw32_libdir}/*.a
152 159  
153 160 %{_mingw32_datadir}/%{_product}/pot/*.pot
154   -%{_mingw32_datadir}/%{_product}/colors.conf
155   -
156   -%dir %{_mingw32_datadir}/%{_product}/remap
157   -%{_mingw32_datadir}/%{_product}/remap/*.xml
158   -
159 161 %{_mingw32_datadir}/%{_product}/def/*.def
160 162  
161 163 %files -n mingw32-glade-catalog-v3270
... ...
win/x86_64/mingw64-libv3270.spec
... ... @@ -32,7 +32,7 @@ Name: mingw64-libv3270
32 32 Version: 5.2
33 33  
34 34 %define MAJOR_VERSION %(echo %{version} | cut -d. -f1)
35   -%define MINOR_VERSION %(echo %{version} | cut -d. -f2)
  35 +%define MINOR_VERSION %(echo %{version} | cut -d. -f2 | cut -d+ -f1)
36 36 %define _libvrs %{MAJOR_VERSION}_%{MINOR_VERSION}
37 37 %define _product %(x86_64-w64-mingw32-pkg-config --variable=product_name lib3270)
38 38  
... ... @@ -48,8 +48,12 @@ BuildRoot: /var/tmp/%{name}-%{version}
48 48  
49 49 Provides: mingw64(lib:v3270)
50 50  
  51 +Requires: mingw64(libgdk_pixbuf-2.0-0.dll)
  52 +BuildRequires: mingw64(pkg:gdk-pixbuf-2.0)
  53 +
51 54 BuildRequires: autoconf
52 55 BuildRequires: automake
  56 +BuildRequires: libtool
53 57 BuildRequires: gettext-tools
54 58 BuildRequires: pkgconfig(glib-2.0)
55 59  
... ... @@ -129,7 +133,7 @@ make all
129 133  
130 134 %install
131 135 %{_mingw64_makeinstall}
132   -%_mingw64_find_lang libv3270 langfiles
  136 +%_mingw64_find_lang libv3270-%{MAJOR_VERSION}.%{MINOR_VERSION} langfiles
133 137  
134 138 %clean
135 139 rm -rf %{buildroot}
... ...