Exemple #1
0
static void
load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t * cfg)
{
    gchar **profile_keys, **keys;

    if (section_name == NULL)
        return;

    keys = mc_config_get_keys (cfg, section_name, NULL);

    for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
    {
        gchar **values;

        values = mc_config_get_string_list (cfg, section_name, *profile_keys, NULL);
        if (values != NULL)
        {
            int action;

            action = keybind_lookup_action (*profile_keys);
            if (action > 0)
            {
                gchar **curr_values;

                for (curr_values = values; *curr_values != NULL; curr_values++)
                    keybind_cmd_bind (keymap, *curr_values, action);
            }

            g_strfreev (values);
        }
    }

    g_strfreev (keys);
}
Exemple #2
0
static void
load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t * cfg)
{
    gchar **profile_keys, **keys;
    gchar **values, **curr_values;
    char *valcopy, *value;
    int action;
    gsize len, values_len;

    if (section_name == NULL)
        return;

    profile_keys = keys = mc_config_get_keys (cfg, section_name, &len);

    while (*profile_keys != NULL)
    {
        curr_values = values =
                          mc_config_get_string_list (cfg, section_name, *profile_keys, &values_len);

        action = keybind_lookup_action (*profile_keys);

        if (action > 0)
        {
            if (curr_values != NULL)
            {
                while (*curr_values != NULL)
                {
                    valcopy = convert_controls (*curr_values);
                    keybind_cmd_bind (keymap, valcopy, action);
                    g_free (valcopy);
                    curr_values++;
                }
            }
            else
            {
                value = mc_config_get_string (cfg, section_name, *profile_keys, "");
                valcopy = convert_controls (value);
                /* define_sequence (key_code, valcopy, MCKEY_NOACTION); */
                g_free (valcopy);
                g_free (value);
            }
        }

        profile_keys++;
        g_strfreev (values);
    }
    g_strfreev (keys);
}
Exemple #3
0
static void
load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t * cfg)
{
    gchar **profile_keys, **keys;
    gsize len;

    if (section_name == NULL)
        return;

    profile_keys = keys = mc_config_get_keys (cfg, section_name, &len);

    while (*profile_keys != NULL)
    {
        gchar **values, **curr_values;

        curr_values = values = mc_config_get_string_list (cfg, section_name, *profile_keys, &len);

        if (curr_values != NULL)
        {
            int action;

            action = keybind_lookup_action (*profile_keys);
            if (action > 0)
                while (*curr_values != NULL)
                {
                    keybind_cmd_bind (keymap, *curr_values, action);
                    curr_values++;
                }

            g_strfreev (values);
        }

        profile_keys++;
    }

    g_strfreev (keys);
}