summaryrefslogtreecommitdiff
path: root/gtk/gtkimmulticontext.c
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2016-10-23 17:05:25 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2016-10-23 18:23:59 +0200
commitf3bc6619eb5891f5564321116fea4471be4ca26e (patch)
treeb34993d46709007b473860a70796f5cbf11e03f2 /gtk/gtkimmulticontext.c
parent88fcbd946af6d2baaa859389b5e18c29fb200b46 (diff)
downloadgtk+-f3bc6619eb5891f5564321116fea4471be4ca26e.tar.gz
Remove deprecated gtk_im_multicontext_append_menuitems
Diffstat (limited to 'gtk/gtkimmulticontext.c')
-rw-r--r--gtk/gtkimmulticontext.c156
1 files changed, 0 insertions, 156 deletions
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index a8700a8c66..32503a3c70 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -548,162 +548,6 @@ gtk_im_multicontext_delete_surrounding_cb (GtkIMContext *slave,
return result;
}
-static void
-activate_cb (GtkWidget *menuitem,
- GtkIMMulticontext *context)
-{
- if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
- {
- const gchar *id = g_object_get_data (G_OBJECT (menuitem), "gtk-context-id");
-
- gtk_im_multicontext_set_context_id (context, id);
- }
-}
-
-static int
-pathnamecmp (const char *a,
- const char *b)
-{
-#ifndef G_OS_WIN32
- return strcmp (a, b);
-#else
- /* Ignore case insensitivity, probably not that relevant here. Just
- * make sure slash and backslash compare equal.
- */
- while (*a && *b)
- if ((G_IS_DIR_SEPARATOR (*a) && G_IS_DIR_SEPARATOR (*b)) ||
- *a == *b)
- a++, b++;
- else
- return (*a - *b);
- return (*a - *b);
-#endif
-}
-
-/**
- * gtk_im_multicontext_append_menuitems:
- * @context: a #GtkIMMulticontext
- * @menushell: a #GtkMenuShell
- *
- * Add menuitems for various available input methods to a menu;
- * the menuitems, when selected, will switch the input method
- * for the context and the global default input method.
- *
- * Deprecated: 3.10: It is better to use the system-wide input
- * method framework for changing input methods. Modern
- * desktop shells offer on-screen displays for this that
- * can triggered with a keyboard shortcut, e.g. Super-Space.
- **/
-void
-gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
- GtkMenuShell *menushell)
-{
- GtkIMMulticontextPrivate *priv = context->priv;
- const GtkIMContextInfo **contexts;
- guint n_contexts, i;
- GSList *group = NULL;
- GtkWidget *menuitem, *system_menuitem;
- const char *system_context_id;
-
- system_context_id = _gtk_im_module_get_default_context_id ();
- system_menuitem = menuitem = gtk_radio_menu_item_new_with_label (group, C_("input method menu", "System"));
- if (!priv->context_id_aux)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
- group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"), NULL);
- g_signal_connect (menuitem, "activate", G_CALLBACK (activate_cb), context);
-
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (menushell, menuitem);
-
- _gtk_im_module_list (&contexts, &n_contexts);
-
- for (i = 0; i < n_contexts; i++)
- {
- const gchar *translated_name;
-#ifdef ENABLE_NLS
- if (contexts[i]->domain && contexts[i]->domain[0])
- {
- if (strcmp (contexts[i]->domain, GETTEXT_PACKAGE) == 0)
- {
- /* Same translation domain as GTK+ */
- if (!(contexts[i]->domain_dirname && contexts[i]->domain_dirname[0]) ||
- pathnamecmp (contexts[i]->domain_dirname, _gtk_get_localedir ()) == 0)
- {
- /* Empty or NULL, domain directory, or same as
- * GTK+. Input method may have a name in the GTK+
- * message catalog.
- */
- translated_name = g_dpgettext2 (GETTEXT_PACKAGE, "input method menu", contexts[i]->context_name);
- }
- else
- {
- /* Separate domain directory but the same
- * translation domain as GTK+. We can't call
- * bindtextdomain() as that would make GTK+ forget
- * its own messages.
- */
- g_warning ("Input method %s should not use GTK's translation domain %s",
- contexts[i]->context_id, GETTEXT_PACKAGE);
- /* Try translating the name in GTK+'s domain */
- translated_name = g_dpgettext2 (GETTEXT_PACKAGE, "input method menu", contexts[i]->context_name);
- }
- }
- else if (contexts[i]->domain_dirname && contexts[i]->domain_dirname[0])
- /* Input method has own translation domain and message catalog */
- {
- bindtextdomain (contexts[i]->domain,
- contexts[i]->domain_dirname);
-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
- bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
-#endif
- translated_name = g_dgettext (contexts[i]->domain, contexts[i]->context_name);
- }
- else
- {
- /* Different translation domain, but no domain directory */
- translated_name = contexts[i]->context_name;
- }
- }
- else
- /* Empty or NULL domain. We assume that input method does not
- * want a translated name in this case.
- */
- translated_name = contexts[i]->context_name;
-#else
- translated_name = contexts[i]->context_name;
-#endif
- 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);
-
- if (strcmp (contexts[i]->context_id, system_context_id) == 0)
- {
- GtkWidget *label;
- char *text;
-
- label = gtk_bin_get_child (GTK_BIN (system_menuitem));
- 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",
- G_CALLBACK (activate_cb), context);
-
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (menushell, menuitem);
- }
-
- g_free (contexts);
-}
-
/**
* gtk_im_multicontext_get_context_id:
* @context: a #GtkIMMulticontext