Commit 847739b824af9a9ab6f34fde533ab210aabe311c

Authored by Perry Werneck
1 parent 4ba3da61

Working on the UI.

@@ -55,3 +55,5 @@ certs @@ -55,3 +55,5 @@ certs
55 src/include/lib3270 55 src/include/lib3270
56 *.desktop 56 *.desktop
57 vgcore.* 57 vgcore.*
  58 +gschemas.compiled
  59 +*.gschema.xml
@@ -51,6 +51,9 @@ @@ -51,6 +51,9 @@
51 <Option compilerVar="CC" /> 51 <Option compilerVar="CC" />
52 </Unit> 52 </Unit>
53 <Unit filename="src/main/private.h" /> 53 <Unit filename="src/main/private.h" />
  54 + <Unit filename="src/main/tools.c">
  55 + <Option compilerVar="CC" />
  56 + </Unit>
54 <Unit filename="src/objects/actions/abstract.c"> 57 <Unit filename="src/objects/actions/abstract.c">
55 <Option compilerVar="CC" /> 58 <Option compilerVar="CC" />
56 </Unit> 59 </Unit>
schemas/application.gschema.xml.in
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- 2 <!--
3 3
  4 + Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  5 + (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  6 + aplicativos mainframe. Registro no INPI sob o nome G3270.
  7 +
  8 + Copyright (C) <2008> <Banco do Brasil S.A.>
  9 +
  10 + Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  11 + os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  12 + Free Software Foundation.
  13 +
  14 + Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  15 + GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  16 + A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  17 + obter mais detalhes.
  18 +
  19 + Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  20 + programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  21 + St, Fifth Floor, Boston, MA 02110-1301 USA
  22 +
  23 +
  24 + Contatos:
  25 +
  26 + perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  27 + erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
4 28
5 --> 29 -->
6 30
7 <schemalist> 31 <schemalist>
8 32
9 - <schema path="/br/com/bb/@PRODUCT_NAME@/application/" id="br.com.bb.@PRODUCT_NAME@"> 33 + <schema id="br.com.bb.@PACKAGE_NAME@">
10 34
11 <key name="ui-style" type="u"> 35 <key name="ui-style" type="u">
12 <default>1</default> 36 <default>1</default>
@@ -14,6 +38,12 @@ @@ -14,6 +38,12 @@
14 <description>The ID of the current user interface style</description> 38 <description>The ID of the current user interface style</description>
15 </key> 39 </key>
16 40
  41 + <key name="has-subtitle" type="b">
  42 + <default>true</default>
  43 + <summary>Enable top window subtitle</summary>
  44 + <description>If TRUE, reserve space for a subtitle, even if none is currently set.</description>
  45 + </key>
  46 +
17 </schema> 47 </schema>
18 48
19 </schemalist> 49 </schemalist>
src/include/pw3270.h
@@ -49,4 +49,6 @@ @@ -49,4 +49,6 @@
49 /* not really I18N-related, but also a string marker macro */ 49 /* not really I18N-related, but also a string marker macro */
50 #define I_(string) g_intern_static_string (string) 50 #define I_(string) g_intern_static_string (string)
51 51
  52 + G_GNUC_INTERNAL GSettings * pw3270_get_settings(void);
  53 +
52 #endif // PW3270_H_INCLUDED 54 #endif // PW3270_H_INCLUDED
src/main/main.c
@@ -45,39 +45,8 @@ int main (int argc, char **argv) { @@ -45,39 +45,8 @@ int main (int argc, char **argv) {
45 GtkApplication *app; 45 GtkApplication *app;
46 int status; 46 int status;
47 47
48 -/*  
49 -#ifdef DEBUG  
50 - {  
51 - GError * error = NULL;  
52 - GSettingsSchemaSource * source =  
53 - g_settings_schema_source_new_from_directory(  
54 - ".",  
55 - NULL,  
56 - TRUE,  
57 - &error  
58 - );  
59 -  
60 - g_assert_no_error(error);  
61 -  
62 - GSettingsSchema * schema =  
63 - g_settings_schema_source_lookup(  
64 - source,  
65 - "br.com.bb.pw3270",  
66 - TRUE);  
67 -  
68 - g_settings_schema_source_unref(source);  
69 -  
70 - GSettings * settings = g_settings_new_full(schema, NULL, "/br/com/bb/pw3270/application/");  
71 -  
72 - debug("ui-style=%u",g_settings_get_uint(settings,"ui-style"));  
73 -  
74 - g_object_unref(settings);  
75 - }  
76 -#endif // DEBUG  
77 -*/  
78 -  
79 -// app = pw3270_application_new("br.com.bb." G_STRINGIFY(PRODUCT_NAME),G_APPLICATION_HANDLES_OPEN);  
80 - app = pw3270_application_new("br.com.bb.pw3270",G_APPLICATION_HANDLES_OPEN); 48 + g_set_application_name(G_STRINGIFY(PRODUCT_NAME));
  49 + app = pw3270_application_new("br.com.bb." G_STRINGIFY(PRODUCT_NAME),G_APPLICATION_HANDLES_OPEN);
81 50
82 status = g_application_run(G_APPLICATION (app), argc, argv); 51 status = g_application_run(G_APPLICATION (app), argc, argv);
83 g_object_unref (app); 52 g_object_unref (app);
src/main/private.h
@@ -33,4 +33,8 @@ @@ -33,4 +33,8 @@
33 33
34 #include <pw3270.h> 34 #include <pw3270.h>
35 35
  36 + #include <lib3270.h>
  37 + #include <lib3270/log.h>
  38 +
  39 +
36 #endif // PRIVATE_H_INCLUDED 40 #endif // PRIVATE_H_INCLUDED
src/main/tools.c 0 → 100644
@@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
  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. Registro no INPI sob
  5 + * o nome G3270.
  6 + *
  7 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  8 + *
  9 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  10 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  11 + * Free Software Foundation.
  12 + *
  13 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  14 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  15 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  16 + * obter mais detalhes.
  17 + *
  18 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  19 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  20 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  21 + *
  22 + * Este programa está nomeado como main.c e possui - linhas de código.
  23 + *
  24 + * Contatos:
  25 + *
  26 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  27 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  28 + *
  29 + */
  30 +
  31 + /**
  32 + * @brief Misc tools for pw3270 application.
  33 + *
  34 + */
  35 +
  36 + #include "private.h"
  37 +
  38 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  39 +
  40 + GSettings * pw3270_get_settings() {
  41 +
  42 +#ifdef DEBUG
  43 + GError * error = NULL;
  44 + GSettingsSchemaSource * source =
  45 + g_settings_schema_source_new_from_directory(
  46 + ".",
  47 + NULL,
  48 + TRUE,
  49 + &error
  50 + );
  51 +
  52 + g_assert_no_error(error);
  53 +
  54 + GSettingsSchema * schema =
  55 + g_settings_schema_source_lookup(
  56 + source,
  57 + "br.com.bb." PACKAGE_NAME,
  58 + TRUE);
  59 +
  60 + g_settings_schema_source_unref(source);
  61 +
  62 + g_autofree gchar * path = g_strconcat("/apps/" PACKAGE_NAME "/", g_get_application_name(),"/",NULL);
  63 +
  64 + debug("path=%s",path);
  65 + return g_settings_new_full(schema, NULL, path);
  66 +
  67 +#else
  68 +
  69 + #error TODO!
  70 +
  71 +#endif // DEBUG
  72 +
  73 + }
src/objects/actions/abstract.c
@@ -89,6 +89,8 @@ @@ -89,6 +89,8 @@
89 89
90 GObjectClass *object_class = G_OBJECT_CLASS(klass); 90 GObjectClass *object_class = G_OBJECT_CLASS(klass);
91 91
  92 + debug("%s",__FUNCTION__);
  93 +
92 klass->change_widget = change_widget; 94 klass->change_widget = change_widget;
93 klass->get_enabled = get_enabled; 95 klass->get_enabled = get_enabled;
94 klass->activate = activate; 96 klass->activate = activate;
@@ -154,8 +156,8 @@ @@ -154,8 +156,8 @@
154 // Install signals 156 // Install signals
155 action_signals[SIGNAL_CHANGE_STATE] = 157 action_signals[SIGNAL_CHANGE_STATE] =
156 g_signal_new( 158 g_signal_new(
157 - I_("change-state"),  
158 - G_TYPE_SIMPLE_ACTION, 159 + I_("change_state"),
  160 + G_TYPE_ACTION,
159 G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT, 161 G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
160 0, NULL, NULL, 162 0, NULL, NULL,
161 NULL, 163 NULL,
@@ -202,8 +204,7 @@ @@ -202,8 +204,7 @@
202 204
203 } 205 }
204 206
205 -  
206 - void pw3270_action_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { 207 + void pw3270_action_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) {
207 208
208 GAction *action = G_ACTION(object); 209 GAction *action = G_ACTION(object);
209 210
@@ -236,7 +237,7 @@ @@ -236,7 +237,7 @@
236 237
237 } 238 }
238 239
239 - void pw3270_action_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { 240 + void pw3270_action_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) {
240 241
241 // debug("%s(%d)",__FUNCTION__,prop_id); 242 // debug("%s(%d)",__FUNCTION__,prop_id);
242 243
@@ -306,8 +307,7 @@ @@ -306,8 +307,7 @@
306 307
307 } 308 }
308 309
309 - GVariant * pw3270_action_get_state_hint(GAction *action) {  
310 - debug("%s",__FUNCTION__); 310 + GVariant * pw3270_action_get_state_hint(GAction G_GNUC_UNUSED(*action)) {
311 return NULL; 311 return NULL;
312 } 312 }
313 313
@@ -351,7 +351,7 @@ @@ -351,7 +351,7 @@
351 351
352 } 352 }
353 353
354 - void pw3270_action_set_enabled(GAction *object, gboolean state) { 354 + void pw3270_action_set_enabled(GAction *object, gboolean G_GNUC_UNUSED(state)) {
355 g_object_notify_by_pspec(G_OBJECT(object), PW3270_ACTION_GET_CLASS(object)->properties.enabled); 355 g_object_notify_by_pspec(G_OBJECT(object), PW3270_ACTION_GET_CLASS(object)->properties.enabled);
356 } 356 }
357 357
@@ -401,8 +401,8 @@ @@ -401,8 +401,8 @@
401 401
402 } 402 }
403 403
404 - gboolean get_enabled(GAction *object, GtkWidget *terminal) {  
405 - debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(object)); 404 + gboolean get_enabled(GAction G_GNUC_UNUSED(*object), GtkWidget G_GNUC_UNUSED(*terminal)) {
  405 +// debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(object));
406 return TRUE; 406 return TRUE;
407 } 407 }
408 408
src/objects/actions/lib3270/pakey.c
@@ -55,9 +55,9 @@ @@ -55,9 +55,9 @@
55 55
56 G_DEFINE_TYPE(Lib3270PaAction, Lib3270PaAction, PW3270_TYPE_ACTION); 56 G_DEFINE_TYPE(Lib3270PaAction, Lib3270PaAction, PW3270_TYPE_ACTION);
57 57
58 - static gboolean get_enabled(GAction *action, GtkWidget *terminal) { 58 + static gboolean get_enabled(GAction G_GNUC_UNUSED(*action), GtkWidget *terminal) {
59 59
60 - debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action)); 60 +// debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action));
61 61
62 if(terminal) 62 if(terminal)
63 return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE; 63 return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE;
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 94
95 } 95 }
96 96
97 - static const GVariantType * get_parameter_type(GAction *action) 97 + static const GVariantType * get_parameter_type(GAction G_GNUC_UNUSED(*action))
98 { 98 {
99 return G_VARIANT_TYPE_UINT16; 99 return G_VARIANT_TYPE_UINT16;
100 } 100 }
@@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
110 110
111 } 111 }
112 112
113 - void Lib3270PaAction_init(Lib3270PaAction *action) { 113 + void Lib3270PaAction_init(Lib3270PaAction G_GNUC_UNUSED(*action)) {
114 } 114 }
115 115
116 GAction * pw3270_action_new_pakey(void) { 116 GAction * pw3270_action_new_pakey(void) {
src/objects/actions/lib3270/pfkey.c
@@ -55,9 +55,9 @@ @@ -55,9 +55,9 @@
55 55
56 G_DEFINE_TYPE(Lib3270PfAction, Lib3270PfAction, PW3270_TYPE_ACTION); 56 G_DEFINE_TYPE(Lib3270PfAction, Lib3270PfAction, PW3270_TYPE_ACTION);
57 57
58 - static gboolean get_enabled(GAction *action, GtkWidget *terminal) { 58 + static gboolean get_enabled(GAction G_GNUC_UNUSED(*action), GtkWidget *terminal) {
59 59
60 - debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action)); 60 +// debug("%s(%s)",__FUNCTION__,pw3270_action_get_name(action));
61 61
62 if(terminal) 62 if(terminal)
63 return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE; 63 return lib3270_is_connected(v3270_get_session(terminal)) > 0 ? TRUE: FALSE;
@@ -94,8 +94,7 @@ @@ -94,8 +94,7 @@
94 94
95 } 95 }
96 96
97 - static const GVariantType * get_parameter_type(GAction *action)  
98 - { 97 + static const GVariantType * get_parameter_type(GAction G_GNUC_UNUSED(*action)) {
99 return G_VARIANT_TYPE_UINT16; 98 return G_VARIANT_TYPE_UINT16;
100 } 99 }
101 100
@@ -110,7 +109,7 @@ @@ -110,7 +109,7 @@
110 109
111 } 110 }
112 111
113 - void Lib3270PfAction_init(Lib3270PfAction *action) { 112 + void Lib3270PfAction_init(Lib3270PfAction G_GNUC_UNUSED(*action)) {
114 } 113 }
115 114
116 GAction * pw3270_action_new_pfkey(void) { 115 GAction * pw3270_action_new_pfkey(void) {
src/objects/actions/memcheck.sh 0 → 100755
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +#!/bin/bash
  2 +valgrind \
  3 + --leak-check=full \
  4 + --track-origins=yes \
  5 + --gen-suppressions=all \
  6 + --suppressions=valgrind.suppression \
  7 + .bin/Debug/PW3270\ Actions
  8 +
src/objects/actions/valgrind.suppression 0 → 100644
@@ -0,0 +1,162 @@ @@ -0,0 +1,162 @@
  1 +{
  2 + libcrypto_BIO_read
  3 + Memcheck:Cond
  4 + ...
  5 + fun:BIO_read
  6 +}
  7 +
  8 +{
  9 + libcrypt_FIPS_selftest
  10 + Memcheck:Cond
  11 + ...
  12 + fun:FIPS_selftest
  13 +}
  14 +
  15 +{
  16 + libcrypt_FIPS_mode_set
  17 + Memcheck:Cond
  18 + ...
  19 + fun:FIPS_mode_set
  20 +}
  21 +
  22 +{
  23 + libcrypt_BIO_new_mem_buf
  24 + Memcheck:Cond
  25 + ...
  26 + fun:BIO_new_mem_buf
  27 +}
  28 +
  29 +
  30 +{
  31 + g_type_register_fundamental
  32 + Memcheck:Leak
  33 + ...
  34 + fun:g_type_register_fundamental
  35 +}
  36 +
  37 +{
  38 + glib_dl_init
  39 + Memcheck:Leak
  40 + ...
  41 + fun:_dl_init
  42 +}
  43 +
  44 +{
  45 + pango_itemize_with_base_dir
  46 + Memcheck:Leak
  47 + ...
  48 + fun:pango_itemize_with_base_dir
  49 +}
  50 +
  51 +{
  52 + fontconfig_FcDefaultSubstitute
  53 + Memcheck:Leak
  54 + ...
  55 + fun:FcDefaultSubstitute
  56 +}
  57 +
  58 +{
  59 + fontconfig_FcConfigParseAndLoad
  60 + Memcheck:Leak
  61 + ...
  62 + fun:FcConfigParseAndLoad
  63 +}
  64 +
  65 +{
  66 + fontconfig_FcFontMatch
  67 + Memcheck:Leak
  68 + ...
  69 + fun:FcFontMatch
  70 +}
  71 +
  72 +{
  73 + g_type_register_static
  74 + Memcheck:Leak
  75 + ...
  76 + fun:g_type_register_static
  77 +}
  78 +
  79 +{
  80 + g_thread_pool_push
  81 + Memcheck:Leak
  82 + ...
  83 + fun:g_task_run_in_thread
  84 +}
  85 +
  86 +{
  87 + g_bus_get_sync
  88 + Memcheck:Leak
  89 + ...
  90 + fun:g_bus_get_sync
  91 +}
  92 +
  93 +{
  94 + g_type_add_interface_static
  95 + Memcheck:Leak
  96 + ...
  97 + fun:g_type_add_interface_static
  98 +}
  99 +
  100 +{
  101 + g_type_create_instance
  102 + Memcheck:Leak
  103 + ...
  104 + fun:g_type_create_instance
  105 +}
  106 +
  107 +{
  108 + fontconfig_FcPatternDuplicate
  109 + Memcheck:Leak
  110 + ...
  111 + fun:FcPatternDuplicate
  112 +}
  113 +
  114 +{
  115 + gtk_style_context_set_state
  116 + Memcheck:Leak
  117 + ...
  118 + fun:gtk_style_context_set_state
  119 +}
  120 +
  121 +{
  122 + g_param_spec_flags
  123 + Memcheck:Leak
  124 + ...
  125 + fun:g_param_spec_flags
  126 +}
  127 +
  128 +{
  129 + gtk_style_new
  130 + Memcheck:Leak
  131 + ...
  132 + fun:gtk_style_new
  133 +}
  134 +
  135 +{
  136 + libcrypto_BIO_read
  137 + Memcheck:Cond
  138 + fun:BIO_read
  139 +}
  140 +
  141 +{
  142 + cairo_mask
  143 + Memcheck:Cond
  144 + ...
  145 + fun:cairo_mask
  146 +}
  147 +
  148 +{
  149 + gtk_css_dimension_value_new
  150 + Memcheck:Leak
  151 + ...
  152 + fun:gtk_css_dimension_value_new
  153 +}
  154 +
  155 +{
  156 + gtk_style_constructed
  157 + Memcheck:Leak
  158 + ...
  159 + fun:gtk_style_constructed
  160 +}
  161 +
  162 +
src/objects/window/application.c
@@ -127,45 +127,10 @@ @@ -127,45 +127,10 @@
127 #endif // _WIN32 127 #endif // _WIN32
128 128
129 // Bind properties 129 // Bind properties
130 - GSettings * settings = NULL;  
131 -  
132 -#ifdef DEBUG  
133 - {  
134 - GError * error = NULL;  
135 - GSettingsSchemaSource * source =  
136 - g_settings_schema_source_new_from_directory(  
137 - ".",  
138 - NULL,  
139 - TRUE,  
140 - &error  
141 - );  
142 -  
143 - g_assert_no_error(error);  
144 -  
145 - GSettingsSchema * schema =  
146 - g_settings_schema_source_lookup(  
147 - source,  
148 - "br.com.bb." G_STRINGIFY(PRODUCT_NAME),  
149 - TRUE);  
150 -  
151 - g_settings_schema_source_unref(source);  
152 -  
153 - settings = g_settings_new_full(schema, NULL, "/br/com/bb/" G_STRINGIFY(PRODUCT_NAME) "/application/");  
154 -  
155 - }  
156 -#else  
157 -  
158 - #error TODO!  
159 -  
160 -#endif // DEBUG 130 + g_autoptr(GSettings) settings = pw3270_get_settings();
161 131
162 if(settings) { 132 if(settings) {
163 -  
164 g_settings_bind(settings, "ui-style", app, "ui-style", G_SETTINGS_BIND_DEFAULT); 133 g_settings_bind(settings, "ui-style", app, "ui-style", G_SETTINGS_BIND_DEFAULT);
165 -  
166 -  
167 - g_object_unref(settings);  
168 -  
169 } 134 }
170 135
171 } 136 }
src/objects/window/terminal.c
@@ -50,7 +50,11 @@ @@ -50,7 +50,11 @@
50 50
51 } 51 }
52 52
53 - static gboolean on_terminal_focus(GtkWidget *terminal, GdkEvent *event, GtkWindow * window) { 53 + static gboolean on_terminal_focus(GtkWidget *terminal, GdkEvent G_GNUC_UNUSED(*event), GtkWindow * window) {
  54 +
  55 + if(gtk_window_get_default_widget(window) == terminal) {
  56 + return FALSE;
  57 + }
54 58
55 // Store the active terminal widget. 59 // Store the active terminal widget.
56 gtk_widget_grab_default(terminal); 60 gtk_widget_grab_default(terminal);
@@ -62,6 +66,22 @@ @@ -62,6 +66,22 @@
62 66
63 pw3270_window_set_subtitle(GTK_WIDGET(window), v3270_is_connected(terminal) ? _("Connected to host") : _("Disconnected from host")); 67 pw3270_window_set_subtitle(GTK_WIDGET(window), v3270_is_connected(terminal) ? _("Connected to host") : _("Disconnected from host"));
64 68
  69 + // Update actions
  70 + size_t ix;
  71 + gchar ** actions = g_action_group_list_actions(G_ACTION_GROUP(window));
  72 +
  73 + for(ix = 0; actions[ix]; ix++) {
  74 +
  75 + GAction * action = g_action_map_lookup_action(G_ACTION_MAP(window), actions[ix]);
  76 +
  77 + if(action && PW3270_IS_ACTION(action)) {
  78 + pw3270_action_set_terminal_widget(action,terminal);
  79 + }
  80 +
  81 + }
  82 +
  83 + g_strfreev(actions);
  84 +
65 return FALSE; 85 return FALSE;
66 } 86 }
67 87
@@ -92,7 +112,7 @@ @@ -92,7 +112,7 @@
92 112
93 } 113 }
94 114
95 - static void on_close_tab(GtkButton *button, GtkWidget *terminal) { 115 + static void on_close_tab(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) {
96 116
97 GtkNotebook * notebook = GTK_NOTEBOOK(gtk_widget_get_parent(terminal)); 117 GtkNotebook * notebook = GTK_NOTEBOOK(gtk_widget_get_parent(terminal));
98 gtk_notebook_remove_page(notebook,gtk_notebook_page_num(notebook, terminal)); 118 gtk_notebook_remove_page(notebook,gtk_notebook_page_num(notebook, terminal));
src/objects/window/window.c
@@ -28,16 +28,18 @@ @@ -28,16 +28,18 @@
28 */ 28 */
29 29
30 #include "private.h" 30 #include "private.h"
  31 + #include <pw3270.h>
31 #include <pw3270/toolbar.h> 32 #include <pw3270/toolbar.h>
32 #include <pw3270/application.h> 33 #include <pw3270/application.h>
  34 + #include <pw3270/actions.h>
33 35
34 G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); 36 G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW);
35 37
36 - static void pw3270ApplicationWindow_class_init(pw3270ApplicationWindowClass *klass) { 38 + static void pw3270ApplicationWindow_class_init(pw3270ApplicationWindowClass G_GNUC_UNUSED(*klass)) {
37 39
38 } 40 }
39 41
40 - void on_page_changed(GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data) { 42 + void on_page_changed(GtkNotebook *notebook, GtkWidget G_GNUC_UNUSED(*child), guint G_GNUC_UNUSED(page_num), gpointer G_GNUC_UNUSED(user_data)) {
41 gtk_notebook_set_show_tabs(notebook,gtk_notebook_get_n_pages(notebook) > 1); 43 gtk_notebook_set_show_tabs(notebook,gtk_notebook_get_n_pages(notebook) > 1);
42 } 44 }
43 45
@@ -63,6 +65,11 @@ @@ -63,6 +65,11 @@
63 gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); 65 gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox));
64 66
65 // 67 //
  68 + // Setup tn3270 actions.
  69 + //
  70 + pw3270_window_add_actions(GTK_WIDGET(widget));
  71 +
  72 + //
