Commit 3dbac5c1921f4e5daf698b4798b742d070dd47e4

Authored by Perry Werneck
Committed by GitHub
2 parents 59186425 91b65218
Exists in master and in 1 other branch develop

Merge pull request #12 from PerryWerneck/develop

Fixing arch build, locale conflicts and visual adjustments.
@@ -4,7 +4,11 @@ Created originally as part of PW3270 application. @@ -4,7 +4,11 @@ Created originally as part of PW3270 application.
4 4
5 See more details at https://softwarepublico.gov.br/social/pw3270/ 5 See more details at https://softwarepublico.gov.br/social/pw3270/
6 6
  7 +[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
7 ![CodeQL](https://github.com/PerryWerneck/libv3270/workflows/CodeQL/badge.svg?branch=master) 8 ![CodeQL](https://github.com/PerryWerneck/libv3270/workflows/CodeQL/badge.svg?branch=master)
  9 +![Analytics](https://ga-beacon.appspot.com/G-RSMGQ9Q5BG/github/libv3270)
  10 +![Downloads](https://img.shields.io/github/downloads/PerryWerneck/libv3270/total.svg)
  11 +
8 12
9 ## Instalation 13 ## Instalation
10 14
@@ -9,7 +9,7 @@ url="https://portal.softwarepublico.gov.br/social/pw3270/" @@ -9,7 +9,7 @@ url="https://portal.softwarepublico.gov.br/social/pw3270/"
9 arch=(i686 x86_64) 9 arch=(i686 x86_64)
10 license=(GPL) 10 license=(GPL)
11 depends=() 11 depends=()
12 -makedepends=(autoconf automake make openssl lib3270 gtk3 python3) 12 +makedepends=(autoconf automake make openssl lib3270 gtk3 python3 libtool)
13 checkdepends=() 13 checkdepends=()
14 14
15 #groups=(gnome) 15 #groups=(gnome)
@@ -22,8 +22,10 @@ conflicts=($pkgname) @@ -22,8 +22,10 @@ conflicts=($pkgname)
22 22
23 prepare() { 23 prepare() {
24 cd $pkgname-$pkgver 24 cd $pkgname-$pkgver
  25 + mkdir -p scripts
  26 + touch scripts/config.rpath
25 NOCONFIGURE=1 ./autogen.sh 27 NOCONFIGURE=1 ./autogen.sh
26 - ./configure --prefix=/usr 28 + ./configure --prefix=/usr --disable-static
27 } 29 }
28 30
29 build() { 31 build() {
@@ -6,21 +6,33 @@ test -n "$srcdir" || srcdir=. @@ -6,21 +6,33 @@ test -n "$srcdir" || srcdir=.
6 olddir=`pwd` 6 olddir=`pwd`
7 cd "$srcdir" 7 cd "$srcdir"
8 8
  9 +mkdir -p scripts
9 mkdir -p m4 10 mkdir -p m4
10 11
  12 +libtoolize --force
  13 +if test $? != 0 ; then
  14 + echo "libtoolize failed."
  15 + exit -1
  16 +fi
  17 +
11 aclocal 18 aclocal
12 if test $? != 0 ; then 19 if test $? != 0 ; then
13 echo "aclocal failed." 20 echo "aclocal failed."
14 exit -1 21 exit -1
15 fi 22 fi
16 23
17 -autoconf 24 +#autoheader --force
  25 +#if test $? != 0 ; then
  26 +# echo "autoheader failed."
  27 +# exit -1
  28 +#fi
  29 +
  30 +autoconf --force
18 if test $? != 0 ; then 31 if test $? != 0 ; then
19 echo "autoconf failed." 32 echo "autoconf failed."
20 exit -1 33 exit -1
21 fi 34 fi
22 35
23 -mkdir -p scripts  
24 automake --add-missing 2> /dev/null | true 36 automake --add-missing 2> /dev/null | true
25 37
26 cd "$olddir" 38 cd "$olddir"
@@ -99,5 +99,5 @@ base=rgb(24,24,24);rgb(79,156,254);rgb(237,74,70);rgb(235,110,183);rgb(131,199,7 @@ -99,5 +99,5 @@ base=rgb(24,24,24);rgb(79,156,254);rgb(237,74,70);rgb(235,110,183);rgb(131,199,7
99 field=rgb(131,199,70);rgb(237,74,70);rgb(65,199,185);rgb(250,145,83) 99 field=rgb(131,199,70);rgb(237,74,70);rgb(65,199,185);rgb(250,145,83)
100 selection=rgb(37,37,37);rgb(222,222,222) 100 selection=rgb(37,37,37);rgb(222,222,222)
101 OIA=rgb(24,24,24);rgb(222,222,222);rgb(79,156,254);rgb(131,199,70);rgb(239,197,65) 101 OIA=rgb(24,24,24);rgb(222,222,222);rgb(79,156,254);rgb(131,199,70);rgb(239,197,65)
102 -cross-hair=rgb(222,222,222) 102 +cross-hair=rgb(30,48,34)
103 103
@@ -159,6 +159,9 @@ AC_DEFINE_UNQUOTED(PACKAGE_MINOR_VERSION, $app_vrs_minor) @@ -159,6 +159,9 @@ AC_DEFINE_UNQUOTED(PACKAGE_MINOR_VERSION, $app_vrs_minor)
159 AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major) 159 AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major)
160 AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor) 160 AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor)
161 161
  162 +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"libv3270-$app_vrs_major.$app_vrs_minor",[The gettext package name.])
  163 +AC_SUBST(GETTEXT_PACKAGE,"libv3270-$app_vrs_major.$app_vrs_minor")
  164 +
162 AC_ARG_WITH([release], [AS_HELP_STRING([--with-release], [Set release])], [ app_cv_release="$withval" ],[ app_cv_release="`date +%-y`.`date +%-m`.`date +%-d`" ]) 165 AC_ARG_WITH([release], [AS_HELP_STRING([--with-release], [Set release])], [ app_cv_release="$withval" ],[ app_cv_release="`date +%-y`.`date +%-m`.`date +%-d`" ])
163 166
164 app_rls_major=$(echo $app_cv_release.0.0 | cut -d. -f1) 167 app_rls_major=$(echo $app_cv_release.0.0 | cut -d. -f1)
locale/Makefile.in
@@ -33,6 +33,7 @@ datarootdir=@datarootdir@ @@ -33,6 +33,7 @@ datarootdir=@datarootdir@
33 localedir=${datarootdir}/locale 33 localedir=${datarootdir}/locale
34 34
35 PACKAGE_NAME=@PACKAGE_NAME@ 35 PACKAGE_NAME=@PACKAGE_NAME@
  36 +GETTEXT_PACKAGE=@GETTEXT_PACKAGE@
36 PACKAGE_VERSION=@PACKAGE_VERSION@ 37 PACKAGE_VERSION=@PACKAGE_VERSION@
37 PACKAGE_TARNAME=@PACKAGE_TARNAME@ 38 PACKAGE_TARNAME=@PACKAGE_TARNAME@
38 PRODUCT_NAME=@PRODUCT_NAME@ 39 PRODUCT_NAME=@PRODUCT_NAME@
@@ -50,21 +51,21 @@ INSTALL_DATA=@INSTALL_DATA@ @@ -50,21 +51,21 @@ INSTALL_DATA=@INSTALL_DATA@
50 #---[ Rules ]---------------------------------------------------------------------------- 51 #---[ Rules ]----------------------------------------------------------------------------
51 52
52 %.po: \ 53 %.po: \
53 - $(PACKAGE_NAME).pot 54 + $(GETTEXT_PACKAGE).pot
54 55
55 @echo $(basename $@) ... 56 @echo $(basename $@) ...
56 - @$(MSGMERGE) --update --sort-output $@ $(PACKAGE_NAME).pot 57 + @$(MSGMERGE) --update --sort-output $@ $(GETTEXT_PACKAGE).pot
57 @touch $@ 58 @touch $@
58 59
59 -$(BINDIR)/%/LC_MESSAGES/$(PACKAGE_NAME).mo: \ 60 +$(BINDIR)/%/LC_MESSAGES/$(GETTEXT_PACKAGE).mo: \
60 %.po 61 %.po
61 62
62 @echo $< ... 63 @echo $< ...
63 @$(MKDIR) `dirname $@` 64 @$(MKDIR) `dirname $@`
64 @$(MSGFMT) -c -v -o $@ $^ 65 @$(MSGFMT) -c -v -o $@ $^
65 66
66 -$(DESTDIR)$(localedir)/%/LC_MESSAGES/$(PACKAGE_NAME).mo: \  
67 - $(BINDIR)/%/LC_MESSAGES/$(PACKAGE_NAME).mo 67 +$(DESTDIR)$(localedir)/%/LC_MESSAGES/$(GETTEXT_PACKAGE).mo: \
  68 + $(BINDIR)/%/LC_MESSAGES/$(GETTEXT_PACKAGE).mo
68 69
69 @echo $< ... 70 @echo $< ...
70 @$(MKDIR) `dirname $@` 71 @$(MKDIR) `dirname $@`
@@ -73,10 +74,10 @@ $(DESTDIR)$(localedir)/%/LC_MESSAGES/$(PACKAGE_NAME).mo: \ @@ -73,10 +74,10 @@ $(DESTDIR)$(localedir)/%/LC_MESSAGES/$(PACKAGE_NAME).mo: \
73 #---[ Targets ]-------------------------------------------------------------------------- 74 #---[ Targets ]--------------------------------------------------------------------------
74 75
75 all: \ 76 all: \
76 - $(foreach SRC, $(basename $(wildcard *.po)), $(BINDIR)/$(SRC)/LC_MESSAGES/$(PACKAGE_NAME).mo) 77 + $(foreach SRC, $(basename $(wildcard *.po)), $(BINDIR)/$(SRC)/LC_MESSAGES/$(GETTEXT_PACKAGE).mo)
77 78
78 install: \ 79 install: \
79 - $(foreach SRC, $(basename $(wildcard *.po)), $(DESTDIR)$(localedir)/$(SRC)/LC_MESSAGES/$(PACKAGE_NAME).mo) 80 + $(foreach SRC, $(basename $(wildcard *.po)), $(DESTDIR)$(localedir)/$(SRC)/LC_MESSAGES/$(GETTEXT_PACKAGE).mo)
80 81
81 82
82 83
src/dialogs/dialog.c
@@ -54,13 +54,10 @@ @@ -54,13 +54,10 @@
54 54
55 #elif GTK_CHECK_VERSION(3,12,0) 55 #elif GTK_CHECK_VERSION(3,12,0)
56 56
57 - gboolean use_header;  
58 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
59 -  
60 GtkWidget * dialog = 57 GtkWidget * dialog =
61 GTK_WIDGET(g_object_new( 58 GTK_WIDGET(g_object_new(
62 GTK_TYPE_DIALOG, 59 GTK_TYPE_DIALOG,
63 - "use-header-bar", (use_header ? 1 : 0), 60 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
64 NULL 61 NULL
65 )); 62 ));
66 63
src/dialogs/load.c
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 #include <clipboard.h> 35 #include <clipboard.h>
36 #include <limits.h> 36 #include <limits.h>
37 #include <v3270/dialogs.h> 37 #include <v3270/dialogs.h>
  38 + #include <v3270/tools.h>
38 39
39 /*--[ Widget definition ]----------------------------------------------------------------------------*/ 40 /*--[ Widget definition ]----------------------------------------------------------------------------*/
40 41
@@ -73,16 +74,7 @@ @@ -73,16 +74,7 @@
73 74
74 } 75 }
75 76
76 - static void cancel_operation(GtkButton G_GNUC_UNUSED(*button), GtkDialog *dialog)  
77 - {  
78 - gtk_dialog_response(dialog,GTK_RESPONSE_CANCEL);  
79 - }  
80 -  
81 - static void apply_operation(GtkButton G_GNUC_UNUSED(*button), GtkDialog *dialog)  
82 - {  
83 - gtk_dialog_response(dialog,GTK_RESPONSE_APPLY);  
84 - }  
85 - 77 +/*
86 #ifdef WIN32 78 #ifdef WIN32
87 static void icon_press(GtkEntry G_GNUC_UNUSED(*entry), G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270LoadDialog *widget) 79 static void icon_press(GtkEntry G_GNUC_UNUSED(*entry), G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270LoadDialog *widget)
88 { 80 {
@@ -128,9 +120,23 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -128,9 +120,23 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
128 120
129 } 121 }
130 #endif // _WIN32 122 #endif // _WIN32
  123 +*/
131 124
132 - static void V3270LoadDialog_init(V3270LoadDialog *dialog)  
133 - { 125 + static void filename_changed(GtkEntry *entry, V3270LoadDialog *dialog) {
  126 +
  127 + const gchar * text = gtk_entry_get_text(entry);
  128 + GtkWidget * button = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),GTK_RESPONSE_APPLY);
  129 +
  130 + if(!(text && *text)) {
  131 + gtk_widget_set_sensitive(button,FALSE);
  132 + return;
  133 + }
  134 +
  135 + gtk_widget_set_sensitive(button,g_file_test(text, G_FILE_TEST_IS_REGULAR));
  136 +
  137 + }
  138 +
  139 + static void V3270LoadDialog_init(V3270LoadDialog *dialog) {
134 // 0--------1---------------------2-------3--------------------4 140 // 0--------1---------------------2-------3--------------------4
135 // 0 - Filename xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx. x 141 // 0 - Filename xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx. x
136 // 1 - Charset xxxxxxxxx.xxxxxxxxx. Format: xxxxxxxxx.xxxxxxxxx. 142 // 1 - Charset xxxxxxxxx.xxxxxxxxx. Format: xxxxxxxxx.xxxxxxxxx.
@@ -141,7 +147,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -141,7 +147,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
141 // Setup visual elements 147 // Setup visual elements
142 // https://developer.gnome.org/hig/stable/visual-layout.html.en 148 // https://developer.gnome.org/hig/stable/visual-layout.html.en
143 GtkWidget *widget; 149 GtkWidget *widget;
144 - GtkWidget *button;  
145 150
146 GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); 151 GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
147 gtk_window_set_resizable(GTK_WINDOW(dialog),FALSE); 152 gtk_window_set_resizable(GTK_WINDOW(dialog),FALSE);
@@ -166,10 +171,23 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -166,10 +171,23 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
166 gtk_grid_attach(grid,widget,0,0,1,1); 171 gtk_grid_attach(grid,widget,0,0,1,1);
167 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); 172 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename);
168 173
  174 + /*
169 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open"); 175 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open");
170 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE); 176 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE);
171 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file")); 177 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file"));
172 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog); 178 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog);
  179 + */
  180 +
  181 + g_signal_connect(dialog->filename,"changed",G_CALLBACK(filename_changed),dialog);
  182 +
  183 + gtk_entry_bind_to_filechooser(
  184 + dialog->filename,
  185 + GTK_FILE_CHOOSER_ACTION_OPEN,
  186 + _( "Select file" ),
  187 + NULL,
  188 + "*.txt",
  189 + _("Text files")
  190 + );
