Skip to content

Commit

Permalink
src/ibusenginesimple: Support GTK4 coompose file
Browse files Browse the repository at this point in the history
Load $XDG_CONFIG_HOME/gtk-4.0/Compose
  • Loading branch information
fujiwarat committed Mar 1, 2022
1 parent 19377ad commit df664b1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/ibusenginesimple.c
Expand Up @@ -1448,8 +1448,16 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,
g_free (path);
return retval;
}
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);

path = g_build_filename (g_get_user_config_dir (),
"gtk-4.0", "Compose", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
ibus_engine_simple_add_compose_file (simple, path);
g_free (path);
return retval;
}
g_clear_pointer(&path, g_free);

path = g_build_filename (g_get_user_config_dir (),
"gtk-3.0", "Compose", NULL);
Expand All @@ -1458,8 +1466,7 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,
g_free (path);
return retval;
}
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);

home = g_get_home_dir ();
if (home == NULL)
Expand All @@ -1471,8 +1478,7 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,
g_free (path);
return retval;
}
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);

#if GLIB_CHECK_VERSION (2, 58, 0)
langs = g_get_language_names_with_category ("LC_CTYPE");
Expand Down Expand Up @@ -1508,8 +1514,7 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,

if (g_file_test (path, G_FILE_TEST_EXISTS))
break;
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);
}

#if !GLIB_CHECK_VERSION (2, 58, 0)
Expand All @@ -1518,15 +1523,13 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,

if (path != NULL)
ibus_engine_simple_add_compose_file (simple, path);
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);
} else {
path = g_build_filename (X11_DATADIR, locale, "Compose", NULL);
do {
if (g_file_test (path, G_FILE_TEST_EXISTS))
break;
g_free (path);
path = NULL;
g_clear_pointer(&path, g_free);
} while (0);
if (path == NULL)
return retval;
Expand Down

0 comments on commit df664b1

Please sign in to comment.