Commit 046d1798fabb7e0ba6f1abbb7c946f0cdc8b3374
1 parent
d008acb5
Exists in
master
and in
4 other branches
Refactoring "set host" dialog.
Showing
5 changed files
with
96 additions
and
5 deletions
Show diff stats
pw3270.cbp
| @@ -111,6 +111,9 @@ | @@ -111,6 +111,9 @@ | ||
| 111 | <Unit filename="src/objects/window/actions/preferences.c"> | 111 | <Unit filename="src/objects/window/actions/preferences.c"> |
| 112 | <Option compilerVar="CC" /> | 112 | <Option compilerVar="CC" /> |
| 113 | </Unit> | 113 | </Unit> |
| 114 | + <Unit filename="src/objects/window/actions/sethost.c"> | ||
| 115 | + <Option compilerVar="CC" /> | ||
| 116 | + </Unit> | ||
| 114 | <Unit filename="src/objects/window/private.h" /> | 117 | <Unit filename="src/objects/window/private.h" /> |
| 115 | <Unit filename="src/objects/window/terminal.c"> | 118 | <Unit filename="src/objects/window/terminal.c"> |
| 116 | <Option compilerVar="CC" /> | 119 | <Option compilerVar="CC" /> |
| @@ -0,0 +1,80 @@ | @@ -0,0 +1,80 @@ | ||
| 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 <v3270/settings.h> | ||
| 33 | + #include <v3270/dialogs.h> | ||
| 34 | + | ||
| 35 | + static void on_response(GtkDialog *dialog, gint response_id, GtkWidget *settings) { | ||
| 36 | + | ||
| 37 | + v3270_settings_on_dialog_response(dialog,response_id,settings); | ||
| 38 | + | ||
| 39 | + if(response_id == GTK_RESPONSE_APPLY) { | ||
| 40 | +#ifndef DEBUG | ||
| 41 | + #error TO DO! | ||
| 42 | +#endif // DEBUG | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + gtk_widget_destroy(GTK_WIDGET(dialog)); | ||
| 46 | + | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + void pw3270_window_set_host_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer window) { | ||
| 50 | + | ||
| 51 | + debug("%s",__FUNCTION__); | ||
| 52 | + | ||
| 53 | + if(!PW3270_IS_APPLICATION_WINDOW(window)) | ||
| 54 | + return; | ||
| 55 | + | ||
| 56 | + GtkWidget * terminal = gtk_window_get_default_widget(GTK_WINDOW(window)); | ||
| 57 | + if(!GTK_IS_V3270(terminal)) | ||
| 58 | + return; | ||
| 59 | + | ||
| 60 | + GtkWidget * settings = v3270_host_select_new(); | ||
| 61 | + GtkWidget * dialog = | ||
| 62 | + v3270_settings_dialog_new( | ||
| 63 | + terminal, | ||
| 64 | + settings | ||
| 65 | + ); | ||
| 66 | + | ||
| 67 | + if(dialog) { | ||
| 68 | + | ||
| 69 | + v3270_dialog_setup(dialog,_("Setup host"),_("C_onnect")); | ||
| 70 | + | ||
| 71 | + gtk_window_set_default_size(GTK_WINDOW(dialog), 700, 150); | ||
| 72 | + | ||
| 73 | + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); | ||
| 74 | + g_signal_connect(dialog,"response",G_CALLBACK(on_response),settings); | ||
| 75 | + | ||
| 76 | + gtk_widget_show_all(dialog); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + } | ||
| 80 | + |
src/objects/window/private.h
| @@ -68,5 +68,7 @@ | @@ -68,5 +68,7 @@ | ||
| 68 | G_GNUC_INTERNAL void pw3270_window_open_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 68 | G_GNUC_INTERNAL void pw3270_window_open_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
| 69 | G_GNUC_INTERNAL void pw3270_window_close_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 69 | G_GNUC_INTERNAL void pw3270_window_close_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
| 70 | G_GNUC_INTERNAL void pw3270_window_preferences_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 70 | G_GNUC_INTERNAL void pw3270_window_preferences_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
| 71 | + G_GNUC_INTERNAL void pw3270_window_set_host_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer application); | ||
| 72 | + | ||
| 71 | 73 | ||
| 72 | #endif // PRIVATE_H_INCLUDED | 74 | #endif // PRIVATE_H_INCLUDED |
src/objects/window/window.c
| @@ -115,6 +115,12 @@ | @@ -115,6 +115,12 @@ | ||
| 115 | .activate = pw3270_window_preferences_activated, | 115 | .activate = pw3270_window_preferences_activated, |
| 116 | }, | 116 | }, |
| 117 | 117 | ||
| 118 | + { | ||
| 119 | + .name = "set.host", | ||
| 120 | + .activate = pw3270_window_set_host_activated, | ||
| 121 | + }, | ||
| 122 | + | ||
| 123 | + | ||
| 118 | }; | 124 | }; |
| 119 | 125 | ||
| 120 | g_action_map_add_action_entries( | 126 | g_action_map_add_action_entries( |
ui/application.xml
| @@ -144,7 +144,7 @@ | @@ -144,7 +144,7 @@ | ||
| 144 | 144 | ||
| 145 | <item> | 145 | <item> |
| 146 | <attribute name="label" translatable="yes">Paste text file</attribute> | 146 | <attribute name="label" translatable="yes">Paste text file</attribute> |
| 147 | - <attribute name="action">win.pastefile</attribute> | 147 | + <attribute name="action">win.paste_file</attribute> |
| 148 | </item> | 148 | </item> |
| 149 | 149 | ||
| 150 | </section> | 150 | </section> |
| @@ -210,7 +210,7 @@ | @@ -210,7 +210,7 @@ | ||
| 210 | 210 | ||
| 211 | <item> | 211 | <item> |
| 212 | <attribute name="label" translatable="yes">Configure host</attribute> | 212 | <attribute name="label" translatable="yes">Configure host</attribute> |
| 213 | - <attribute name="action">win.setup_host</attribute> | 213 | + <attribute name="action">win.set.host</attribute> |
| 214 | </item> | 214 | </item> |
| 215 | 215 | ||
| 216 | <item> | 216 | <item> |
| @@ -231,17 +231,17 @@ | @@ -231,17 +231,17 @@ | ||
| 231 | 231 | ||
| 232 | <item> | 232 | <item> |
| 233 | <attribute name="label" translatable="yes">Colors</attribute> | 233 | <attribute name="label" translatable="yes">Colors</attribute> |
| 234 | - <attribute name="action">win.coloers</attribute> | 234 | + <attribute name="action">win.edit.colors</attribute> |
| 235 | </item> | 235 | </item> |
| 236 | 236 | ||
| 237 | <item> | 237 | <item> |
| 238 | <attribute name="label" translatable="yes">Select font</attribute> | 238 | <attribute name="label" translatable="yes">Select font</attribute> |
| 239 | - <attribute name="action">win.select_font</attribute> | 239 | + <attribute name="action">win.select.font</attribute> |
| 240 | </item> | 240 | </item> |
| 241 | 241 | ||
| 242 | <item> | 242 | <item> |
| 243 | <attribute name="label" translatable="yes">Screen sizes</attribute> | 243 | <attribute name="label" translatable="yes">Screen sizes</attribute> |
| 244 | - <attribute name="action">win.screen_sizes</attribute> | 244 | + <attribute name="action">win.screen.sizes</attribute> |
| 245 | </item> | 245 | </item> |
| 246 | 246 | ||
| 247 | </submenu> | 247 | </submenu> |