Exemple #1
0
void test_string_map()
{
    FcitxStringMap* map = fcitx_string_map_new("a:true,b:false", ',');
    assert(fcitx_string_map_get(map, "a", false));
    assert(!fcitx_string_map_get(map, "b", false));
    assert(fcitx_string_map_get(map, "c", true));
    fcitx_string_map_set(map, "c", false);
    assert(!fcitx_string_map_get(map, "c", true));
    char* joined = fcitx_string_map_to_string(map, '\n');
    assert(strcmp(joined, "a:true\nb:false\nc:false") == 0);
    free(joined);

    fcitx_string_map_free(map);
}
Exemple #2
0
static boolean ChttransEnabled(FcitxChttrans* chttrans) {
    boolean result = false;
    FcitxIM* im = FcitxInstanceGetCurrentIM(chttrans->owner);
    if (im) {
        boolean defaultValue = false;
        if (strcmp(im->langCode, "zh_TW") == 0 || strcmp(im->langCode, "en_HK") == 0 || strcmp(im->langCode, "zh_HK") == 0) {
            defaultValue = true;
        }
        result = fcitx_string_map_get(chttrans->enableIM, im->uniqueName, defaultValue);
    }
    return result;
}
Exemple #3
0
static void
FcitxNotifyShowTip(FcitxNotify *notify, const char *appName,
                   const char *appIcon, int32_t timeout, const char *tip_id,
                   const char *summary, const char *body)
{
    if (fcitx_unlikely(!tip_id) ||
        fcitx_string_map_get(notify->hide_notify, tip_id, false))
        return;
    fcitx_string_map_set(notify->hide_notify, tip_id, false);
    const FcitxFreedesktopNotifyAction actions[] = {
        {
            .id = "dont-show",
            .name = _("Do not show again"),
        }, {