Commit 89bb30e819e4fffe315b54cd275bd6e99aef48b6
1 parent
f0793765
Exists in
master
and in
4 other branches
Creating action to bind with v3270 properties.
Showing
4 changed files
with
106 additions
and
0 deletions
Show diff stats
Makefile.in
... | ... | @@ -33,6 +33,7 @@ INSTALL_PACKAGES=@INSTALL_PACKAGES@ |
33 | 33 | SOURCES= \ |
34 | 34 | $(wildcard src/objects/actions/*.c) \ |
35 | 35 | $(wildcard src/objects/actions/lib3270/*.c) \ |
36 | + $(wildcard src/objects/actions/v3270/*.c) \ | |
36 | 37 | $(wildcard src/objects/application/*.c) \ |
37 | 38 | $(wildcard src/objects/application/actions/*.c) \ |
38 | 39 | $(wildcard src/objects/window/*.c) \ | ... | ... |
pw3270.cbp
... | ... | @@ -82,6 +82,9 @@ |
82 | 82 | <Unit filename="src/objects/actions/simple.c"> |
83 | 83 | <Option compilerVar="CC" /> |
84 | 84 | </Unit> |
85 | + <Unit filename="src/objects/actions/v3270/property.c"> | |
86 | + <Option compilerVar="CC" /> | |
87 | + </Unit> | |
85 | 88 | <Unit filename="src/objects/actions/window.c"> |
86 | 89 | <Option compilerVar="CC" /> |
87 | 90 | </Unit> | ... | ... |
src/include/pw3270/actions.h
... | ... | @@ -183,6 +183,34 @@ |
183 | 183 | |
184 | 184 | pw3270SimpleAction * pw3270_dialog_action_new(GtkWidget * (*factory)(GtkWidget *)); |
185 | 185 | |
186 | + // | |
187 | + // V3270 Property Action | |
188 | + // | |
189 | + #define V3270_TYPE_PROPERTY_ACTION (v3270PropertyAction_get_type()) | |
190 | + #define V3270_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), V3270_TYPE_PROPERTY_ACTION, v3270PropertyAction)) | |
191 | + #define V3270_PROPERTY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), V3270_TYPE_PROPERTY_ACTION, v3270PropertyActionClass)) | |
192 | + #define V3270_IS_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), V3270_TYPE_PROPERTY_ACTION)) | |
193 | + #define V3270_IS_PROPERTY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), V3270_TYPE_PROPERTY_ACTION)) | |
194 | + #define V3270_PROPERTY_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), V3270_TYPE_PROPERTY_ACTION, v3270PropertyActionClass)) | |
195 | + | |
196 | + typedef struct _v3270PropertyAction { | |
197 | + | |
198 | + pw3270Action parent; | |
199 | + | |
200 | + GParamSpec *pspec; | |
201 | + | |
202 | + } v3270PropertyAction; | |
203 | + | |
204 | + typedef struct _v3270PropertyActionClass { | |
205 | + | |
206 | + pw3270ActionClass parent_class; | |
207 | + | |
208 | + } v3270PropertyActionClass; | |
209 | + | |
210 | + GType v3270PropertyAction_get_type(void) G_GNUC_CONST; | |
211 | + | |
212 | + v3270PropertyAction * v3270_property_action_new(GtkWidget *widget, const gchar *property_name); | |
213 | + | |
186 | 214 | G_END_DECLS |
187 | 215 | |
188 | 216 | #endif // PW3270_ACTIONS_H_INCLUDED | ... | ... |
... | ... | @@ -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 | + /** | |
31 | + * @brief Implement GAction "wrapper" for v3270 properties. | |
32 | + * | |
33 | + * Reference: | |
34 | + * | |
35 | + * <https://github.com/GNOME/glib/blob/master/gio/gpropertyaction.c> | |
36 | + * | |
37 | + */ | |
38 | + | |
39 | + #include "../private.h" | |
40 | + #include <pw3270/window.h> | |
41 | + #include <v3270.h> | |
42 | + | |
43 | + static void v3270PropertyAction_class_init(v3270PropertyActionClass *klass); | |
44 | + static void v3270PropertyAction_init(v3270PropertyAction *action); | |
45 | + | |
46 | + G_DEFINE_TYPE(v3270PropertyAction, v3270PropertyAction, PW3270_TYPE_ACTION); | |
47 | + | |
48 | + void v3270PropertyAction_class_init(v3270PropertyActionClass *klass) { | |
49 | + | |
50 | + } | |
51 | + | |
52 | + static void v3270PropertyAction_init(v3270PropertyAction *action) { | |
53 | + | |
54 | + } | |
55 | + | |
56 | + v3270PropertyAction * v3270_property_action_new(GtkWidget *widget, const gchar *property_name) { | |
57 | + | |
58 | + v3270PropertyAction * action = (v3270PropertyAction *) g_object_new(V3270_TYPE_PROPERTY_ACTION, NULL); | |
59 | + | |
60 | + action->pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(widget), property_name); | |
61 | + | |
62 | + if(~action->pspec->flags & G_PARAM_READABLE || ~action->pspec->flags & G_PARAM_WRITABLE || action->pspec->flags & G_PARAM_CONSTRUCT_ONLY) { | |
63 | + | |
64 | + g_critical( | |
65 | + "Property '%s::%s' must be readable, writable, and not construct-only", | |
66 | + G_OBJECT_TYPE_NAME(G_OBJECT(widget)), | |
67 | + property_name | |
68 | + ); | |
69 | + | |
70 | + return NULL; | |
71 | + } | |
72 | + | |
73 | + return action; | |
74 | + } | ... | ... |