Commit 260e9454 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

allocate the GtkTextUtilCallbackInfo structs with GSlice.

2008-06-26  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextutil.c (_gtk_text_util_append_special_char_menuitems):
	allocate the GtkTextUtilCallbackInfo structs with GSlice.


svn path=/trunk/; revision=20686
parent 3d322ce1
2008-06-26 Michael Natterer <mitch@imendio.com>
* gtk/gtktextutil.c (_gtk_text_util_append_special_char_menuitems):
allocate the GtkTextUtilCallbackInfo structs with GSlice.
2008-06-25 Michael Natterer <mitch@imendio.com>
* gtk/gtktypeutils.h: there is no reason to include
......
......@@ -70,6 +70,26 @@ static const GtkUnicodeMenuEntry bidi_menu_entries[] = {
{ 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)
......@@ -112,10 +132,7 @@ _gtk_text_util_append_special_char_menuitems (GtkMenuShell *menushe
GtkWidget *menuitem;
GtkTextUtilCallbackInfo *info;
/* wasteful to have a bunch of copies, but simplifies mem management */
info = g_new (GtkTextUtilCallbackInfo, 1);
info->func = func;
info->data = data;
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"),
......@@ -123,7 +140,7 @@ _gtk_text_util_append_special_char_menuitems (GtkMenuShell *menushe
g_signal_connect_data (menuitem, "activate",
G_CALLBACK (activate_cb),
info, (GClosureNotify) g_free, 0);
info, (GClosureNotify) callback_info_free, 0);
gtk_widget_show (menuitem);
gtk_menu_shell_append (menushell, menuitem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment