Commit cb68047cd0126034f8f40ed7af806e48ef65dc89

Authored by Perry Werneck
1 parent e266a9bc

Adding session properties dialog.

pw3270.cbp
... ... @@ -129,16 +129,16 @@
129 129 <Unit filename="src/objects/window/actions/filetransfer.c">
130 130 <Option compilerVar="CC" />
131 131 </Unit>
132   - <Unit filename="src/objects/window/actions/open.c">
  132 + <Unit filename="src/objects/window/actions/hostproperties.c">
133 133 <Option compilerVar="CC" />
134 134 </Unit>
135   - <Unit filename="src/objects/window/actions/preferences.c">
  135 + <Unit filename="src/objects/window/actions/open.c">
136 136 <Option compilerVar="CC" />
137 137 </Unit>
138   - <Unit filename="src/objects/window/actions/setcolors.c">
  138 + <Unit filename="src/objects/window/actions/sessionproperties.c">
139 139 <Option compilerVar="CC" />
140 140 </Unit>
141   - <Unit filename="src/objects/window/actions/sethost.c">
  141 + <Unit filename="src/objects/window/actions/setcolors.c">
142 142 <Option compilerVar="CC" />
143 143 </Unit>
144 144 <Unit filename="src/objects/window/private.h" />
... ...
src/objects/window/actions/hostproperties.c 0 → 100644
... ... @@ -0,0 +1,71 @@
  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 + #include "../private.h"
  31 + #include <pw3270/window.h>
  32 + #include <pw3270/actions.h>
  33 + #include <v3270/settings.h>
  34 + #include <v3270/dialogs.h>
  35 +
  36 + static GtkWidget * factory(GtkWidget *terminal);
  37 +
  38 + GAction * pw3270_action_host_properties_new(void) {
  39 +
  40 + pw3270SimpleAction * action = pw3270_dialog_action_new(factory);
  41 +
  42 + action->parent.name = "host.properties";
  43 + action->group.id = LIB3270_ACTION_GROUP_OFFLINE;
  44 + action->icon_name = "network-server";
  45 + action->label = N_("Host properties");
  46 +
  47 + return G_ACTION(action);
  48 + }
  49 +
  50 + GtkWidget * factory(GtkWidget *terminal) {
  51 +
  52 + GtkWidget * dialog = v3270_settings_dialog_new();
  53 + V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_select_new());
  54 +
  55 + if(settings->title)
  56 + gtk_window_set_title(GTK_WINDOW(dialog), settings->title);
  57 +
  58 + gtk_container_add(GTK_CONTAINER(dialog), GTK_WIDGET(settings));
  59 +
  60 + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  61 + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
  62 +
  63 + v3270_settings_dialog_set_terminal_widget(dialog, terminal);
  64 +
  65 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  66 + g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),settings);
  67 +
  68 + return dialog;
  69 +
  70 + }
  71 +
... ...
src/objects/window/actions/preferences.c
... ... @@ -1,56 +0,0 @@
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   - #include "../private.h"
31   - #include <pw3270/window.h>
32   - #include <pw3270/actions.h>
33   - #include <v3270/settings.h>
34   -
35   - static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal);
36   -
37   - GAction * pw3270_session_preferences_action_new(void) {
38   -
39   - pw3270SimpleAction * action = pw3270_simple_action_new();
40   -
41   - action->parent.activate = activate;
42   - action->parent.name = "preferences";
43   - action->icon_name = "preferences-other";
44   - action->label = N_("Session properties");
45   -
46   - return G_ACTION(action);
47   -
48   -
49   - }
50   -
51   - void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
52   -
53   - debug("%s","Activating session properties dialog");
54   -
55   - }
56   -
src/objects/window/actions/sessionproperties.c 0 → 100644
... ... @@ -0,0 +1,74 @@
  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 + #include "../private.h"
  31 + #include <pw3270/window.h>
  32 + #include <pw3270/actions.h>
  33 + #include <v3270/settings.h>
  34 + #include <v3270/dialogs.h>
  35 + #include <v3270/colorscheme.h>
  36 +
  37 + static GtkWidget * factory(GtkWidget *terminal);
  38 +
  39 + GAction * pw3270_action_session_properties_new(void) {
  40 +
  41 + pw3270SimpleAction * action = pw3270_dialog_action_new(factory);
  42 +
  43 + action->parent.name = "session.properties";
  44 + action->icon_name = "preferences-other";
  45 + action->label = N_("Session properties");
  46 +
  47 + return G_ACTION(action);
  48 +
  49 +
  50 + }
  51 +
  52 + GtkWidget * factory(GtkWidget *terminal) {
  53 +
  54 + GtkWidget * dialog = v3270_settings_dialog_new();
  55 +
  56 + gtk_window_set_title(GTK_WINDOW(dialog), _("Session properties"));
  57 +
  58 + // Add settings pages.
  59 + gtk_container_add(GTK_CONTAINER(dialog), v3270_host_select_new());
  60 + gtk_container_add(GTK_CONTAINER(dialog), v3270_color_selection_new());
  61 + gtk_container_add(GTK_CONTAINER(dialog), v3270_font_chooser_widget_new());
  62 +
  63 + // Setup dialog box
  64 + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  65 + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
  66 +
  67 + v3270_settings_dialog_set_terminal_widget(dialog, terminal);
  68 +
  69 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  70 + g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),terminal);
  71 +
  72 + return dialog;
  73 +
  74 + }
