in reply to Gtk3::Clipboard problem [SOLVED]

Ok, I replaced line marked by '# XXX' with this:

my $clipboard = Gtk3::Clipboard::get(Gtk3::Gdk::Atom::intern('clipboard', 0));

And the next line with this:

$clipboard->set_text($col1content, length $col1content);

Now I don't get any error but the clipboard is still not working.

Replies are listed 'Best First'.
Re^2: Gtk3::Clipboard problem
by Anonymous Monk on Sep 01, 2014 at 21:26 UTC

    Now I don't get any error but the clipboard is still not working.

    What does that mean "not working"?

    What happens when you run the test t/zz-GtkTextBuffer.t (does it pass, is the clipboard section skipped)?

    gtk-text-buffer-set-text shows text/length just like gtk-clipboard-set-text but zz-GtkTextBuffer.t shows set_text without a length argument, so

    What happens if you use  set_text($col1content);?

      I click the button 'Copy URL to clipboard' and then I try to paste copied text in text editor--nothing happen.

      This is output of test:

      1..44 ok 1 - An object of class 'Gtk3::TextBuffer' isa 'Gtk3::TextBuffer' ok 2 ok 3 - An object of class 'Gtk3::TextBuffer' isa 'Gtk3::TextBuffer' ok 4 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 5 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 6 ok 7 ok 8 ok 9 ok 10 ok 11 ok 12 ok 13 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 14 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 15 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 16 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 17 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 18 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 19 ok 20 ok 21 ok 22 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 23 - An object of class 'Gtk3::TextChildAnchor' isa 'Gtk3::TextChil +dAnchor' ok 24 - An object of class 'Gtk3::TextMark' isa 'Gtk3::TextMark' ok 25 ok 26 - An object of class 'Gtk3::TextIter' isa 'Gtk3::TextIter' ok 27 - An object of class 'Gtk3::TextMark' isa 'Gtk3::TextMark' ok 28 - An object of class 'Gtk3::TextMark' isa 'Gtk3::TextMark' ok 29 ok 30 ok 31 - An object of class 'Gtk3::TextTag' isa 'Gtk3::TextTag' ok 32 ok 33 ok 34 - An object of class 'Gtk3::TextTag' isa 'Gtk3::TextTag' ok 35 - An object of class 'Gtk3::TextTag' isa 'Gtk3::TextTag' ok 36 ok 37 - An object of class 'Gtk3::TargetList' isa 'Gtk3::TargetList' ok 38 - An object of class 'Gtk3::TargetList' isa 'Gtk3::TargetList' ok 39 - An object of class 'Gtk3::TargetList' isa 'Gtk3::TargetList' ok 40 - An object of class 'Gtk3::TargetList' isa 'Gtk3::TargetList' ok 41 ok 42 ok 43 ok 44

      If I replace line $clipboard->set_text($col1content, length $col1content); with $clipboard->set_text($col1content); I get an error message:

      $ perl clipboard.pl $tpath --> ARRAY(0x9e5e740) $tp --> Gtk3::TreePath=SCALAR(0x9e5e730) $col0content --> Google $col1content --> http://www.google.cz/ $clipboard --> Gtk3::Clipboard=HASH(0xa517230) *** unhandled exception in callback: *** Gtk3::Clipboard::set_text: passed too few parameters (expected 3 +, got 2) at clipboard.pl line 91. *** ignoring at /usr/share/perl5/vendor_perl/Gtk3.pm line 321. $

        Hmm

        What happens if you don't specify an atom? Or use "PRIMARY" as the atom?