Re: Gtk3::Application open signal

Hi Torsten,

Apologies for the delay in replying.

On 02/05/18 22:46, Torsten Schoenfeld wrote:
I think this is due to the @ARGV semantics.  In Perl, @ARGV does not
contain the program's name, but Gtk3::Application's run() expects the
C-style argv with the program's name at the beginning.  So try to use
the following:

  $app->run([$0, @ARGV]);

Thanks. That get things going.

Also: I wrote a version of your program that more closely resembles the
Python version.  Here it is, in case it is helpful:

Thanks for this. Very helpful. Where should I have looked to know that
the Perl method names were simply capitalised versions of the C methods?

For anyone interested, $files is an arrayref of
Glib::Object::_Unregistered::GLocalFile, for which there is a method
get_basename() to dig out the filename:

sub OPEN {
    my ($app, $files, $nfiles, $arg3) = @_;
    print "in open\n";
    use Data::Dumper;
    print Dumper($files, $nfiles, $arg3);
    for my $file (@$files) {
        print $file->get_basename(), "\n";

I don't understand what is going on in the signal version, though. If
the callback for the open signal is:

sub _open {
    my ($app, $files, $nfiles, $arg3) = @_;
    print "files: $files, $nfiles, $arg3\n";
    use Data::Dumper;
    print Dumper($files, $nfiles, $arg3);

I get output like:

files: 94684537255296, 1,
$VAR1 = '94684537255296';
$VAR2 = 1;
$VAR3 = '';

What is going on?



Attachment: signature.asc
Description: OpenPGP digital signature

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