text util: Remove an unused function

_gtk_text_util_append_special_char_menuitems was not used.
This commit is contained in:
Matthias Clasen 2019-09-13 17:25:02 -04:00
parent 97231ca231
commit c0071a0676
2 changed files with 0 additions and 112 deletions

View File

@ -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)
{

View 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);