173 191
174 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60); 192 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60);
175 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX); 193 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX);
@@ -191,41 +209,20 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -191,41 +209,20 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
191 209
192 // Buttons 210 // Buttons
193 // https://developer.gnome.org/icon-naming-spec/ 211 // https://developer.gnome.org/icon-naming-spec/
194 -#ifdef _WIN32  
195 - widget = NULL;  
196 -#elif GTK_CHECK_VERSION(3,14,0)  
197 - widget = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));  
198 -#else  
199 - widget = NULL;  
200 -#endif // GTK(3,14,0) 212 + gtk_dialog_add_buttons(
  213 + GTK_DIALOG (dialog),
  214 + _("_Cancel"), GTK_RESPONSE_CANCEL,
  215 + _("_Load"), GTK_RESPONSE_APPLY,
  216 + NULL
  217 + );
201 218
202 - if(widget)  
203 - {  
204 - // Have header bar  
205 - button = gtk_button_new_with_mnemonic(_("_Cancel"));  
206 - gtk_widget_set_tooltip_markup(button,_("Click to cancel operation"));  
207 - gtk_header_bar_pack_start(GTK_HEADER_BAR(widget),button);  
208 - g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(cancel_operation),dialog);  
209 -  
210 - button = gtk_button_new_with_mnemonic(_("_Load"));  
211 - gtk_widget_set_tooltip_markup(button,_("Click to load file"));  
212 - gtk_header_bar_pack_end(GTK_HEADER_BAR(widget),button);  
213 - g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(apply_operation),dialog); 219 + if(!v3270_dialog_get_use_header()) {
  220 + GtkWidget * content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
  221 + gtk_box_set_spacing(GTK_BOX(content_area),6);
214 } 222 }
215 - else  
216 - {  
217 - gtk_box_set_spacing(  
218 - GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),  
219 - 18  
220 - );  
221 223
222 - gtk_dialog_add_buttons(  
223 - GTK_DIALOG (dialog),  
224 - _("_Cancel"), GTK_RESPONSE_CANCEL,  
225 - _("_Load"), GTK_RESPONSE_APPLY,  
226 - NULL  
227 - );  
228 - } 224 + gtk_widget_set_sensitive(gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),GTK_RESPONSE_APPLY),FALSE);
  225 +
