[gtk/wip/kill-menu: 1/6] text util: Remove an unused function



commit c0071a06765e411b244831a040feb4d946e996b8
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 13 17:25:02 2019 -0400

    text util: Remove an unused function
    
    _gtk_text_util_append_special_char_menuitems was not used.

 gtk/gtktextutil.c | 105 ------------------------------------------------------
 gtk/gtktextutil.h |   7 ----
 2 files changed, 112 deletions(-)
---
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 2c3c43d8bc..200f87285c 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -29,7 +29,6 @@
 
 #include "gtktextbuffer.h"
 #include "gtktextlayoutprivate.h"
-#include "gtkmenuitem.h"
 #include "gtkintl.h"
 
 #define DRAG_ICON_MAX_WIDTH 250
@@ -37,110 +36,6 @@
 #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)
 {
diff --git a/gtk/gtktextutil.h b/gtk/gtktextutil.h
index 450ed464a1..4ad534ce7b 100644
--- a/gtk/gtktextutil.h
+++ b/gtk/gtktextutil.h
@@ -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);


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