Commit 2702cf34a2a0750623ac2418e7b98f92caa3e076
1 parent
85badda0
Exists in
master
and in
4 other branches
Adding action name validation.
Showing
1 changed file
with
20 additions
and
17 deletions
Show diff stats
src/objects/window/window.c
| ... | ... | @@ -112,7 +112,7 @@ |
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { | |
| 115 | + void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) { | |
| 116 | 116 | |
| 117 | 117 | if(prop_id == PROP_ACTION_NAMES) { |
| 118 | 118 | g_value_take_string(value,pw3270_window_get_action_names(GTK_WIDGET(object))); |
| ... | ... | @@ -150,9 +150,6 @@ |
| 150 | 150 | g_action_map_add_lib3270_actions(G_ACTION_MAP(widget)); |
| 151 | 151 | g_action_map_add_lib3270_toggles(G_ACTION_MAP(widget)); |
| 152 | 152 | |
| 153 | - g_action_map_add_action(G_ACTION_MAP(widget),v3270_pfkey_action_new()); | |
| 154 | - g_action_map_add_action(G_ACTION_MAP(widget),v3270_pakey_action_new()); | |
| 155 | - | |
| 156 | 153 | // Map special actions |
| 157 | 154 | { |
| 158 | 155 | size_t ix; |
| ... | ... | @@ -170,11 +167,19 @@ |
| 170 | 167 | |
| 171 | 168 | pw3270_action_connect_new(), |
| 172 | 169 | |
| 170 | + v3270_pfkey_action_new(), | |
| 171 | + v3270_pakey_action_new(), | |
| 172 | + | |
| 173 | 173 | }; |
| 174 | 174 | |
| 175 | 175 | for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { |
| 176 | - debug("Inserting %s",g_action_get_name(actions[ix])); | |
| 177 | - g_action_map_add_action(G_ACTION_MAP(widget),actions[ix]); | |
| 176 | + | |
| 177 | + if(!g_action_get_name(actions[ix])) { | |
| 178 | + g_warning("Window special action %u is unnamed",(unsigned int) ix); | |
| 179 | + } else { | |
| 180 | + g_action_map_add_action(G_ACTION_MAP(widget),actions[ix]); | |
| 181 | + } | |
| 182 | + | |
| 178 | 183 | } |
| 179 | 184 | |
| 180 | 185 | } |
| ... | ... | @@ -322,7 +327,7 @@ |
| 322 | 327 | gtk_window_set_default_size (GTK_WINDOW (window), 800, 500); |
| 323 | 328 | |
| 324 | 329 | // Create terminal widget |
| 325 | - GtkWidget * terminal = pw3270_application_window_new_tab(window, session_file); | |
| 330 | + GtkWidget * terminal = pw3270_application_window_new_tab(GTK_WIDGET(window), session_file); | |
| 326 | 331 | |
| 327 | 332 | // Create property actions |
| 328 | 333 | static const gchar * properties[] = { |
| ... | ... | @@ -334,17 +339,17 @@ |
| 334 | 339 | |
| 335 | 340 | for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) { |
| 336 | 341 | |
| 337 | - g_action_map_add_action( | |
| 338 | - G_ACTION_MAP(window), | |
| 339 | - v3270_property_action_new(terminal,properties[ix]) | |
| 340 | - ); | |
| 342 | + GAction * action = v3270_property_action_new(terminal,properties[ix]); | |
| 341 | 343 | |
| 344 | + if(!g_action_get_name(action)) { | |
| 345 | + g_warning("Window property action %s is unnamed",properties[ix]); | |
| 346 | + } else { | |
| 347 | + g_action_map_add_action(G_ACTION_MAP(window),action); | |
| 348 | + } | |
| 342 | 349 | } |
| 343 | 350 | |
| 344 | - | |
| 345 | 351 | // gtk_window_set_interactive_debugging(TRUE); |
| 346 | 352 | |
| 347 | - | |
| 348 | 353 | return GTK_WIDGET(window); |
| 349 | 354 | |
| 350 | 355 | } |
| ... | ... | @@ -374,9 +379,7 @@ |
| 374 | 379 | |
| 375 | 380 | } |
| 376 | 381 | |
| 377 | - void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | |
| 378 | - | |
| 379 | - debug("%s",__FUNCTION__); | |
| 380 | - | |
| 382 | + void pw3270_application_generic_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer G_GNUC_UNUSED(application)) { | |
| 383 | + g_message("Generic action %s was activated",g_action_get_name(G_ACTION(action))); | |
| 381 | 384 | } |
| 382 | 385 | ... | ... |