229 226
230 } 227 }
231 228
@@ -233,14 +230,11 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -233,14 +230,11 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
233 { 230 {
234 g_return_val_if_fail(GTK_IS_V3270(widget),NULL); 231 g_return_val_if_fail(GTK_IS_V3270(widget),NULL);
235 232
236 - gboolean use_header;  
237 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
238 -  
239 // Create dialog 233 // Create dialog
240 V3270LoadDialog * dialog = V3270_LOAD_DIALOG( 234 V3270LoadDialog * dialog = V3270_LOAD_DIALOG(
241 g_object_new( 235 g_object_new(
242 GTK_TYPE_V3270LoadDialog, 236 GTK_TYPE_V3270LoadDialog,
243 - "use-header-bar", (use_header ? 1 : 0), 237 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
244 NULL) 238 NULL)
245 ); 239 );
246 240
src/dialogs/popups.c
@@ -32,14 +32,14 @@ @@ -32,14 +32,14 @@
32 #include <terminal.h> 32 #include <terminal.h>
33 #include <v3270/dialogs.h> 33 #include <v3270/dialogs.h>
34 #include <v3270/settings.h> 34 #include <v3270/settings.h>
  35 + #include <v3270/tools.h>
35 #include <lib3270/popup.h> 36 #include <lib3270/popup.h>
36 37
37 /*--[ Implement ]------------------------------------------------------------------------------------*/ 38 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 39
39 static void v3270_dialog_add_class_for_response(GtkWidget *dialog, gint response_id, const char *className) { 40 static void v3270_dialog_add_class_for_response(GtkWidget *dialog, gint response_id, const char *className) {
40 GtkWidget * widget = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),response_id); 41 GtkWidget * widget = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),response_id);
41 - GtkStyleContext *context = gtk_widget_get_style_context(widget);  
42 - gtk_style_context_add_class(context,className); 42 + gtk_widget_add_class(widget,className);
43 } 43 }
44 44
45 GtkResponseType v3270_popup_dialog_show(GtkWidget *widget, const LIB3270_POPUP *popup, gboolean wait) { 45 GtkResponseType v3270_popup_dialog_show(GtkWidget *widget, const LIB3270_POPUP *popup, gboolean wait) {
src/dialogs/print/settingsdialog.c
@@ -454,13 +454,10 @@ static void V3270FTSettingsDialog_init(V3270FTSettingsDialog *widget) @@ -454,13 +454,10 @@ static void V3270FTSettingsDialog_init(V3270FTSettingsDialog *widget)
454 454
455 LIB3270_EXPORT GtkWidget * v3270_ft_settings_dialog_new(GtkWidget *parent) 455 LIB3270_EXPORT GtkWidget * v3270_ft_settings_dialog_new(GtkWidget *parent)
456 { 456 {
457 - gboolean use_header;  
458 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
459 -  
460 GtkWidget * dialog = 457 GtkWidget * dialog =
461 GTK_WIDGET(g_object_new( 458 GTK_WIDGET(g_object_new(
462 GTK_TYPE_V3270_FT_DIALOG, 459 GTK_TYPE_V3270_FT_DIALOG,
463 - "use-header-bar", (use_header ? 1 : 0), 460 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
464 NULL 461 NULL
465 )); 462 ));
466 463
src/dialogs/save/private.h
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 GtkWidget * terminal; 49 GtkWidget * terminal;
50 GtkWidget * filename; 50 GtkWidget * filename;
51 GtkWidget * charset; 51 GtkWidget * charset;
52 - GtkWidget * format; 52 + GtkComboBox * format;
53 LIB3270_CONTENT_OPTION mode; 53 LIB3270_CONTENT_OPTION mode;
54 54
55 }; 55 };
src/dialogs/save/save.c
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 #include <lib3270/selection.h> 34 #include <lib3270/selection.h>
35 #include <clipboard.h> 35 #include <clipboard.h>
36 #include <limits.h> 36 #include <limits.h>
  37 + #include <v3270/tools.h>
37 38
38 /*--[ GTK Requires ]---------------------------------------------------------------------------------*/ 39 /*--[ GTK Requires ]---------------------------------------------------------------------------------*/
39 40
@@ -63,13 +64,6 @@ @@ -63,13 +64,6 @@
63 64
64 /*--[ Implement ]------------------------------------------------------------------------------------*/ 65 /*--[ Implement ]------------------------------------------------------------------------------------*/
65 66
66 -/*  
67 - static void V3270SaveDialog_finalize(V3270SaveDialog *object)  
68 - {  
69 - V3270SaveDialog *dialog = V3270_SAVE_DIALOG(object);  
70 - }  
71 -*/  
72 -  
73 static void V3270SaveDialog_class_init(V3270SaveDialogClass G_GNUC_UNUSED(*klass)) 67 static void V3270SaveDialog_class_init(V3270SaveDialogClass G_GNUC_UNUSED(*klass))
74 { 68 {
75 69
@@ -78,16 +72,7 @@ @@ -78,16 +72,7 @@
78 72
79 } 73 }
80 74
81 - static void cancel_operation(GtkButton G_GNUC_UNUSED(*button), GtkDialog *dialog)  
82 - {  
83 - gtk_dialog_response(dialog,GTK_RESPONSE_CANCEL);  
84 - }  
85 -  
86 - static void apply_operation(GtkButton G_GNUC_UNUSED(*button), GtkDialog *dialog)  
87 - {  
88 - gtk_dialog_response(dialog,GTK_RESPONSE_APPLY);  
89 - }  
90 - 75 +/*
91 #ifdef WIN32 76 #ifdef WIN32
92 static void icon_press(GtkEntry G_GNUC_UNUSED(*entry), G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) 77 static void icon_press(GtkEntry G_GNUC_UNUSED(*entry), G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget)
93 { 78 {
@@ -136,29 +121,42 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -136,29 +121,42 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
136 121
137 } 122 }
138 #endif // _WIN32 123 #endif // _WIN32
  124 +*/
139 125
140 -  
141 - static void filename_changed(GtkEntry *entry, GtkComboBox *formats) 126 + static void filename_changed(GtkEntry *entry, V3270SaveDialog *dialog)
142 { 127 {
143 const gchar * text = gtk_entry_get_text(entry); 128 const gchar * text = gtk_entry_get_text(entry);
  129 + GtkWidget * button = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),GTK_RESPONSE_APPLY);
144 130
145 - if(!(text && *text)) 131 + if(!(text && *text)) {
  132 + gtk_widget_set_sensitive(button,FALSE);
  133 + return;
  134 + }
  135 +
  136 + if(g_str_has_suffix(text,G_DIR_SEPARATOR_S)) {
  137 + gtk_widget_set_sensitive(button,FALSE);
146 return; 138 return;
  139 + }
147 140
148 - const gchar * extension = strrchr(text,'.'); 141 + g_autofree gchar * dirname = g_path_get_dirname(text);
  142 + g_autofree gchar * basename = g_path_get_basename(text);
  143 +
  144 + gtk_widget_set_sensitive(button,g_file_test(dirname,G_FILE_TEST_IS_DIR));
  145 +
  146 + const gchar * extension = strrchr(basename,'.');
149 if(!extension) 147 if(!extension)
150 return; 148 return;
151 149
152 extension++; 150 extension++;
153 - const gchar * format = gtk_combo_box_get_active_id(formats); 151 + const gchar * format = gtk_combo_box_get_active_id(dialog->format);
154 if(*format == '.') 152 if(*format == '.')
155 format++; 153 format++;
156 154
157 if(g_ascii_strcasecmp(extension,format) == 0) 155 if(g_ascii_strcasecmp(extension,format) == 0)
158 return; 156 return;
159 157
160 - gint column = gtk_combo_box_get_id_column(formats);  
161 - GtkTreeModel * model = gtk_combo_box_get_model(formats); 158 + gint column = gtk_combo_box_get_id_column(dialog->format);
  159 + GtkTreeModel * model = gtk_combo_box_get_model(dialog->format);
162 GtkTreeIter iter; 160 GtkTreeIter iter;
163 161
164 debug("id_column=%d",column); 162 debug("id_column=%d",column);
@@ -172,7 +170,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -172,7 +170,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
172 170
173 if(g_ascii_strcasecmp(extension,id + (*id == '.' ? 1 : 0)) == 0) 171 if(g_ascii_strcasecmp(extension,id + (*id == '.' ? 1 : 0)) == 0)
174 { 172 {
175 - gtk_combo_box_set_active_iter(formats,&iter); 173 + gtk_combo_box_set_active_iter(dialog->format,&iter);
176 break; 174 break;
177 } 175 }
178 176
@@ -228,7 +226,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -228,7 +226,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
228 // Setup visual elements 226 // Setup visual elements
229 // https://developer.gnome.org/hig/stable/visual-layout.html.en 227 // https://developer.gnome.org/hig/stable/visual-layout.html.en
230 GtkWidget *widget; 228 GtkWidget *widget;
231 - GtkWidget *button;  
232 229
233 GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); 230 GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
234 gtk_window_set_resizable(GTK_WINDOW(dialog),FALSE); 231 gtk_window_set_resizable(GTK_WINDOW(dialog),FALSE);
@@ -253,10 +250,21 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -253,10 +250,21 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
253 gtk_grid_attach(grid,widget,0,0,1,1); 250 gtk_grid_attach(grid,widget,0,0,1,1);
254 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); 251 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename);
255 252
  253 + /*
256 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-save-as"); 254 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-save-as");
257 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE); 255 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE);
258 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file")); 256 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file"));
259 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog); 257 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog);
  258 + */
  259 +
  260 + gtk_entry_bind_to_filechooser(
  261 + dialog->filename,
  262 + GTK_FILE_CHOOSER_ACTION_SAVE,
  263 + _( "Select destination file" ),
  264 + NULL,
  265 + NULL,
  266 + NULL
  267 + );
