Commit 27646cda659c768a13d443a1cef59e4fa1fae9bb
1 parent
01838f36
Exists in
master
and in
4 other branches
Reimpleminting "about" dialog.
Showing
8 changed files
with
213 additions
and
79 deletions
Show diff stats
Makefile.in
@@ -34,6 +34,7 @@ SOURCES= \ | @@ -34,6 +34,7 @@ SOURCES= \ | ||
34 | $(wildcard src/objects/actions/*.c) \ | 34 | $(wildcard src/objects/actions/*.c) \ |
35 | $(wildcard src/objects/actions/lib3270/*.c) \ | 35 | $(wildcard src/objects/actions/lib3270/*.c) \ |
36 | $(wildcard src/objects/window/*.c) \ | 36 | $(wildcard src/objects/window/*.c) \ |
37 | + $(wildcard src/objects/window/actions/*.c) \ | ||
37 | $(wildcard src/objects/terminal/*.c) \ | 38 | $(wildcard src/objects/terminal/*.c) \ |
38 | $(wildcard src/objects/toolbar/*.c) \ | 39 | $(wildcard src/objects/toolbar/*.c) \ |
39 | $(wildcard src/main/*.c) \ | 40 | $(wildcard src/main/*.c) \ |
pw3270.cbp
@@ -89,7 +89,10 @@ | @@ -89,7 +89,10 @@ | ||
89 | <Unit filename="src/objects/toolbar/toolbutton.c"> | 89 | <Unit filename="src/objects/toolbar/toolbutton.c"> |
90 | <Option compilerVar="CC" /> | 90 | <Option compilerVar="CC" /> |
91 | </Unit> | 91 | </Unit> |
92 | - <Unit filename="src/objects/window/actions.c"> | 92 | + <Unit filename="src/objects/window/actions/about.c"> |
93 | + <Option compilerVar="CC" /> | ||
94 | + </Unit> | ||
95 | + <Unit filename="src/objects/window/actions/window.c"> | ||
93 | <Option compilerVar="CC" /> | 96 | <Option compilerVar="CC" /> |
94 | </Unit> | 97 | </Unit> |
95 | <Unit filename="src/objects/window/application.c"> | 98 | <Unit filename="src/objects/window/application.c"> |
src/objects/window/actions.c
@@ -1,77 +0,0 @@ | @@ -1,77 +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 | - * 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 | - void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
38 | - | ||
39 | - debug("%s",__FUNCTION__); | ||
40 | - | ||
41 | - } | ||
42 | - | ||
43 | - | ||
44 | - void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
45 | - | ||
46 | - g_print("Exiting application\n"); | ||
47 | - | ||
48 | - /* | ||
49 | - GList *list = gtk_application_get_windows(GTK_APPLICATION(application)); | ||
50 | - | ||
51 | - while(list) { | ||
52 | - | ||
53 | - GtkWidget * window = GTK_WIDGET(list->data); | ||
54 | - list = list->next; | ||
55 | - | ||
56 | - gtk_widget_destroy(window); | ||
57 | - | ||
58 | - } | ||
59 | - */ | ||
60 | - | ||
61 | - g_application_quit(G_APPLICATION(application)); | ||
62 | - | ||
63 | - } | ||
64 | - | ||
65 | - void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
66 | - | ||
67 | - debug("%s",__FUNCTION__); | ||
68 | - pw3270_terminal_new(GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application)))); | ||
69 | - | ||
70 | - } | ||
71 | - | ||
72 | - void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
73 | - | ||
74 | - debug("%s",__FUNCTION__); | ||
75 | - g_application_activate(application); | ||
76 | - | ||
77 | - } |
@@ -0,0 +1,128 @@ | @@ -0,0 +1,128 @@ | ||
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/application.h> | ||
32 | + | ||
33 | + void pw3270_application_about_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer application) { | ||
34 | + | ||
35 | + static const gchar *authors[] = | ||
36 | + { | ||
37 | + "Perry Werneck <perry.werneck@gmail.com>", | ||
38 | + "Paul Mattes <Paul.Mattes@usa.net>", | ||
39 | + "Georgia Tech Research Corporation (GTRC)", | ||
40 | + "and others", | ||
41 | + NULL | ||
42 | + }; | ||
43 | + | ||
44 | + static const gchar *license = | ||
45 | + N_( "This program is free software; you can redistribute it and/or " | ||
46 | + "modify it under the terms of the GNU General Public License as " | ||
47 | + "published by the Free Software Foundation; either version 2 of the " | ||
48 | + "License, or (at your option) any later version.\n\n" | ||
49 | + "This program is distributed in the hope that it will be useful, " | ||
50 | + "but WITHOUT ANY WARRANTY; without even the implied warranty of " | ||
51 | + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " | ||
52 | + "GNU General Public License for more details.\n\n" | ||
53 | + "You should have received a copy of the GNU General Public License " | ||
54 | + "along with this program; if not, write to the Free Software " | ||
55 | + "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 " | ||
56 | + "USA" ); | ||
57 | + | ||
58 | + GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); | ||
59 | + | ||
60 | + // Associate with the window | ||
61 | + { | ||
62 | + GtkWindow * window = gtk_application_get_active_window(GTK_APPLICATION(application)); | ||
63 | + if(window) { | ||
64 | + gtk_window_set_transient_for(GTK_WINDOW(dialog), window); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + // Get application logo | ||
69 | + { | ||
70 | + lib3270_autoptr(char) logo = lib3270_build_data_filename(G_STRINGIFY(PRODUCT_NAME) "-logo.png",NULL); | ||
71 | + | ||
72 | + if(g_file_test(logo,G_FILE_TEST_EXISTS)) { | ||
73 | + GError * error = NULL; | ||
74 | + GdkPixbuf * pix = gdk_pixbuf_new_from_file(logo,&error); | ||
75 | + | ||
76 | + gtk_about_dialog_set_logo(dialog,pix); | ||
77 | + | ||
78 | + if(pix) { | ||
79 | + | ||
80 | + g_object_unref(pix); | ||
81 | + | ||
82 | + } else { | ||
83 | + | ||
84 | + g_warning("Can't load %s: %s",logo,error->message); | ||
85 | + g_error_free(error); | ||
86 | + | ||
87 | + } | ||
88 | + | ||
89 | + } else { | ||
90 | + | ||
91 | + g_message("%s: %s",logo,strerror(ENOENT)); | ||
92 | + | ||
93 | + } | ||
94 | + | ||
95 | + } | ||
96 | + | ||
97 | + // Set version | ||
98 | + { | ||
99 | +#ifdef PACKAGE_RELEASE | ||
100 | + g_autofree gchar * version = g_strdup_printf(_("Version %s-%s"),PACKAGE_VERSION,G_STRINGIFY(PACKAGE_RELEASE)); | ||
101 | +#else | ||
102 | + g_autofree gchar * version = g_strdup_printf(_("Version %s-%s"),PACKAGE_VERSION,G_STRINGIFY(BUILD_DATE)); | ||
103 | +#endif // PACKAGE_REVISION | ||
104 | + | ||
105 | + gtk_about_dialog_set_version(dialog,version); | ||
106 | + } | ||
107 | + | ||
108 | + // Set comments | ||
109 | + { | ||
110 | + g_autofree gchar * comments = g_strdup_printf(_( "3270 terminal emulator for GTK %d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION); | ||
111 | + gtk_about_dialog_set_comments(dialog, comments); | ||
112 | + } | ||
113 | + | ||
114 | + gtk_about_dialog_set_copyright(dialog, "Copyright © 2008 Banco do Brasil S.A." ); | ||
115 | + gtk_about_dialog_set_license(dialog, gettext( license ) ); | ||
116 | + gtk_about_dialog_set_wrap_license(dialog,TRUE); | ||
117 | + gtk_about_dialog_set_website(dialog,"https://portal.softwarepublico.gov.br/social/pw3270/"); | ||
118 | + gtk_about_dialog_set_website_label(dialog,_( "Brazilian Public Software Portal" )); | ||
119 | + gtk_about_dialog_set_authors(dialog,authors); | ||
120 | + gtk_about_dialog_set_translator_credits(dialog,_("translator-credits")); | ||
121 | + | ||
122 | + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); | ||
123 | + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL); | ||
124 | + gtk_widget_show_all(GTK_WIDGET(dialog)); | ||
125 | + | ||
126 | + | ||
127 | + } | ||
128 | + |
@@ -0,0 +1,71 @@ | @@ -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 | + * 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 | + | ||
38 | + void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
39 | + | ||
40 | + g_print("Exiting application\n"); | ||
41 | + | ||
42 | + /* | ||
43 | + GList *list = gtk_application_get_windows(GTK_APPLICATION(application)); | ||
44 | + | ||
45 | + while(list) { | ||
46 | + | ||
47 | + GtkWidget * window = GTK_WIDGET(list->data); | ||
48 | + list = list->next; | ||
49 | + | ||
50 | + gtk_widget_destroy(window); | ||
51 | + | ||
52 | + } | ||
53 | + */ | ||
54 | + | ||
55 | + g_application_quit(G_APPLICATION(application)); | ||
56 | + | ||
57 | + } | ||
58 | + | ||
59 | + void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
60 | + | ||
61 | + debug("%s",__FUNCTION__); | ||
62 | + pw3270_terminal_new(GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application)))); | ||
63 | + | ||
64 | + } | ||
65 | + | ||
66 | + void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
67 | + | ||
68 | + debug("%s",__FUNCTION__); | ||
69 | + g_application_activate(application); | ||
70 | + | ||
71 | + } |
src/objects/window/application.c
@@ -207,7 +207,7 @@ | @@ -207,7 +207,7 @@ | ||
207 | static GActionEntry actions[] = { | 207 | static GActionEntry actions[] = { |
208 | { | 208 | { |
209 | .name = "about", | 209 | .name = "about", |
210 | - .activate = pw3270_application_generic_activated, | 210 | + .activate = pw3270_application_about_activated, |
211 | }, | 211 | }, |
212 | 212 | ||
213 | { | 213 | { |
src/objects/window/private.h
@@ -69,5 +69,6 @@ | @@ -69,5 +69,6 @@ | ||
69 | G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 69 | G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
70 | G_GNUC_INTERNAL void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 70 | G_GNUC_INTERNAL void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
71 | G_GNUC_INTERNAL void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 71 | G_GNUC_INTERNAL void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
72 | + G_GNUC_INTERNAL void pw3270_application_about_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | ||
72 | 73 | ||
73 | #endif // PRIVATE_H_INCLUDED | 74 | #endif // PRIVATE_H_INCLUDED |
src/objects/window/window.c