Commit e60b57c4e4963d72ff0cf45c97365b7d04e6026f

Authored by Perry Werneck
1 parent d1bc4ea4

Working on "classic" ui.

pw3270.cbp
... ... @@ -111,6 +111,9 @@
111 111 <Unit filename="src/objects/window/actions/preferences.c">
112 112 <Option compilerVar="CC" />
113 113 </Unit>
  114 + <Unit filename="src/objects/window/actions/setcolors.c">
  115 + <Option compilerVar="CC" />
  116 + </Unit>
114 117 <Unit filename="src/objects/window/actions/sethost.c">
115 118 <Option compilerVar="CC" />
116 119 </Unit>
... ...
src/include/pw3270/actions.h
... ... @@ -83,6 +83,9 @@
83 83  
84 84 GType pw3270Action_get_type(void) G_GNUC_CONST;
85 85  
  86 + /// @brief New generica acion.
  87 + GAction * pw3270_action_new();
  88 +
86 89 /// @brief New action from LIB3270's control data.
87 90 GAction * pw3270_action_new_from_lib3270(const LIB3270_ACTION * definition);
88 91  
... ...
src/objects/actions/abstract.c
... ... @@ -401,9 +401,9 @@
401 401  
402 402 }
403 403  
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;
  404 + gboolean get_enabled(GAction G_GNUC_UNUSED(*object), GtkWidget *terminal) {
  405 + debug("Action %s is %s",pw3270_action_get_name(object),terminal == NULL ? "disabled" : "enabled");
  406 + return terminal != NULL;
407 407 }
408 408  
409 409 void activate(GAction *action, GVariant G_GNUC_UNUSED(*parameter), GtkWidget G_GNUC_UNUSED(*terminal)) {
... ... @@ -439,3 +439,7 @@
439 439 H3270 * pw3270_action_get_session(GAction *action) {
440 440 return v3270_get_session(PW3270_ACTION(action)->terminal);
441 441 }
  442 +
  443 + GAction * pw3270_action_new() {
  444 + return G_ACTION(g_object_new(PW3270_TYPE_ACTION, NULL));
  445 + }
... ...
src/objects/window/actions/preferences.c
... ... @@ -28,10 +28,25 @@
28 28 */
29 29  
30 30 #include "../private.h"
  31 + #include <pw3270/window.h>
  32 + #include <pw3270/actions.h>
  33 + #include <v3270/settings.h>
31 34  
32   - void pw3270_window_preferences_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer application) {
  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 + pw3270Action * action = PW3270_ACTION(pw3270_action_new());
  40 +
  41 + action->activate = activate;
  42 + action->name = "preferences";
  43 +
  44 + return G_ACTION(action);
  45 +
  46 + }
  47 +
  48 + void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
33 49  
34   - debug("%s",__FUNCTION__);
35 50  
36 51 }
37 52  
... ...
src/objects/window/actions/setcolors.c 0 → 100644
... ... @@ -0,0 +1,62 @@
  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 void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal);
  38 +
  39 + GAction * pw3270_set_color_action_new(void) {
  40 +
  41 + pw3270Action * action = PW3270_ACTION(pw3270_action_new());
  42 +
  43 + action->activate = activate;
  44 + action->name = "setcolors";
  45 +
  46 + return G_ACTION(action);
  47 +
  48 + }
  49 +
  50 + void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
  51 +
  52 + g_return_if_fail(GTK_IS_V3270(terminal));
  53 +
  54 + GtkWidget * dialog = v3270_settings_dialog_new(terminal, v3270_color_selection_new());
  55 +
  56 + v3270_dialog_setup(dialog,_("Color setup"),_("_Save"));
  57 +
  58 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  59 + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL);
  60 +
  61 + }
  62 +
... ...
src/objects/window/private.h
... ... @@ -66,10 +66,11 @@
66 66  
67 67 // Actions
68 68 GAction * pw3270_set_host_action_new(void);
  69 + GAction * pw3270_set_color_action_new(void);
  70 + GAction * pw3270_session_preferences_action_new(void);
