]> Pileus Git - ~andy/gtk/commitdiff
Add Unicode control char menu, based on patch from Dov. Bug #63495
authorHavoc Pennington <hp@redhat.com>
Mon, 17 Dec 2001 16:46:08 +0000 (16:46 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Mon, 17 Dec 2001 16:46:08 +0000 (16:46 +0000)
2001-12-06  Havoc Pennington  <hp@redhat.com>

        Add Unicode control char menu, based on patch from Dov.
        Bug #63495

        * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
        gtk_entry_enter_text
        (gtk_entry_enter_text): function to do "typing in text"
        (popup_targets_received): add the Unicode menu items

        * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
        on Input Methods item, and add the unicode menu items.

        * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
        used in GtkEntry and GtkTextView - may become public later.

13 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/gdk-pixbuf/tmpl/scaling.sgml
gtk/Makefile.am
gtk/gtkentry.c
gtk/gtktextutil.c [new file with mode: 0644]
gtk/gtktextutil.h [new file with mode: 0644]
gtk/gtktextview.c

index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index 2aa0e2a36244eed028fc31f3517f627d0cd58b3e..c5c547ee6a6644bfd727e8c84f34d28aea715ff9 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Havoc Pennington  <hp@redhat.com>
+
+        Add Unicode control char menu, based on patch from Dov.
+       Bug #63495
+       
+       * gtk/gtkentry.c (gtk_entry_commit_cb): share code via
+       gtk_entry_enter_text
+       (gtk_entry_enter_text): function to do "typing in text"
+       (popup_targets_received): add the Unicode menu items
+
+       * gtk/gtktextview.c (popup_targets_received): add missing mnemonic
+       on Input Methods item, and add the unicode menu items.
+
+       * gtk/gtktextutil.h, gtk/gtktextutil.c: private utilities to be
+       used in GtkEntry and GtkTextView - may become public later.     
+
 2001-12-16  Kjartan Maraas  <kmaraas@gnome.org>
 
        * gtk/gtkprogressbar.c: Fix a typo.
index bd7d13f45fe8db6d72a7b514f24434b47fee3c96..6de66aee3b0a864cf8327a699c0037fd4d06e9d4 100644 (file)
@@ -106,25 +106,19 @@ Wolberg's "Digital Image Warping", and is formally defined as the
 hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
 image (the filter is designed to be idempotent for 1:1 pixel mapping).
 
-<!-- ##### FUNCTION gdk_pixbuf_scale ##### -->
+<!-- ##### FUNCTION gdk_pixbuf_scale_simple ##### -->
 <para>
 
 </para>
 
 @src: 
-@dest: 
-@dest_x: 
-@dest_y: 
 @dest_width: 
 @dest_height: 
-@offset_x: 
-@offset_y: 
-@scale_x: 
-@scale_y: 
 @interp_type: 
+@Returns: 
 
 
-<!-- ##### FUNCTION gdk_pixbuf_composite ##### -->
+<!-- ##### FUNCTION gdk_pixbuf_scale ##### -->
 <para>
 
 </para>
@@ -140,63 +134,69 @@ image (the filter is designed to be idempotent for 1:1 pixel mapping).
 @scale_x: 
 @scale_y: 
 @interp_type: 
-@overall_alpha: 
 
 
-<!-- ##### FUNCTION gdk_pixbuf_composite_color ##### -->
+<!-- ##### FUNCTION gdk_pixbuf_composite_color_simple ##### -->
 <para>
 
 </para>
 
 @src: 
-@dest: 
-@dest_x: 
-@dest_y: 
 @dest_width: 
 @dest_height: 
-@offset_x: 
-@offset_y: 
-@scale_x: 
-@scale_y: 
 @interp_type: 
 @overall_alpha: 
-@check_x: 
-@check_y: 
 @check_size: 
 @color1: 
 @color2: 
+@Returns: <!--
+Local variables:
+mode: sgml
+sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
+End:
+-->
 
 
-<!-- ##### FUNCTION gdk_pixbuf_scale_simple ##### -->
+<!-- ##### FUNCTION gdk_pixbuf_composite ##### -->
 <para>
 
 </para>
 
 @src: 
+@dest: 
+@dest_x: 
+@dest_y: 
 @dest_width: 
 @dest_height: 
+@offset_x: 
+@offset_y: 
+@scale_x: 
+@scale_y: 
 @interp_type: 
-@Returns
+@overall_alpha
 
 
-<!-- ##### FUNCTION gdk_pixbuf_composite_color_simple ##### -->
+<!-- ##### FUNCTION gdk_pixbuf_composite_color ##### -->
 <para>
 
 </para>
 
 @src: 
+@dest: 
+@dest_x: 
+@dest_y: 
 @dest_width: 
 @dest_height: 
+@offset_x: 
+@offset_y: 
+@scale_x: 
+@scale_y: 
 @interp_type: 
 @overall_alpha: 
+@check_x: 
+@check_y: 
 @check_size: 
 @color1: 
 @color2: 
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
 
 
index 670ee1c5aee6ae1643c0565b90f96775e0dc28ff..505ef1de3b257ba60a9b76640e96450f95193e87 100644 (file)
@@ -234,6 +234,7 @@ gtk_private_h_sources = @STRIP_BEGIN@ \
        gtktextchildprivate.h   \
        gtktextsegment.h        \
        gtktexttypes.h          \
+       gtktextutil.h           \
        gtktextiterprivate.h    \
        gtktextmarkprivate.h    \
        gtktexttagprivate.h     \
@@ -364,6 +365,7 @@ gtk_c_sources = @STRIP_BEGIN@   \
        gtktexttag.c            \
        gtktexttagtable.c       \
        gtktexttypes.c          \
+       gtktextutil.c           \
        gtktextview.c           \
        gtkthemes.c             \
        gtktipsquery.c          \
index 3dfeb3ff203ccc6db51bc6f92e7805af99ca0f42..2e2f9f317b71315642e9778114c083cba30c4176 100644 (file)
@@ -46,6 +46,7 @@
 #include "gtksettings.h"
 #include "gtkstock.h"
 #include "gtksignal.h"
+#include "gtktextutil.h"
 #include "gtkwindow.h"
 
 #define MIN_ENTRY_WIDTH  150
@@ -247,6 +248,8 @@ static gboolean gtk_entry_delete_surrounding_cb   (GtkIMContext *context,
 
 /* Internal routines
  */
+static void         gtk_entry_enter_text               (GtkEntry       *entry,
+                                                        const gchar    *str);
 static void         gtk_entry_set_positions            (GtkEntry       *entry,
                                                        gint            current_pos,
                                                        gint            selection_bound);
@@ -2226,19 +2229,7 @@ gtk_entry_commit_cb (GtkIMContext *context,
                     const gchar  *str,
                     GtkEntry     *entry)
 {
-  GtkEditable *editable = GTK_EDITABLE (entry);
-  gint tmp_pos = entry->current_pos;
-
-  if (gtk_editable_get_selection_bounds (editable, NULL, NULL))
-    gtk_editable_delete_selection (editable);
-  else
-    {
-      if (entry->overwrite_mode)
-        gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
-    }
-
-  gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);
-  gtk_editable_set_position (editable, tmp_pos);
+  gtk_entry_enter_text (entry, str);
 }
 
 static void 
@@ -2287,6 +2278,26 @@ gtk_entry_delete_surrounding_cb (GtkIMContext *slave,
 /* Internal functions
  */
 
+/* Used for im_commit_cb and inserting Unicode chars */
+static void
+gtk_entry_enter_text (GtkEntry       *entry,
+                      const gchar    *str)
+{
+  GtkEditable *editable = GTK_EDITABLE (entry);
+  gint tmp_pos = entry->current_pos;
+
+  if (gtk_editable_get_selection_bounds (editable, NULL, NULL))
+    gtk_editable_delete_selection (editable);
+  else
+    {
+      if (entry->overwrite_mode)
+        gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
+    }
+
+  gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);
+  gtk_editable_set_position (editable, tmp_pos);
+}
+
 /* All changes to entry->current_pos and entry->selection_bound
  * should go through this function.
  */
@@ -3765,6 +3776,16 @@ popup_position_func (GtkMenu   *menu,
   *y = CLAMP (*y, 0, MAX (0, gdk_screen_height () - req.height));
 }
 
+
+static void
+unichar_chosen_func (const char *text,
+                     gpointer    data)
+{
+  GtkEntry *entry = GTK_ENTRY (data);
+
+  gtk_entry_enter_text (entry, text);
+}
+
 typedef struct
 {
   GtkEntry *entry;
@@ -3822,6 +3843,19 @@ popup_targets_received (GtkClipboard     *clipboard,
       gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (entry->im_context),
                                            GTK_MENU_SHELL (submenu));
       
+      menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode control character"));
+      gtk_widget_show (menuitem);
+      
+      submenu = gtk_menu_new ();
+      gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+      gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);      
+
+      _gtk_text_util_append_special_char_menuitems (GTK_MENU_SHELL (submenu),
+                                                    unichar_chosen_func,
+                                                    entry);
+      if (!entry->editable)
+        gtk_widget_set_sensitive (menuitem, FALSE);
+      
       gtk_signal_emit (GTK_OBJECT (entry),
                       signals[POPULATE_POPUP],
                       entry->popup_menu);
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
new file mode 100644 (file)
index 0000000..7a53fab
--- /dev/null
@@ -0,0 +1,117 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2001.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#include "gtktextutil.h"
+#include "gtkintl.h"
+#include "gtkmenuitem.h"
+
+typedef struct _GtkUnicodeMenuEntry GtkUnicodeMenuEntry;
+typedef struct _GtkTextUtilCallbackInfo GtkTextUtilCallbackInfo;
+
+struct _GtkUnicodeMenuEntry {
+  const char *label;
+  gunichar ch;
+};
+
+struct _GtkTextUtilCallbackInfo
+{
+  GtkTextUtilCharChosenFunc func;
+  gpointer data;
+};
+
+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_("ZWN Zero width _joiner"), 0x200D },
+  { N_("ZWNJ Zero width _non-joiner"), 0x200C }
+};
+
+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;
+
+      /* wasteful to have a bunch of copies, but simplifies mem management */
+      info = g_new (GtkTextUtilCallbackInfo, 1);
+      info->func = func;
+      info->data = data;
+      
+      menuitem = gtk_menu_item_new_with_mnemonic (bidi_menu_entries[i].label);
+      g_object_set_data (G_OBJECT (menuitem), "gtk-unicode-menu-entry",
+                         &bidi_menu_entries[i]);
+      
+      g_signal_connect_data (G_OBJECT (menuitem), "activate",
+                             G_CALLBACK (activate_cb),
+                             info, (GClosureNotify) g_free, 0);
+      
+      gtk_widget_show (menuitem);
+      gtk_menu_shell_append (menushell, menuitem);
+    }
+}
+
diff --git a/gtk/gtktextutil.h b/gtk/gtktextutil.h
new file mode 100644 (file)
index 0000000..d12c8ab
--- /dev/null
@@ -0,0 +1,54 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2001.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __GTK_TEXT_UTIL_H__
+#define __GTK_TEXT_UTIL_H__
+
+
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmenushell.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* This is a private uninstalled header shared between 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);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GTK_TEXT_UTIL_H__ */
index ce99a63f0d38f929d5a4064d365a7f8161370b5c..e1e055f43468e37390da08c405095a7b28ae69ec 100644 (file)
@@ -43,6 +43,7 @@
 #include "gtktextview.h"
 #include "gtkimmulticontext.h"
 #include "gdk/gdkkeysyms.h"
