Re: Storing cut/copy URIs into Gtk::Clipboard



Thanks,
but I can't find in your answer how I can store in the clipboard URIs to stay in the clipboard after the app quits, which is the whole point of this thread (to me).
And yes, of course I won't store like 500MB of URIs, we're talking common sense: my file browser cuts/copies a list of file paths stored as URIs in the clipboard and
the user should be able to paste them into nautilus after he closes my file browser.



On Thu, Jul 25, 2013 at 10:18 AM, Murray Cumming <murrayc murrayc com> wrote:
On Wed, 2013-07-24 at 13:40 +0300, Jiergir Ogoerg wrote:
> Hi,
>
> The question is about the C++ (mm) backend.
>
>
> Gtk::Clipboard has 2 options: (1) store data which is available also
> after the app quits until someone cleans up the clipboard, or (2)
> provide a function to be called to fill in the clipboard on request.

Unless this is for very small amounts of data, I think you should want
to always provide a function, and call set_can_store() if you want that
function to be called when the application quits. Otherwise, you'd be
copying large amounts of data when calling the set_*() convenience
methods.

> I need to use the 1st option since the URIs must stay in clipboard
> after the app exits, but there are only methods for text and images:
> set_text() or set_image(), then set_can_store() then store().
>
>
> So how do I store() as URIs?
>
>
> Use case: I (need to) put the string as URI with a "cut\n" or "copy\n"
> in front of it so that nautilus provides a "paste" option in the
> right-click menu.

gtk_clipboard_set_text() just copies the text and uses
gtk_clipboard_set_with_data() (Gtk::Clipboard::set() in gtkmm) to
provide that copied data in future.


--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]