260 268
261 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60); 269 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60);
262 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX); 270 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX);
@@ -284,9 +292,9 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -284,9 +292,9 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
284 gtk_widget_set_valign(widget,GTK_ALIGN_CENTER); 292 gtk_widget_set_valign(widget,GTK_ALIGN_CENTER);
285 gtk_grid_attach(grid,widget,2,1,1,1); 293 gtk_grid_attach(grid,widget,2,1,1,1);
286 294
287 - dialog->format = gtk_combo_box_text_new(); 295 + dialog->format = GTK_COMBO_BOX(gtk_combo_box_text_new());
288 296
289 - gtk_grid_attach(grid,dialog->format,3,1,1,1); 297 + gtk_grid_attach(grid,GTK_WIDGET(dialog->format),3,1,1,1);
290 298
291 for(ix=0;ix<G_N_ELEMENTS(formats);ix++) 299 for(ix=0;ix<G_N_ELEMENTS(formats);ix++)
292 { 300 {
@@ -320,7 +328,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -320,7 +328,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
320 328
321 } 329 }
322 330
323 - g_signal_connect(dialog->filename,"changed",G_CALLBACK(filename_changed),dialog->format); 331 + g_signal_connect(dialog->filename,"changed",G_CALLBACK(filename_changed),dialog);
324 g_signal_connect(dialog->format,"changed",G_CALLBACK(fileformat_changed),dialog->filename); 332 g_signal_connect(dialog->format,"changed",G_CALLBACK(fileformat_changed),dialog->filename);
325 333
326 } 334 }
@@ -328,41 +336,19 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -328,41 +336,19 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
328 336
329 // Buttons 337 // Buttons
330 // https://developer.gnome.org/icon-naming-spec/ 338 // https://developer.gnome.org/icon-naming-spec/
331 -#ifdef _WIN32  
332 - widget = NULL;  
333 -#elif GTK_CHECK_VERSION(3,14,0)  
334 - widget = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));  
335 -#else  
336 - widget = NULL;  
337 -#endif // GTK(3,14,0)  
338 -  
339 - if(widget)  
340 - {  
341 - // Have header bar  
342 - button = gtk_button_new_with_mnemonic(_("_Cancel"));  
343 - gtk_widget_set_tooltip_markup(button,_("Click to cancel operation"));  
344 - gtk_header_bar_pack_start(GTK_HEADER_BAR(widget),button);  
345 - g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(cancel_operation),dialog);  
346 -  
347 - button = gtk_button_new_with_mnemonic(_("_Save"));  
348 - gtk_widget_set_tooltip_markup(button,_("Click to save file"));  
349 - gtk_header_bar_pack_end(GTK_HEADER_BAR(widget),button);  
350 - g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(apply_operation),dialog); 339 + gtk_dialog_add_buttons(
  340 + GTK_DIALOG (dialog),
  341 + _("_Cancel"), GTK_RESPONSE_CANCEL,
  342 + _("_Save"), GTK_RESPONSE_APPLY,
  343 + NULL
  344 + );
  345 +
  346 + if(!v3270_dialog_get_use_header()) {
  347 + GtkWidget * content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
  348 + gtk_box_set_spacing(GTK_BOX(content_area),6);
351 } 349 }
352 - else  
353 - {  
354 - gtk_box_set_spacing(  
355 - GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),  
356 - 18  
357 - );  
358 350
359 - gtk_dialog_add_buttons(  
360 - GTK_DIALOG (dialog),  
361 - _("_Cancel"), GTK_RESPONSE_CANCEL,  
362 - _("_Save"), GTK_RESPONSE_APPLY,  
363 - NULL  
364 - );  
365 - } 351 + gtk_widget_set_sensitive(gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),GTK_RESPONSE_APPLY),FALSE);
366 352
367 } 353 }
368 354
@@ -377,14 +363,11 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -377,14 +363,11 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
377 N_("Save copy"), 363 N_("Save copy"),
378 }; 364 };
379 365
380 - gboolean use_header;  
381 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
382 -  
383 // Create dialog 366 // Create dialog
384 V3270SaveDialog * dialog = V3270_SAVE_DIALOG( 367 V3270SaveDialog * dialog = V3270_SAVE_DIALOG(
385 g_object_new( 368 g_object_new(
386 GTK_TYPE_V3270SaveDialog, 369 GTK_TYPE_V3270SaveDialog,
387 - "use-header-bar", (use_header ? 1 : 0), 370 + "use-header-bar", v3270_dialog_get_use_header() ? 1 : 0,
388 NULL) 371 NULL)
389 ); 372 );
390 373
src/dialogs/security.c
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 #include <config.h> 30 #include <config.h>
31 31
32 #define ENABLE_NLS 32 #define ENABLE_NLS
33 - #define GETTEXT_PACKAGE PACKAGE_NAME  
34 33
35 #include <gtk/gtk.h> 34 #include <gtk/gtk.h>
36 #include <libintl.h> 35 #include <libintl.h>
@@ -215,12 +214,10 @@ @@ -215,12 +214,10 @@
215 214
216 #if GTK_CHECK_VERSION(3,12,0) 215 #if GTK_CHECK_VERSION(3,12,0)
217 216
218 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
219 -  
220 GtkWidget * dialog = 217 GtkWidget * dialog =
221 GTK_WIDGET(g_object_new( 218 GTK_WIDGET(g_object_new(
222 GTK_TYPE_DIALOG, 219 GTK_TYPE_DIALOG,
223 - "use-header-bar", (use_header ? 1 : 0), 220 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
224 NULL 221 NULL
225 )); 222 ));
226 223
src/dialogs/settings/dialog.c
@@ -48,19 +48,6 @@ @@ -48,19 +48,6 @@
48 48
49 /*--[ Implement ]------------------------------------------------------------------------------------*/ 49 /*--[ Implement ]------------------------------------------------------------------------------------*/
50 50
51 -/*  
52 -static gboolean on_tab_focus(V3270Settings *settings, GdkEvent G_GNUC_UNUSED(*event), V3270SettingsDialog *dialog)  
53 -{  
54 - debug("title: %s",settings->title);  
55 - debug("label: %s",settings->label);  
56 -  
57 - if(settings->title)  
58 - gtk_window_set_title(dialog,settings->title);  
59 -  
60 - return FALSE;  
61 -}  
62 -*/  
63 -  
64 static void on_switch_page(GtkNotebook G_GNUC_UNUSED(*notebook), V3270Settings *settings, guint G_GNUC_UNUSED(page_num), V3270SettingsDialog *dialog) 51 static void on_switch_page(GtkNotebook G_GNUC_UNUSED(*notebook), V3270Settings *settings, guint G_GNUC_UNUSED(page_num), V3270SettingsDialog *dialog)
65 { 52 {
66 debug("title: %s",settings->title); 53 debug("title: %s",settings->title);
@@ -215,15 +202,9 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog) @@ -215,15 +202,9 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog)
215 GtkWidget * content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); 202 GtkWidget * content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
216 203
217 // Get use of header bar. 204 // Get use of header bar.
218 -#ifndef _WIN32  
219 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &dialog->has_subtitle, NULL);  
220 -#endif // _WIN32  
221 -  
222 - // https://developer.gnome.org/hig/stable/visual-layout.html.en  
223 - //gtk_box_set_spacing(GTK_BOX(content_area),18);  
224 - //gtk_container_set_border_width(GTK_CONTAINER(content_area),18); 205 + dialog->has_subtitle = v3270_dialog_get_use_header();
225 206
226 -// gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); 207 + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
227 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); 208 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
228 209
229 gtk_dialog_add_buttons( 210 gtk_dialog_add_buttons(
@@ -236,11 +217,6 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog) @@ -236,11 +217,6 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog)
236 // Create notebook for settings widgets 217 // Create notebook for settings widgets
237 dialog->tabs = GTK_NOTEBOOK(gtk_notebook_new()); 218 dialog->tabs = GTK_NOTEBOOK(gtk_notebook_new());
238 219
239 -#ifdef _WIN32  
240 - gtk_widget_set_margin_bottom(GTK_WIDGET(dialog->tabs),3);  
241 -// gtk_notebook_set_show_border(dialog->tabs, TRUE);  
242 -#endif // _WIN32  
243 -  
244 gtk_notebook_set_scrollable(dialog->tabs,TRUE); 220 gtk_notebook_set_scrollable(dialog->tabs,TRUE);
245 gtk_notebook_set_show_tabs(dialog->tabs,FALSE); 221 gtk_notebook_set_show_tabs(dialog->tabs,FALSE);
246 g_signal_connect(G_OBJECT(dialog->tabs), "page-added", G_CALLBACK(on_page_changed), dialog); 222 g_signal_connect(G_OBJECT(dialog->tabs), "page-added", G_CALLBACK(on_page_changed), dialog);
@@ -248,29 +224,20 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog) @@ -248,29 +224,20 @@ static void V3270SettingsDialog_init(V3270SettingsDialog *dialog)
248 g_signal_connect(G_OBJECT(dialog->tabs), "switch-page", G_CALLBACK(on_switch_page), dialog); 224 g_signal_connect(G_OBJECT(dialog->tabs), "switch-page", G_CALLBACK(on_switch_page), dialog);
249 gtk_box_pack_start(GTK_BOX(content_area),GTK_WIDGET(dialog->tabs),TRUE,TRUE,0); 225 gtk_box_pack_start(GTK_BOX(content_area),GTK_WIDGET(dialog->tabs),TRUE,TRUE,0);
250 226
251 - 227 + if(!dialog->has_subtitle) {
  228 + gtk_box_set_spacing(GTK_BOX(content_area),3);
  229 + gtk_widget_set_margin_bottom(content_area,3);
  230 + }
