text util: Remove an unused function
authorMatthias Clasen <mclasen@redhat.com>
Fri, 13 Sep 2019 21:25:02 +0000 (17:25 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 15 Sep 2019 19:01:45 +0000 (15:01 -0400)
_gtk_text_util_append_special_char_menuitems was not used.

gtk/gtktextutil.c
gtk/gtktextutil.h

index 2c3c43d8bc6027ac66e06a604eaf72791ddcfc12..200f87285c61951f880f9bd8a9d6b020931a5440 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "gtktextbuffer.h"
 #include "gtktextlayoutprivate.h"
-#include "gtkmenuitem.h"
 #include "gtkintl.h"
 
 #define DRAG_ICON_MAX_WIDTH 250
 #define DRAG_ICON_MAX_LINES 7
 #define ELLIPSIS_CHARACTER "\xe2\x80\xa6"
 
-typedef struct _GtkUnicodeMenuEntry GtkUnicodeMenuEntry;
-typedef struct _GtkTextUtilCallbackInfo GtkTextUtilCallbackInfo;
-
-struct _GtkUnicodeMenuEntry {
-  const char *label;
-  gunichar ch;
-};
-
-struct _GtkTextUtilCallbackInfo
-{
-  GtkTextUtilCharChosenFunc func;
-  gpointer data;
-};
-
-static const GtkUnicodeMenuEntry bidi_menu_entries[] = {
-  { N_("LRM _Left-to-right mark"), 0x200E },
-  { N_("RLM _Right-to-left mark"), 0x200F },
-  { N_("LRE Left-to-right _embedding"), 0x202A },
-  { N_("RLE Right-to-left e_mbedding"), 0x202B },
-  { N_("LRO Left-to-right _override"), 0x202D },
-  { N_("RLO Right-to-left o_verride"), 0x202E },
-  { N_("PDF _Pop directional formatting"), 0x202C },
-  { N_("ZWS _Zero width space"), 0x200B },
-  { N_("ZWJ Zero width _joiner"), 0x200D },
-  { N_("ZWNJ Zero width _non-joiner"), 0x200C }
-};
-
-static GtkTextUtilCallbackInfo *
-callback_info_new (GtkTextUtilCharChosenFunc  func,
-                   gpointer                   data)
-{
-  GtkTextUtilCallbackInfo *info;
-
-  info = g_slice_new (GtkTextUtilCallbackInfo);
-
-  info->func = func;
-  info->data = data;
-
-  return info;
-}
-
-static void
-callback_info_free (GtkTextUtilCallbackInfo *info)
-{
-  g_slice_free (GtkTextUtilCallbackInfo, info);
-}
-
-static void
-activate_cb (GtkWidget *menu_item,
-             gpointer   data)
-{
-  GtkUnicodeMenuEntry *entry;
-  GtkTextUtilCallbackInfo *info = data;
-  char buf[7];
-  
-  entry = g_object_get_data (G_OBJECT (menu_item), "gtk-unicode-menu-entry");
-
-  buf[g_unichar_to_utf8 (entry->ch, buf)] = '\0';
-  
-  (* info->func) (buf, info->data);
-}
-
-/*
- * _gtk_text_util_append_special_char_menuitems
- * @menushell: a #GtkMenuShell
- * @callback:  call this when an item is chosen
- * @data: data for callback
- * 
- * Add menuitems for various bidi control characters  to a menu;
- * the menuitems, when selected, will call the given function
- * with the chosen character.
- *
- * This function is private/internal in GTK 2.0, the functionality may
- * become public sometime, but it probably needs more thought first.
- * e.g. maybe there should be a way to just get the list of items,
- * instead of requiring the menu items to be created.
- */
-void
-_gtk_text_util_append_special_char_menuitems (GtkMenuShell              *menushell,
-                                              GtkTextUtilCharChosenFunc  func,
-                                              gpointer                   data)
-{
-  int i;
-
-  for (i = 0; i < G_N_ELEMENTS (bidi_menu_entries); i++)
-    {
-      GtkWidget *menuitem;
-      GtkTextUtilCallbackInfo *info;
-
-      info = callback_info_new (func, data);
-
-      menuitem = gtk_menu_item_new_with_mnemonic (_(bidi_menu_entries[i].label));
-      g_object_set_data (G_OBJECT (menuitem), I_("gtk-unicode-menu-entry"),
-                         (gpointer)&bidi_menu_entries[i]);
-
-      g_signal_connect_data (menuitem, "activate",
-                             G_CALLBACK (activate_cb),
-                             info, (GClosureNotify) callback_info_free, 0);
-
-      gtk_widget_show (menuitem);
-      gtk_menu_shell_append (menushell, menuitem);
-    }
-}
-
 static void
 append_n_lines (GString *str, const gchar *text, GSList *lines, gint n_lines)
 {
index 450ed464a1584ccfbe19438c10a1e744b5569422..4ad534ce7bb5cf2aa4125d59fe77cbce1326b06d 100644 (file)
@@ -31,13 +31,6 @@ G_BEGIN_DECLS
  * GtkTextView and GtkEntry
  */
 
-typedef void (* GtkTextUtilCharChosenFunc) (const char *text,
-                                            gpointer    data);
-
-void _gtk_text_util_append_special_char_menuitems (GtkMenuShell              *menushell,
-                                                   GtkTextUtilCharChosenFunc  func,
-                                                   gpointer                   data);
-
 GdkPaintable *    gtk_text_util_create_drag_icon  (GtkWidget     *widget,
                                                    gchar         *text,
                                                    gssize         len);