[gtk+/wip/ricotz/deprecated: 3/7] Remove deprecated gtk_im_multicontext_append_menuitems



commit c9c2e10f1aaa183d255e20bbe93ed6daeb08d71d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Oct 23 17:05:25 2016 +0200

    Remove deprecated gtk_im_multicontext_append_menuitems

 docs/reference/gtk/gtk4-sections.txt |    1 -
 gtk/gtkimmulticontext.c              |  156 ----------------------------------
 gtk/gtkimmulticontext.h              |    3 -
 3 files changed, 0 insertions(+), 160 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 6ee6b64..69b7e6f 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1745,7 +1745,6 @@ gtk_im_context_simple_get_type
 <TITLE>GtkIMMulticontext</TITLE>
 GtkIMMulticontext
 gtk_im_multicontext_new
-gtk_im_multicontext_append_menuitems
 gtk_im_multicontext_get_context_id
 gtk_im_multicontext_set_context_id
 <SUBSECTION Standard>
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index a8700a8..32503a3 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
diff --git a/gtk/gtkimmulticontext.h b/gtk/gtkimmulticontext.h
index 77bc70c..bee93f9 100644
--- a/gtk/gtkimmulticontext.h
+++ b/gtk/gtkimmulticontext.h
@@ -63,9 +63,6 @@ GType         gtk_im_multicontext_get_type (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
 GtkIMContext *gtk_im_multicontext_new      (void);
 
-GDK_DEPRECATED_IN_3_10
-void          gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
-                                                   GtkMenuShell      *menushell);
 GDK_AVAILABLE_IN_ALL
 const char  * gtk_im_multicontext_get_context_id   (GtkIMMulticontext *context);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]