252 } 231 }
253 232
254 GtkWidget * v3270_settings_dialog_new() 233 GtkWidget * v3270_settings_dialog_new()
255 { 234 {
256 -#ifdef _WIN32  
257 -  
258 - GtkWidget * dialog =  
259 - GTK_WIDGET(g_object_new(  
260 - GTK_TYPE_V3270_SETTINGS_DIALOG,  
261 - "use-header-bar", FALSE,  
262 - NULL  
263 - ));  
264 -  
265 -#elif GTK_CHECK_VERSION(3,12,0)  
266 -  
267 - gboolean use_header;  
268 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL); 235 +#if GTK_CHECK_VERSION(3,12,0)
269 236
270 GtkWidget * dialog = 237 GtkWidget * dialog =
271 GTK_WIDGET(g_object_new( 238 GTK_WIDGET(g_object_new(
272 GTK_TYPE_V3270_SETTINGS_DIALOG, 239 GTK_TYPE_V3270_SETTINGS_DIALOG,
273 - "use-header-bar", (use_header ? 1 : 0), 240 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
274 NULL 241 NULL
275 )); 242 ));
276 243
src/dialogs/tools.c
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 29
30 #include <internals.h> 30 #include <internals.h>
31 #include <v3270/dialogs.h> 31 #include <v3270/dialogs.h>
  32 + #include <v3270/tools.h>
32 33
33 /*--[ Implement ]------------------------------------------------------------------------------------*/ 34 /*--[ Implement ]------------------------------------------------------------------------------------*/
34 35
@@ -45,33 +46,28 @@ @@ -45,33 +46,28 @@
45 return grid; 46 return grid;
46 } 47 }
47 48
  49 + GtkWidget * v3270_dialog_section_get_label_widget(GtkWidget *widget) {
  50 + GtkWidget *rc = NULL;
  51 + g_object_get(G_OBJECT(widget),"label-widget",&rc,NULL);
  52 + return rc;
  53 + }
  54 +
