return TRUE;
}
-gboolean
-window_cb_key_press(GtkWidget * widget, GdkEventKey * event)
+static CustomKey
+custom_key_get_type(gint keyval)
{
-CustomKey custom_key;
-
-switch (event->keyval) {
+switch (keyval) {
case HILDON_HARDKEY_UP:
- custom_key = CUSTOM_KEY_UP;
+ return CUSTOM_KEY_UP;
break;
case HILDON_HARDKEY_DOWN:
- custom_key = CUSTOM_KEY_DOWN;
+ return CUSTOM_KEY_DOWN;
break;
case HILDON_HARDKEY_LEFT:
- custom_key = CUSTOM_KEY_LEFT;
+ return CUSTOM_KEY_LEFT;
break;
case HILDON_HARDKEY_RIGHT:
- custom_key = CUSTOM_KEY_RIGHT;
+ return CUSTOM_KEY_RIGHT;
break;
case HILDON_HARDKEY_SELECT:
- custom_key = CUSTOM_KEY_SELECT;
+ return CUSTOM_KEY_SELECT;
break;
case HILDON_HARDKEY_INCREASE:
- custom_key = CUSTOM_KEY_INCREASE;
+ return CUSTOM_KEY_INCREASE;
break;
case HILDON_HARDKEY_DECREASE:
- custom_key = CUSTOM_KEY_DECREASE;
+ return CUSTOM_KEY_DECREASE;
break;
case HILDON_HARDKEY_FULLSCREEN:
- custom_key = CUSTOM_KEY_FULLSCREEN;
+ return CUSTOM_KEY_FULLSCREEN;
break;
case HILDON_HARDKEY_ESC:
- custom_key = CUSTOM_KEY_ESC;
+ return CUSTOM_KEY_ESC;
break;
default:
- return FALSE;
+ return CUSTOM_KEY_ENUM_COUNT;
+}
+
}
- switch (_action[custom_key]) {
+gboolean
+window_cb_key_press(GtkWidget * widget, GdkEventKey * event)
+{
+CustomKey custom_key;
+
+custom_key=custom_key_get_type(event->keyval);
+if (custom_key==CUSTOM_KEY_ENUM_COUNT)
+ return FALSE;
+
+switch (_action[custom_key]) {
case CUSTOM_ACTION_PAN_NORTH:
map_pan(0, -PAN_UNITS);
break;
break;
case CUSTOM_ACTION_TOGGLE_AUTOCENTER:
switch (_center_mode) {
- case CENTER_LATLON:
- case CENTER_WAS_LEAD:
- set_action_activate("autocenter_lead", TRUE);
- break;
- case CENTER_LEAD:
- case CENTER_WAS_LATLON:
- set_action_activate("autocenter_latlon", TRUE);
- break;
- default:
- set_action_activate("autocenter_latlon", TRUE);
- break;
+ case CENTER_LATLON:
+ case CENTER_WAS_LEAD:
+ set_action_activate("autocenter_lead", TRUE);
+ break;
+ case CENTER_LEAD:
+ case CENTER_WAS_LATLON:
+ set_action_activate("autocenter_latlon", TRUE);
+ break;
+ default:
+ set_action_activate("autocenter_latlon", TRUE);
+ break;
}
break;
case CUSTOM_ACTION_ZOOM_IN: