Commit 03b30baf2871ad8890ee9a267a7684531100788e
1 parent
a8df5330
Exists in
master
and in
5 other branches
Ajustando linefeeds, iniciando modernizacao do dialogo de hostname
Showing
25 changed files
with
548 additions
and
526 deletions
Show diff stats
src/include/lib3270.h
@@ -567,7 +567,8 @@ | @@ -567,7 +567,8 @@ | ||
567 | * @param h Session handle. | 567 | * @param h Session handle. |
568 | * @param ix Toggle id. | 568 | * @param ix Toggle id. |
569 | * @param value New toggle state (non zero for true). | 569 | * @param value New toggle state (non zero for true). |
570 | - * * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on invalid toggle id | 570 | + * |
571 | + * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on invalid toggle id | ||
571 | */ | 572 | */ |
572 | LIB3270_EXPORT int lib3270_set_toggle(H3270 *h, LIB3270_TOGGLE ix, int value); | 573 | LIB3270_EXPORT int lib3270_set_toggle(H3270 *h, LIB3270_TOGGLE ix, int value); |
573 | 574 |
src/include/lib3270/log.h
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | #define trace(x, ...) // __VA_ARGS__ | 49 | #define trace(x, ...) // __VA_ARGS__ |
50 | 50 | ||
51 | #else | 51 | #else |
52 | - | 52 | + |
53 | #ifdef __cplusplus | 53 | #ifdef __cplusplus |
54 | extern "C" { | 54 | extern "C" { |
55 | #endif | 55 | #endif |
@@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
65 | #else | 65 | #else |
66 | #define trace(x, ...) // __VA_ARGS__ | 66 | #define trace(x, ...) // __VA_ARGS__ |
67 | #endif | 67 | #endif |
68 | - | 68 | + |
69 | #ifdef __cplusplus | 69 | #ifdef __cplusplus |
70 | } | 70 | } |
71 | #endif | 71 | #endif |
src/include/pw3270/hllapi.h
@@ -42,9 +42,9 @@ extern "C" { | @@ -42,9 +42,9 @@ extern "C" { | ||
42 | 42 | ||
43 | /* Function codes */ | 43 | /* Function codes */ |
44 | #define HLLAPI_CMD_CONNECTPS 1 /**< connect presentation space */ | 44 | #define HLLAPI_CMD_CONNECTPS 1 /**< connect presentation space */ |
45 | - #define HLLAPI_CMD_DISCONNECTPS 2 /**< disconnect presentation space */ | 45 | + #define HLLAPI_CMD_DISCONNECTPS 2 /**< disconnect presentation space */ |
46 | #define HLLAPI_CMD_INPUTSTRING 3 /**< send string */ | 46 | #define HLLAPI_CMD_INPUTSTRING 3 /**< send string */ |
47 | - #define HLLAPI_CMD_WAIT 4 /**< Wait if the session is waiting for a host response */ | 47 | + #define HLLAPI_CMD_WAIT 4 /**< Wait if the session is waiting for a host response */ |
48 | #define HLLAPI_CMD_COPYPS 5 /**< Copies the contents of the presentation space into a string buffer. */ | 48 | #define HLLAPI_CMD_COPYPS 5 /**< Copies the contents of the presentation space into a string buffer. */ |
49 | #define HLLAPI_CMD_SEARCHPS 6 /**< Search the presentation space for a specified string. */ | 49 | #define HLLAPI_CMD_SEARCHPS 6 /**< Search the presentation space for a specified string. */ |
50 | #define HLLAPI_CMD_QUERYCURSOR 7 /**< Determines the location of the cursor in the presentation space. */ | 50 | #define HLLAPI_CMD_QUERYCURSOR 7 /**< Determines the location of the cursor in the presentation space. */ |
@@ -58,49 +58,49 @@ extern "C" { | @@ -58,49 +58,49 @@ extern "C" { | ||
58 | 58 | ||
59 | 59 | ||
60 | /* Result codes */ | 60 | /* Result codes */ |
61 | - #define HLLAPI_STATUS_SUCCESS 0 /**< Good return code */ | 61 | + #define HLLAPI_STATUS_SUCCESS 0 /**< Good return code */ |
62 | #define HLLAPI_STATUS_DISCONNECTED 1 /**< The presentation space was not valid or not connected. */ | 62 | #define HLLAPI_STATUS_DISCONNECTED 1 /**< The presentation space was not valid or not connected. */ |
63 | - #define HLLAPI_STATUS_BAD_PARAMETER 2 /**< An incorrect option was specified. */ | ||
64 | - #define HLLAPI_STATUS_TIMEOUT 4 /**< Timeout */ | 63 | + #define HLLAPI_STATUS_BAD_PARAMETER 2 /**< An incorrect option was specified. */ |
64 | + #define HLLAPI_STATUS_TIMEOUT 4 /**< Timeout */ | ||
65 | #define HLLAPI_STATUS_KEYBOARD_LOCKED 5 /**< The keyboard is locked. */ | 65 | #define HLLAPI_STATUS_KEYBOARD_LOCKED 5 /**< The keyboard is locked. */ |
66 | - #define HLLAPI_STATUS_UNAVAILABLE 11 /**< Resource unavailable at this time */ | 66 | + #define HLLAPI_STATUS_UNAVAILABLE 11 /**< Resource unavailable at this time */ |
67 | #define HLLAPI_STATUS_SYSTEM_ERROR 9 /**< A system error occurred */ | 67 | #define HLLAPI_STATUS_SYSTEM_ERROR 9 /**< A system error occurred */ |
68 | 68 | ||
69 | #define HLLAPI_STATUS_WAITING HLLAPI_STATUS_TIMEOUT | 69 | #define HLLAPI_STATUS_WAITING HLLAPI_STATUS_TIMEOUT |
70 | 70 | ||
71 | #ifdef _WIN32 | 71 | #ifdef _WIN32 |
72 | - // http://www.mingw.org/wiki/Visual_Basic_DLL | ||
73 | - __declspec (dllexport) int __stdcall hllapi(const LPWORD func, LPSTR str, LPWORD length, LPWORD rc); | ||
74 | - | 72 | + // http://www.mingw.org/wiki/Visual_Basic_DLL |
73 | + __declspec (dllexport) int __stdcall hllapi(const LPWORD func, LPSTR str, LPWORD length, LPWORD rc); | ||
74 | + | ||
75 | __declspec (dllexport) DWORD __stdcall hllapi_init(LPSTR mode); | 75 | __declspec (dllexport) DWORD __stdcall hllapi_init(LPSTR mode); |
76 | - __declspec (dllexport) DWORD __stdcall hllapi_deinit(void); | ||
77 | - | ||
78 | - __declspec (dllexport) DWORD __stdcall hllapi_get_revision(void); | ||
79 | - __declspec (dllexport) DWORD __stdcall hllapi_get_datadir(LPSTR datadir); | ||
80 | - | ||
81 | - __declspec (dllexport) DWORD __stdcall hllapi_connect(LPSTR uri, WORD wait); | ||
82 | - __declspec (dllexport) DWORD __stdcall hllapi_disconnect(void); | ||
83 | - __declspec (dllexport) DWORD __stdcall hllapi_get_message_id(void); | ||
84 | - __declspec (dllexport) DWORD __stdcall hllapi_is_connected(void); | ||
85 | - __declspec (dllexport) DWORD __stdcall hllapi_get_state(void); | ||
86 | - __declspec (dllexport) DWORD __stdcall hllapi_get_screen_at(WORD row, WORD col, LPSTR buffer); | ||
87 | - __declspec (dllexport) DWORD __stdcall hllapi_get_screen(WORD pos, LPSTR buffer, WORD len); | ||
88 | - __declspec (dllexport) DWORD __stdcall hllapi_enter(void); | ||
89 | - __declspec (dllexport) DWORD __stdcall hllapi_set_text_at(WORD row, WORD col, LPSTR text); | 76 | + __declspec (dllexport) DWORD __stdcall hllapi_deinit(void); |
77 | + | ||
78 | + __declspec (dllexport) DWORD __stdcall hllapi_get_revision(void); | ||
79 | + __declspec (dllexport) DWORD __stdcall hllapi_get_datadir(LPSTR datadir); | ||
80 | + | ||
81 | + __declspec (dllexport) DWORD __stdcall hllapi_connect(LPSTR uri, WORD wait); | ||
82 | + __declspec (dllexport) DWORD __stdcall hllapi_disconnect(void); | ||
83 | + __declspec (dllexport) DWORD __stdcall hllapi_get_message_id(void); | ||
84 | + __declspec (dllexport) DWORD __stdcall hllapi_is_connected(void); | ||
85 | + __declspec (dllexport) DWORD __stdcall hllapi_get_state(void); | ||
86 | + __declspec (dllexport) DWORD __stdcall hllapi_get_screen_at(WORD row, WORD col, LPSTR buffer); | ||
87 | + __declspec (dllexport) DWORD __stdcall hllapi_get_screen(WORD pos, LPSTR buffer, WORD len); | ||
88 | + __declspec (dllexport) DWORD __stdcall hllapi_enter(void); | ||
89 | + __declspec (dllexport) DWORD __stdcall hllapi_set_text_at(WORD row, WORD col, LPSTR text); | ||
90 | __declspec (dllexport) DWORD __stdcall hllapi_cmp_text_at(WORD row, WORD col, LPSTR text); | 90 | __declspec (dllexport) DWORD __stdcall hllapi_cmp_text_at(WORD row, WORD col, LPSTR text); |
91 | __declspec (dllexport) DWORD __stdcall hllapi_emulate_input(LPSTR buffer, WORD len, WORD pasting); | 91 | __declspec (dllexport) DWORD __stdcall hllapi_emulate_input(LPSTR buffer, WORD len, WORD pasting); |
92 | - __declspec (dllexport) DWORD __stdcall hllapi_wait_for_ready(WORD seconds); | ||
93 | - __declspec (dllexport) DWORD __stdcall hllapi_wait(WORD seconds); | ||
94 | - __declspec (dllexport) DWORD __stdcall hllapi_pfkey(WORD key); | ||
95 | - __declspec (dllexport) DWORD __stdcall hllapi_pakey(WORD key); | ||
96 | - __declspec (dllexport) DWORD __stdcall hllapi_setcursor(WORD key); | ||
97 | - __declspec (dllexport) DWORD __stdcall hllapi_getcursor(); | ||
98 | - __declspec (dllexport) DWORD __stdcall hllapi_erase_eof(void); | ||
99 | - __declspec (dllexport) DWORD __stdcall hllapi_print(void); | ||
100 | - | ||
101 | -#else | ||
102 | - | ||
103 | - #error NOT IMPLEMENTED | 92 | + __declspec (dllexport) DWORD __stdcall hllapi_wait_for_ready(WORD seconds); |
93 | + __declspec (dllexport) DWORD __stdcall hllapi_wait(WORD seconds); | ||
94 | + __declspec (dllexport) DWORD __stdcall hllapi_pfkey(WORD key); | ||
95 | + __declspec (dllexport) DWORD __stdcall hllapi_pakey(WORD key); | ||
96 | + __declspec (dllexport) DWORD __stdcall hllapi_setcursor(WORD key); | ||
97 | + __declspec (dllexport) DWORD __stdcall hllapi_getcursor(); | ||
98 | + __declspec (dllexport) DWORD __stdcall hllapi_erase_eof(void); | ||
99 | + __declspec (dllexport) DWORD __stdcall hllapi_print(void); | ||
100 | + | ||
101 | +#else | ||
102 | + | ||
103 | + #error NOT IMPLEMENTED | ||
104 | 104 | ||
105 | #endif // _WIN32 | 105 | #endif // _WIN32 |
106 | 106 |
src/include/pw3270/ipcpackets.h
@@ -27,138 +27,141 @@ | @@ -27,138 +27,141 @@ | ||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | - typedef enum _hllapi_packet | ||
31 | - { | ||
32 | - HLLAPI_PACKET_CONNECT, | ||
33 | - HLLAPI_PACKET_DISCONNECT, | ||
34 | - HLLAPI_PACKET_GET_PROGRAM_MESSAGE, | ||
35 | - HLLAPI_PACKET_GET_TEXT_AT_OFFSET, | ||
36 | - HLLAPI_PACKET_GET_TEXT_AT, | ||
37 | - HLLAPI_PACKET_SET_TEXT_AT, | ||
38 | - HLLAPI_PACKET_CMP_TEXT_AT, | ||
39 | - HLLAPI_PACKET_ENTER, | ||
40 | - HLLAPI_PACKET_PFKEY, | ||
41 | - HLLAPI_PACKET_PAKEY, | ||
42 | - HLLAPI_PACKET_SET_CURSOR_POSITION, | ||
43 | - HLLAPI_PACKET_GET_CURSOR_POSITION, | ||
44 | - HLLAPI_PACKET_INPUT_STRING, | 30 | + typedef enum _hllapi_packet |
31 | + { | ||
32 | + HLLAPI_PACKET_CONNECT, | ||
33 | + HLLAPI_PACKET_DISCONNECT, | ||
34 | + HLLAPI_PACKET_GET_PROGRAM_MESSAGE, | ||
35 | + HLLAPI_PACKET_GET_TEXT_AT_OFFSET, | ||
36 | + HLLAPI_PACKET_GET_TEXT_AT, | ||
37 | + HLLAPI_PACKET_SET_TEXT_AT, | ||
38 | + HLLAPI_PACKET_CMP_TEXT_AT, | ||
39 | + HLLAPI_PACKET_ENTER, | ||
40 | + HLLAPI_PACKET_PFKEY, | ||
41 | + HLLAPI_PACKET_PAKEY, | ||
42 | + HLLAPI_PACKET_SET_CURSOR_POSITION, | ||
43 | + HLLAPI_PACKET_GET_CURSOR_POSITION, | ||
44 | + HLLAPI_PACKET_INPUT_STRING, | ||
45 | HLLAPI_PACKET_IS_CONNECTED, | 45 | HLLAPI_PACKET_IS_CONNECTED, |
46 | HLLAPI_PACKET_SET_CURSOR, | 46 | HLLAPI_PACKET_SET_CURSOR, |
47 | HLLAPI_PACKET_GET_CURSOR, | 47 | HLLAPI_PACKET_GET_CURSOR, |
48 | HLLAPI_PACKET_EMULATE_INPUT, | 48 | HLLAPI_PACKET_EMULATE_INPUT, |
49 | HLLAPI_PACKET_ERASE_EOF, | 49 | HLLAPI_PACKET_ERASE_EOF, |
50 | - HLLAPI_PACKET_PRINT, | ||
51 | - HLLAPI_PACKET_GET_CSTATE, | ||
52 | - HLLAPI_PACKET_IS_READY, HLLAPI_PACKET_SET_TOGGLE, | ||
53 | - HLLAPI_PACKET_FIELD_START, | 50 | + HLLAPI_PACKET_PRINT, |
51 | + HLLAPI_PACKET_GET_CSTATE, | ||
52 | + HLLAPI_PACKET_IS_READY, | ||
53 | + HLLAPI_PACKET_SET_TOGGLE, | ||
54 | + HLLAPI_PACKET_FIELD_START, | ||
54 | HLLAPI_PACKET_FIELD_LEN, | 55 | HLLAPI_PACKET_FIELD_LEN, |
55 | HLLAPI_PACKET_NEXT_UNPROTECTED, | 56 | HLLAPI_PACKET_NEXT_UNPROTECTED, |
56 | - HLLAPI_PACKET_QUIT, | ||
57 | - | ||
58 | - HLLAPI_PACKET_INVALID | ||
59 | - | ||
60 | - } HLLAPI_PACKET; | ||
61 | - | ||
62 | -#pragma pack(1) | ||
63 | - | ||
64 | -struct hllapi_packet_result | ||
65 | -{ | ||
66 | - int rc; | ||
67 | -}; | ||
68 | - | ||
69 | -struct hllapi_packet_text_result | ||
70 | -{ | ||
71 | - int rc; | ||
72 | - char text[1]; | ||
73 | -}; | ||
74 | - | ||
75 | -struct hllapi_packet_query | ||
76 | -{ | ||
77 | - unsigned char packet_id; | ||
78 | -}; | ||
79 | - | ||
80 | -struct hllapi_packet_connect | ||
81 | -{ | ||
82 | - unsigned char packet_id; | ||
83 | - unsigned char wait; | ||
84 | - char hostname[1]; | ||
85 | -}; | ||
86 | - | ||
87 | -struct hllapi_packet_keycode | ||
88 | -{ | ||
89 | - unsigned char packet_id; | ||
90 | - unsigned short keycode; | ||
91 | -}; | ||
92 | - | ||
93 | -struct hllapi_packet_cursor | ||
94 | -{ | ||
95 | - unsigned char packet_id; | ||
96 | - unsigned short row; | ||
97 | - unsigned short col; | ||
98 | -}; | ||
99 | - | ||
100 | -struct hllapi_packet_text | ||
101 | -{ | ||
102 | - unsigned char packet_id; | ||
103 | - char text[1]; | ||
104 | -}; | ||
105 | - | ||
106 | -struct hllapi_packet_at | ||
107 | -{ | ||
108 | - unsigned char packet_id; | ||
109 | - unsigned short row; | ||
110 | - unsigned short col; | ||
111 | - unsigned short len; | ||
112 | -}; | ||
113 | - | ||
114 | -struct hllapi_packet_text_at | ||
115 | -{ | ||
116 | - unsigned char packet_id; | ||
117 | - unsigned short row; | ||
118 | - unsigned short col; | ||
119 | - char text[1]; | ||
120 | -}; | ||
121 | - | ||
122 | -struct hllapi_packet_query_at | ||
123 | -{ | ||
124 | - unsigned char packet_id; | ||
125 | - unsigned short row; | ||
126 | - unsigned short col; | ||
127 | - unsigned short len; | ||
128 | -}; | ||
129 | - | ||
130 | -struct hllapi_packet_wait | ||
131 | -{ | ||
132 | - unsigned char packet_id; | ||
133 | - int timeout; | ||
134 | -}; | ||
135 | - | ||
136 | -struct hllapi_packet_addr | ||
137 | -{ | ||
138 | - unsigned char packet_id; | ||
139 | - unsigned short addr; | ||
140 | -}; | ||
141 | - | ||
142 | -struct hllapi_packet_query_offset | ||
143 | -{ | ||
144 | - unsigned char packet_id; | ||
145 | - unsigned short addr; | ||
146 | - unsigned short len; | ||
147 | -}; | ||
148 | - | ||
149 | -struct hllapi_packet_emulate_input | ||
150 | -{ | 57 | + HLLAPI_PACKET_QUIT, |
58 | + | ||
59 | + HLLAPI_PACKET_INVALID | ||
60 | + | ||
61 | + } HLLAPI_PACKET; | ||
62 | + | ||
63 | +#pragma pack(1) | ||
64 | + | ||
65 | +struct hllapi_packet_result | ||
66 | +{ | ||
67 | + int rc; | ||
68 | +}; | ||
69 | + | ||
70 | +struct hllapi_packet_text_result | ||
71 | +{ | ||
72 | + int rc; | ||
73 | + char text[1]; | ||
74 | +}; | ||
75 | + | ||
76 | +struct hllapi_packet_query | ||
77 | +{ | ||
78 | + unsigned char packet_id; | ||
79 | +}; | ||
80 | + | ||
81 | +struct hllapi_packet_connect | ||
82 | +{ | ||
83 | + unsigned char packet_id; | ||
84 | + unsigned char wait; | ||
85 | + char hostname[1]; | ||
86 | +}; | ||
87 | + | ||
88 | +struct hllapi_packet_keycode | ||
89 | +{ | ||
90 | + unsigned char packet_id; | ||
91 | + unsigned short keycode; | ||
92 | +}; | ||
93 | + | ||
94 | +struct hllapi_packet_cursor | ||
95 | +{ | ||
96 | + unsigned char packet_id; | ||
97 | + unsigned short row; | ||
98 | + unsigned short col; | ||
99 | +}; | ||
100 | + | ||
101 | +struct hllapi_packet_text | ||
102 | +{ | ||
103 | + unsigned char packet_id; | ||
104 | + char text[1]; | ||
105 | +}; | ||
106 | + | ||
107 | +struct hllapi_packet_at | ||
108 | +{ | ||
109 | + unsigned char packet_id; | ||
110 | + unsigned short row; | ||
111 | + unsigned short col; | ||
112 | + unsigned short len; | ||
113 | +}; | ||
114 | + | ||
115 | +struct hllapi_packet_text_at | ||
116 | +{ | ||
117 | + unsigned char packet_id; | ||
118 | + unsigned short row; | ||
119 | + unsigned short col; | ||
120 | + char text[1]; | ||
121 | +}; | ||
122 | + | ||
123 | +struct hllapi_packet_query_at | ||
124 | +{ | ||
125 | + unsigned char packet_id; | ||
126 | + unsigned short row; | ||
127 | + unsigned short col; | ||
128 | + unsigned short len; | ||
129 | +}; | ||
130 | + | ||
131 | +struct hllapi_packet_wait | ||
132 | +{ | ||
133 | + unsigned char packet_id; | ||
134 | + int timeout; | ||
135 | +}; | ||
136 | + | ||
137 | +struct hllapi_packet_addr | ||
138 | +{ | ||
139 | + unsigned char packet_id; | ||
140 | + unsigned short addr; | ||
141 | +}; | ||
142 | + | ||
143 | +struct hllapi_packet_query_offset | ||
144 | +{ | ||
145 | + unsigned char packet_id; | ||
146 | + unsigned short addr; | ||
147 | + unsigned short len; | ||
148 | +}; | ||
149 | + | ||
150 | +struct hllapi_packet_emulate_input | ||
151 | +{ | ||
151 | unsigned char packet_id; | 152 | unsigned char packet_id; |
152 | unsigned short len; | 153 | unsigned short len; |
153 | unsigned char pasting; | 154 | unsigned char pasting; |
154 | - char text[1]; | ||
155 | -}; | ||
156 | - struct hllapi_packet_set | ||
157 | -{ | 155 | + char text[1]; |
156 | +}; | ||
157 | + | ||
158 | +struct hllapi_packet_set | ||
159 | +{ | ||
158 | unsigned char packet_id; | 160 | unsigned char packet_id; |
159 | - unsigned short id; unsigned short value; | ||
160 | -}; | ||
161 | - | ||
162 | - | ||
163 | -#pragma pack() | ||
164 | - | 161 | + unsigned short id; |
162 | + unsigned short value; | ||
163 | +}; | ||
164 | + | ||
165 | + | ||
166 | +#pragma pack() | ||
167 | + |
src/include/pw3270/v3270.h
@@ -175,7 +175,7 @@ | @@ -175,7 +175,7 @@ | ||
175 | LIB3270_EXPORT gchar * v3270_get_copy(GtkWidget *widget); | 175 | LIB3270_EXPORT gchar * v3270_get_copy(GtkWidget *widget); |
176 | LIB3270_EXPORT void v3270_set_copy(GtkWidget *widget, const gchar *text); | 176 | LIB3270_EXPORT void v3270_set_copy(GtkWidget *widget, const gchar *text); |
177 | 177 | ||
178 | - LIB3270_EXPORT int v3270_run_script(GtkWidget *widget, const gchar *script); | 178 | + LIB3270_EXPORT int v3270_run_script(GtkWidget *widget, const gchar *script); |
179 | 179 | ||
180 | LIB3270_EXPORT gchar * v3270_get_text(GtkWidget *widget,int offset, int len); | 180 | LIB3270_EXPORT gchar * v3270_get_text(GtkWidget *widget,int offset, int len); |
181 | LIB3270_EXPORT gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); | 181 | LIB3270_EXPORT gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); |
src/lib3270/host.c
@@ -496,7 +496,7 @@ static void try_reconnect(H3270 *session) | @@ -496,7 +496,7 @@ static void try_reconnect(H3270 *session) | ||
496 | 496 | ||
497 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) | 497 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) |
498 | { | 498 | { |
499 | - host_disconnect(h,0); | 499 | + host_disconnect(h,0); |
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 |
src/lib3270/kybd.c
@@ -1007,8 +1007,8 @@ LIB3270_EXPORT int lib3270_input_string(H3270 *hSession, const unsigned char *st | @@ -1007,8 +1007,8 @@ LIB3270_EXPORT int lib3270_input_string(H3270 *hSession, const unsigned char *st | ||
1007 | str++; | 1007 | str++; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | - screen_update(hSession,0,hSession->rows*hSession->cols); | ||
1011 | - | 1010 | + screen_update(hSession,0,hSession->rows*hSession->cols); |
1011 | + | ||
1012 | return 0; | 1012 | return 0; |
1013 | } | 1013 | } |
1014 | 1014 |
src/lib3270/macros.c
@@ -330,8 +330,8 @@ | @@ -330,8 +330,8 @@ | ||
330 | int f; | 330 | int f; |
331 | 331 | ||
332 | CHECK_SESSION_HANDLE(session); | 332 | CHECK_SESSION_HANDLE(session); |
333 | - | ||
334 | - trace("macro(%s)",argv[0]); | 333 | + |
334 | + trace("macro(%s)",argv[0]); | ||
335 | 335 | ||
336 | // Get the number of arguments | 336 | // Get the number of arguments |
337 | for(argc = 0; argv[argc]; argc++); | 337 | for(argc = 0; argv[argc]; argc++); |
src/lib3270/screen.c
@@ -388,8 +388,8 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | @@ -388,8 +388,8 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | ||
388 | LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) | 388 | LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) |
389 | { | 389 | { |
390 | CHECK_SESSION_HANDLE(h); | 390 | CHECK_SESSION_HANDLE(h); |
391 | - | ||
392 | - trace("%s(%d)",__FUNCTION__,baddr); | 391 | + |
392 | + trace("%s(%d)",__FUNCTION__,baddr); | ||
393 | 393 | ||
394 | if(h->selected && !lib3270_get_toggle(h,LIB3270_TOGGLE_KEEP_SELECTED)) | 394 | if(h->selected && !lib3270_get_toggle(h,LIB3270_TOGGLE_KEEP_SELECTED)) |
395 | lib3270_unselect(h); | 395 | lib3270_unselect(h); |
src/lib3270/selection.c
@@ -488,9 +488,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -488,9 +488,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
488 | } | 488 | } |
489 | 489 | ||
490 | maxlen = (h->rows * (h->cols+1)) - offset; | 490 | maxlen = (h->rows * (h->cols+1)) - offset; |
491 | - if(maxlen <= 0 || offset < 0) | ||
492 | - { | ||
493 | - errno = EINVAL; | 491 | + if(maxlen <= 0 || offset < 0) |
492 | + { | ||
493 | + errno = EINVAL; | ||
494 | return NULL; | 494 | return NULL; |
495 | } | 495 | } |
496 | 496 |
src/lib3270/toggles.c
@@ -105,9 +105,11 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG | @@ -105,9 +105,11 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG | ||
105 | session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_names[ix]); | 105 | session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_names[ix]); |
106 | 106 | ||
107 | } | 107 | } |
108 | - LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) | 108 | + |
109 | +LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) | ||
109 | { | 110 | { |
110 | - char v = value ? True : False; struct lib3270_toggle * t; | 111 | + char v = value ? True : False; |
112 | + struct lib3270_toggle * t; | ||
111 | 113 | ||
112 | CHECK_SESSION_HANDLE(session); | 114 | CHECK_SESSION_HANDLE(session); |
113 | 115 | ||
@@ -118,9 +120,11 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG | @@ -118,9 +120,11 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG | ||
118 | 120 | ||
119 | if(v == t->value) | 121 | if(v == t->value) |
120 | return 0; | 122 | return 0; |
121 | - t->value = v; | ||
122 | 123 | ||
123 | - toggle_notify(session,t,ix); return 1; | 124 | + t->value = v; |
125 | + | ||
126 | + toggle_notify(session,t,ix); | ||
127 | + return 1; | ||
124 | } | 128 | } |
125 | 129 | ||
126 | LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | 130 | LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) |
src/plugins/rx3270/rx3270.h
@@ -33,15 +33,15 @@ | @@ -33,15 +33,15 @@ | ||
33 | 33 | ||
34 | #include <lib3270/config.h> | 34 | #include <lib3270/config.h> |
35 | 35 | ||
36 | - #ifdef HAVE_OOREXXAPI_H | ||
37 | - #ifdef WIN32 | ||
38 | - #define _SSIZE_T_DEFINED | 36 | + #ifdef HAVE_OOREXXAPI_H |
37 | + #ifdef WIN32 | ||
38 | + #define _SSIZE_T_DEFINED | ||
39 | #endif | 39 | #endif |
40 | - #include <oorexxapi.h> | 40 | + #include <oorexxapi.h> |
41 | #else | 41 | #else |
42 | #error Only Rexx 4 | 42 | #error Only Rexx 4 |
43 | #endif | 43 | #endif |
44 | - | 44 | + |
45 | #include <errno.h> | 45 | #include <errno.h> |
46 | #include <stdio.h> | 46 | #include <stdio.h> |
47 | #include <lib3270.h> | 47 | #include <lib3270.h> |
@@ -101,7 +101,8 @@ | @@ -101,7 +101,8 @@ | ||
101 | REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); | 101 | REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); |
102 | REXX_METHOD_PROTOTYPE(rx3270_method_enter); | 102 | REXX_METHOD_PROTOTYPE(rx3270_method_enter); |
103 | REXX_METHOD_PROTOTYPE(rx3270_method_pfkey); | 103 | REXX_METHOD_PROTOTYPE(rx3270_method_pfkey); |
104 | - REXX_METHOD_PROTOTYPE(rx3270_method_pakey); REXX_METHOD_PROTOTYPE(rx3270_method_get_text); | 104 | + REXX_METHOD_PROTOTYPE(rx3270_method_pakey); |
105 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_text); | ||
105 | REXX_METHOD_PROTOTYPE(rx3270_method_get_text_at); | 106 | REXX_METHOD_PROTOTYPE(rx3270_method_get_text_at); |
106 | REXX_METHOD_PROTOTYPE(rx3270_method_set_text_at); | 107 | REXX_METHOD_PROTOTYPE(rx3270_method_set_text_at); |
107 | REXX_METHOD_PROTOTYPE(rx3270_method_cmp_text_at); | 108 | REXX_METHOD_PROTOTYPE(rx3270_method_cmp_text_at); |
@@ -130,8 +131,8 @@ | @@ -130,8 +131,8 @@ | ||
130 | 131 | ||
131 | /* | 132 | /* |
132 | #if defined (HAVE_GNUC_VISIBILITY) | 133 | #if defined (HAVE_GNUC_VISIBILITY) |
133 | - class __attribute__((visibility("default"))) rx3270 | ||
134 | -#elif defined(WIN32) | 134 | + class __attribute__((visibility("default"))) rx3270 |
135 | +#elif defined(WIN32) | ||
135 | class __declspec (dllexport) rx3270 | 136 | class __declspec (dllexport) rx3270 |
136 | #else | 137 | #else |
137 | #error NOT_IMPLEMENTED | 138 | #error NOT_IMPLEMENTED |
@@ -209,7 +210,8 @@ | @@ -209,7 +210,8 @@ | ||
209 | virtual int pfkey(int key) = 0; | 210 | virtual int pfkey(int key) = 0; |
210 | virtual int pakey(int key) = 0; | 211 | virtual int pakey(int key) = 0; |
211 | 212 | ||
212 | - virtual char * get_text_at(int row, int col, size_t sz) = 0; virtual char * get_text(int baddr, size_t len) = 0; | 213 | + virtual char * get_text_at(int row, int col, size_t sz) = 0; |
214 | + virtual char * get_text(int baddr, size_t len) = 0; | ||
213 | virtual int cmp_text_at(int row, int col, const char *text) = 0; | 215 | virtual int cmp_text_at(int row, int col, const char *text) = 0; |
214 | virtual int set_text_at(int row, int col, const char *str) = 0; | 216 | virtual int set_text_at(int row, int col, const char *str) = 0; |
215 | virtual int emulate_input(const char *str) = 0; | 217 | virtual int emulate_input(const char *str) = 0; |
src/pw3270/actions.c
@@ -860,10 +860,10 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | @@ -860,10 +860,10 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | ||
860 | 860 | ||
861 | return action; | 861 | return action; |
862 | } | 862 | } |
863 | - | 863 | + |
864 | static void action_text_script(GtkAction *action, GtkWidget *widget) | 864 | static void action_text_script(GtkAction *action, GtkWidget *widget) |
865 | -{ | ||
866 | - v3270_run_script(widget,g_object_get_data(G_OBJECT(action),"script_text")); | 865 | +{ |
866 | + v3270_run_script(widget,g_object_get_data(G_OBJECT(action),"script_text")); | ||
867 | } | 867 | } |
868 | 868 | ||
869 | void ui_connect_text_script(GtkWidget *widget, GtkAction *action, const gchar *script_text, GError **error) | 869 | void ui_connect_text_script(GtkWidget *widget, GtkAction *action, const gchar *script_text, GError **error) |
@@ -871,7 +871,7 @@ void ui_connect_text_script(GtkWidget *widget, GtkAction *action, const gchar *s | @@ -871,7 +871,7 @@ void ui_connect_text_script(GtkWidget *widget, GtkAction *action, const gchar *s | ||
871 | gchar *base = g_strstrip(g_strdup(script_text)); | 871 | gchar *base = g_strstrip(g_strdup(script_text)); |
872 | gchar *text = g_strdup(base); | 872 | gchar *text = g_strdup(base); |
873 | g_free(base); | 873 | g_free(base); |
874 | - | 874 | + |
875 | gtk_action_set_sensitive(action,TRUE); | 875 | gtk_action_set_sensitive(action,TRUE); |
876 | g_object_set_data_full(G_OBJECT(action),"script_text",text,g_free); | 876 | g_object_set_data_full(G_OBJECT(action),"script_text",text,g_free); |
877 | g_signal_connect(action,"activate",G_CALLBACK(action_text_script),widget); | 877 | g_signal_connect(action,"activate",G_CALLBACK(action_text_script),widget); |
src/pw3270/common/config.c
src/pw3270/filetransfer.c
@@ -129,11 +129,11 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg) | @@ -129,11 +129,11 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg) | ||
129 | const gchar *remote = gtk_entry_get_text(GTK_ENTRY(dlg->file[1])); | 129 | const gchar *remote = gtk_entry_get_text(GTK_ENTRY(dlg->file[1])); |
130 | int f; | 130 | int f; |
131 | 131 | ||
132 | - if(!*remote) | 132 | + if(!*remote) |
133 | return FALSE; | 133 | return FALSE; |
134 | - | 134 | + |
135 | if(!(dlg->option&LIB3270_FT_OPTION_RECEIVE)) | 135 | if(!(dlg->option&LIB3270_FT_OPTION_RECEIVE)) |
136 | - { | 136 | + { |
137 | // Sending file, should have local and remote filenames | 137 | // Sending file, should have local and remote filenames |
138 | if(!( *local && g_file_test(local,G_FILE_TEST_EXISTS))) | 138 | if(!( *local && g_file_test(local,G_FILE_TEST_EXISTS))) |
139 | return FALSE; | 139 | return FALSE; |
@@ -156,34 +156,34 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg) | @@ -156,34 +156,34 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg) | ||
156 | 156 | ||
157 | return TRUE; | 157 | return TRUE; |
158 | } | 158 | } |
159 | - | 159 | + |
160 | static void check_remote_filename(GtkEditable *editable, struct ftdialog *dlg) | 160 | static void check_remote_filename(GtkEditable *editable, struct ftdialog *dlg) |
161 | -{ | ||
162 | -#if GTK_CHECK_VERSION(3,2,0) | ||
163 | - if(!gtk_entry_get_text_length(dlg->file[0])) | ||
164 | - { | ||
165 | - gchar *basename = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(editable))); | ||
166 | - gchar *filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),basename,NULL); | ||
167 | - gtk_entry_set_placeholder_text(dlg->file[0],filename); | ||
168 | - g_free(filename); | ||
169 | - g_free(basename); | ||
170 | - } | ||
171 | -#endif // GTK(3,2) | 161 | +{ |
162 | +#if GTK_CHECK_VERSION(3,2,0) | ||
163 | + if(!gtk_entry_get_text_length(dlg->file[0])) | ||
164 | + { | ||
165 | + gchar *basename = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(editable))); | ||
166 | + gchar *filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),basename,NULL); | ||
167 | + gtk_entry_set_placeholder_text(dlg->file[0],filename); | ||
168 | + g_free(filename); | ||
169 | + g_free(basename); | ||
170 | + } | ||
171 | +#endif // GTK(3,2) | ||
172 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(editable,dlg)); | 172 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(editable,dlg)); |
173 | -} | 173 | +} |
174 | 174 | ||
175 | static void check_entry(GtkEditable *editable, struct ftdialog *dlg) | 175 | static void check_entry(GtkEditable *editable, struct ftdialog *dlg) |
176 | -{ | 176 | +{ |
177 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(editable,dlg)); | 177 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(editable,dlg)); |
178 | } | 178 | } |
179 | - | ||
180 | -static GtkEntry * add_filename_entry(GObject *action, int ix, int row, struct ftdialog *dlg, GtkTable *table) | ||
181 | -{ | 179 | + |
180 | +static GtkEntry * add_filename_entry(GObject *action, int ix, int row, struct ftdialog *dlg, GtkTable *table) | ||
181 | +{ | ||
182 | static const gchar * label_text[] = { N_( "_Local file name:" ), N_( "_Host file name:" ) }; | 182 | static const gchar * label_text[] = { N_( "_Local file name:" ), N_( "_Host file name:" ) }; |
183 | - static const gchar * attr[] = { "local", "remote" }; | ||
184 | - | ||
185 | - GtkWidget * entry = gtk_entry_new(); | ||
186 | - GtkWidget * label = gtk_label_new_with_mnemonic(gettext(label_text[ix])); | 183 | + static const gchar * attr[] = { "local", "remote" }; |
184 | + | ||
185 | + GtkWidget * entry = gtk_entry_new(); | ||
186 | + GtkWidget * label = gtk_label_new_with_mnemonic(gettext(label_text[ix])); | ||
187 | gchar * val; | 187 | gchar * val; |
188 | 188 | ||
189 | gtk_misc_set_alignment(GTK_MISC(label),0,.5); | 189 | gtk_misc_set_alignment(GTK_MISC(label),0,.5); |
@@ -200,9 +200,9 @@ static GtkEntry * add_filename_entry(GObject *action, int ix, int row, struct ft | @@ -200,9 +200,9 @@ static GtkEntry * add_filename_entry(GObject *action, int ix, int row, struct ft | ||
200 | gtk_label_set_mnemonic_widget(GTK_LABEL(label),entry); | 200 | gtk_label_set_mnemonic_widget(GTK_LABEL(label),entry); |
201 | 201 | ||
202 | gtk_table_attach(GTK_TABLE(table),entry,1,3,row,row+1,GTK_EXPAND|GTK_SHRINK|GTK_FILL,GTK_EXPAND|GTK_SHRINK|GTK_FILL,2,2); | 202 | gtk_table_attach(GTK_TABLE(table),entry,1,3,row,row+1,GTK_EXPAND|GTK_SHRINK|GTK_FILL,GTK_EXPAND|GTK_SHRINK|GTK_FILL,2,2); |
203 | - | ||
204 | - return GTK_ENTRY(entry); | ||
205 | -} | 203 | + |
204 | + return GTK_ENTRY(entry); | ||
205 | +} | ||
206 | 206 | ||
207 | static void add_file_fields(GObject *action, struct ftdialog *dlg) | 207 | static void add_file_fields(GObject *action, struct ftdialog *dlg) |
208 | { | 208 | { |
@@ -210,26 +210,26 @@ static void add_file_fields(GObject *action, struct ftdialog *dlg) | @@ -210,26 +210,26 @@ static void add_file_fields(GObject *action, struct ftdialog *dlg) | ||
210 | GtkWidget * widget; | 210 | GtkWidget * widget; |
211 | 211 | ||
212 | gtk_container_set_border_width(GTK_CONTAINER(table),2); | 212 | gtk_container_set_border_width(GTK_CONTAINER(table),2); |
213 | - | ||
214 | - if(dlg->option&LIB3270_FT_OPTION_RECEIVE) | ||
215 | - { | ||
216 | - // Receiving file, first the remote filename | ||
217 | - dlg->file[1] = add_filename_entry(action,1,0,dlg,table); | ||
218 | - | ||
219 | - dlg->file[0] = add_filename_entry(action,0,1,dlg,table); | 213 | + |
214 | + if(dlg->option&LIB3270_FT_OPTION_RECEIVE) | ||
215 | + { | ||
216 | + // Receiving file, first the remote filename | ||
217 | + dlg->file[1] = add_filename_entry(action,1,0,dlg,table); | ||
218 | + | ||
219 | + dlg->file[0] = add_filename_entry(action,0,1,dlg,table); | ||
220 | widget = gtk_button_new_with_mnemonic( _( "_Browse" ) ); | 220 | widget = gtk_button_new_with_mnemonic( _( "_Browse" ) ); |
221 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg); | 221 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg); |
222 | gtk_table_attach(GTK_TABLE(table),widget,3,4,1,2,0,0,2,2); | 222 | gtk_table_attach(GTK_TABLE(table),widget,3,4,1,2,0,0,2,2); |
223 | - } | ||
224 | - else | ||
225 | - { | ||
226 | - // Sending file, first the local filename | ||
227 | - dlg->file[0] = add_filename_entry(action,0,0,dlg,table); | 223 | + } |
224 | + else | ||
225 | + { | ||
226 | + // Sending file, first the local filename | ||
227 | + dlg->file[0] = add_filename_entry(action,0,0,dlg,table); | ||
228 | widget = gtk_button_new_with_mnemonic( _( "_Browse" ) ); | 228 | widget = gtk_button_new_with_mnemonic( _( "_Browse" ) ); |
229 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg); | 229 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg); |
230 | gtk_table_attach(GTK_TABLE(table),widget,3,4,0,1,0,0,2,2); | 230 | gtk_table_attach(GTK_TABLE(table),widget,3,4,0,1,0,0,2,2); |
231 | - | ||
232 | - dlg->file[1] = add_filename_entry(action,1,1,dlg,table); | 231 | + |
232 | + dlg->file[1] = add_filename_entry(action,1,1,dlg,table); | ||
233 | } | 233 | } |
234 | 234 | ||
235 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg->dialog))),GTK_WIDGET(table),FALSE,FALSE,2); | 235 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg->dialog))),GTK_WIDGET(table),FALSE,FALSE,2); |
@@ -394,19 +394,19 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | @@ -394,19 +394,19 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | ||
394 | H3270FT * ft = NULL; | 394 | H3270FT * ft = NULL; |
395 | const char * msg = NULL; | 395 | const char * msg = NULL; |
396 | int f; | 396 | int f; |
397 | - int parm[G_N_ELEMENTS(dlg->parm)]; | ||
398 | - const gchar * remote_filename; | ||
399 | - | 397 | + int parm[G_N_ELEMENTS(dlg->parm)]; |
398 | + const gchar * remote_filename; | ||
399 | + | ||
400 | g_signal_connect(G_OBJECT(dlg->file[0]),"changed",G_CALLBACK(check_entry),dlg); | 400 | g_signal_connect(G_OBJECT(dlg->file[0]),"changed",G_CALLBACK(check_entry),dlg); |
401 | g_signal_connect(G_OBJECT(dlg->file[1]),"changed",G_CALLBACK(check_remote_filename),dlg); | 401 | g_signal_connect(G_OBJECT(dlg->file[1]),"changed",G_CALLBACK(check_remote_filename),dlg); |
402 | 402 | ||
403 | - for(f=0;f<2;f++) | 403 | + for(f=0;f<2;f++) |
404 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(GTK_EDITABLE(dlg->file[f]),dlg)); | 404 | gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(GTK_EDITABLE(dlg->file[f]),dlg)); |
405 | 405 | ||
406 | gtk_widget_show_all(dlg->dialog); | 406 | gtk_widget_show_all(dlg->dialog); |
407 | 407 | ||
408 | for(f=0;f<G_N_ELEMENTS(dlg->parm);f++) | 408 | for(f=0;f<G_N_ELEMENTS(dlg->parm);f++) |
409 | - { | 409 | + { |
410 | if(dlg->parm[f]) | 410 | if(dlg->parm[f]) |
411 | { | 411 | { |
412 | gchar *val = get_attribute(action,dlg,gtk_widget_get_name(GTK_WIDGET(dlg->parm[f]))); | 412 | gchar *val = get_attribute(action,dlg,gtk_widget_get_name(GTK_WIDGET(dlg->parm[f]))); |
@@ -439,21 +439,21 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | @@ -439,21 +439,21 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | ||
439 | { | 439 | { |
440 | parm[f] = 0; | 440 | parm[f] = 0; |
441 | } | 441 | } |
442 | - } | ||
443 | - | ||
444 | - remote_filename = gtk_entry_get_text(dlg->file[1]); | ||
445 | - | 442 | + } |
443 | + | ||
444 | + remote_filename = gtk_entry_get_text(dlg->file[1]); | ||
445 | + | ||
446 | set_string_to_config(dlg->name,"local","%s",gtk_entry_get_text(dlg->file[0])); | 446 | set_string_to_config(dlg->name,"local","%s",gtk_entry_get_text(dlg->file[0])); |
447 | set_string_to_config(dlg->name,"remote","%s",remote_filename); | 447 | set_string_to_config(dlg->name,"remote","%s",remote_filename); |
448 | - | ||
449 | - if(!gtk_entry_get_text_length(dlg->file[0])) | ||
450 | - { | ||
451 | - // Local filename wasn´t set, create a new one | ||
452 | - gchar *basename = g_path_get_basename(remote_filename); | ||
453 | - gchar *filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),basename,NULL); | ||
454 | - gtk_entry_set_text(dlg->file[0],filename); | ||
455 | - g_free(filename); | ||
456 | - g_free(basename); | 448 | + |
449 | + if(!gtk_entry_get_text_length(dlg->file[0])) | ||
450 | + { | ||
451 | + // Local filename wasn´t set, create a new one | ||
452 | + gchar *basename = g_path_get_basename(remote_filename); | ||
453 | + gchar *filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),basename,NULL); | ||
454 | + gtk_entry_set_text(dlg->file[0],filename); | ||
455 | + g_free(filename); | ||
456 | + g_free(basename); | ||
457 | } | 457 | } |
458 | 458 | ||
459 | ft = lib3270_ft_new( v3270_get_session(widget), | 459 | ft = lib3270_ft_new( v3270_get_session(widget), |
src/pw3270/hostdialog.c
@@ -117,8 +117,8 @@ | @@ -117,8 +117,8 @@ | ||
117 | 117 | ||
118 | void hostname_action(GtkAction *action, GtkWidget *widget) | 118 | void hostname_action(GtkAction *action, GtkWidget *widget) |
119 | { | 119 | { |
120 | - const gchar * title = g_object_get_data(G_OBJECT(action),"title"); | ||
121 | - gchar * cfghost = get_string_from_config("host","uri",""); | 120 | + const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
121 | + gchar * cfghost = get_string_from_config("host","uri",""); | ||
122 | gchar * hostname; | 122 | gchar * hostname; |
123 | gchar * ptr; | 123 | gchar * ptr; |
124 | gboolean again = TRUE; | 124 | gboolean again = TRUE; |
@@ -145,19 +145,31 @@ | @@ -145,19 +145,31 @@ | ||
145 | 145 | ||
146 | 146 | ||
147 | { | 147 | { |
148 | - GtkWidget * label; | 148 | + // Host info - GtkTable version |
149 | + struct _line | ||
150 | + { | ||
151 | + const gchar * label; | ||
152 | + GtkWidget * widget; | ||
153 | + GtkAttachOptions xoptions; | ||
154 | + } line[] = | ||
155 | + { | ||
156 | + { N_( "_Hostname:" ), GTK_WIDGET(host), GTK_EXPAND|GTK_FILL }, | ||
157 | + { N_( "_Port:" ), GTK_WIDGET(port), GTK_FILL } | ||
158 | + }; | ||
149 | 159 | ||
150 | - label = gtk_label_new_with_mnemonic( _("_Hostname:") ); | ||
151 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label),GTK_WIDGET(host)); | ||
152 | - gtk_table_attach(table,label,0,1,0,1,0,0,5,0); | ||
153 | - gtk_table_attach(table,GTK_WIDGET(host), 1,2,0,1,GTK_EXPAND|GTK_FILL,0,0,0); | 160 | + int f; |
154 | 161 | ||
155 | - label = gtk_label_new_with_mnemonic( _( "_Port:" ) ); | ||
156 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label),GTK_WIDGET(port)); | ||
157 | - gtk_table_attach(table, label, 2,3,0,1,0,0,5,0); | ||
158 | - gtk_table_attach(table,GTK_WIDGET(port), 3,4,0,1,GTK_FILL,0,0,0); | 162 | + for(f=0;f<G_N_ELEMENTS(line);f++) |
163 | + { | ||
164 | + int col = f*3; | ||
165 | + | ||
166 | + GtkWidget * label = gtk_label_new_with_mnemonic( gettext(line[f].label) ); | ||
167 | + gtk_label_set_mnemonic_widget(GTK_LABEL(label),line[f].widget); | ||
168 | + gtk_table_attach(table,label,col,col+1,0,1,0,0,2,2); | ||
169 | + gtk_table_attach(table,line[f].widget,col+1,col+2,0,1,line[f].xoptions,0,2,2); | ||
170 | + } | ||
159 | 171 | ||
160 | - gtk_table_attach(table,GTK_WIDGET(sslcheck), 1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); | 172 | + gtk_table_attach(table,GTK_WIDGET(sslcheck),1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); |
161 | } | 173 | } |
162 | 174 | ||
163 | { | 175 | { |
src/pw3270/main.c
@@ -173,7 +173,7 @@ static gboolean datadir(const gchar *option_name, const gchar *value, gpointer d | @@ -173,7 +173,7 @@ static gboolean datadir(const gchar *option_name, const gchar *value, gpointer d | ||
173 | g_free(msg); | 173 | g_free(msg); |
174 | } | 174 | } |
175 | 175 | ||
176 | - g_free(path); | 176 | + g_free(path); |
177 | 177 | ||
178 | return rc == ERROR_SUCCESS; | 178 | return rc == ERROR_SUCCESS; |
179 | } | 179 | } |
@@ -354,8 +354,8 @@ int main(int argc, char *argv[]) | @@ -354,8 +354,8 @@ int main(int argc, char *argv[]) | ||
354 | gchar * locdir = g_build_filename(appdir,"locale",NULL); | 354 | gchar * locdir = g_build_filename(appdir,"locale",NULL); |
355 | 355 | ||
356 | g_chdir(appdir); | 356 | g_chdir(appdir); |
357 | - bindtextdomain( PACKAGE_NAME, locdir ); | ||
358 | - | 357 | + bindtextdomain( PACKAGE_NAME, locdir ); |
358 | + | ||
359 | g_free(locdir); | 359 | g_free(locdir); |
360 | g_free(appdir); | 360 | g_free(appdir); |
361 | 361 |
src/pw3270/plugin.c
@@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
47 | GList * lst = NULL; | 47 | GList * lst = NULL; |
48 | #ifdef WIN32 | 48 | #ifdef WIN32 |
49 | UINT errorMode; | 49 | UINT errorMode; |
50 | -#endif // WIN32 | 50 | +#endif // WIN32 |
51 | 51 | ||
52 | 52 | ||
53 | trace("Loading plugins from %s",path); | 53 | trace("Loading plugins from %s",path); |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | #ifdef WIN32 | 66 | #ifdef WIN32 |
67 | // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx | 67 | // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx |
68 | errorMode = SetErrorMode(1); | 68 | errorMode = SetErrorMode(1); |
69 | -#endif // WIN32 | 69 | +#endif // WIN32 |
70 | 70 | ||
71 | name = g_dir_read_name(dir); | 71 | name = g_dir_read_name(dir); |
72 | while(name) | 72 | while(name) |
@@ -135,7 +135,7 @@ | @@ -135,7 +135,7 @@ | ||
135 | 135 | ||
136 | #ifdef WIN32 | 136 | #ifdef WIN32 |
137 | SetErrorMode(errorMode); | 137 | SetErrorMode(errorMode); |
138 | -#endif // WIN32 | 138 | +#endif // WIN32 |
139 | 139 | ||
140 | g_dir_close(dir); | 140 | g_dir_close(dir); |
141 | 141 | ||
@@ -161,40 +161,40 @@ | @@ -161,40 +161,40 @@ | ||
161 | 161 | ||
162 | LIB3270_EXPORT void pw3270_init_plugins(void) | 162 | LIB3270_EXPORT void pw3270_init_plugins(void) |
163 | { | 163 | { |
164 | -#if defined( DEBUG ) | ||
165 | - | ||
166 | - gchar * dir = g_get_current_dir(); | ||
167 | - gchar * path = g_build_filename(dir,"plugins",NULL); | ||
168 | - | ||
169 | - trace("%s testing [%s]",__FUNCTION__,path); | ||
170 | - | ||
171 | - if(!g_file_test(path,G_FILE_TEST_IS_DIR)) | ||
172 | - { | 164 | +#if defined( DEBUG ) |
165 | + | ||
166 | + gchar * dir = g_get_current_dir(); | ||
167 | + gchar * path = g_build_filename(dir,"plugins",NULL); | ||
168 | + | ||
169 | + trace("%s testing [%s]",__FUNCTION__,path); | ||
170 | + | ||
171 | + if(!g_file_test(path,G_FILE_TEST_IS_DIR)) | ||
172 | + { | ||
173 | g_free(path); | 173 | g_free(path); |
174 | 174 | ||
175 | - path = g_build_filename(dir,".bin","Debug","plugins",NULL); | ||
176 | - trace("%s testing [%s]",__FUNCTION__,path); | 175 | + path = g_build_filename(dir,".bin","Debug","plugins",NULL); |
176 | + trace("%s testing [%s]",__FUNCTION__,path); | ||
177 | 177 | ||
178 | - if(!g_file_test(path,G_FILE_TEST_IS_DIR)) | ||
179 | - { | 178 | + if(!g_file_test(path,G_FILE_TEST_IS_DIR)) |
179 | + { | ||
180 | g_free(path); | 180 | g_free(path); |
181 | path = pw3270_build_filename(NULL,"plugins",NULL); | 181 | path = pw3270_build_filename(NULL,"plugins",NULL); |
182 | - trace("%s using [%s]",__FUNCTION__,path); | 182 | + trace("%s using [%s]",__FUNCTION__,path); |
183 | } | 183 | } |
184 | - } | 184 | + } |
185 | 185 | ||
186 | - load(path); | ||
187 | - | ||
188 | - g_free(path); | ||
189 | - g_free(dir); | 186 | + load(path); |
187 | + | ||
188 | + g_free(path); | ||
189 | + g_free(dir); | ||
190 | + | ||
191 | +#elif defined( WIN32 ) | ||
190 | 192 | ||
191 | -#elif defined( WIN32 ) | ||
192 | - | ||
193 | gchar * path = pw3270_build_filename(NULL,"plugins",NULL); | 193 | gchar * path = pw3270_build_filename(NULL,"plugins",NULL); |
194 | load(path); | 194 | load(path); |
195 | - g_free(path); | ||
196 | - | ||
197 | -#else | 195 | + g_free(path); |
196 | + | ||
197 | +#else | ||
198 | 198 | ||
199 | const gchar * appname[] = { g_get_application_name(), PACKAGE_NAME }; | 199 | const gchar * appname[] = { g_get_application_name(), PACKAGE_NAME }; |
200 | int f; | 200 | int f; |
@@ -202,17 +202,17 @@ | @@ -202,17 +202,17 @@ | ||
202 | for(f=0;f<G_N_ELEMENTS(appname);f++) | 202 | for(f=0;f<G_N_ELEMENTS(appname);f++) |
203 | { | 203 | { |
204 | gchar *path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s-plugins",LIBDIR,appname[f]); | 204 | gchar *path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s-plugins",LIBDIR,appname[f]); |
205 | - | 205 | + |
206 | if(g_file_test(path,G_FILE_TEST_IS_DIR)) | 206 | if(g_file_test(path,G_FILE_TEST_IS_DIR)) |
207 | { | 207 | { |
208 | load(path); | 208 | load(path); |
209 | g_free(path); | 209 | g_free(path); |
210 | return; | 210 | return; |
211 | - } | 211 | + } |
212 | 212 | ||
213 | g_free(path); | 213 | g_free(path); |
214 | } | 214 | } |
215 | - | 215 | + |
216 | #endif | 216 | #endif |
217 | } | 217 | } |
218 | 218 |
src/pw3270/print.c
@@ -32,6 +32,7 @@ | @@ -32,6 +32,7 @@ | ||
32 | #include "globals.h" | 32 | #include "globals.h" |
33 | #include <pw3270/v3270.h> | 33 | #include <pw3270/v3270.h> |
34 | #include <lib3270/selection.h> | 34 | #include <lib3270/selection.h> |
35 | + #include <lib3270/trace.h> | ||
35 | 36 | ||
36 | #define AUTO_FONT_SIZE 1 | 37 | #define AUTO_FONT_SIZE 1 |
37 | 38 |
src/pw3270/trace.c
@@ -27,8 +27,8 @@ | @@ -27,8 +27,8 @@ | ||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | - #include <gtk/gtk.h> | ||
31 | - | 30 | + #include <gtk/gtk.h> |
31 | + | ||
32 | #define ENABLE_NLS | 32 | #define ENABLE_NLS |
33 | #define GETTEXT_PACKAGE PACKAGE_NAME | 33 | #define GETTEXT_PACKAGE PACKAGE_NAME |
34 | 34 | ||
@@ -43,69 +43,69 @@ | @@ -43,69 +43,69 @@ | ||
43 | #endif // HAVE_SYSLOG | 43 | #endif // HAVE_SYSLOG |
44 | 44 | ||
45 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | 45 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
46 | - | 46 | + |
47 | G_BEGIN_DECLS | 47 | G_BEGIN_DECLS |
48 | 48 | ||
49 | struct _pw3270_traceClass | 49 | struct _pw3270_traceClass |
50 | { | 50 | { |
51 | GtkWindowClass parent_class; | 51 | GtkWindowClass parent_class; |
52 | }; | 52 | }; |
53 | - | 53 | + |
54 | struct _pw3270_trace | 54 | struct _pw3270_trace |
55 | { | 55 | { |
56 | - GtkWindow parent; | ||
57 | - GtkAdjustment * scroll; | ||
58 | - GtkTextBuffer * text; | ||
59 | - GtkWidget * entry; | ||
60 | - GtkWidget * button; | 56 | + GtkWindow parent; |
57 | + GtkAdjustment * scroll; | ||
58 | + GtkTextBuffer * text; | ||
59 | + GtkWidget * entry; | ||
60 | + GtkWidget * button; | ||
61 | gchar **line; | 61 | gchar **line; |
62 | - guint log_handler; | 62 | + guint log_handler; |
63 | gboolean * enabled; | 63 | gboolean * enabled; |
64 | - gboolean destroy_on_close; | ||
65 | - }; | ||
66 | - | ||
67 | - const GtkWindowClass * pw3270_trace_get_parent_class(void); | ||
68 | - | 64 | + gboolean destroy_on_close; |
65 | + }; | ||
66 | + | ||
67 | + const GtkWindowClass * pw3270_trace_get_parent_class(void); | ||
68 | + | ||
69 | G_END_DECLS | 69 | G_END_DECLS |
70 | 70 | ||
71 | G_DEFINE_TYPE(pw3270_trace, pw3270_trace, GTK_TYPE_WINDOW); | 71 | G_DEFINE_TYPE(pw3270_trace, pw3270_trace, GTK_TYPE_WINDOW); |
72 | 72 | ||
73 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 73 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
74 | - | 74 | + |
75 | const GtkWindowClass * pw3270_trace_get_parent_class(void) | 75 | const GtkWindowClass * pw3270_trace_get_parent_class(void) |
76 | { | 76 | { |
77 | trace("%s",__FUNCTION__); | 77 | trace("%s",__FUNCTION__); |
78 | return GTK_WINDOW_CLASS(pw3270_trace_parent_class); | 78 | return GTK_WINDOW_CLASS(pw3270_trace_parent_class); |
79 | } | 79 | } |
80 | - | ||
81 | - static void activate_default(GtkWindow *window) | ||
82 | - { | ||
83 | - pw3270_trace * hwnd = PW3270_TRACE(window); | ||
84 | - | ||
85 | - trace("%s",__FUNCTION__); | 80 | + |
81 | + static void activate_default(GtkWindow *window) | ||
82 | + { | ||
83 | + pw3270_trace * hwnd = PW3270_TRACE(window); | ||
84 | + | ||
85 | + trace("%s",__FUNCTION__); | ||
86 | 86 | ||
87 | if(hwnd->enabled) | 87 | if(hwnd->enabled) |
88 | { | 88 | { |
89 | - if(*hwnd->line) | ||
90 | - g_free(*hwnd->line); | ||
91 | - | ||
92 | - *hwnd->line = g_strdup(gtk_entry_get_text(GTK_ENTRY(hwnd->entry))); | ||
93 | - | ||
94 | - gtk_widget_set_sensitive(hwnd->entry,FALSE); | ||
95 | - gtk_widget_set_sensitive(hwnd->button,FALSE); | ||
96 | - | 89 | + if(*hwnd->line) |
90 | + g_free(*hwnd->line); | ||
91 | + | ||
92 | + *hwnd->line = g_strdup(gtk_entry_get_text(GTK_ENTRY(hwnd->entry))); | ||
93 | + | ||
94 | + gtk_widget_set_sensitive(hwnd->entry,FALSE); | ||
95 | + gtk_widget_set_sensitive(hwnd->button,FALSE); | ||
96 | + | ||
97 | *hwnd->enabled = FALSE; | 97 | *hwnd->enabled = FALSE; |
98 | } | 98 | } |
99 | - | ||
100 | - } | ||
101 | - | 99 | + |
100 | + } | ||
101 | + | ||
102 | #if GTK_CHECK_VERSION(3,0,0) | 102 | #if GTK_CHECK_VERSION(3,0,0) |
103 | static void destroy(GtkWidget *widget) | 103 | static void destroy(GtkWidget *widget) |
104 | #else | 104 | #else |
105 | static void destroy(GtkObject *widget) | 105 | static void destroy(GtkObject *widget) |
106 | #endif | 106 | #endif |
107 | { | 107 | { |
108 | - pw3270_trace * hwnd = PW3270_TRACE(widget); | 108 | + pw3270_trace * hwnd = PW3270_TRACE(widget); |
109 | 109 | ||
110 | if(hwnd->log_handler) | 110 | if(hwnd->log_handler) |
111 | { | 111 | { |
@@ -113,43 +113,43 @@ static void destroy(GtkObject *widget) | @@ -113,43 +113,43 @@ static void destroy(GtkObject *widget) | ||
113 | hwnd->log_handler = 0; | 113 | hwnd->log_handler = 0; |
114 | } | 114 | } |
115 | 115 | ||
116 | - if(hwnd->line) | 116 | + if(hwnd->line) |
117 | *hwnd->line = NULL; | 117 | *hwnd->line = NULL; |
118 | 118 | ||
119 | - if(hwnd->enabled) | 119 | + if(hwnd->enabled) |
120 | *hwnd->enabled = FALSE; | 120 | *hwnd->enabled = FALSE; |
121 | 121 | ||
122 | - } | ||
123 | - | ||
124 | - static gboolean delete_event(GtkWidget *widget, GdkEventAny *event) | ||
125 | - { | 122 | + } |
123 | + | ||
124 | + static gboolean delete_event(GtkWidget *widget, GdkEventAny *event) | ||
125 | + { | ||
126 | pw3270_trace * hwnd = PW3270_TRACE(widget); | 126 | pw3270_trace * hwnd = PW3270_TRACE(widget); |
127 | - | 127 | + |
128 | trace("%s destroy=%s",__FUNCTION__,hwnd->destroy_on_close ? "Yes" : "No"); | 128 | trace("%s destroy=%s",__FUNCTION__,hwnd->destroy_on_close ? "Yes" : "No"); |
129 | 129 | ||
130 | if(hwnd->line) | 130 | if(hwnd->line) |
131 | *hwnd->line = NULL; | 131 | *hwnd->line = NULL; |
132 | 132 | ||
133 | - if(hwnd->enabled) | 133 | + if(hwnd->enabled) |
134 | *hwnd->enabled = FALSE; | 134 | *hwnd->enabled = FALSE; |
135 | 135 | ||
136 | if(hwnd->destroy_on_close) | 136 | if(hwnd->destroy_on_close) |
137 | return FALSE; | 137 | return FALSE; |
138 | 138 | ||
139 | gtk_widget_hide(widget); | 139 | gtk_widget_hide(widget); |
140 | - return TRUE; | ||
141 | - } | ||
142 | - | 140 | + return TRUE; |
141 | + } | ||
142 | + | ||
143 | static void pw3270_trace_class_init(pw3270_traceClass *klass) | 143 | static void pw3270_trace_class_init(pw3270_traceClass *klass) |
144 | { | 144 | { |
145 | GtkWindowClass * window_class = GTK_WINDOW_CLASS(klass); | 145 | GtkWindowClass * window_class = GTK_WINDOW_CLASS(klass); |
146 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); | 146 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); |
147 | - | ||
148 | - trace("%s",__FUNCTION__); | ||
149 | - | ||
150 | - window_class->activate_default = activate_default; | ||
151 | - widget_class->delete_event = delete_event; | ||
152 | - | 147 | + |
148 | + trace("%s",__FUNCTION__); | ||
149 | + | ||
150 | + window_class->activate_default = activate_default; | ||
151 | + widget_class->delete_event = delete_event; | ||
152 | + | ||
153 | #if GTK_CHECK_VERSION(3,0,0) | 153 | #if GTK_CHECK_VERSION(3,0,0) |
154 | { | 154 | { |
155 | widget_class->destroy = destroy; | 155 | widget_class->destroy = destroy; |
@@ -162,12 +162,12 @@ static void destroy(GtkObject *widget) | @@ -162,12 +162,12 @@ static void destroy(GtkObject *widget) | ||
162 | #endif // GTK3 | 162 | #endif // GTK3 |
163 | 163 | ||
164 | } | 164 | } |
165 | - | ||
166 | - static void activate(GtkButton *button, GtkWindow *window) | ||
167 | - { | ||
168 | - trace("%s",__FUNCTION__); | ||
169 | - activate_default(window); | ||
170 | - } | 165 | + |
166 | + static void activate(GtkButton *button, GtkWindow *window) | ||
167 | + { | ||
168 | + trace("%s",__FUNCTION__); | ||
169 | + activate_default(window); | ||
170 | + } | ||
171 | 171 | ||
172 | static void menu_save(GtkWidget *button, pw3270_trace *window) | 172 | static void menu_save(GtkWidget *button, pw3270_trace *window) |
173 | { | 173 | { |
@@ -223,12 +223,12 @@ static void destroy(GtkObject *widget) | @@ -223,12 +223,12 @@ static void destroy(GtkObject *widget) | ||
223 | 223 | ||
224 | gtk_widget_destroy(dialog); | 224 | gtk_widget_destroy(dialog); |
225 | 225 | ||
226 | - } | 226 | + } |
227 | 227 | ||
228 | static void menu_close(GtkWidget *button, GtkWidget *window) | 228 | static void menu_close(GtkWidget *button, GtkWidget *window) |
229 | { | 229 | { |
230 | gtk_widget_destroy(window); | 230 | gtk_widget_destroy(window); |
231 | - } | 231 | + } |
232 | 232 | ||
233 | struct submenu | 233 | struct submenu |
234 | { | 234 | { |
@@ -318,17 +318,17 @@ static void destroy(GtkObject *widget) | @@ -318,17 +318,17 @@ static void destroy(GtkObject *widget) | ||
318 | #endif // HAVE_SYSLOG | 318 | #endif // HAVE_SYSLOG |
319 | 319 | ||
320 | } | 320 | } |
321 | - | 321 | + |
322 | static void pw3270_trace_init(pw3270_trace *window) | 322 | static void pw3270_trace_init(pw3270_trace *window) |
323 | - { | ||
324 | - GtkWidget * widget; | ||
325 | - GtkWidget * view; | 323 | + { |
324 | + GtkWidget * widget; | ||
325 | + GtkWidget * view; | ||
326 | #if GTK_CHECK_VERSION(3,0,0) | 326 | #if GTK_CHECK_VERSION(3,0,0) |
327 | GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0); | 327 | GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0); |
328 | #else | 328 | #else |
329 | GtkWidget * vbox = gtk_vbox_new(FALSE,0); | 329 | GtkWidget * vbox = gtk_vbox_new(FALSE,0); |
330 | #endif // GTK_CHECK_VERSION | 330 | #endif // GTK_CHECK_VERSION |
331 | - gchar * fontname = get_string_from_config("trace", "fontname", "Monospace 8"); | 331 | + gchar * fontname = get_string_from_config("trace", "fontname", "Monospace 8"); |
332 | PangoFontDescription * fontdesc = pango_font_description_from_string("Monospace 8"); | 332 | PangoFontDescription * fontdesc = pango_font_description_from_string("Monospace 8"); |
333 | 333 | ||
334 | g_free(fontname); | 334 | g_free(fontname); |
@@ -347,54 +347,54 @@ static void destroy(GtkObject *widget) | @@ -347,54 +347,54 @@ static void destroy(GtkObject *widget) | ||
347 | 347 | ||
348 | build_menu(widget, window, GTK_STOCK_FILE, filemenu, G_N_ELEMENTS(filemenu)); | 348 | build_menu(widget, window, GTK_STOCK_FILE, filemenu, G_N_ELEMENTS(filemenu)); |
349 | 349 | ||
350 | - gtk_box_pack_start(GTK_BOX(vbox),widget,FALSE,TRUE,0); | 350 | + gtk_box_pack_start(GTK_BOX(vbox),widget,FALSE,TRUE,0); |
351 | } | 351 | } |
352 | - | ||
353 | - // Trace container | ||
354 | - widget = gtk_scrolled_window_new(NULL,NULL); | ||
355 | - window->scroll = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(widget)); | ||
356 | - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | ||
357 | - view = gtk_text_view_new(); | ||
358 | - | ||
359 | -#if GTK_CHECK_VERSION(3,0,0) | ||
360 | - gtk_widget_override_font(GTK_WIDGET(view), fontdesc); | 352 | + |
353 | + // Trace container | ||
354 | + widget = gtk_scrolled_window_new(NULL,NULL); | ||
355 | + window->scroll = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(widget)); | ||
356 | + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | ||
357 | + view = gtk_text_view_new(); | ||
358 | + | ||
359 | +#if GTK_CHECK_VERSION(3,0,0) | ||
360 | + gtk_widget_override_font(GTK_WIDGET(view), fontdesc); | ||
361 | #else | 361 | #else |
362 | - gtk_widget_modify_font(GTK_WIDGET(view), fontdesc); | 362 | + gtk_widget_modify_font(GTK_WIDGET(view), fontdesc); |
363 | #endif // GTK_CHECK_VERSION | 363 | #endif // GTK_CHECK_VERSION |
364 | 364 | ||
365 | window->text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); | 365 | window->text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); |
366 | - gtk_text_view_set_editable(GTK_TEXT_VIEW(view), TRUE); | ||
367 | - | ||
368 | -#if GTK_CHECK_VERSION(3,8,0) | ||
369 | - gtk_container_add(GTK_CONTAINER(widget),view); | ||
370 | -#else | ||
371 | - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(widget),view); | ||
372 | -#endif // GTK_CHECK_VERSION | ||
373 | - gtk_box_pack_start(GTK_BOX(vbox),widget,TRUE,TRUE,0); | ||
374 | - | ||
375 | - // Edit box | 366 | + gtk_text_view_set_editable(GTK_TEXT_VIEW(view), TRUE); |
367 | + | ||
368 | +#if GTK_CHECK_VERSION(3,8,0) | ||
369 | + gtk_container_add(GTK_CONTAINER(widget),view); | ||
370 | +#else | ||
371 | + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(widget),view); | ||
372 | +#endif // GTK_CHECK_VERSION | ||
373 | + gtk_box_pack_start(GTK_BOX(vbox),widget,TRUE,TRUE,0); | ||
374 | + | ||
375 | + // Edit box | ||
376 | #if GTK_CHECK_VERSION(3,0,0) | 376 | #if GTK_CHECK_VERSION(3,0,0) |
377 | - widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); | 377 | + widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); |
378 | #else | 378 | #else |
379 | - widget = gtk_hbox_new(FALSE,0); | 379 | + widget = gtk_hbox_new(FALSE,0); |
380 | #endif // GTK_CHECK_VERSION | 380 | #endif // GTK_CHECK_VERSION |
381 | - gtk_box_pack_start(GTK_BOX(widget),gtk_label_new( _( "Command:" )),FALSE,TRUE,4); | ||
382 | - window->entry = gtk_entry_new(); | ||
383 | - gtk_box_pack_start(GTK_BOX(widget),window->entry,TRUE,TRUE,4); | ||
384 | - gtk_widget_set_sensitive(window->entry,FALSE); | ||
385 | - g_signal_connect(G_OBJECT(window->entry),"activate",G_CALLBACK(activate),window); | ||
386 | - | ||
387 | - window->button = gtk_button_new_from_stock(GTK_STOCK_OK); | ||
388 | - gtk_box_pack_end(GTK_BOX(widget),window->button,FALSE,FALSE,4); | ||
389 | - gtk_widget_set_sensitive(window->button,FALSE); | ||
390 | - gtk_button_set_focus_on_click(GTK_BUTTON(window->button),FALSE); | ||
391 | - | ||
392 | - g_signal_connect(G_OBJECT(window->button),"clicked",G_CALLBACK(activate),window); | ||
393 | - | ||
394 | - gtk_box_pack_start(GTK_BOX(vbox),widget,FALSE,TRUE,0); | ||
395 | - | ||
396 | - gtk_widget_show_all(vbox); | ||
397 | - | 381 | + gtk_box_pack_start(GTK_BOX(widget),gtk_label_new( _( "Command:" )),FALSE,TRUE,4); |
382 | + window->entry = gtk_entry_new(); | ||
383 | + gtk_box_pack_start(GTK_BOX(widget),window->entry,TRUE,TRUE,4); | ||
384 | + gtk_widget_set_sensitive(window->entry,FALSE); | ||
385 | + g_signal_connect(G_OBJECT(window->entry),"activate",G_CALLBACK(activate),window); | ||
386 | + | ||
387 | + window->button = gtk_button_new_from_stock(GTK_STOCK_OK); | ||
388 | + gtk_box_pack_end(GTK_BOX(widget),window->button,FALSE,FALSE,4); | ||
389 | + gtk_widget_set_sensitive(window->button,FALSE); | ||
390 | + gtk_button_set_focus_on_click(GTK_BUTTON(window->button),FALSE); | ||
391 | + | ||
392 | + g_signal_connect(G_OBJECT(window->button),"clicked",G_CALLBACK(activate),window); | ||
393 | + | ||
394 | + gtk_box_pack_start(GTK_BOX(vbox),widget,FALSE,TRUE,0); | ||
395 | + | ||
396 | + gtk_widget_show_all(vbox); | ||
397 | + | ||
398 | gtk_container_add(GTK_CONTAINER(window),vbox); | 398 | gtk_container_add(GTK_CONTAINER(window),vbox); |
399 | 399 | ||
400 | pango_font_description_free(fontdesc); | 400 | pango_font_description_free(fontdesc); |
@@ -403,65 +403,65 @@ static void destroy(GtkObject *widget) | @@ -403,65 +403,65 @@ static void destroy(GtkObject *widget) | ||
403 | trace("Log handler set to %d",window->log_handler); | 403 | trace("Log handler set to %d",window->log_handler); |
404 | 404 | ||
405 | } | 405 | } |
406 | - | 406 | + |
407 | GtkWidget * pw3270_trace_new(void) | 407 | GtkWidget * pw3270_trace_new(void) |
408 | { | 408 | { |
409 | return g_object_new(PW3270_TYPE_TRACE, NULL); | 409 | return g_object_new(PW3270_TYPE_TRACE, NULL); |
410 | } | 410 | } |
411 | - | ||
412 | - void pw3270_trace_vprintf(GtkWidget *widget, const char *fmt, va_list args) | ||
413 | - { | ||
414 | - GtkTextIter itr; | ||
415 | - gchar * msg; | ||
416 | - pw3270_trace * hwnd = PW3270_TRACE(widget); | ||
417 | - | ||
418 | - gtk_text_buffer_get_end_iter(hwnd->text,&itr); | ||
419 | - | ||
420 | - msg = g_strdup_vprintf(fmt,args); | ||
421 | - gtk_text_buffer_insert(hwnd->text,&itr,msg,strlen(msg)); | ||
422 | - g_free(msg); | ||
423 | - | ||
424 | - gtk_text_buffer_get_end_iter(hwnd->text,&itr); | ||
425 | - | ||
426 | -#if GTK_CHECK_VERSION(2,14,0) | ||
427 | - gtk_adjustment_set_value(hwnd->scroll,gtk_adjustment_get_upper(hwnd->scroll)); | ||
428 | -#else | ||
429 | - gtk_adjustment_set_value(hwnd->scroll,(GTK_ADJUSTMENT(hwnd->scroll))->upper); | ||
430 | -#endif // | ||
431 | - | ||
432 | - } | ||
433 | - | ||
434 | - void pw3270_trace_printf(GtkWidget *widget, const char *fmt, ... ) | ||
435 | - { | 411 | + |
412 | + void pw3270_trace_vprintf(GtkWidget *widget, const char *fmt, va_list args) | ||
413 | + { | ||
414 | + GtkTextIter itr; | ||
415 | + gchar * msg; | ||
416 | + pw3270_trace * hwnd = PW3270_TRACE(widget); | ||
417 | + | ||
418 | + gtk_text_buffer_get_end_iter(hwnd->text,&itr); | ||
419 | + | ||
420 | + msg = g_strdup_vprintf(fmt,args); | ||
421 | + gtk_text_buffer_insert(hwnd->text,&itr,msg,strlen(msg)); | ||
422 | + g_free(msg); | ||
423 | + | ||
424 | + gtk_text_buffer_get_end_iter(hwnd->text,&itr); | ||
425 | + | ||
426 | +#if GTK_CHECK_VERSION(2,14,0) | ||
427 | + gtk_adjustment_set_value(hwnd->scroll,gtk_adjustment_get_upper(hwnd->scroll)); | ||
428 | +#else | ||
429 | + gtk_adjustment_set_value(hwnd->scroll,(GTK_ADJUSTMENT(hwnd->scroll))->upper); | ||
430 | +#endif // | ||
431 | + | ||
432 | + } | ||
433 | + | ||
434 | + void pw3270_trace_printf(GtkWidget *widget, const char *fmt, ... ) | ||
435 | + { | ||
436 | va_list arg_ptr; | 436 | va_list arg_ptr; |
437 | va_start(arg_ptr, fmt); | 437 | va_start(arg_ptr, fmt); |
438 | pw3270_trace_vprintf(widget,fmt,arg_ptr); | 438 | pw3270_trace_vprintf(widget,fmt,arg_ptr); |
439 | va_end(arg_ptr); | 439 | va_end(arg_ptr); |
440 | } | 440 | } |
441 | - | ||
442 | - LIB3270_EXPORT gchar * pw3270_trace_get_command(GtkWidget *widget) | ||
443 | - { | ||
444 | - pw3270_trace * hwnd = PW3270_TRACE(widget); | ||
445 | - gchar * line = NULL; | ||
446 | - gboolean enabled = TRUE; | ||
447 | - | ||
448 | - hwnd->line = &line; | ||
449 | - hwnd->enabled = &enabled; | ||
450 | - | ||
451 | - gtk_window_present(GTK_WINDOW(widget)); | ||
452 | - gtk_widget_set_sensitive(hwnd->entry,TRUE); | ||
453 | - gtk_widget_set_sensitive(hwnd->button,TRUE); | ||
454 | - gtk_widget_grab_focus(hwnd->entry); | ||
455 | - | ||
456 | - while(enabled) | ||
457 | - { | 441 | + |
442 | + LIB3270_EXPORT gchar * pw3270_trace_get_command(GtkWidget *widget) | ||
443 | + { | ||
444 | + pw3270_trace * hwnd = PW3270_TRACE(widget); | ||
445 | + gchar * line = NULL; | ||
446 | + gboolean enabled = TRUE; | ||
447 | + | ||
448 | + hwnd->line = &line; | ||
449 | + hwnd->enabled = &enabled; | ||
450 | + | ||
451 | + gtk_window_present(GTK_WINDOW(widget)); | ||
452 | + gtk_widget_set_sensitive(hwnd->entry,TRUE); | ||
453 | + gtk_widget_set_sensitive(hwnd->button,TRUE); | ||
454 | + gtk_widget_grab_focus(hwnd->entry); | ||
455 | + | ||
456 | + while(enabled) | ||
457 | + { | ||
458 | gtk_main_iteration(); | 458 | gtk_main_iteration(); |
459 | - } | 459 | + } |
460 | + | ||
461 | + hwnd->line = NULL; | ||
462 | + hwnd->enabled = NULL; | ||
460 | 463 | ||
461 | - hwnd->line = NULL; | ||
462 | - hwnd->enabled = NULL; | ||
463 | - | ||
464 | - return line; | 464 | + return line; |
465 | } | 465 | } |
466 | 466 | ||
467 | LIB3270_EXPORT void pw3270_trace_set_destroy_on_close(GtkWidget *widget,gboolean on) | 467 | LIB3270_EXPORT void pw3270_trace_set_destroy_on_close(GtkWidget *widget,gboolean on) |
src/pw3270/uiparser/button.c
1 | - | 1 | + |
2 | /* | 2 | /* |
3 | * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | 3 | * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 |
4 | * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | 4 | * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a |
@@ -28,14 +28,14 @@ | @@ -28,14 +28,14 @@ | ||
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | 30 | ||
31 | - #include "keypad.h" | 31 | + #include "keypad.h" |
32 | #include <pw3270/v3270.h> | 32 | #include <pw3270/v3270.h> |
33 | 33 | ||
34 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 34 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
35 | - | ||
36 | - | 35 | + |
36 | + | ||
37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
38 | - | 38 | + |
39 | GtkReliefStyle ui_get_relief(const gchar **names, const gchar **values, GtkReliefStyle def) | 39 | GtkReliefStyle ui_get_relief(const gchar **names, const gchar **values, GtkReliefStyle def) |
40 | { | 40 | { |
41 | 41 | ||
@@ -69,10 +69,10 @@ | @@ -69,10 +69,10 @@ | ||
69 | { | 69 | { |
70 | gtk_action_activate(action); | 70 | gtk_action_activate(action); |
71 | } | 71 | } |
72 | - | 72 | + |
73 | static void button_script(GtkButton *button, GtkWidget *widget) | 73 | static void button_script(GtkButton *button, GtkWidget *widget) |
74 | - { | ||
75 | - v3270_run_script(widget,g_object_get_data(G_OBJECT(button),"script_text")); | 74 | + { |
75 | + v3270_run_script(widget,g_object_get_data(G_OBJECT(button),"script_text")); | ||
76 | } | 76 | } |
77 | 77 | ||
78 | void keypad_button_start(GMarkupParseContext *context, const gchar **names,const gchar **values, GError **error, struct keypad *keypad) | 78 | void keypad_button_start(GMarkupParseContext *context, const gchar **names,const gchar **values, GError **error, struct keypad *keypad) |
@@ -113,11 +113,11 @@ | @@ -113,11 +113,11 @@ | ||
113 | GTK_WIDGET_UNSET_FLAGS(widget,GTK_CAN_FOCUS); | 113 | GTK_WIDGET_UNSET_FLAGS(widget,GTK_CAN_FOCUS); |
114 | GTK_WIDGET_UNSET_FLAGS(widget,GTK_CAN_DEFAULT); | 114 | GTK_WIDGET_UNSET_FLAGS(widget,GTK_CAN_DEFAULT); |
115 | #endif // GTK(2,18) | 115 | #endif // GTK(2,18) |
116 | - | 116 | + |
117 | gtk_button_set_relief(GTK_BUTTON(widget),ui_get_relief(names, values, keypad->relief)); | 117 | gtk_button_set_relief(GTK_BUTTON(widget),ui_get_relief(names, values, keypad->relief)); |
118 | gtk_button_set_alignment(GTK_BUTTON(widget),0.5,0.5); | 118 | gtk_button_set_alignment(GTK_BUTTON(widget),0.5,0.5); |
119 | gtk_button_set_focus_on_click(GTK_BUTTON(widget),FALSE); | 119 | gtk_button_set_focus_on_click(GTK_BUTTON(widget),FALSE); |
120 | - | 120 | + |
121 | if(name) | 121 | if(name) |
122 | action = ui_get_action(info->center_widget,name,info->actions,names,values,error); | 122 | action = ui_get_action(info->center_widget,name,info->actions,names,values,error); |
123 | 123 | ||
@@ -127,9 +127,9 @@ | @@ -127,9 +127,9 @@ | ||
127 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(button_clicked),action); | 127 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(button_clicked),action); |
128 | } | 128 | } |
129 | else | 129 | else |
130 | - { | ||
131 | - keypad->widget = widget; | ||
132 | - gtk_widget_set_sensitive(widget,FALSE); | 130 | + { |
131 | + keypad->widget = widget; | ||
132 | + gtk_widget_set_sensitive(widget,FALSE); | ||
133 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(button_script),info->center_widget); | 133 | g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(button_script),info->center_widget); |
134 | } | 134 | } |
135 | } | 135 | } |
src/pw3270/uiparser/keypad.c
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | - #include "keypad.h" | 30 | + #include "keypad.h" |
31 | 31 | ||
32 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 32 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
33 | 33 | ||
@@ -68,8 +68,8 @@ | @@ -68,8 +68,8 @@ | ||
68 | } | 68 | } |
69 | 69 | ||
70 | static void element_end(GMarkupParseContext *context, const gchar *element_name, struct keypad *keypad, GError **error) | 70 | static void element_end(GMarkupParseContext *context, const gchar *element_name, struct keypad *keypad, GError **error) |
71 | - { | ||
72 | - keypad->widget = NULL; | 71 | + { |
72 | + keypad->widget = NULL; | ||
73 | // trace("%s: %s",__FUNCTION__,element_name); | 73 | // trace("%s: %s",__FUNCTION__,element_name); |
74 | } | 74 | } |
75 | 75 | ||
@@ -105,28 +105,28 @@ | @@ -105,28 +105,28 @@ | ||
105 | 105 | ||
106 | return UI_ATTR_DIRECTION_NONE; | 106 | return UI_ATTR_DIRECTION_NONE; |
107 | } | 107 | } |
108 | - | ||
109 | - static void element_text(GMarkupParseContext *context, const gchar *text, gsize sz, struct keypad *keypad, GError **error) | ||
110 | - { | ||
111 | - if(keypad->widget) | ||
112 | - { | 108 | + |
109 | + static void element_text(GMarkupParseContext *context, const gchar *text, gsize sz, struct keypad *keypad, GError **error) | ||
110 | + { | ||
111 | + if(keypad->widget) | ||
112 | + { | ||
113 | gchar *base = g_strstrip(g_strdup(text)); | 113 | gchar *base = g_strstrip(g_strdup(text)); |
114 | gchar *text = g_strdup(base); | 114 | gchar *text = g_strdup(base); |
115 | - g_free(base); | ||
116 | - | ||
117 | - if(*text) | ||
118 | - { | 115 | + g_free(base); |
116 | + | ||
117 | + if(*text) | ||
118 | + { | ||
119 | gtk_widget_set_sensitive(keypad->widget,TRUE); | 119 | gtk_widget_set_sensitive(keypad->widget,TRUE); |
120 | g_object_set_data_full(G_OBJECT(keypad->widget),"script_text",text,g_free); | 120 | g_object_set_data_full(G_OBJECT(keypad->widget),"script_text",text,g_free); |
121 | - } | ||
122 | - else | ||
123 | - { | ||
124 | - g_free(text); | ||
125 | - } | ||
126 | - | ||
127 | - } | ||
128 | - | ||
129 | - } | 121 | + } |
122 | + else | ||
123 | + { | ||
124 | + g_free(text); | ||
125 | + } | ||
126 | + | ||
127 | + } | ||
128 | + | ||
129 | + } | ||
130 | 130 | ||
131 | GObject * ui_create_keypad(GMarkupParseContext *context,GtkAction *action,struct parser *info,const gchar **names, const gchar **values, GError **error) | 131 | GObject * ui_create_keypad(GMarkupParseContext *context,GtkAction *action,struct parser *info,const gchar **names, const gchar **values, GError **error) |
132 | { | 132 | { |
src/pw3270/uiparser/keypad.h
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | - | 29 | + |
30 | 30 | ||
31 | #include <gtk/gtk.h> | 31 | #include <gtk/gtk.h> |
32 | #include "private.h" | 32 | #include "private.h" |
@@ -53,10 +53,10 @@ | @@ -53,10 +53,10 @@ | ||
53 | GtkWidget * table; | 53 | GtkWidget * table; |
54 | GtkReliefStyle relief; | 54 | GtkReliefStyle relief; |
55 | UI_ATTR_DIRECTION pos; | 55 | UI_ATTR_DIRECTION pos; |
56 | - GList * rows; | ||
57 | - | ||
58 | - GtkWidget * widget; | ||
59 | - | 56 | + GList * rows; |
57 | + | ||
58 | + GtkWidget * widget; | ||
59 | + | ||
60 | }; | 60 | }; |
61 | 61 | ||
62 | G_GNUC_INTERNAL void keypad_button_start(GMarkupParseContext *context, const gchar **names,const gchar **values, GError **error, struct keypad *keypad); | 62 | G_GNUC_INTERNAL void keypad_button_start(GMarkupParseContext *context, const gchar **names,const gchar **values, GError **error, struct keypad *keypad); |
src/pw3270/uiparser/private.h
@@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
93 | 93 | ||
94 | int ui_parse_file(struct parser *info, const gchar *filename); | 94 | int ui_parse_file(struct parser *info, const gchar *filename); |
95 | void ui_action_set_options(GtkAction *action, struct parser *info, const gchar **names, const gchar **values, GError **error); | 95 | void ui_action_set_options(GtkAction *action, struct parser *info, const gchar **names, const gchar **values, GError **error); |
96 | - | 96 | + |
97 | G_GNUC_INTERNAL GtkReliefStyle ui_get_relief(const gchar **names, const gchar **values, GtkReliefStyle def); | 97 | G_GNUC_INTERNAL GtkReliefStyle ui_get_relief(const gchar **names, const gchar **values, GtkReliefStyle def); |
98 | 98 | ||
99 | GObject * ui_get_element(struct parser *info, GtkAction *action, enum ui_element id, const gchar **names, const gchar **values, GError **error); | 99 | GObject * ui_get_element(struct parser *info, GtkAction *action, enum ui_element id, const gchar **names, const gchar **values, GError **error); |
src/pw3270/v3270/macros.c
@@ -29,46 +29,46 @@ | @@ -29,46 +29,46 @@ | ||
29 | * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | 29 | * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | - | 32 | + |
33 | #include "private.h" | 33 | #include "private.h" |
34 | #include <lib3270/macros.h> | 34 | #include <lib3270/macros.h> |
35 | - | 35 | + |
36 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 36 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
37 | - | ||
38 | - static int v3270_macro_copy(GtkWidget *widget, int argc, const char **argv) | ||
39 | - { | 37 | + |
38 | + static int v3270_macro_copy(GtkWidget *widget, int argc, const char **argv) | ||
39 | + { | ||
40 | v3270_copy(widget, V3270_SELECT_TEXT, FALSE); | 40 | v3270_copy(widget, V3270_SELECT_TEXT, FALSE); |
41 | - return 0; | 41 | + return 0; |
42 | } | 42 | } |
43 | - | ||
44 | - static int v3270_macro_append(GtkWidget *widget, int argc, const char **argv) | ||
45 | - { | 43 | + |
44 | + static int v3270_macro_append(GtkWidget *widget, int argc, const char **argv) | ||
45 | + { | ||
46 | v3270_copy_append(widget); | 46 | v3270_copy_append(widget); |
47 | - return 0; | 47 | + return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | - static int run_macro(GtkWidget *widget, int argc, const char **argv) | ||
51 | - { | 50 | + static int run_macro(GtkWidget *widget, int argc, const char **argv) |
51 | + { | ||
52 | #define V3270_MACRO( name ) { #name, v3270_macro_ ## name } | 52 | #define V3270_MACRO( name ) { #name, v3270_macro_ ## name } |
53 | - | 53 | + |
54 | static const struct _list | 54 | static const struct _list |
55 | { | 55 | { |
56 | const char *name; | 56 | const char *name; |
57 | int (*exec)(GtkWidget *widget, int argc, const char **argv); | 57 | int (*exec)(GtkWidget *widget, int argc, const char **argv); |
58 | - } list[] = | ||
59 | - { | ||
60 | - V3270_MACRO( copy ), | ||
61 | - V3270_MACRO( append ), | 58 | + } list[] = |
59 | + { | ||
60 | + V3270_MACRO( copy ), | ||
61 | + V3270_MACRO( append ), | ||
62 | }; | 62 | }; |
63 | 63 | ||
64 | int f; | 64 | int f; |
65 | - gchar *rsp; | ||
66 | - | ||
67 | - for(f=0;f<G_N_ELEMENTS(list);f++) | ||
68 | - { | ||
69 | - if(!g_ascii_strcasecmp(argv[0],list[f].name)) | ||
70 | - return list[f].exec(widget,argc,argv); | ||
71 | - } | 65 | + gchar *rsp; |
66 | + | ||
67 | + for(f=0;f<G_N_ELEMENTS(list);f++) | ||
68 | + { | ||
69 | + if(!g_ascii_strcasecmp(argv[0],list[f].name)) | ||
70 | + return list[f].exec(widget,argc,argv); | ||
71 | + } | ||
72 | 72 | ||
73 | rsp = lib3270_run_macro(GTK_V3270(widget)->host,argv); | 73 | rsp = lib3270_run_macro(GTK_V3270(widget)->host,argv); |
74 | if(rsp) | 74 | if(rsp) |
@@ -76,21 +76,21 @@ | @@ -76,21 +76,21 @@ | ||
76 | g_free(rsp); | 76 | g_free(rsp); |
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | - | ||
80 | - return -1; | 79 | + |
80 | + return -1; | ||
81 | } | 81 | } |
82 | 82 | ||
83 | - int v3270_run_script(GtkWidget *widget, const gchar *script) | ||
84 | -{ | ||
85 | - gchar **ln; | 83 | + int v3270_run_script(GtkWidget *widget, const gchar *script) |
84 | +{ | ||
85 | + gchar **ln; | ||
86 | int f; | 86 | int f; |
87 | - | ||
88 | - if(!script) | ||
89 | - return 0; | ||
90 | - | 87 | + |
88 | + if(!script) | ||
89 | + return 0; | ||
90 | + | ||
91 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); | 91 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); |
92 | - | ||
93 | - ln = g_strsplit(script,"\n",-1); | 92 | + |
93 | + ln = g_strsplit(script,"\n",-1); | ||
94 | 94 | ||
95 | for(f=0;ln[f];f++) | 95 | for(f=0;ln[f];f++) |
96 | { | 96 | { |
@@ -100,7 +100,7 @@ | @@ -100,7 +100,7 @@ | ||
100 | 100 | ||
101 | if(g_shell_parse_argv(g_strstrip(ln[f]),&argc,&argv,&error)) | 101 | if(g_shell_parse_argv(g_strstrip(ln[f]),&argc,&argv,&error)) |
102 | { | 102 | { |
103 | - run_macro(widget, argc, (const char **) argv); | 103 | + run_macro(widget, argc, (const char **) argv); |
104 | } | 104 | } |
105 | else | 105 | else |
106 | { | 106 | { |
@@ -113,8 +113,8 @@ | @@ -113,8 +113,8 @@ | ||
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | - g_strfreev(ln); | ||
117 | - | 116 | + g_strfreev(ln); |
117 | + | ||
118 | return 0; | 118 | return 0; |
119 | -} | 119 | +} |
120 | 120 |