48 GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child) { 55 GtkWidget * v3270_dialog_section_new(const gchar * title, const gchar *tooltip, GtkWidget *child) {
49 56
50 // https://developer.gnome.org/hig/stable/visual-layout.html.en 57 // https://developer.gnome.org/hig/stable/visual-layout.html.en
51 58
52 - GtkFrame * frame = GTK_FRAME(gtk_frame_new(""));  
53 - GtkWidget * label = gtk_label_new(NULL); 59 + GtkFrame * frame = GTK_FRAME(gtk_frame_new(title));
  60 + GtkWidget * label = v3270_dialog_section_get_label_widget(GTK_WIDGET(frame));
54 61
55 #ifdef G_OS_UNIX 62 #ifdef G_OS_UNIX
56 { 63 {
57 // Unix/Linux version, follow gnome guidelines 64 // Unix/Linux version, follow gnome guidelines
58 - g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title);  
59 - gtk_label_set_markup(GTK_LABEL(label),markup);  
60 -  
61 - g_object_set(G_OBJECT(frame),"margin-top",6,NULL);  
62 - 65 + gtk_widget_add_class(label,"separator");
63 gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); 66 gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE);
64 67
65 } 68 }
66 -#else  
67 - {  
68 - // Non Unix/Linux, use the windows style.  
69 - gtk_label_set_text(GTK_LABEL(label),title);  
70 - }  
71 #endif // G_OS_UNIX 69 #endif // G_OS_UNIX
72 70
73 - gtk_frame_set_label_widget(GTK_FRAME(frame),label);  
74 -  
75 if(child) { 71 if(child) {
76 gtk_container_set_border_width(GTK_CONTAINER(child),12); 72 gtk_container_set_border_width(GTK_CONTAINER(child),12);
77 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child)); 73 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(child));
@@ -220,4 +216,18 @@ @@ -220,4 +216,18 @@
220 216
221 } 217 }
222 218
  219 + gboolean v3270_dialog_get_use_header() {
  220 +
  221 +#ifdef _WIN32
  222 + return FALSE;
  223 +#elif GTK_CHECK_VERSION(3,12,0)
  224 + gboolean use_header;
  225 + g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);
  226 + return use_header;
  227 +#else
  228 + return FALSE;
  229 +#endif // _WIN32
  230 +
  231 + }
  232 +
223 233
src/dialogs/transfer.c
@@ -126,12 +126,10 @@ LIB3270_EXPORT gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION opt @@ -126,12 +126,10 @@ LIB3270_EXPORT gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION opt
126 126
127 #if GTK_CHECK_VERSION(3,12,0) 127 #if GTK_CHECK_VERSION(3,12,0)
128 128
129 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
130 -  
131 GtkWidget * dialog = 129 GtkWidget * dialog =
132 GTK_WIDGET(g_object_new( 130 GTK_WIDGET(g_object_new(
133 GTK_TYPE_DIALOG, 131 GTK_TYPE_DIALOG,
134 - "use-header-bar", (use_header ? 1 : 0), 132 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
135 NULL 133 NULL
136 )); 134 ));
137 135
src/filetransfer/private.h
@@ -35,7 +35,6 @@ @@ -35,7 +35,6 @@
35 #include <config.h> 35 #include <config.h>
36 36
37 #define ENABLE_NLS 37 #define ENABLE_NLS
38 - #define GETTEXT_PACKAGE PACKAGE_NAME  
39 38
40 #include <libintl.h> 39 #include <libintl.h>
41 #include <glib/gi18n-lib.h> 40 #include <glib/gi18n-lib.h>
src/filetransfer/v3270ft.c
@@ -726,13 +726,10 @@ LIB3270_EXPORT GtkWidget * v3270ft_new(GtkWidget *parent) { @@ -726,13 +726,10 @@ LIB3270_EXPORT GtkWidget * v3270ft_new(GtkWidget *parent) {
726 726
727 #if GTK_CHECK_VERSION(3,12,0) 727 #if GTK_CHECK_VERSION(3,12,0)
728 728
729 - gboolean use_header;  
730 - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL);  
731 -  
732 GtkWidget * dialog = 729 GtkWidget * dialog =
733 GTK_WIDGET(g_object_new( 730 GTK_WIDGET(g_object_new(
734 GTK_TYPE_V3270FT, 731 GTK_TYPE_V3270FT,
735 - "use-header-bar", (use_header ? 1 : 0), 732 + "use-header-bar", (v3270_dialog_get_use_header() ? 1 : 0),
736 NULL 733 NULL
737 )); 734 ));
738 735
src/include/config.h.in
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 #undef PACKAGE_VERSION 35 #undef PACKAGE_VERSION
36 #undef PACKAGE_RELEASE 36 #undef PACKAGE_RELEASE
37 #undef PRODUCT_NAME 37 #undef PRODUCT_NAME
  38 + #undef GETTEXT_PACKAGE
38 39
39 #undef HAVE_LIBM 40 #undef HAVE_LIBM
40 41
src/include/internals.h
@@ -34,7 +34,6 @@ @@ -34,7 +34,6 @@
34 #include <config.h> 34 #include <config.h>
35 35
36 #define ENABLE_NLS 36 #define ENABLE_NLS
37 - #define GETTEXT_PACKAGE PACKAGE_NAME  
38 37
39 #include <glib.h> 38 #include <glib.h>
40 #include <glib/gi18n-lib.h> 39 #include <glib/gi18n-lib.h>
@@ -193,6 +192,8 @@ @@ -193,6 +192,8 @@
193 G_GNUC_INTERNAL GtkHeaderBar * v3270_dialog_get_header_bar(GtkWidget * widget); 192 G_GNUC_INTERNAL GtkHeaderBar * v3270_dialog_get_header_bar(GtkWidget * widget);
194 #endif // ! GTK 3.12 193 #endif // ! GTK 3.12
195 194
  195 + G_GNUC_INTERNAL gboolean v3270_dialog_get_use_header();
  196 +
196 G_GNUC_INTERNAL void v3270_grid_attach(GtkGrid *grid, const struct v3270_entry_field * description, GtkWidget *widget); 197 G_GNUC_INTERNAL void v3270_grid_attach(GtkGrid *grid, const struct v3270_entry_field * description, GtkWidget *widget);
197 198
198 // Toggle button widget 199 // Toggle button widget
src/include/v3270/tools.h
@@ -37,6 +37,9 @@ @@ -37,6 +37,9 @@
37 /// @brief Bind pointer to widget; release it when widget is destroyed. 37 /// @brief Bind pointer to widget; release it when widget is destroyed.
38 LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr); 38 LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr);
39 39
  40 + /// @brief Add style to widget.
  41 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className);
  42 +