+#include "gtktextutil.h"
 #include <string.h>
 
 /* How scrolling, validation, exposes, etc. work.
@@ -5692,6 +5693,15 @@ range_contains_editable_text (const GtkTextIter *start,
   return FALSE;
 }                             
 
+static void
+unichar_chosen_func (const char *text,
+                     gpointer    data)
+{
+  GtkTextView *text_view = GTK_TEXT_VIEW (data);
+
+  gtk_text_view_commit_text (text_view, text);
+}
+
 static void
 popup_targets_received (GtkClipboard     *clipboard,
                        GtkSelectionData *data,
@@ -5744,7 +5754,7 @@ popup_targets_received (GtkClipboard     *clipboard,
       gtk_widget_show (menuitem);
       gtk_menu_shell_append (GTK_MENU_SHELL (text_view->popup_menu), menuitem);
       
-      menuitem = gtk_menu_item_new_with_label (_("Input Methods"));
+      menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
       gtk_widget_show (menuitem);
       submenu = gtk_menu_new ();
       gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
@@ -5752,6 +5762,18 @@ popup_targets_received (GtkClipboard     *clipboard,
       
       gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_view->im_context),
                                            GTK_MENU_SHELL (submenu));
+
+      menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode control character"));
+      gtk_widget_show (menuitem);
+      gtk_widget_set_sensitive (menuitem, can_insert);
+      
+      submenu = gtk_menu_new ();
+      gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+      gtk_menu_shell_append (GTK_MENU_SHELL (text_view->popup_menu), menuitem);      
+
+      _gtk_text_util_append_special_char_menuitems (GTK_MENU_SHELL (submenu),
+                                                    unichar_chosen_func,
+                                                    text_view);
       
       gtk_signal_emit (GTK_OBJECT (text_view),
                       signals[POPULATE_POPUP],