Commit d16909b3ab383410b97972cd676708681a1b561f
1 parent
edfb6f92
Exists in
master
and in
4 other branches
Implementing application object.
Showing
9 changed files
with
373 additions
and
211 deletions
Show diff stats
... | ... | @@ -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 | +/** | |
31 | + * @brief Declares the pw3270 application. | |
32 | + * | |
33 | + */ | |
34 | + | |
35 | +#ifndef PW3270_APPLICATION_H_INCLUDED | |
36 | + | |
37 | + #define PW3270_APPLICATION_H_INCLUDED | |
38 | + | |
39 | + #include <gtk/gtk.h> | |
40 | + | |
41 | + G_BEGIN_DECLS | |
42 | + | |
43 | + #define PW3270_TYPE_APPLICATION (pw3270Application_get_type ()) | |
44 | + #define PW3270_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ | |
45 | + PW3270_TYPE_APPLICATION, pw3270Application)) | |
46 | + #define PW3270_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ | |
47 | + PW3270_TYPE_APPLICATION, pw3270ApplicationClass)) | |
48 | + #define PW3270_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ | |
49 | + PW3270_TYPE_APPLICATION)) | |
50 | + #define PW3270_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ | |
51 | + PW3270_TYPE_APPLICATION)) | |
52 | + #define PW3270_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ | |
53 | + GTK_TYPE_APPLICATION, pw3270ApplicationClass)) | |
54 | + | |
55 | + typedef enum _pw3270_ui_type { | |
56 | + PW3270_UI_STYLE_CLASSICAL, ///< @brief Interface "classica", com menu e toolbar. | |
57 | + PW3270_UI_STYLE_GNOME, ///< @brief Interface padrão gnome. | |
58 | + } PW3270_UI_TYPE; | |
59 | + | |
60 | + | |
61 | + typedef struct _pw3270ApplicationClass pw3270ApplicationClass; | |
62 | + typedef struct _pw3270Application pw3270Application; | |
63 | + | |
64 | + GType pw3270Application_get_type(); | |
65 | + GtkApplication * pw3270_application_new(const gchar *application_id, GApplicationFlags flags); | |
66 | + PW3270_UI_TYPE pw3270_application_get_ui_type(GApplication *app); | |
67 | + | |
68 | + G_END_DECLS | |
69 | + | |
70 | + | |
71 | +#endif // PW3270_WINDOW_H_INCLUDED | ... | ... |
src/include/pw3270/window.h
... | ... | @@ -53,7 +53,6 @@ |
53 | 53 | #define PW3270_APPLICATION_WINDOW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ |
54 | 54 | GTK_TYPE_APPLICATION_WINDOW, pw3270ApplicationWindowClass)) |
55 | 55 | |
56 | - | |
57 | 56 | typedef struct _pw3270ApplicationWindowClass pw3270ApplicationWindowClass; |
58 | 57 | typedef struct _pw3270ApplicationWindow pw3270ApplicationWindow; |
59 | 58 | ... | ... |
... | ... | @@ -0,0 +1,159 @@ |
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 | + * References: | |
29 | + * | |
30 | + * https://fossies.org/linux/gtk+/examples/plugman.c | |
31 | + * | |
32 | + */ | |
33 | + | |
34 | + #include "private.h" | |
35 | + #include <pw3270/application.h> | |
36 | + | |
37 | + struct _pw3270ApplicationClass { | |
38 | + GtkApplicationClass parent_class; | |
39 | + }; | |
40 | + | |
41 | + struct _pw3270Application { | |
42 | + GtkApplication parent; | |
43 | + }; | |
44 | + | |
45 | + static void startup(GApplication * application); | |
46 | + static void activate(GApplication * application); | |
47 | + static void open(GApplication * application, GFile **files, gint n_files, const gchar *hint); | |
48 | + | |
49 | + G_DEFINE_TYPE(pw3270Application, pw3270Application, GTK_TYPE_APPLICATION); | |
50 | + | |
51 | + static void pw3270Application_class_init(pw3270ApplicationClass *klass) { | |
52 | + | |
53 | + GApplicationClass *application_class = G_APPLICATION_CLASS(klass); | |
54 | + | |
55 | + application_class->startup = startup; | |
56 | + application_class->activate = activate; | |
57 | + application_class->open = open; | |
58 | + | |
59 | + } | |
60 | + | |
61 | + static void pw3270Application_init(pw3270Application *app) { | |
62 | + | |
63 | + | |
64 | + } | |
65 | + | |
66 | + GtkApplication * pw3270_application_new(const gchar *application_id, GApplicationFlags flags) { | |
67 | + | |
68 | + return g_object_new( | |
69 | + PW3270_TYPE_APPLICATION, | |
70 | + "application-id", application_id, | |
71 | + "flags", G_APPLICATION_HANDLES_OPEN, | |
72 | + NULL); | |
73 | + | |
74 | + } | |
75 | + | |
76 | + static void action_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | |
77 | + | |
78 | + debug("%s",__FUNCTION__); | |
79 | + | |
80 | + } | |
81 | + | |
82 | + void startup(GApplication *application) { | |
83 | + | |
84 | + G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application); | |
85 | + | |
86 | + // | |
87 | + // Setup application default actions. | |
88 | + // | |
89 | + static GActionEntry app_entries[] = { | |
90 | + { | |
91 | + "app.about", | |
92 | + action_activated, | |
93 | + NULL, | |
94 | + NULL, | |
95 | + NULL | |
96 | + }, | |
97 | + { | |
98 | + "app.preferences", | |
99 | + action_activated, | |
100 | + NULL, | |
101 | + NULL, | |
102 | + NULL | |
103 | + }, | |
104 | + { | |
105 | + "app.quit", | |
106 | + action_activated, | |
107 | + NULL, | |
108 | + NULL, | |
109 | + NULL | |
110 | + } | |
111 | + }; | |
112 | + | |
113 | + g_action_map_add_action_entries( | |
114 | + G_ACTION_MAP(application), | |
115 | + app_entries, | |
116 | + G_N_ELEMENTS(app_entries), | |
117 | + application | |
118 | + ); | |
119 | + | |
120 | + // | |
121 | + // Setup application menus | |
122 | + // | |
123 | + GtkBuilder * builder = gtk_builder_new_from_file("ui/application.xml"); | |
124 | + gtk_application_set_app_menu(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "app-menu"))); | |
125 | + | |
126 | + if(pw3270_application_get_ui_type(application) == PW3270_UI_STYLE_CLASSICAL) | |
127 | + gtk_application_set_menubar(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "menubar"))); | |
128 | + | |
129 | + g_object_unref(builder); | |
130 | + | |
131 | + } | |
132 | + | |
133 | + void activate(GApplication *application) { | |
134 | + | |
135 | + GtkWidget * window = pw3270_application_window_new(GTK_APPLICATION(application)); | |
136 | + | |
137 | + gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(window),TRUE); | |
138 | + | |
139 | + // Create terminal widget | |
140 | + pw3270_terminal_new(window); | |
141 | + pw3270_terminal_new(window); | |
142 | + | |
143 | + // Setup and show main window | |
144 | + gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); | |
145 | + gtk_window_set_default_size (GTK_WINDOW (window), 800, 500); | |
146 | + | |
147 | + // gtk_widget_show_all(window); | |
148 | + gtk_window_present(GTK_WINDOW(window)); | |
149 | + | |
150 | + } | |
151 | + | |
152 | + void open(GApplication *application, GFile **files, gint n_files, const gchar *hint) { | |
153 | + | |
154 | + } | |
155 | + | |
156 | + PW3270_UI_TYPE pw3270_application_get_ui_type(GApplication *app) { | |
157 | + return PW3270_UI_STYLE_GNOME; | |
158 | + } | |
159 | + | ... | ... |
src/objects/window/application.xml
... | ... | @@ -1,53 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<interface> | |
3 | - <requires lib="gtk+" version="3.0"/> | |
4 | - <menu id="app-menu"> | |
5 | - <section> | |
6 | - <item> | |
7 | - <attribute name="label" translatable="yes">About PW3270</attribute> | |
8 | - <attribute name="action">app.about</attribute> | |
9 | - </item> | |
10 | - <item> | |
11 | - <attribute name="label" translatable="yes">Preferences</attribute> | |
12 | - <attribute name="action">app.help</attribute> | |
13 | - </item> | |
14 | - <item> | |
15 | - <attribute name="label" translatable="yes">Quit</attribute> | |
16 | - <attribute name="action">app.quit</attribute> | |
17 | - </item> | |
18 | - </section> | |
19 | - </menu> | |
20 | - <menu id='menubar'> | |
21 | - | |
22 | - <submenu> | |
23 | - <attribute name='label' translatable='yes'>_Edit</attribute> | |
24 | - <section> | |
25 | - <item> | |
26 | - <attribute name='label' translatable='yes'>_Copy</attribute> | |
27 | - <attribute name='action'>app.quit</attribute> | |
28 | - </item> | |
29 | - <item> | |
30 | - <attribute name='label' translatable='yes'>_Paste</attribute> | |
31 | - <attribute name='action'>app.quit</attribute> | |
32 | - </item> | |
33 | - </section> | |
34 | - <section> | |
35 | - <item> | |
36 | - <attribute name='label' translatable='yes'>Plugins</attribute> | |
37 | - <attribute name='action'>app.quit</attribute> | |
38 | - </item> | |
39 | - </section> | |
40 | - </submenu> | |
41 | - | |
42 | - <submenu> | |
43 | - <attribute name='label' translatable='yes'>_View</attribute> | |
44 | - <section> | |
45 | - <item> | |
46 | - <attribute name='label' translatable='yes'>_Fullscreen</attribute> | |
47 | - <attribute name='action'>app.quit</attribute> | |
48 | - </item> | |
49 | - </section> | |
50 | - </submenu> | |
51 | - | |
52 | - </menu> | |
53 | -</interface> |
src/objects/window/init.c
... | ... | @@ -1,64 +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/toolbar.h> | |
32 | - | |
33 | - G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); | |
34 | - | |
35 | - static void pw3270ApplicationWindow_class_init(pw3270ApplicationWindowClass *klass) { | |
36 | - | |
37 | - } | |
38 | - | |
39 | - static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | |
40 | - | |
41 | - GtkBox * vBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL,0)); | |
42 | - | |
43 | - widget->notebook = GTK_NOTEBOOK(gtk_notebook_new()); | |
44 | - widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); | |
45 | - widget->toolbar = GTK_TOOLBAR(pw3270_toolbar_new()); | |
46 | - | |
47 | - gtk_notebook_set_show_tabs(widget->notebook,FALSE); | |
48 | - gtk_notebook_set_show_border(widget->notebook, FALSE); | |
49 | - | |
50 | - gtk_box_pack_start(vBox,GTK_WIDGET(widget->toolbar),FALSE,TRUE,0); | |
51 | - gtk_box_pack_start(vBox,GTK_WIDGET(widget->notebook),TRUE,TRUE,0); | |
52 | - | |
53 | - gtk_widget_show_all(GTK_WIDGET(vBox)); | |
54 | - gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); | |
55 | - | |
56 | - } | |
57 | - | |
58 | - GtkWidget * pw3270_application_window_new(GtkApplication * application) { | |
59 | - | |
60 | - g_return_val_if_fail(GTK_IS_APPLICATION(application), NULL); | |
61 | - return g_object_new(PW3270_TYPE_APPLICATION_WINDOW, "application", application, NULL); | |
62 | - | |
63 | - } | |
64 | - |
src/objects/window/testprogram/testprogram.c
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | */ |
30 | 30 | |
31 | 31 | #include <config.h> |
32 | - #include <pw3270/window.h> | |
32 | + #include <pw3270/application.h> | |
33 | 33 | #include <pw3270/toolbar.h> |
34 | 34 | #include <v3270.h> |
35 | 35 | #include <v3270/trace.h> |
... | ... | @@ -37,25 +37,6 @@ |
37 | 37 | |
38 | 38 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
39 | 39 | |
40 | - static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { | |
41 | - | |
42 | - GtkWidget * window = pw3270_application_window_new(app); | |
43 | - | |
44 | - gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(window),TRUE); | |
45 | - | |
46 | - // Create terminal widget | |
47 | - pw3270_terminal_new(window); | |
48 | - pw3270_terminal_new(window); | |
49 | - | |
50 | - // Setup and show main window | |
51 | - gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); | |
52 | - gtk_window_set_default_size (GTK_WINDOW (window), 800, 500); | |
53 | - | |
54 | - // gtk_widget_show_all(window); | |
55 | - gtk_window_present(GTK_WINDOW(window)); | |
56 | - | |
57 | -} | |
58 | - | |
59 | 40 | GtkWidget * pw3270_toolbar_new(void) { |
60 | 41 | |
61 | 42 | static const struct _item { |
... | ... | @@ -89,86 +70,16 @@ GtkWidget * pw3270_toolbar_new(void) { |
89 | 70 | return toolbar; |
90 | 71 | } |
91 | 72 | |
92 | -static void preferences_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | |
93 | - | |
94 | - debug("%s",__FUNCTION__); | |
95 | - | |
96 | -} | |
97 | - | |
98 | -static void quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | |
99 | - | |
100 | - debug("%s",__FUNCTION__); | |
101 | - | |
102 | -} | |
103 | - | |
104 | -void startup(GtkApplication *app) { | |
105 | - | |
106 | - static GActionEntry app_entries[] = { | |
107 | - { | |
108 | - "app.about", | |
109 | - quit_activated, | |
110 | - NULL, | |
111 | - NULL, | |
112 | - NULL | |
113 | - }, | |
114 | - { | |
115 | - "app.help", | |
116 | - quit_activated, | |
117 | - NULL, | |
118 | - NULL, | |
119 | - NULL | |
120 | - }, | |
121 | - { | |
122 | - "app.preferences", | |
123 | - preferences_activated, | |
124 | - NULL, | |
125 | - NULL, | |
126 | - NULL | |
127 | - }, | |
128 | - { | |
129 | - "app.quit", | |
130 | - quit_activated, | |
131 | - NULL, | |
132 | - NULL, | |
133 | - NULL | |
134 | - } | |
135 | - }; | |
136 | - | |
137 | - g_action_map_add_action_entries( | |
138 | - G_ACTION_MAP(app), | |
139 | - app_entries, | |
140 | - G_N_ELEMENTS(app_entries), | |
141 | - app | |
142 | - ); | |
143 | - | |
144 | - GtkBuilder * builder = gtk_builder_new_from_file("application.xml"); | |
145 | - | |
146 | - debug("Builder: %p",builder); | |
147 | - | |
148 | - gtk_application_set_app_menu(GTK_APPLICATION (app), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); | |
149 | - gtk_application_set_menubar(GTK_APPLICATION (app), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"))); | |
150 | - | |
151 | - g_object_unref(builder); | |
152 | - | |
153 | -} | |
154 | - | |
155 | - | |
156 | 73 | int main (int argc, char **argv) { |
157 | 74 | |
158 | 75 | GtkApplication *app; |
159 | 76 | int status; |
160 | 77 | |
161 | - app = gtk_application_new("br.com.bb.pw3270",G_APPLICATION_HANDLES_OPEN); | |
162 | - | |
163 | - g_signal_connect (app, "activate", G_CALLBACK(activate), NULL); | |
164 | - g_signal_connect (app, "startup", G_CALLBACK(startup), NULL); | |
165 | - | |
78 | + app = pw3270_application_new("br.com.bb.pw3270",G_APPLICATION_HANDLES_OPEN); | |
166 | 79 | status = g_application_run (G_APPLICATION (app), argc, argv); |
167 | 80 | g_object_unref (app); |
168 | 81 | |
169 | - g_message("rc=%d",status); | |
170 | - | |
171 | - return 0; | |
82 | + return status; | |
172 | 83 | |
173 | 84 | } |
174 | 85 | ... | ... |
... | ... | @@ -0,0 +1,53 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<interface> | |
3 | + <requires lib="gtk+" version="3.0"/> | |
4 | + <menu id="app-menu"> | |
5 | + <section> | |
6 | + <item> | |
7 | + <attribute name="label" translatable="yes">About PW3270</attribute> | |
8 | + <attribute name="action">app.about</attribute> | |
9 | + </item> | |
10 | + <item> | |
11 | + <attribute name="label" translatable="yes">Preferences</attribute> | |
12 | + <attribute name="action">app.help</attribute> | |
13 | + </item> | |
14 | + <item> | |
15 | + <attribute name="label" translatable="yes">Quit</attribute> | |
16 | + <attribute name="action">app.quit</attribute> | |
17 | + </item> | |
18 | + </section> | |
19 | + </menu> | |
20 | + <menu id='menubar'> | |
21 | + | |
22 | + <submenu> | |
23 | + <attribute name='label' translatable='yes'>_Edit</attribute> | |
24 | + <section> | |
25 | + <item> | |
26 | + <attribute name='label' translatable='yes'>_Copy</attribute> | |
27 | + <attribute name='action'>app.quit</attribute> | |
28 | + </item> | |
29 | + <item> | |
30 | + <attribute name='label' translatable='yes'>_Paste</attribute> | |
31 | + <attribute name='action'>app.quit</attribute> | |
32 | + </item> | |
33 | + </section> | |
34 | + <section> | |
35 | + <item> | |
36 | + <attribute name='label' translatable='yes'>Plugins</attribute> | |
37 | + <attribute name='action'>app.quit</attribute> | |
38 | + </item> | |
39 | + </section> | |
40 | + </submenu> | |
41 | + | |
42 | + <submenu> | |
43 | + <attribute name='label' translatable='yes'>_View</attribute> | |
44 | + <section> | |
45 | + <item> | |
46 | + <attribute name='label' translatable='yes'>_Fullscreen</attribute> | |
47 | + <attribute name='action'>app.quit</attribute> | |
48 | + </item> | |
49 | + </section> | |
50 | + </submenu> | |
51 | + | |
52 | + </menu> | |
53 | +</interface> | ... | ... |
... | ... | @@ -0,0 +1,82 @@ |
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/toolbar.h> | |
32 | + | |
33 | + G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); | |
34 | + | |
35 | + static void pw3270ApplicationWindow_class_init(pw3270ApplicationWindowClass *klass) { | |
36 | + | |
37 | + /* | |
38 | + window_props[PROP_UI_STYLE] = | |
39 | + g_param_spec_uint ( | |
40 | + "ui_style", // P_() | |
41 | + "ui_style", // P_() | |
42 | + _( "The application interface style" ), | |
43 | + PW3270_UI_STYLE_CLASSICAL, | |
44 | + PW3270_UI_STYLE_GNOME, | |
45 | + PW3270_UI_STYLE_GNOME, | |
46 | + G_PARAM_READABLE | |
47 | + ); | |
48 | + */ | |
49 | + | |
50 | + | |
51 | + } | |
52 | + | |
53 | + static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | |
54 | + | |
55 | + GtkBox * vBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL,0)); | |
56 | + | |
57 | + widget->notebook = GTK_NOTEBOOK(gtk_notebook_new()); | |
58 | + widget->terminal = pw3270_terminal_new(GTK_WIDGET(widget)); | |
59 | + widget->toolbar = GTK_TOOLBAR(pw3270_toolbar_new()); | |
60 | + | |
61 | + gtk_notebook_set_show_tabs(widget->notebook,FALSE); | |
62 | + gtk_notebook_set_show_border(widget->notebook, FALSE); | |
63 | + | |
64 | + gtk_box_pack_start(vBox,GTK_WIDGET(widget->toolbar),FALSE,TRUE,0); | |
65 | + gtk_box_pack_start(vBox,GTK_WIDGET(widget->notebook),TRUE,TRUE,0); | |
66 | + | |
67 | + gtk_widget_show_all(GTK_WIDGET(vBox)); | |
68 | + gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); | |
69 | + | |
70 | + } | |
71 | + | |
72 | + GtkWidget * pw3270_application_window_new(GtkApplication * application) { | |
73 | + | |
74 | + g_return_val_if_fail(GTK_IS_APPLICATION(application), NULL); | |
75 | + return g_object_new( | |
76 | + PW3270_TYPE_APPLICATION_WINDOW, | |
77 | + "application", application, | |
78 | + NULL); | |
79 | + | |
80 | + | |
81 | + } | |
82 | + | ... | ... |
src/objects/window/window.cbp
... | ... | @@ -39,9 +39,10 @@ |
39 | 39 | <Add option="`pkg-config --libs gtk+-3.0 libv3270`" /> |
40 | 40 | </Linker> |
41 | 41 | <Unit filename="../../include/pw3270/actions.h" /> |
42 | + <Unit filename="../../include/pw3270/application.h" /> | |
42 | 43 | <Unit filename="../../include/pw3270/toolbar.h" /> |
43 | 44 | <Unit filename="../../include/pw3270/window.h" /> |
44 | - <Unit filename="init.c"> | |
45 | + <Unit filename="application.c"> | |
45 | 46 | <Option compilerVar="CC" /> |
46 | 47 | </Unit> |
47 | 48 | <Unit filename="private.h" /> |
... | ... | @@ -51,6 +52,9 @@ |
51 | 52 | <Unit filename="testprogram/testprogram.c"> |
52 | 53 | <Option compilerVar="CC" /> |
53 | 54 | </Unit> |
55 | + <Unit filename="window.c"> | |
56 | + <Option compilerVar="CC" /> | |
57 | + </Unit> | |
54 | 58 | <Extensions> |
55 | 59 | <code_completion /> |
56 | 60 | <envvars /> | ... | ... |