40 /// @brief Bind file chooser with entry field. 43 /// @brief Bind file chooser with entry field.
41 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); 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);
42 45
src/terminal/accessible.c
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 #include <config.h> 30 #include <config.h>
31 31
32 #define ENABLE_NLS 32 #define ENABLE_NLS
33 - #define GETTEXT_PACKAGE PACKAGE_NAME  
34 33
35 #include <gtk/gtk.h> 34 #include <gtk/gtk.h>
36 #include <libintl.h> 35 #include <libintl.h>
src/terminal/drawing/oia.c
@@ -35,7 +35,6 @@ @@ -35,7 +35,6 @@
35 #endif // WIN32 35 #endif // WIN32
36 36
37 #define ENABLE_NLS 37 #define ENABLE_NLS
38 - #define GETTEXT_PACKAGE PACKAGE_NAME  
39 38
40 #include <gtk/gtk.h> 39 #include <gtk/gtk.h>
41 #include <libintl.h> 40 #include <libintl.h>
@@ -258,10 +257,8 @@ static void setup_double_char_position(GdkRectangle *rect, G_GNUC_UNUSED v3270Fo @@ -258,10 +257,8 @@ static void setup_double_char_position(GdkRectangle *rect, G_GNUC_UNUSED v3270Fo
258 static int draw_centered_char(cairo_t *cr, v3270FontInfo *metrics, int x, int y, const gchar chr) 257 static int draw_centered_char(cairo_t *cr, v3270FontInfo *metrics, int x, int y, const gchar chr)
259 { 258 {
260 char str[2] = { chr, 0 }; 259 char str[2] = { chr, 0 };
261 -// cairo_text_extents_t extents;  
262 260
263 cairo_set_scaled_font(cr,metrics->scaled); 261 cairo_set_scaled_font(cr,metrics->scaled);
264 -// cairo_text_extents(cr,str,&extents);  
265 262
266 v3270_draw_text_at(cr, x, y, metrics, str); 263 v3270_draw_text_at(cr, x, y, metrics, str);
267 264
@@ -293,33 +290,95 @@ static void draw_undera(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGB @@ -293,33 +290,95 @@ static void draw_undera(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGB
293 290
294 } 291 }
295 292
  293 +static void draw_boxed_char(cairo_t *cr, const GdkRectangle *rect, v3270FontInfo *metrics, const char *str) {
  294 +
  295 + cairo_status_t status;
  296 + cairo_glyph_t * glyphs = NULL;
  297 + int num_glyphs = 0;
  298 + cairo_text_cluster_t * clusters = NULL;
  299 + int num_clusters = 0;
  300 + cairo_text_cluster_flags_t cluster_flags;
  301 + double x = ((double) rect->x);
  302 + double y = (rect->y+metrics->height);
  303 +
  304 + status = cairo_scaled_font_text_to_glyphs(
  305 + metrics->scaled,
  306 + x+1,
  307 + y,
  308 + str, strlen(str),
  309 + &glyphs,
  310 + &num_glyphs,
  311 + &clusters,
  312 + &num_clusters,
  313 + &cluster_flags
  314 + );
  315 +
  316 + if (status == CAIRO_STATUS_SUCCESS) {
  317 + cairo_show_text_glyphs(
  318 + cr,
  319 + str,
  320 + strlen(str),
  321 + glyphs,
  322 + num_glyphs,
  323 + clusters,
  324 + num_clusters,
  325 + cluster_flags
  326 + );
  327 + }
  328 +
  329 + if(glyphs)
  330 + cairo_glyph_free(glyphs);
  331 +
  332 + if(clusters)
  333 + cairo_text_cluster_free(clusters);
  334 +
  335 + // https://www.cairographics.org/FAQ/#sharp_lines
  336 + cairo_set_line_width(cr, 1);
  337 + cairo_move_to(cr,rect->x + 0.5, rect->y + 0.5);
  338 + cairo_line_to(cr,rect->x + 0.5, rect->y + rect->height + 0.5);
  339 + cairo_line_to(cr,rect->x + rect->width + 0.5, rect->y + rect->height + 0.5);
  340 + cairo_line_to(cr,rect->x + rect->width + 0.5, rect->y + 0.5);
  341 + cairo_close_path(cr);
  342 +
  343 + cairo_stroke(cr);
  344 +
  345 +}
  346 +
296 void v3270_draw_connection(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGBA *color, const GdkRectangle *rect) 347 void v3270_draw_connection(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGBA *color, const GdkRectangle *rect)
297 { 348 {
298 - gchar str = ' ';  
299 -  
300 gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_BACKGROUND); 349 gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_BACKGROUND);
301 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); 350 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
302 cairo_fill(cr); 351 cairo_fill(cr);
  352 + cairo_stroke(cr);
303 353
304 gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_FOREGROUND); 354 gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_FOREGROUND);
305 - cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);  
306 - cairo_stroke(cr);  
307 355
308 - if(lib3270_get_oia_box_solid(host)) 356 + //cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
  357 +
  358 + if(lib3270_get_oia_box_solid(host))
309 { 359 {
310 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); 360 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
311 cairo_fill(cr); 361 cairo_fill(cr);
  362 + cairo_stroke(cr);
312 return; 363 return;
313 } 364 }
314 365
  366 + const gchar *str = " ";
315 if(lib3270_in_ansi(host)) 367 if(lib3270_in_ansi(host))
316 - str = 'N'; 368 + str = "N";
317 else if(lib3270_in_sscp(host)) 369 else if(lib3270_in_sscp(host))
318 - str = 'S'; 370 + str = "S";
319 else 371 else
320 - str = '?'; 372 + str = "?";
  373 +
  374 + draw_boxed_char(
  375 + cr,
  376 + rect,
  377 + metrics,
  378 + str
  379 + );
321 380
322 - draw_centered_char(cr,metrics,rect->x,rect->y,str); 381 +// draw_centered_char(cr,metrics,rect->x,rect->y,str[0]);
323 382
324 } 383 }
325 384
@@ -553,9 +612,6 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkRGBA *color, GdkRectangle * @@ -553,9 +612,6 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkRGBA *color, GdkRectangle *
553 612
554 } 613 }
555 614
556 -// v3270_draw_oia(cr, terminal->host, rect.y, cols, &terminal->font, terminal->color,terminal->oia_rect);  
557 -// void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect)  
558 -  
559 void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols) 615 void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols)
560 { 616 {
561 static const struct _right_fields 617 static const struct _right_fields
@@ -611,11 +667,29 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols) @@ -611,11 +667,29 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols)
611 667
612 gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_FOREGROUND); 668 gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_FOREGROUND);
613 669
  670 + {
  671 + GdkRectangle rect = {
  672 + .x = lCol,
  673 + .y = row,
  674 + .width = terminal->font.width+2,
  675 + .height = terminal->font.spacing.value
  676 + };
  677 +
  678 + draw_boxed_char(
  679 + cr,
  680 + &rect,
  681 + &terminal->font,
  682 + "4"
  683 + );
  684 + }
  685 +
  686 + /*
614 draw_centered_char(cr,&terminal->font,lCol,row,'4'); 687 draw_centered_char(cr,&terminal->font,lCol,row,'4');
615 688
616 cairo_stroke(cr); 689 cairo_stroke(cr);
617 cairo_rectangle(cr, lCol, row, terminal->font.width+2, terminal->font.spacing.value); 690 cairo_rectangle(cr, lCol, row, terminal->font.width+2, terminal->font.spacing.value);
618 cairo_stroke(cr); 691 cairo_stroke(cr);
  692 + */
619 693
620 lCol += (terminal->font.width+5); 694 lCol += (terminal->font.width+5);
621 695
@@ -629,10 +703,16 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols) @@ -629,10 +703,16 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols)
629 lCol += (3 + terminal->oia.rect[V3270_OIA_UNDERA].width); 703 lCol += (3 + terminal->oia.rect[V3270_OIA_UNDERA].width);
630 704
631 // Connection indicator 705 // Connection indicator
  706 + //terminal->oia.rect[V3270_OIA_CONNECTION].x = lCol;
  707 + //terminal->oia.rect[V3270_OIA_CONNECTION].y = row;
  708 + //terminal->oia.rect[V3270_OIA_CONNECTION].width = terminal->font.width;
  709 + //terminal->oia.rect[V3270_OIA_CONNECTION].height = terminal->font.spacing.value;
  710 +
632 terminal->oia.rect[V3270_OIA_CONNECTION].x = lCol; 711 terminal->oia.rect[V3270_OIA_CONNECTION].x = lCol;
633 terminal->oia.rect[V3270_OIA_CONNECTION].y = row; 712 terminal->oia.rect[V3270_OIA_CONNECTION].y = row;
634 - terminal->oia.rect[V3270_OIA_CONNECTION].width = terminal->font.width+3; 713 + terminal->oia.rect[V3270_OIA_CONNECTION].width = terminal->font.width+2;
635 terminal->oia.rect[V3270_OIA_CONNECTION].height = terminal->font.spacing.value; 714 terminal->oia.rect[V3270_OIA_CONNECTION].height = terminal->font.spacing.value;
  715 +
