diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-02-23 22:00:55 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-02-23 22:06:02 -0500 |
commit | b0b38c106deaa77d7bcbd4ecb7de6b41c07a9d22 (patch) | |
tree | fb960a502c082f0f75c5db58175deaace784fa15 /gtk/gtkimmulticontext.c | |
parent | aba2de34436035513b11faa2da4c7c56cc38ede9 (diff) | |
download | gtk+-b0b38c106deaa77d7bcbd4ecb7de6b41c07a9d22.tar.gz |
Make gtk-im-context-none work
This was added a few years ago, as a way to have _no_ im context
at all. But it didn't actually work. Make it work, and streamline
the handling of none by moving it all to gtkimmodule.c.
As part of this, add context to the translated names of all
im modules we ship.
Diffstat (limited to 'gtk/gtkimmulticontext.c')
-rw-r--r-- | gtk/gtkimmulticontext.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index 9d2a1ad0a2..6422abe6fa 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -38,8 +38,6 @@ */ -#define NONE_ID "gtk-im-context-none" - struct _GtkIMMulticontextPrivate { GtkIMContext *slave; @@ -274,12 +272,12 @@ gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext) priv->context_id = g_strdup (get_effective_context_id (multicontext)); - if (g_strcmp0 (priv->context_id, NONE_ID) == 0) - return NULL; - slave = _gtk_im_module_create (priv->context_id); - gtk_im_multicontext_set_slave (multicontext, slave, FALSE); - g_object_unref (slave); + if (slave) + { + gtk_im_multicontext_set_slave (multicontext, slave, FALSE); + g_object_unref (slave); + } } return priv->slave; @@ -618,19 +616,6 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context, gtk_widget_show (menuitem); gtk_menu_shell_append (menushell, menuitem); - menuitem = gtk_radio_menu_item_new_with_label (group, C_("input method menu", "None")); - if (g_strcmp0 (priv->context_id_aux, NONE_ID) == 0) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE); - g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"), NONE_ID); - g_signal_connect (menuitem, "activate", G_CALLBACK (activate_cb), context); - gtk_widget_show (menuitem); - gtk_menu_shell_append (menushell, menuitem); - group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - - menuitem = gtk_separator_menu_item_new (); - gtk_widget_show (menuitem); - gtk_menu_shell_append (menushell, menuitem); - _gtk_im_module_list (&contexts, &n_contexts); for (i = 0; i < n_contexts; i++) @@ -649,7 +634,7 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context, * GTK+. Input method may have a name in the GTK+ * message catalog. */ - translated_name = _(contexts[i]->context_name); + translated_name = C_("input method menu", contexts[i]->context_name); } else { @@ -688,9 +673,8 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context, #else translated_name = contexts[i]->context_name; #endif - menuitem = gtk_radio_menu_item_new_with_label (group, - translated_name); - + menuitem = gtk_radio_menu_item_new_with_label (group, translated_name); + if ((priv->context_id_aux && strcmp (contexts[i]->context_id, priv->context_id_aux) == 0)) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE); @@ -704,10 +688,10 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context, text = g_strdup_printf (C_("input method menu", "System (%s)"), translated_name); gtk_label_set_text (GTK_LABEL (label), text); g_free (text); - } - + } + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - + g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"), (char *)contexts[i]->context_id); g_signal_connect (menuitem, "activate", |