2003-02-12  Matthias Clasen  <maclas@gmx.de>

	Fix for #82734 and #78216:

	* gtk/gtktextview.c (delete_cb):
	(select_all_cb): New callbacks for context menu items.
	(popup_targets_received): Add "Delete" and "Select All" to context
	menu, mnemonics and title caps for all items.

	* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
	context menu item.
	(popup_targets_received): Add "Delete" to context menu, mnemonics
	and title caps for all items.
This commit is contained in:
Matthias Clasen 2003-02-11 23:31:00 +00:00 committed by Matthias Clasen
parent 43d0d79cc0
commit 4b9e72c756
7 changed files with 139 additions and 4 deletions

View File

@ -1,3 +1,17 @@
2003-02-12 Matthias Clasen <maclas@gmx.de>
Fix for #82734 and #78216:
* gtk/gtktextview.c (delete_cb):
(select_all_cb): New callbacks for context menu items.
(popup_targets_received): Add "Delete" and "Select All" to context
menu, mnemonics and title caps for all items.
* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
context menu item.
(popup_targets_received): Add "Delete" to context menu, mnemonics
and title caps for all items.
2003-02-09 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilesel.c (win32_gtk_add_drives_to_dir_list): Use

View File

@ -1,3 +1,17 @@
2003-02-12 Matthias Clasen <maclas@gmx.de>
Fix for #82734 and #78216:
* gtk/gtktextview.c (delete_cb):
(select_all_cb): New callbacks for context menu items.
(popup_targets_received): Add "Delete" and "Select All" to context
menu, mnemonics and title caps for all items.
* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
context menu item.
(popup_targets_received): Add "Delete" to context menu, mnemonics
and title caps for all items.
2003-02-09 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilesel.c (win32_gtk_add_drives_to_dir_list): Use

View File

@ -1,3 +1,17 @@
2003-02-12 Matthias Clasen <maclas@gmx.de>
Fix for #82734 and #78216:
* gtk/gtktextview.c (delete_cb):
(select_all_cb): New callbacks for context menu items.
(popup_targets_received): Add "Delete" and "Select All" to context
menu, mnemonics and title caps for all items.
* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
context menu item.
(popup_targets_received): Add "Delete" to context menu, mnemonics
and title caps for all items.
2003-02-09 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilesel.c (win32_gtk_add_drives_to_dir_list): Use

View File

@ -1,3 +1,17 @@
2003-02-12 Matthias Clasen <maclas@gmx.de>
Fix for #82734 and #78216:
* gtk/gtktextview.c (delete_cb):
(select_all_cb): New callbacks for context menu items.
(popup_targets_received): Add "Delete" and "Select All" to context
menu, mnemonics and title caps for all items.
* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
context menu item.
(popup_targets_received): Add "Delete" to context menu, mnemonics
and title caps for all items.
2003-02-09 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilesel.c (win32_gtk_add_drives_to_dir_list): Use

View File

@ -1,3 +1,17 @@
2003-02-12 Matthias Clasen <maclas@gmx.de>
Fix for #82734 and #78216:
* gtk/gtktextview.c (delete_cb):
(select_all_cb): New callbacks for context menu items.
(popup_targets_received): Add "Delete" and "Select All" to context
menu, mnemonics and title caps for all items.
* gtk/gtkentry.c (gtk_entry_delete_cb): New callback for "Delete"
context menu item.
(popup_targets_received): Add "Delete" to context menu, mnemonics
and title caps for all items.
2003-02-09 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilesel.c (win32_gtk_add_drives_to_dir_list): Use

View File

@ -2249,6 +2249,19 @@ gtk_entry_paste_clipboard (GtkEntry *entry)
gtk_entry_paste (entry, GDK_NONE);
}
static void
gtk_entry_delete_cb (GtkEntry *entry)
{
GtkEditable *editable = GTK_EDITABLE (entry);
gint start, end;
if (entry->editable)
{
if (gtk_editable_get_selection_bounds (editable, &start, &end))
gtk_editable_delete_text (editable, start, end);
}
}
static void
gtk_entry_toggle_overwrite (GtkEntry *entry)
{
@ -3956,7 +3969,18 @@ popup_targets_received (GtkClipboard *clipboard,
append_action_signal (entry, entry->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",
entry->editable && clipboard_contains_text);
menuitem = gtk_menu_item_new_with_label (_("Select All"));
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_DELETE, NULL);
gtk_widget_set_sensitive (menuitem, entry->current_pos != entry->selection_bound);
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (gtk_entry_delete_cb), entry);
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 (_("Select _All"));
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (gtk_entry_select_all), entry);
gtk_widget_show (menuitem);
@ -3966,7 +3990,7 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->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);
@ -3976,7 +4000,7 @@ 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"));
menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode Control Character"));
gtk_widget_show (menuitem);
submenu = gtk_menu_new ();

View File

@ -6398,6 +6398,27 @@ append_action_signal (GtkTextView *text_view,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
static void
select_all_cb (GtkWidget *menuitem,
GtkTextView *text_view)
{
GtkTextBuffer *buffer;
GtkTextIter start_iter, end_iter;
buffer = text_view->buffer;
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
gtk_text_buffer_move_mark_by_name (buffer, "insert", &start_iter);
gtk_text_buffer_move_mark_by_name (buffer, "selection_bound", &end_iter);
gtk_text_buffer_copy_clipboard (buffer, gtk_clipboard_get (GDK_NONE));
}
static void
delete_cb (GtkTextView *text_view)
{
gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
text_view->editable);
}
static void
popup_menu_detach (GtkWidget *attach_widget,
GtkMenu *menu)
@ -6553,6 +6574,26 @@ popup_targets_received (GtkClipboard *clipboard,
append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",
can_insert && clipboard_contains_text);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_DELETE, NULL);
gtk_widget_set_sensitive (menuitem,
have_selection &&
range_contains_editable_text (&sel_start, &sel_end,
text_view->editable));
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (delete_cb), text_view);
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);
menuitem = gtk_menu_item_new_with_mnemonic (_("Select _All"));
g_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (select_all_cb), text_view);
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);
@ -6566,7 +6607,7 @@ 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"));
menuitem = gtk_menu_item_new_with_mnemonic (_("_Insert Unicode Control Character"));
gtk_widget_show (menuitem);
gtk_widget_set_sensitive (menuitem, can_insert);