66 // Setup Window actions. 73 // Setup Window actions.
67 // 74 //
68 static GActionEntry actions[] = { 75 static GActionEntry actions[] = {
@@ -97,6 +104,8 @@ @@ -97,6 +104,8 @@
97 104
98 const gchar * title = _( "IBM 3270 Terminal emulator" ); 105 const gchar * title = _( "IBM 3270 Terminal emulator" );
99 106
  107 + g_autoptr(GSettings) settings = pw3270_get_settings();
  108 +
100 g_return_val_if_fail(GTK_IS_APPLICATION(application), NULL); 109 g_return_val_if_fail(GTK_IS_APPLICATION(application), NULL);
101 pw3270ApplicationWindow * window = 110 pw3270ApplicationWindow * window =
102 g_object_new( 111 g_object_new(
@@ -124,8 +133,10 @@ @@ -124,8 +133,10 @@
124 gtk_header_bar_set_show_close_button(header,TRUE); 133 gtk_header_bar_set_show_close_button(header,TRUE);
125 134
126 gtk_header_bar_set_title(header,title); 135 gtk_header_bar_set_title(header,title);
127 - // gtk_header_bar_set_subtitle(header,_("Disconnected from host"));  
128 - gtk_header_bar_set_has_subtitle(header,TRUE); 136 + if(settings)
  137 + g_settings_bind(settings, "has-subtitle", header, "has-subtitle", G_SETTINGS_BIND_DEFAULT);
  138 + else
  139 + gtk_header_bar_set_has_subtitle(header,TRUE);
129 140
130 // Create gear button 141 // Create gear button
131 // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons 142 // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons
ui/application.xml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
  2 +<!--
  3 +
  4 + Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  5 + (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  6 + aplicativos mainframe. Registro no INPI sob o nome G3270.
  7 +
  8 + Copyright (C) <2008> <Banco do Brasil S.A.>
  9 +
  10 + Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  11 + os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  12 + Free Software Foundation.
  13 +
  14 + Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  15 + GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  16 + A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  17 + obter mais detalhes.
  18 +
  19 + Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  20 + programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  21 + St, Fifth Floor, Boston, MA 02110-1301 USA
  22 +
  23 +
  24 + Contatos:
  25 +
  26 + perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  27 + erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  28 +
  29 +-->
2 <interface> 30 <interface>
3 <requires lib="gtk+" version="3.0"/> 31 <requires lib="gtk+" version="3.0"/>
4 <menu id="app-menu"> 32 <menu id="app-menu">
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
  2 +<!--
  3 +
  4 + Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  5 + (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  6 + aplicativos mainframe. Registro no INPI sob o nome G3270.
  7 +
  8 + Copyright (C) <2008> <Banco do Brasil S.A.>
  9 +
  10 + Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  11 + os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  12 + Free Software Foundation.
  13 +
  14 + Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  15 + GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  16 + A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  17 + obter mais detalhes.
  18 +
  19 + Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  20 + programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  21 + St, Fifth Floor, Boston, MA 02110-1301 USA
  22 +
  23 +
  24 + Contatos:
  25 +
  26 + perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  27 + erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  28 +
  29 +-->
2 <interface> 30 <interface>
3 <requires lib="gtk+" version="3.0"/> 31 <requires lib="gtk+" version="3.0"/>
4 <menu id="gear-menu"> 32 <menu id="gear-menu">