69 71  
70 72 G_GNUC_INTERNAL void pw3270_window_open_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
71 73 G_GNUC_INTERNAL void pw3270_window_close_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
72   - G_GNUC_INTERNAL void pw3270_window_preferences_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
73 74  
74 75  
75 76 #endif // PRIVATE_H_INCLUDED
... ...
src/objects/window/window.c
... ... @@ -100,10 +100,17 @@
100 100 size_t ix;
101 101  
102 102 GAction * actions[] = {
103   - pw3270_set_host_action_new()
  103 + pw3270_set_host_action_new(),
  104 + pw3270_set_color_action_new(),
  105 + pw3270_session_preferences_action_new()
104 106 };
105 107  
  108 + debug("****************************** %s",__FUNCTION__);
  109 + debug("color is %s",g_action_get_enabled(actions[1]) ? "enabled" : "disabled");
  110 + debug("****************************** %s",__FUNCTION__);
  111 +
106 112 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) {
  113 + debug("Inserting %s",g_action_get_name(actions[ix]));
107 114 g_action_map_add_action(G_ACTION_MAP(widget),actions[ix]);
108 115 }
109 116  
... ... @@ -124,11 +131,6 @@
124 131 .activate = pw3270_window_close_activated,
125 132 },
126 133  
127   - {
128   - .name = "preferences",
129   - .activate = pw3270_window_preferences_activated,
130   - },
131   -
132 134 };
133 135  
134 136 g_action_map_add_action_entries(
... ...
ui/application.xml
... ... @@ -231,7 +231,7 @@
231 231  
232 232 <item>
233 233 <attribute name="label" translatable="yes">Colors</attribute>
234   - <attribute name="action">win.edit.colors</attribute>
  234 + <attribute name="action">win.set.colors</attribute>
235 235 </item>
236 236  
237 237 <item>
... ... @@ -244,42 +244,103 @@
244 244 <attribute name="action">win.screen.sizes</attribute>
245 245 </item>
246 246  
247   - </submenu>
  247 + <submenu>
  248 +
  249 + <attribute name='label' translatable='yes'>Options</attribute>
  250 +
  251 + <item>
  252 + <attribute name="label" translatable="yes">Connect on startup</attribute>
  253 + <attribute name="action">win.autoconnect</attribute>
  254 + </item>
  255 +
  256 + <item>
  257 + <attribute name="label" translatable="yes">Blinking Cursor</attribute>
  258 + <attribute name="action">win.cursorblink</attribute>
  259 + </item>
  260 +
  261 + <item>
  262 + <attribute name="label" translatable="yes">Monocase</attribute>
  263 + <attribute name="action">win.monocase</attribute>
  264 + </item>
  265 +
  266 + <item>
  267 + <attribute name="label" translatable="yes">Track Cursor</attribute>
  268 + <attribute name="action">win.cursorpos</attribute>
  269 + </item>
  270 +
  271 + <item>
  272 + <attribute name="label" translatable="yes">Full Screen</attribute>
  273 + <attribute name="action">win.fullscreen</attribute>
  274 + </item>
  275 +
  276 + <item>
  277 + <attribute name="label" translatable="yes">Resize on alternate screen</attribute>
  278 + <attribute name="action">win.altscreen</attribute>
  279 + </item>
  280 +
  281 + <item>
  282 + <attribute name="label" translatable="yes">Paste with left margin</attribute>
  283 + <attribute name="action">win.marginedpaste</attribute>
  284 + </item>
  285 +
  286 + <item>
  287 + <attribute name="label" translatable="yes">Cross hair cursor</attribute>
  288 + <attribute name="action">win.crosshair</attribute>
  289 + </item>
  290 +
  291 + <item>
  292 + <attribute name="label" translatable="yes">Blank Fill</attribute>
  293 + <attribute name="action">win.blankfill</attribute>
  294 + </item>
  295 +
  296 + <item>
  297 + <attribute name="label" translatable="yes">Select by rectangles</attribute>
  298 + <attribute name="action">win.rectselect</attribute>
  299 + </item>
  300 +
  301 + <item>
  302 + <attribute name="label" translatable="yes">Auto-Reconnect</attribute>
  303 + <attribute name="action">win.autoreconnect</attribute>
  304 + </item>
  305 +
  306 + <item>
  307 + <attribute name="label" translatable="yes">Bold</attribute>
  308 + <attribute name="action">win.bold</attribute>
  309 + </item>
  310 +
  311 + <item>
  312 + <attribute name="label" translatable="yes">Show Underline</attribute>
  313 + <attribute name="action">win.underline</attribute>
  314 + </item>
  315 +
  316 + <item>
  317 + <attribute name="label" translatable="yes">Keep selected</attribute>
  318 + <attribute name="action">win.keepselected</attribute>
  319 + </item>
  320 +
  321 + <item>
  322 + <attribute name="label" translatable="yes">Smart paste</attribute>
  323 + <attribute name="action">win.smartpaste</attribute>
  324 + </item>
  325 +
  326 + <item>
  327 + <attribute name="label" translatable="yes">Alert sound</attribute>
  328 + <attribute name="action">win.beep</attribute>
  329 + </item>
  330 +
  331 + <item>
  332 + <attribute name="label" translatable="yes">Use +/- for field navigation</attribute>
  333 + <attribute name="action">win.kpalternative</attribute>
  334 + </item>
  335 +
  336 + <item>
  337 + <attribute name="label" translatable="yes">Network keep alive</attribute>
  338 + <attribute name="action">win.keepalive</attribute>
  339 + </item>
  340 +
  341 + </submenu>
248 342  
249   - <!--
250   -
251   - <menu name='SettingsMenu' label='Settings'>
252   -
253   - <menu name='OptionsMenu' label='_Options' >
254   - <menuitem action='toggle' id='AutoConnect' label='Connect on startup' />
255   - <menuitem action='toggle' id='CursorBlink' label='Blinking Cursor' />
256   - <menuitem action='toggle' id='Monocase' label='Monocase' />
257   - <menuitem action='toggle' id='CursorPos' label='Track Cursor' />
258   - <menuitem action='toggle' id='FullScreen' key='<alt>Home' label='Full Screen' />
259   - <menuitem action='toggle' id='AltScreen' label='Resize on alternate screen' />
260   - <menuitem action='toggle' id='MarginedPaste' label='Paste with left margin' />
261   - <menuitem action='toggle' id='CrossHair' key='<alt>x' label='Cross hair cursor' />
262   - <menuitem action='toggle' id='BlankFill' label='Blank Fill' />
263   - <menuitem action='toggle' id='RectSelect' label='Select by rectangles' />
264   - <menuitem action='toggle' id='AutoReconnect' label='Auto-Reconnect' />
265   - <menuitem action='toggle' id='Bold' label='Bold' />
266   - <menuitem action='toggle' id='Underline' label='Show Underline' />
267   - <menuitem action='toggle' id='KeepSelected' label='Keep selected' />
268   - <menuitem action='toggle' id='SmartPaste' label='Smart paste' />
269   - <menuitem action='toggle' id='Beep' label='Alert sound' />
270   - <menuitem action='toggle' id='KPAlternative' label='Use +/- for field navigation' />
271   - <menuitem action='toggle' id='keepalive' label='Network keep alive' />
272   - </menu>
273   -
274   - <menuitem name='InputMethod' label='Input method' />
275   -
276   - </menu>
277   -
278   - <menu name='HelpMenu' label='Help' >
279   - <menuitem action='about' icon='about' sysmenu='about' />
280   - </menu>
281   -
282   - -->
  343 + </submenu>
283 344  
284 345 <submenu>
285 346  
... ...