Commit 22765196d65d421077c5bc5cd28b0f8d11bab6ff
1 parent
16a8c05e
Exists in
master
and in
5 other branches
Reorganizando montagem das acoes para uso de novos atributos
Showing
6 changed files
with
242 additions
and
60 deletions
Show diff stats
src/gtk/actions.c
@@ -35,8 +35,11 @@ | @@ -35,8 +35,11 @@ | ||
35 | #include <lib3270/actions.h> | 35 | #include <lib3270/actions.h> |
36 | #include <lib3270/selection.h> | 36 | #include <lib3270/selection.h> |
37 | 37 | ||
38 | + #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) | ||
39 | + | ||
38 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 40 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
39 | 41 | ||
42 | +/* | ||
40 | static void lib3270_action(GtkAction *action, GtkWidget *widget) | 43 | static void lib3270_action(GtkAction *action, GtkWidget *widget) |
41 | { | 44 | { |
42 | int (*call)(H3270 *h) = (int (*)(H3270 *h)) g_object_get_data(G_OBJECT(action),"lib3270_call"); | 45 | int (*call)(H3270 *h) = (int (*)(H3270 *h)) g_object_get_data(G_OBJECT(action),"lib3270_call"); |
@@ -92,7 +95,7 @@ void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, | @@ -92,7 +95,7 @@ void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, | ||
92 | #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name ) { #name, lib3270_ ## name }, | 95 | #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name ) { #name, lib3270_ ## name }, |
93 | #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, | 96 | #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, |
94 | #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, | 97 | #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, |
95 | - #define DECLARE_LIB3270_FKEY_ACTION( name ) /* name */ | 98 | + #define DECLARE_LIB3270_FKEY_ACTION( name ) // name |
96 | 99 | ||
97 | static const struct _lib3270_action | 100 | static const struct _lib3270_action |
98 | { | 101 | { |
@@ -147,6 +150,7 @@ void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, | @@ -147,6 +150,7 @@ void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, | ||
147 | // Not-found, disable action | 150 | // Not-found, disable action |
148 | gtk_action_set_sensitive(action,FALSE); | 151 | gtk_action_set_sensitive(action,FALSE); |
149 | } | 152 | } |
153 | +*/ | ||
150 | 154 | ||
151 | static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) | 155 | static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) |
152 | { | 156 | { |
@@ -157,6 +161,7 @@ static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) | @@ -157,6 +161,7 @@ static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) | ||
157 | lib3270_set_toggle(GTK_V3270(widget)->host,toggle,gtk_toggle_action_get_active(action)); | 161 | lib3270_set_toggle(GTK_V3270(widget)->host,toggle,gtk_toggle_action_get_active(action)); |
158 | } | 162 | } |
159 | 163 | ||
164 | +/* | ||
160 | void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) | 165 | void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) |
161 | { | 166 | { |
162 | LIB3270_TOGGLE toggle = lib3270_get_toggle_id(id); | 167 | LIB3270_TOGGLE toggle = lib3270_get_toggle_id(id); |
@@ -176,7 +181,9 @@ void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, | @@ -176,7 +181,9 @@ void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, | ||
176 | // Not found, disable action | 181 | // Not found, disable action |
177 | gtk_action_set_sensitive(action,FALSE); | 182 | gtk_action_set_sensitive(action,FALSE); |
178 | } | 183 | } |
184 | +*/ | ||
179 | 185 | ||
186 | +/* | ||
180 | static void selection_move_action(GtkAction *action, GtkWidget *widget) | 187 | static void selection_move_action(GtkAction *action, GtkWidget *widget) |
181 | { | 188 | { |
182 | trace("Action %s activated on widget %p dir=%d",gtk_action_get_name(action),widget,g_object_get_data(G_OBJECT(action),"direction")); | 189 | trace("Action %s activated on widget %p dir=%d",gtk_action_get_name(action),widget,g_object_get_data(G_OBJECT(action),"direction")); |
@@ -219,6 +226,7 @@ void ui_connect_target_action(GtkAction *action, GtkWidget *widget, const gchar | @@ -219,6 +226,7 @@ void ui_connect_target_action(GtkAction *action, GtkWidget *widget, const gchar | ||
219 | } | 226 | } |
220 | 227 | ||
221 | } | 228 | } |
229 | +*/ | ||
222 | 230 | ||
223 | static void action_pfkey(GtkAction *action, GtkWidget *widget) | 231 | static void action_pfkey(GtkAction *action, GtkWidget *widget) |
224 | { | 232 | { |
@@ -226,18 +234,13 @@ static void action_pfkey(GtkAction *action, GtkWidget *widget) | @@ -226,18 +234,13 @@ static void action_pfkey(GtkAction *action, GtkWidget *widget) | ||
226 | lib3270_pfkey(GTK_V3270(widget)->host,(int) g_object_get_data(G_OBJECT(action),"pfkey")); | 234 | lib3270_pfkey(GTK_V3270(widget)->host,(int) g_object_get_data(G_OBJECT(action),"pfkey")); |
227 | } | 235 | } |
228 | 236 | ||
229 | -void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) | ||
230 | -{ | ||
231 | - g_object_set_data(G_OBJECT(action),"pfkey",(gpointer) atoi(id)); | ||
232 | - g_signal_connect(action,"activate",G_CALLBACK(action_pfkey),widget); | ||
233 | -} | ||
234 | - | ||
235 | static void action_pakey(GtkAction *action, GtkWidget *widget) | 237 | static void action_pakey(GtkAction *action, GtkWidget *widget) |
236 | { | 238 | { |
237 | trace("Action %s activated on widget %p key=%d",gtk_action_get_name(action),widget,g_object_get_data(G_OBJECT(action),"pakey")); | 239 | trace("Action %s activated on widget %p key=%d",gtk_action_get_name(action),widget,g_object_get_data(G_OBJECT(action),"pakey")); |
238 | lib3270_pakey(GTK_V3270(widget)->host,(int) g_object_get_data(G_OBJECT(action),"pakey")); | 240 | lib3270_pakey(GTK_V3270(widget)->host,(int) g_object_get_data(G_OBJECT(action),"pakey")); |
239 | } | 241 | } |
240 | 242 | ||
243 | +/* | ||
241 | static void action_fullscreen(GtkAction *action, GtkWidget *widget) | 244 | static void action_fullscreen(GtkAction *action, GtkWidget *widget) |
242 | { | 245 | { |
243 | lib3270_set_toggle(GTK_V3270(widget)->host,LIB3270_TOGGLE_FULL_SCREEN,1); | 246 | lib3270_set_toggle(GTK_V3270(widget)->host,LIB3270_TOGGLE_FULL_SCREEN,1); |
@@ -290,4 +293,178 @@ void ui_connect_index_action(GtkAction *action, GtkWidget *widget, int ix, GtkAc | @@ -290,4 +293,178 @@ void ui_connect_index_action(GtkAction *action, GtkWidget *widget, int ix, GtkAc | ||
290 | g_warning("Action \"%s\" has unexpected id %d",gtk_action_get_name(action),ix); | 293 | g_warning("Action \"%s\" has unexpected id %d",gtk_action_get_name(action),ix); |
291 | gtk_action_set_sensitive(action,FALSE); | 294 | gtk_action_set_sensitive(action,FALSE); |
292 | } | 295 | } |
296 | + } | ||
297 | +*/ | ||
298 | + | ||
299 | +GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash, const gchar **names, const gchar **values, GError **error) | ||
300 | +{ | ||
301 | + GtkAction * action = NULL; | ||
302 | + GtkAction **toggle_action = (GtkAction **) g_object_get_data(G_OBJECT(widget),"toggle_actions"); | ||
303 | + const gchar * direction = ui_get_attribute("direction",names,values); | ||
304 | + unsigned short flags = 0; | ||
305 | + const gchar * attr; | ||
306 | + int id = 0; | ||
307 | + gchar * nm = NULL; | ||
308 | + | ||
309 | + enum _action_type | ||
310 | + { | ||
311 | + ACTION_TYPE_DEFAULT, | ||
312 | + ACTION_TYPE_TOGGLE, | ||
313 | + ACTION_TYPE_MOVE, | ||
314 | + ACTION_TYPE_PFKEY, | ||
315 | + ACTION_TYPE_PAKEY, | ||
316 | + ACTION_TYPE_SET, | ||
317 | + ACTION_TYPE_RESET, | ||
318 | + | ||
319 | + } action_type = ACTION_TYPE_DEFAULT; | ||
320 | + | ||
321 | + if(direction) | ||
322 | + { | ||
323 | + static const gchar *dirname[] = { "up", "down", "left", "right" }; | ||
324 | + int f; | ||
325 | + | ||
326 | + for(f=0;f<G_N_ELEMENTS(dirname);f++) | ||
327 | + { | ||
328 | + if(!g_strcasecmp(direction,dirname[f])) | ||
329 | + { | ||
330 | + flags |= f; | ||
331 | + break; | ||
332 | + } | ||
333 | + } | ||
334 | + } | ||
335 | + | ||
336 | + if(ui_get_bool_attribute("selecting",names,values,FALSE)) | ||
337 | + flags |= 0x80; | ||
338 | + | ||
339 | + // Build action name & type | ||
340 | + if(!g_strcasecmp(name,"toggle")) | ||
341 | + { | ||
342 | + action_type = ACTION_TYPE_TOGGLE; | ||
343 | + attr = ui_get_attribute("id",names,values); | ||
344 | + id = lib3270_get_toggle_id(attr); | ||
345 | + if(id < 0) | ||
346 | + { | ||
347 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("Toggle action needs a valid toggle id" )); | ||
348 | + return NULL; | ||
349 | + } | ||
350 | + nm = g_strconcat(name,attr,NULL); | ||
351 | + } | ||
352 | + else if(!g_strcasecmp(name,"move")) | ||
353 | + { | ||
354 | + action_type = ACTION_TYPE_MOVE; | ||
355 | + attr = ui_get_attribute("target",names,values); | ||
356 | + | ||
357 | + if(!(attr && direction)) | ||
358 | + { | ||
359 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("Move action needs target & direction attributes" )); | ||
360 | + return NULL; | ||
361 | + } | ||
362 | + | ||
363 | + nm = g_strconcat((flags & 0x80) ? "select" : "move",attr,direction, NULL); | ||
364 | + | ||
365 | + } | ||
366 | + else if(!g_strcasecmp(name,"set")) | ||
367 | + { | ||
368 | + attr = ui_get_attribute("toggle",names,values); | ||
369 | + id = lib3270_get_toggle_id(attr); | ||
370 | + if(id < 0) | ||
371 | + { | ||
372 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("Set action needs a valid toggle name" )); | ||
373 | + return NULL; | ||
374 | + } | ||
375 | + nm = g_strconcat("set",attr,NULL); | ||
376 | + } | ||
377 | + else if(!g_strcasecmp(name,"reset")) | ||
378 | + { | ||
379 | + attr = ui_get_attribute("toggle",names,values); | ||
380 | + id = lib3270_get_toggle_id(attr); | ||
381 | + if(id < 0) | ||
382 | + { | ||
383 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("Reset action needs a valid toggle name" )); | ||
384 | + return NULL; | ||
385 | + } | ||
386 | + nm = g_strconcat("reset",attr,NULL); | ||
387 | + } | ||
388 | + else if(!g_strcasecmp(name,"pfkey")) | ||
389 | + { | ||
390 | + action_type = ACTION_TYPE_PFKEY; | ||
391 | + attr = ui_get_attribute("id",names,values); | ||
392 | + if(!attr) | ||
393 | + { | ||
394 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("pf action needs a valid id attribute" )); | ||
395 | + return NULL; | ||
396 | + } | ||
397 | + id = atoi(attr); | ||
398 | + nm = g_strdup_printf("pf%02d",id); | ||
399 | + } | ||
400 | + else if(!g_strcasecmp(name,"pakey")) | ||
401 | + { | ||
402 | + action_type = ACTION_TYPE_PAKEY; | ||
403 | + attr = ui_get_attribute("id",names,values); | ||
404 | + if(!attr) | ||
405 | + { | ||
406 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,"%s",_("pf action needs a valid id attribute" )); | ||
407 | + return NULL; | ||
408 | + } | ||
409 | + id = atoi(attr); | ||
410 | + nm = g_strdup_printf("pa%02d",id); | ||
411 | + } | ||
412 | + else | ||
413 | + { | ||
414 | + nm = g_strdup(name); | ||
415 | + } | ||
416 | + | ||
417 | + // Check if action is available | ||
418 | + action = g_hash_table_lookup(hash,nm); | ||
419 | + if(action) | ||
420 | + { | ||
421 | + g_free(nm); | ||
422 | + return action; | ||
423 | + } | ||
424 | + | ||
425 | + // Not available, create a new one | ||
426 | + switch(action_type) | ||
427 | + { | ||
428 | + case ACTION_TYPE_DEFAULT: | ||
429 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
430 | + break; | ||
431 | + | ||
432 | + case ACTION_TYPE_TOGGLE: | ||
433 | + action = GTK_ACTION(gtk_toggle_action_new(nm,NULL,NULL,NULL)); | ||
434 | + toggle_action[id] = action; | ||
435 | + g_object_set_data(G_OBJECT(action),"toggle_id",(gpointer) id); | ||
436 | + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),(lib3270_get_toggle(GTK_V3270(widget)->host,id) != 0)); | ||
437 | + g_signal_connect(action,"toggled",G_CALLBACK(lib3270_toggle_action),widget); | ||
438 | + break; | ||
439 | + | ||
440 | + case ACTION_TYPE_MOVE: | ||
441 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
442 | + break; | ||
443 | + | ||
444 | + case ACTION_TYPE_PFKEY: | ||
445 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
446 | + g_object_set_data(G_OBJECT(action),"pfkey",(gpointer) id); | ||
447 | + g_signal_connect(action,"activate",G_CALLBACK(action_pfkey),widget); | ||
448 | + break; | ||
449 | + | ||
450 | + case ACTION_TYPE_PAKEY: | ||
451 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
452 | + g_object_set_data(G_OBJECT(action),"pakey",(gpointer) id); | ||
453 | + g_signal_connect(action,"activate",G_CALLBACK(action_pakey),widget); | ||
454 | + break; | ||
455 | + | ||
456 | + case ACTION_TYPE_SET: | ||
457 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
458 | + break; | ||
459 | + | ||
460 | + case ACTION_TYPE_RESET: | ||
461 | + action = gtk_action_new(nm,NULL,NULL,NULL); | ||
462 | + break; | ||
463 | + } | ||
464 | + | ||
465 | + g_hash_table_insert(hash,nm,action); | ||
466 | + g_free(nm); | ||
467 | + | ||
468 | + return action; | ||
293 | } | 469 | } |
470 | + |
src/gtk/uiparser/parsefile.c
@@ -139,33 +139,34 @@ | @@ -139,33 +139,34 @@ | ||
139 | 139 | ||
140 | static GtkAction * get_action(const gchar *name, struct parser *info, const gchar **names, const gchar **values, GError **error) | 140 | static GtkAction * get_action(const gchar *name, struct parser *info, const gchar **names, const gchar **values, GError **error) |
141 | { | 141 | { |
142 | + GtkAction *action; | ||
143 | + | ||
144 | + if(!g_strcasecmp(name,"quit")) | ||
145 | + { | ||
146 | + action = g_hash_table_lookup(info->actions,name); | ||
147 | + if(!action) | ||
148 | + { | ||
149 | + action = gtk_action_new(name,NULL,NULL,NULL); | ||
150 | + g_signal_connect(action,"activate",G_CALLBACK(gtk_main_quit), NULL); | ||
151 | + } | ||
152 | + } | ||
153 | + else | ||
154 | + { | ||
155 | + action = ui_get_action(info->center_widget,name,info->actions,names,values,error); | ||
156 | + } | ||
157 | + | ||
158 | + if(!action) | ||
159 | + return action; | ||
160 | + | ||
161 | +/* | ||
142 | const gchar * target = NULL; | 162 | const gchar * target = NULL; |
143 | const gchar * direction = ui_get_attribute("direction",names,values); | 163 | const gchar * direction = ui_get_attribute("direction",names,values); |
144 | const gchar * id = ui_get_attribute("id",names,values); | 164 | const gchar * id = ui_get_attribute("id",names,values); |
145 | - unsigned short flags = 0; | ||
146 | GtkAction * action; | 165 | GtkAction * action; |
147 | gchar * nm; | 166 | gchar * nm; |
148 | void (*connect)(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) = ui_connect_action; | 167 | void (*connect)(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) = ui_connect_action; |
149 | GtkAction * (*create)(const gchar *,const gchar *,const gchar *,const gchar *) = gtk_action_new; | 168 | GtkAction * (*create)(const gchar *,const gchar *,const gchar *,const gchar *) = gtk_action_new; |
150 | 169 | ||
151 | - if(direction) | ||
152 | - { | ||
153 | - static const gchar *dirname[] = { "up", "down", "left", "right" }; | ||
154 | - int f; | ||
155 | - | ||
156 | - for(f=0;f<G_N_ELEMENTS(dirname);f++) | ||
157 | - { | ||
158 | - if(!g_strcasecmp(direction,dirname[f])) | ||
159 | - { | ||
160 | - flags |= f; | ||
161 | - break; | ||
162 | - } | ||
163 | - } | ||
164 | - } | ||
165 | - | ||
166 | - if(ui_get_bool_attribute("selecting",names,values,FALSE)) | ||
167 | - flags |= 0x80; | ||
168 | - | ||
169 | if(!g_strcasecmp(name,"toggle")) | 170 | if(!g_strcasecmp(name,"toggle")) |
170 | { | 171 | { |
171 | nm = g_strconcat(name,id,NULL); | 172 | nm = g_strconcat(name,id,NULL); |
@@ -241,7 +242,7 @@ | @@ -241,7 +242,7 @@ | ||
241 | g_signal_connect(action,"activate",G_CALLBACK(gtk_main_quit), NULL); | 242 | g_signal_connect(action,"activate",G_CALLBACK(gtk_main_quit), NULL); |
242 | 243 | ||
243 | } | 244 | } |
244 | - | 245 | +*/ |
245 | ui_action_set_options(action,info,names,values,error); | 246 | ui_action_set_options(action,info,names,values,error); |
246 | 247 | ||
247 | return action; | 248 | return action; |
src/gtk/uiparser/parser.h
@@ -52,11 +52,16 @@ | @@ -52,11 +52,16 @@ | ||
52 | } UI_WIDGET_SETUP; | 52 | } UI_WIDGET_SETUP; |
53 | 53 | ||
54 | GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, const gchar **actionname, GtkWidget *widget, const UI_WIDGET_SETUP *itn); | 54 | GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, const gchar **actionname, GtkWidget *widget, const UI_WIDGET_SETUP *itn); |
55 | - void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
56 | - void ui_connect_target_action(GtkAction *action, GtkWidget *widget, const gchar *target, unsigned short flags, GError **error); | ||
57 | - void ui_connect_index_action(GtkAction *action, GtkWidget *widget, int ix, GtkAction **lst); | ||
58 | - void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
59 | - void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
60 | - void ui_connect_pakey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | 55 | + const gchar * ui_get_attribute(const gchar *key, const gchar **name, const gchar **value); |
56 | + gboolean ui_get_bool_attribute(const gchar *key, const gchar **name, const gchar **value, gboolean def); | ||
57 | + GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash, const gchar **names, const gchar **values, GError **error); | ||
58 | + | ||
59 | + | ||
60 | +// void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
61 | +// void ui_connect_target_action(GtkAction *action, GtkWidget *widget, const gchar *target, unsigned short flags, GError **error); | ||
62 | +// void ui_connect_index_action(GtkAction *action, GtkWidget *widget, int ix, GtkAction **lst); | ||
63 | +// void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
64 | +// void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
65 | +// void ui_connect_pakey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ||
61 | 66 | ||
62 | #endif // UI_PARSER_H_INCLUDED | 67 | #endif // UI_PARSER_H_INCLUDED |
src/gtk/uiparser/private.h
@@ -69,8 +69,6 @@ | @@ -69,8 +69,6 @@ | ||
69 | const UI_WIDGET_SETUP * setup; | 69 | const UI_WIDGET_SETUP * setup; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | - const gchar * ui_get_attribute(const gchar *key, const gchar **name, const gchar **value); | ||
73 | - gboolean ui_get_bool_attribute(const gchar *key, const gchar **name, const gchar **value, gboolean def); | ||
74 | int ui_parse_file(struct parser *info, const gchar *filename); | 72 | int ui_parse_file(struct parser *info, const gchar *filename); |
75 | void ui_action_set_options(GtkAction *action, struct parser *info, const gchar **names, const gchar **values, GError **error); | 73 | void ui_action_set_options(GtkAction *action, struct parser *info, const gchar **names, const gchar **values, GError **error); |
76 | 74 |
src/lib3270/toggles.c
@@ -222,14 +222,15 @@ LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix) | @@ -222,14 +222,15 @@ LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix) | ||
222 | 222 | ||
223 | LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name) | 223 | LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name) |
224 | { | 224 | { |
225 | - int f; | ||
226 | - | ||
227 | - for(f=0;f<N_TOGGLES;f++) | 225 | + if(name) |
228 | { | 226 | { |
229 | - if(!strcasecmp(name,toggle_names[f])) | ||
230 | - return f; | 227 | + int f; |
228 | + for(f=0;f<N_TOGGLES;f++) | ||
229 | + { | ||
230 | + if(!strcasecmp(name,toggle_names[f])) | ||
231 | + return f; | ||
232 | + } | ||
231 | } | 233 | } |
232 | - | ||
233 | return -1; | 234 | return -1; |
234 | } | 235 | } |
235 | 236 |
ui/00default.xml
@@ -93,22 +93,22 @@ | @@ -93,22 +93,22 @@ | ||
93 | <menuitem name='ScreenSizes' group='offline' label='Screen size' /> | 93 | <menuitem name='ScreenSizes' group='offline' label='Screen size' /> |
94 | 94 | ||
95 | <menu name='OptionsMenu' label='_Options' > | 95 | <menu name='OptionsMenu' label='_Options' > |
96 | - <menuitem action='Toggle' id='AutoConnect' label='Connect on startup' /> | ||
97 | - <menuitem action='Toggle' id='CursorBlink' label='Blinking Cursor' /> | ||
98 | - <menuitem action='Toggle' id='Monocase' label='Monocase' /> | ||
99 | - <menuitem action='Toggle' id='CursorPos' label='Track Cursor' /> | ||
100 | - <menuitem action='Toggle' id='FullScreen' key='<alt>Home' label='Full Screen' /> | ||
101 | - <menuitem action='Toggle' id='MarginedPaste' label='Paste with left margin' /> | ||
102 | - <menuitem action='Toggle' id='CrossHair' key='<alt>x' label='Cross Hair Cursor' /> | ||
103 | - <menuitem action='Toggle' id='BlankFill' label='Blank Fill' /> | ||
104 | - <menuitem action='Toggle' id='RectSelect' label='Select by rectangles' /> | ||
105 | - <menuitem action='Toggle' id='Reconnect' label='Auto-Reconnect' /> | ||
106 | - <menuitem action='Toggle' id='Bold' label='Bold' /> | ||
107 | - <menuitem action='Toggle' id='Underline' label='Show Underline' /> | ||
108 | - <menuitem action='Toggle' id='KeepSelected' label='Keep selected' /> | ||
109 | - <menuitem action='Toggle' id='SmartPaste' label='Smart paste' /> | ||
110 | - <menuitem action='Toggle' id='Beep' label='Alert sound' /> | ||
111 | - <menuitem action='Toggle' id='KPAlternative' label='Use +/- for field navigation' /> | 96 | + <menuitem action='toggle' id='AutoConnect' label='Connect on startup' /> |
97 | + <menuitem action='toggle' id='CursorBlink' label='Blinking Cursor' /> | ||
98 | + <menuitem action='toggle' id='Monocase' label='Monocase' /> | ||
99 | + <menuitem action='toggle' id='CursorPos' label='Track Cursor' /> | ||
100 | + <menuitem action='toggle' id='FullScreen' key='<alt>Home' label='Full Screen' /> | ||
101 | + <menuitem action='toggle' id='MarginedPaste' label='Paste with left margin' /> | ||
102 | + <menuitem action='toggle' id='CrossHair' key='<alt>x' label='Cross Hair Cursor' /> | ||
103 | + <menuitem action='toggle' id='BlankFill' label='Blank Fill' /> | ||
104 | + <menuitem action='toggle' id='RectSelect' label='Select by rectangles' /> | ||
105 | + <menuitem action='toggle' id='Reconnect' label='Auto-Reconnect' /> | ||
106 | + <menuitem action='toggle' id='Bold' label='Bold' /> | ||
107 | + <menuitem action='toggle' id='Underline' label='Show Underline' /> | ||
108 | + <menuitem action='toggle' id='KeepSelected' label='Keep selected' /> | ||
109 | + <menuitem action='toggle' id='SmartPaste' label='Smart paste' /> | ||
110 | + <menuitem action='toggle' id='Beep' label='Alert sound' /> | ||
111 | + <menuitem action='toggle' id='KPAlternative' label='Use +/- for field navigation' /> | ||
112 | </menu> | 112 | </menu> |
113 | 113 | ||
114 | <!--- Special action - InputMethod menu will be populated with Gtk input_method menu items ---> | 114 | <!--- Special action - InputMethod menu will be populated with Gtk input_method menu items ---> |
@@ -133,8 +133,8 @@ | @@ -133,8 +133,8 @@ | ||
133 | <toolitem action='Disconnect' /> | 133 | <toolitem action='Disconnect' /> |
134 | 134 | ||
135 | <separator/> | 135 | <separator/> |
136 | - <toolitem action='ToggleSet' id='FullScreen' icon='fullscreen' label='Full Screen' /> | ||
137 | - <toolitem action='ToggleReset' id='FullScreen' icon='leave-fullscreen' label='Window' /> | 136 | + <toolitem action='set' toggle='fullscreen' icon='fullscreen' label='Full Screen' /> |
137 | + <toolitem action='reset' toggle='fullscreen' icon='leave-fullscreen' label='Window' /> | ||
138 | <toolitem action='SelectColors' /> | 138 | <toolitem action='SelectColors' /> |
139 | <toolitem action='PrintScreen' /> | 139 | <toolitem action='PrintScreen' /> |
140 | <toolitem action='Quit' /> | 140 | <toolitem action='Quit' /> |
@@ -175,7 +175,7 @@ | @@ -175,7 +175,7 @@ | ||
175 | <accelerator action='Toggle' id='Insert' key='Insert' group='online' /> | 175 | <accelerator action='Toggle' id='Insert' key='Insert' group='online' /> |
176 | 176 | ||
177 | <accelerator action='Home' key='Home' group='online' /> | 177 | <accelerator action='Home' key='Home' group='online' /> |
178 | - <accelerator action='Reset' key='<Shift><Ctrl>r' group='online' /> | 178 | + <!-- accelerator action='Reset' key='<Shift><Ctrl>r' group='online' /--> |
179 | <accelerator action='Return' key='Return' /> | 179 | <accelerator action='Return' key='Return' /> |
180 | <accelerator action='Enter' key='KP_Enter' /> | 180 | <accelerator action='Enter' key='KP_Enter' /> |
181 | <accelerator action='Break' key='Escape' group='online' /> | 181 | <accelerator action='Break' key='Escape' group='online' /> |