GNOME Bugzilla – Bug 306127
Paste menu sensitivity isn't set correctly for the notes sidepane
Last modified: 2005-06-23 16:42:11 UTC
- Copy some text - Open a nautilus anvigational window with the notes sidepane on - Focus the note sidepane - The Edit->Paste menu item from the menu bar is insensitive (note that the paste item in context menu is sensitive and you can paste with Ctrl+V)
Thank you for your bug report! This is due to the fact that the NautilusClipboard text view setup function doesn't setup clipboard tracking for the note sidepane GtkTextView. We might want to copy over some code from gedit to achieve this.
Heh... pretty ironic that I filed this because after adding a sidepane to gedit we have run in similar problems so we tried out nautilus to see if stuff worked there and noticed the bug :-)
Hehe...I've not yet investigated the issue closely but I would guess that we have to connect to some signals of the underlying GtkTextBuffer and refresh the sensitivity information when they are emitted. "changed" might be appropriate, although I don't know whether it is also emitted for selection changes. There is also "end-user-action" and "begin-user-action", "modified-changed" and some insert/remove signals. The GTK+ documentation on these signals sucks, we should update it atfer figuring out how to do it.
OK, here is how it works: connect to the "mark-set" signal of the buffer associated with the text view. In the callback, check whether it matches gtk_text_buffer_get_selection_bound and if it does match, update the sensitivity of cut/paste. It should be sensitive if gtk_text_buffer_get_selection_bounds returns TRUE.
Nah, I was wrong. You should only check for the mark name not being NULL instead of comparing it with gtk_text_buffer_get_selection_bound.
Created attachment 47139 [details] [review] Proposed patch (against HEAD). Paolo: The important part of the patch (for gedit) is the connection to the "mark-set" and the "delete-range" callback. The former reacts on selection changes (combined with the != NULL check in the callback), while the latter listens for selection deletion.
I've committed the attached patch (approval under [1]). Thanks for your efforts. [1] http://mail.gnome.org/archives/nautilus-list/2005-June/msg00047.html