1
Index: gtk+2.0-2.10.10/gtk/gtkimmodule.c
2
===================================================================
3
--- gtk+2.0-2.10.10.orig/gtk/gtkimmodule.c 2007-03-12 14:51:28.000000000 +0100
4
+++ gtk+2.0-2.10.10/gtk/gtkimmodule.c 2007-03-13 14:10:33.000000000 +0100
6
#define GTK_IM_MODULE(im_module) (G_TYPE_CHECK_INSTANCE_CAST ((im_module), GTK_TYPE_IM_MODULE, GtkIMModule))
7
#define GTK_IS_IM_MODULE(im_module) (G_TYPE_CHECK_INSTANCE_TYPE ((im_module), GTK_TYPE_IM_MODULE))
9
+#define IMMODULEFILEEXT ".immodules"
10
+#define IMMODULEFILEEXT_LEN ((int) strlen (IMMODULEFILEEXT))
14
GTypeModule parent_instance;
19
-gtk_im_module_initialize (void)
20
+process_module_file (const gchar *filename, FILE *file)
22
GString *line_buf = g_string_new (NULL);
23
GString *tmp_buf = g_string_new (NULL);
24
- gchar *filename = gtk_rc_get_im_module_file();
26
gboolean have_error = FALSE;
28
GtkIMModule *module = NULL;
31
- contexts_hash = g_hash_table_new (g_str_hash, g_str_equal);
33
- file = g_fopen (filename, "r");
36
- /* In case someone wants only the default input method,
37
- * we allow no file at all.
39
- g_string_free (line_buf, TRUE);
40
- g_string_free (tmp_buf, TRUE);
45
while (!have_error && pango_read_line (file, line_buf))
50
add_module (module, infos);
53
g_string_free (line_buf, TRUE);
54
g_string_free (tmp_buf, TRUE);
59
+gtk_im_module_initialize (void)
61
+ gchar *im_module_file_str = gtk_rc_get_im_module_file();
62
+ gchar *im_module_files_d_str = g_build_filename (GTK_LIBDIR,
72
+ list_str = g_strjoin (G_SEARCHPATH_SEPARATOR_S,
74
+ im_module_files_d_str,
77
+ files = pango_split_file_list (list_str);
79
+ contexts_hash = g_hash_table_new (g_str_hash, g_str_equal);
87
+ GDir *dir = g_dir_open (files[n], 0, NULL);
92
+ while ((dent = g_dir_read_name (dir)))
94
+ int len = strlen (dent);
95
+ if (len > IMMODULEFILEEXT_LEN && strcmp (dent + len - IMMODULEFILEEXT_LEN, IMMODULEFILEEXT) == 0)
97
+ gchar *pathname = g_build_filename (files[n], dent, NULL);
98
+ file = g_fopen (pathname, "r");
101
+ process_module_file(pathname, file);
111
+ file = g_fopen (files[n], "r");
114
+ process_module_file(files[n], file);
120
+ g_strfreev (files);
122
+ g_free (im_module_files_d_str);
123
+ g_free (im_module_file_str);