Commit f2724a25 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Add settings to hide the input method and Unicode control character

2005-10-24  Matthias Clasen  <mclasen@redhat.com>

        Add settings to hide the input method and Unicode control character
        submenus in the context menus of GtkEntry and GtkTextView.

        * gdk/x11/gdkevents-x11.c: Map GTK+ settings to X settings.

        * gtk/gtksettings.c (gtk_settings_class_init): Declare GTK+ settings here.

        * gtk/gtktextview.c (popup_targets_received):
        * gtk/gtkentry.c (popup_targets_received): Use the settings here.
parent 3fe6e986
2005-10-24 Matthias Clasen <mclasen@redhat.com>
Add settings to hide the input method and Unicode control character
submenus in the context menus of GtkEntry and GtkTextView.
* gdk/x11/gdkevents-x11.c: Map GTK+ settings to X settings.
* gtk/gtksettings.c (gtk_settings_class_init): Declare GTK+ settings here.
* gtk/gtktextview.c (popup_targets_received):
* gtk/gtkentry.c (popup_targets_received): Use the settings here.
2005-10-24 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_inserted): emitting
......
2005-10-24 Matthias Clasen <mclasen@redhat.com>
Add settings to hide the input method and Unicode control character
submenus in the context menus of GtkEntry and GtkTextView.
* gdk/x11/gdkevents-x11.c: Map GTK+ settings to X settings.
* gtk/gtksettings.c (gtk_settings_class_init): Declare GTK+ settings here.
* gtk/gtktextview.c (popup_targets_received):
* gtk/gtkentry.c (popup_targets_received): Use the settings here.
2005-10-24 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_inserted): emitting
......
......@@ -2805,6 +2805,8 @@ static const struct
{ "Gtk/MenuBarAccel", "gtk-menu-bar-accel" },
{ "Gtk/CursorThemeName", "gtk-cursor-theme-name" },
{ "Gtk/CursorThemeSize", "gtk-cursor-theme-size" },
{ "Gtk/ShowInputMethodMenu", "gtk-show-input-method-menu" },
{ "Gtk/ShowUnicodeMenu", "gtk-show-unicode-menu" },
{ "Xft/Antialias", "gtk-xft-antialias" },
{ "Xft/Hinting", "gtk-xft-hinting" },
{ "Xft/HintStyle", "gtk-xft-hintstyle" },
......
......@@ -4557,10 +4557,13 @@ popup_targets_received (GtkClipboard *clipboard,
if (GTK_WIDGET_REALIZED (entry))
{
gboolean clipboard_contains_text = gtk_selection_data_targets_include_text (data);
gboolean clipboard_contains_text;
GtkWidget *menuitem;
GtkWidget *submenu;
gboolean show_input_method_menu;
gboolean show_unicode_menu;
clipboard_contains_text = gtk_selection_data_targets_include_text (data);
if (entry->popup_menu)
gtk_widget_destroy (entry->popup_menu);
......@@ -4594,33 +4597,46 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
gtk_widget_set_sensitive (menuitem, entry->editable);
gtk_widget_show (menuitem);
submenu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)),
"gtk-show-input-method-menu", &show_input_method_menu,
"gtk-show-unicode-menu", &show_unicode_menu,
NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
if (show_input_method_menu || show_unicode_menu)
{
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
}
gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (entry->im_context),
GTK_MENU_SHELL (submenu));
if (show_input_method_menu)
{
menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
gtk_widget_set_sensitive (menuitem, entry->editable);
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);
menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode Control Character"));
gtk_widget_show (menuitem);
gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (entry->im_context),
GTK_MENU_SHELL (submenu));
}
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);
if (show_unicode_menu)
{
menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode Control Character"));
gtk_widget_set_sensitive (menuitem, entry->editable);
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);
}
g_signal_emit (entry,
signals[POPULATE_POPUP],
......
......@@ -77,7 +77,9 @@ enum {
PROP_CURSOR_THEME_NAME,
PROP_CURSOR_THEME_SIZE,
#endif
PROP_ALTERNATIVE_BUTTON_ORDER
PROP_ALTERNATIVE_BUTTON_ORDER,
PROP_SHOW_INPUT_METHOD_MENU,
PROP_SHOW_UNICODE_MENU
};
......@@ -385,6 +387,25 @@ gtk_settings_class_init (GtkSettingsClass *class)
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER);
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-show-input-method-menu",
P_("Show the 'Input Methods' menu"),
P_("Whether the context menus of entries and text views should offer to change the input method"),
TRUE,
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_SHOW_INPUT_METHOD_MENU);
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-show-unicode-menu",
P_("Show the 'Insert Unicode Control Character' menu"),
P_("Whether the context menus of entries and text views should offer to insert control characters"),
TRUE,
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_SHOW_UNICODE_MENU);
}
static void
......
......@@ -7070,14 +7070,18 @@ popup_targets_received (GtkClipboard *clipboard,
/* We implicitely rely here on the fact that if we are pasting ourself, we'll
* have text targets as well as the private GTK_TEXT_BUFFER_CONTENTS target.
*/
gboolean clipboard_contains_text = gtk_selection_data_targets_include_text (data);
gboolean clipboard_contains_text;
GtkWidget *menuitem;
GtkWidget *submenu;
gboolean have_selection;
gboolean can_insert;
GtkTextIter iter;
GtkTextIter sel_start, sel_end;
gboolean show_input_method_menu;
gboolean show_unicode_menu;
clipboard_contains_text = gtk_selection_data_targets_include_text (data);
if (text_view->popup_menu)
gtk_widget_destroy (text_view->popup_menu);
......@@ -7125,33 +7129,47 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (text_view->popup_menu), menuitem);
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (text_view->popup_menu), menuitem);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (text_view)),
"gtk-show-input-method-menu", &show_input_method_menu,
"gtk-show-unicode-menu", &show_unicode_menu,
NULL);
menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
gtk_widget_show (menuitem);
gtk_widget_set_sensitive (menuitem, can_insert);
if (show_input_method_menu || show_unicode_menu)
{
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (text_view->popup_menu), menuitem);
}
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_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_view->im_context),
GTK_MENU_SHELL (submenu));
if (show_input_method_menu)
{
menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
gtk_widget_show (menuitem);
gtk_widget_set_sensitive (menuitem, can_insert);
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);
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_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_view->im_context),
GTK_MENU_SHELL (submenu));
}
_gtk_text_util_append_special_char_menuitems (GTK_MENU_SHELL (submenu),
unichar_chosen_func,
text_view);
if (show_unicode_menu)
{
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);
}
g_signal_emit (text_view,
signals[POPULATE_POPUP],
0,
......
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