... ...
src/objects/window/actions/sethost.c
... ... @@ -1,92 +0,0 @@
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   - #include "../private.h"
31   - #include <pw3270/window.h>
32   - #include <pw3270/actions.h>
33   - #include <v3270/settings.h>
34   - #include <v3270/dialogs.h>
35   -
36   - static GtkWidget * factory(GtkWidget *terminal);
37   -
38   - GAction * pw3270_set_host_action_new(void) {
39   -
40   - pw3270SimpleAction * action = pw3270_dialog_action_new(factory);
41   -
42   - action->parent.name = "set.host";
43   - action->group.id = LIB3270_ACTION_GROUP_OFFLINE;
44   - action->icon_name = "network-server";
45   - action->label = N_("Host definition");
46   -
47   - return G_ACTION(action);
48   - }
49   -
50   - /*
51   - static void on_response(GtkWidget *dialog, gint response_id, GtkWidget *settings) {
52   -
53   - if(response_id == GTK_RESPONSE_APPLY) {
54   -
55   - GtkWidget * terminal = v3270_settings_get_terminal_widget(settings);
56   -
57   - v3270_settings_dialog_apply(dialog);
58   - if(terminal)
59   - lib3270_reconnect(v3270_get_session(terminal),0);
60   -
61   - } else {
62   -
63   - v3270_settings_dialog_revert(dialog);
64   - }
65   -
66   - gtk_widget_destroy(GTK_WIDGET(dialog));
67   -
68   - }
69   - */
70   -
71   - GtkWidget * factory(GtkWidget *terminal) {
72   -
73   - GtkWidget * dialog = v3270_settings_dialog_new();
74   - V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_select_new());
75   -
76   - if(settings->title)
77   - gtk_window_set_title(GTK_WINDOW(dialog), settings->title);
78   -
79   - gtk_container_add(GTK_CONTAINER(dialog), GTK_WIDGET(settings));
80   -
81   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
82   - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
83   -
84   - v3270_settings_dialog_set_terminal_widget(dialog, terminal);
85   -
86   - g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
87   - g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),settings);
88   -
89   - return dialog;
90   -
91   - }
92   -
src/objects/window/private.h
... ... @@ -77,11 +77,12 @@
77 77 G_GNUC_INTERNAL GtkWidget * pw3270_setup_image_button(GtkWidget *button, const gchar *image_name);
78 78  
79 79 // Actions
80   - GAction * pw3270_set_host_action_new(void);
  80 + GAction * pw3270_action_host_properties_new(void);
81 81 GAction * pw3270_set_color_action_new(void);
82   - GAction * pw3270_session_preferences_action_new(void);
83 82 GAction * pw3270_file_transfer_action_new(void);
84 83  
  84 + GAction * pw3270_action_session_properties_new(void);
  85 +
85 86 // Terminal actions.
86 87 GAction * pw3270_model_number_action_new(GtkWidget *terminal);
87 88  
... ...
src/objects/window/window.c
... ... @@ -111,9 +111,9 @@
111 111 size_t ix;
112 112  
113 113 GAction * actions[] = {
114   - pw3270_set_host_action_new(),
  114 + pw3270_action_host_properties_new(),
115 115 pw3270_set_color_action_new(),
116   - pw3270_session_preferences_action_new(),
  116 + pw3270_action_session_properties_new(),
117 117 pw3270_file_transfer_action_new()
118 118 };
119 119  
... ... @@ -162,7 +162,7 @@
162 162 "win.disconnect",
163 163 "separator",
164 164 "win.set.colors",
165   - "win.preferences",
  165 + "win.session.properties",
166 166 "win.file.transfer",
167 167 "win.print",
168 168 "app.quit"
... ...
ui/window.xml
... ... @@ -44,6 +44,11 @@
44 44 </section>
45 45  
46 46 <item>
  47 + <attribute name="label" translatable="yes">Session properties</attribute>
  48 + <attribute name="action">win.session.properties</attribute>
  49 + </item>
  50 +
  51 + <item>
47 52 <attribute name="label" translatable="yes">Preferences</attribute>
48 53 <attribute name="action">win.preferences</attribute>
49 54 </item>
... ... @@ -296,8 +301,8 @@
296 301 </item>
297 302  
298 303 <item>
299   - <attribute name="label" translatable="yes">Host properties</attribute>
300   - <attribute name="action">win.set.host</attribute>
  304 + <attribute name="label" translatable="yes">Session properties</attribute>
  305 + <attribute name="action">win.session.properties</attribute>
301 306 </item>
302 307  
303 308 <submenu>
... ...