636 v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_CONNECTION); 716 v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_CONNECTION);
637 717
638 lCol += (4 + terminal->oia.rect[V3270_OIA_CONNECTION].width); 718 lCol += (4 + terminal->oia.rect[V3270_OIA_CONNECTION].width);
@@ -650,7 +730,6 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols) @@ -650,7 +730,6 @@ void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols)
650 } 730 }
651 731
652 cairo_save(cr); 732 cairo_save(cr);
653 -// v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_SSL);  
654 v3270_draw_ssl_status(terminal,cr,terminal->oia.rect+V3270_OIA_SSL); 733 v3270_draw_ssl_status(terminal,cr,terminal->oia.rect+V3270_OIA_SSL);
655 cairo_restore(cr); 734 cairo_restore(cr);
656 735
@@ -681,12 +760,7 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_ @@ -681,12 +760,7 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_
681 760
682 *r = rect; 761 *r = rect;
683 762
684 -#ifdef DEBUG  
685 - cairo_set_source_rgb(cr,0.1,0.1,0.1);  
686 -#else  
687 gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_BACKGROUND); 763 gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_BACKGROUND);
688 -#endif  
689 -  
690 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); 764 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
691 cairo_fill(cr); 765 cairo_fill(cr);
692 766
@@ -721,19 +795,18 @@ gboolean v3270_update_associated_lu(v3270 *terminal) @@ -721,19 +795,18 @@ gboolean v3270_update_associated_lu(v3270 *terminal)
721 795
722 void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) 796 void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id)
723 { 797 {
724 - cairo_t * cr;  
725 - GdkRectangle * rect;  
726 798
727 - if(!widget->surface)  
728 - return; 799 + if(widget->surface) {
729 800
730 - cr = v3270_oia_set_update_region(widget,&rect,V3270_OIA_MESSAGE); 801 + GdkRectangle * rect;
  802 + cairo_t * cr = v3270_oia_set_update_region(widget,&rect,V3270_OIA_MESSAGE);
731 803
732 - draw_status_message(cr,id,&widget->font,widget->color,rect); 804 + draw_status_message(cr,id,&widget->font,widget->color,rect);
  805 + cairo_destroy(cr);
733 806
734 - cairo_destroy(cr); 807 + v3270_queue_draw_area(GTK_WIDGET(widget),rect->x,rect->y,rect->width,rect->height);
735 808
736 - v3270_queue_draw_area(GTK_WIDGET(widget),rect->x,rect->y,rect->width,rect->height); 809 + }
737 810
738 if(widget->accessible) 811 if(widget->accessible)
739 v3270_acessible_set_state(widget->accessible,id); 812 v3270_acessible_set_state(widget->accessible,id);
src/terminal/security.c
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 #include <config.h> 30 #include <config.h>
31 31
32 #define ENABLE_NLS 32 #define ENABLE_NLS
33 - #define GETTEXT_PACKAGE PACKAGE_NAME  
34 33
35 #include <gtk/gtk.h> 34 #include <gtk/gtk.h>
36 #include <libintl.h> 35 #include <libintl.h>
src/tools/entry.c
@@ -101,7 +101,8 @@ @@ -101,7 +101,8 @@
101 NULL 101 NULL
102 ); 102 );
103 103
104 - { 104 + if(descr->pattern) {
  105 +
105 GtkFileFilter *filter; 106 GtkFileFilter *filter;
106 107
107 // Standard filter 108 // Standard filter
@@ -139,14 +140,6 @@ @@ -139,14 +140,6 @@
139 140
140 } 141 }
141 142
142 - static void release_ptr(GtkWidget G_GNUC_UNUSED(*object), gpointer ptr) {  
143 - g_free(ptr);  
144 - }  
145 -  
146 - LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr) {  
147 - g_signal_connect(widget,"destroy",G_CALLBACK(release_ptr),ptr);  
148 - }  
149 -  
150 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) { 143 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) {
151 144
152 gtk_entry_set_icon_from_icon_name( 145 gtk_entry_set_icon_from_icon_name(
@@ -156,7 +149,11 @@ @@ -156,7 +149,11 @@
156 ); 149 );
157 150
158 // Store data 151 // Store data
159 - gsize szEntry = sizeof(struct FileEntry) + strlen(title) + strlen(pattern) + strlen(name) + 4; 152 + gsize szEntry = sizeof(struct FileEntry) + strlen(title) + 4;
  153 +
  154 + if(pattern) {
  155 + szEntry += (strlen(pattern) + strlen(name));
  156 + }
160 struct FileEntry * entry = (struct FileEntry *) g_malloc0(szEntry); 157 struct FileEntry * entry = (struct FileEntry *) g_malloc0(szEntry);
161 gtk_widget_bind_ptr(widget,entry); 158 gtk_widget_bind_ptr(widget,entry);
162 159
@@ -179,11 +176,13 @@ @@ -179,11 +176,13 @@
179 entry->title = (const char *) (entry+1); 176 entry->title = (const char *) (entry+1);
180 strcpy((char *) entry->title,title); 177 strcpy((char *) entry->title,title);
181 178
182 - entry->pattern = entry->title + strlen(entry->title) +1;  
183 - strcpy((char *) entry->pattern,pattern); 179 + if(pattern) {
  180 + entry->pattern = entry->title + strlen(entry->title) +1;
  181 + strcpy((char *) entry->pattern,pattern);
184 182
185 - entry->name = entry->pattern + strlen(entry->pattern) + 1;  
186 - strcpy((char *) entry->name,name); 183 + entry->name = entry->pattern + strlen(entry->pattern) + 1;
  184 + strcpy((char *) entry->name,name);
  185 + }
187 186
188 g_signal_connect(widget,"icon_press",G_CALLBACK(icon_press),(gpointer) entry); 187 g_signal_connect(widget,"icon_press",G_CALLBACK(icon_press),(gpointer) entry);
189 188
src/tools/widget.c 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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 Useful extensions for GtkWidget.
  32 + *
  33 + */
  34 +
  35 + #include <v3270/tools.h>
  36 +
  37 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className) {
  38 + GtkStyleContext *context = gtk_widget_get_style_context(widget);
  39 + gtk_style_context_add_class(context,className);
  40 + }
  41 +
  42 + static void release_ptr(GtkWidget G_GNUC_UNUSED(*object), gpointer ptr) {
  43 + g_free(ptr);
  44 + }
  45 +
  46 + LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr) {
  47 + g_signal_connect(widget,"destroy",G_CALLBACK(release_ptr),ptr);
  48 + }
  49 +
src/trace/private.h
@@ -34,7 +34,6 @@ @@ -34,7 +34,6 @@
34 #include <gtk/gtk.h> 34 #include <gtk/gtk.h>
35 35
36 #define ENABLE_NLS 36 #define ENABLE_NLS
37 - #define GETTEXT_PACKAGE PACKAGE_NAME  
38 37
39 #include <libintl.h> 38 #include <libintl.h>
40 #include <glib/gi18n-lib.h> 39 #include <glib/gi18n-lib.h>
src/trace/tracewindow.c
@@ -36,10 +36,10 @@ @@ -36,10 +36,10 @@
36 * 36 *
37 */ 37 */
38 38
  39 + #include <config.h>
39 #include <gtk/gtk.h> 40 #include <gtk/gtk.h>
40 41
41 #define ENABLE_NLS 42 #define ENABLE_NLS
42 - #define GETTEXT_PACKAGE PACKAGE_NAME  
43 43
44 #include <libintl.h> 44 #include <libintl.h>
45 #include <glib/gi18n-lib.h> 45 #include <glib/gi18n-lib.h>
@@ -408,6 +408,9 @@ @@ -408,6 +408,9 @@
408 <Unit filename="src/tools/entry.c"> 408 <Unit filename="src/tools/entry.c">
409 <Option compilerVar="CC" /> 409 <Option compilerVar="CC" />
410 </Unit> 410 </Unit>
  411 + <Unit filename="src/tools/widget.c">
  412 + <Option compilerVar="CC" />
  413 + </Unit>
411 <Unit filename="src/trace/exec.c"> 414 <Unit filename="src/trace/exec.c">
412 <Option compilerVar="CC" /> 415 <Option compilerVar="CC" />
413 </Unit> 416 </Unit>