Hi all, Now, I'm developing my own text input method module by using the GtkIMModule. My own text input method is seperated to two major component, one is input engine and the other one is input helper. Input engine tooks response for retrieving the correct candidates for users inputs, while the Input helper charges for displaying them to the screen. And various input engines and input helpers are supported. my own text input method module here, plays the part of manager to choose the proper input engine and input helper for the current user. So I want my module can load the need engines or helpers module dynamically. The specific GtkIMModule is loaded as a module when the input method is selected, so all types in the module will be register use g_type_module_register_type(). I load my engines and helpers module in the class initizlize function and call g_type_module_use() and unload them in class finalzie function. Here is the problem, the first time I select my own input method module from the pop-up menu of a editable widget, it works perfect. But after I change to other input methods and re-select it again, an error occurs: Two different plugins tried to register 'xxxxx'. xxxx is a widget class defined in the helper module. Here are piece of my code: static void gtk_im_context_ptim_init(GTypeInstance * this, gpointer class) { GtkIMContextPTIM * this_ptim = GTK_IM_CONTEXT_PTIM(this);
... this->helper_module = g_object_new(PTIM_TYPE_HELPER_MODULE, NULL); this->helper_module->path = g_strdup(module_path); g_type_module_set_name(G_TYPE_MODULE(this->helper_module), this->helper_module->path); if (g_type_module_use(G_TYPE_MODULE(this->helper_module))) { gboolean res = TRUE; if (this->helper_module->helper_moudule_init) { res = this->helper_module->helper_moudule_init(G_TYPE_MODULE(this->helper_module)); } return res; } return; } ... static void gtk_im_context_ptim_finalize(GObject * this) { GtkIMContextPTIM * this_ptim = GTK_IM_CONTEXT_PTIM(this); GtkIMContext * super_class; ... g_type_module_unuse(G_TYPE_MODULE(this_ptim->helper_module)); /* Super class finalizatoin. */ super_class = g_type_class_peek(g_type_parent(GTK_TYPE_IM_CONTEXT_PTIM)); G_OBJECT_CLASS(super_class)->finalize(this); return; } The PTIM_TYPE_HELPER_MODULE is a sub-class of GTypeModule defined by myself to implement a specific helper module. helper_moudule_init() register all the types unsed by helper widgets. So, could anyone give some advices about the problem? Best regards, Nan Ye
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list