Commit 878a939d40facf2d25f80ae832a5bfee5661eeb2

Authored by perry.werneck@gmail.com
1 parent b6c6f0ef

Melhorando teste dos atributos que não precisam ser salvos nas "actions" de interface

Showing 1 changed file with 14 additions and 7 deletions   Show diff stats
src/pw3270/uiparser/action.c
... ... @@ -41,6 +41,19 @@
41 41 return FALSE;
42 42 }
43 43  
  44 + static gboolean check_internal_attribute(const gchar *name)
  45 + {
  46 + static const gchar *ignored[] = { "target", "direction", "sysmenu" };
  47 + int p;
  48 +
  49 + for(p=0;p< G_N_ELEMENTS(ignored);p++)
  50 + {
  51 + if(!g_ascii_strcasecmp(name,ignored[p]))
  52 + return FALSE;
  53 + }
  54 + return TRUE;
  55 + }
  56 +
44 57 void ui_action_set_options(GtkAction *action, struct parser *info, const gchar **name, const gchar **value, GError **error)
45 58 {
46 59 int f;
... ... @@ -97,17 +110,11 @@
97 110 {
98 111 g_object_set_data_full(G_OBJECT(action),"accel_attr",g_strdup(value[f]),g_free);
99 112 }
100   - else if(!g_ascii_strcasecmp(name[f],"target"))
101   - {
102   - }
103   - else if(!g_ascii_strcasecmp(name[f],"direction"))
104   - {
105   - }
106 113 else if(!g_ascii_strcasecmp(name[f],"id"))
107 114 {
108 115 g_object_set_data(G_OBJECT(action),"action_id",GINT_TO_POINTER(atoi(value[f])));
109 116 }
110   - else
  117 + else if(check_internal_attribute(name[f]))
111 118 {
112 119 g_object_set_data(G_OBJECT(action),name[f],g_string_chunk_insert_const(info->strings,value[f]));
113 120 }
... ...