Re: Re: Re: Gtk3::MessageDialog - missing methods
Great!
Thank you very much :-)
Best,
Thomas
Am 9. Januar 2021 23:16:37 schrieb Emmanuele Bassi :
On Sat, 9 Jan 2021 at 17:16, Thomas Funk via gtk-perl-list
wrote:
Hi,
On Sat, 9 Jan 2021 at 02:35, Emmanuele Bassi via gtk-perl-list
wrote:
As Torsten wrote, those methods are not introspectable because of their use
of variadic arguments in C; this means you cannot call them from Perl.
You will need to re-implement them; luckily, they are easier to deal in
Perl than the printf-style format of C:
```
sub Gtk3::MessageDialog::format_secondary_text {
my ($dialog, $format, @args) = @_;
my $text = sprintf $format, @args;
$dialog->set('secondary-text', $text, 'secondary-use-markup' => 0);
}
sub Gtk3::MessageDialog::format_secondary_markup {
my ($dialog, $format, @args) = @_;
my $text = sprintf $format, @args;
$dialog->set('secondary-text' => $text, 'secondary-use-markup' => 1);
}
```
Works like a charme ^^
Thank you very much!
What is the next step? Will you or Torsten push the code into gtk3-perl?
I've opened an MR: https://gitlab.gnome.org/GNOME/perl-gtk3/-/merge_requests/5
Ciao,
Emmanuele.
--
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Re: Re: Gtk3::MessageDialog - missing methods
On Sat, 9 Jan 2021 at 17:16, Thomas Funk via gtk-perl-list < [email protected]> wrote: > Hi, > > On Sat, 9 Jan 2021 at 02:35, Emmanuele Bassi via gtk-perl-list < > [email protected]> wrote: > > As Torsten wrote, those methods are not introspectable because of their > use of variadic arguments in C; this means you cannot call them from Perl. > > > > You will need to re-implement them; luckily, they are easier to deal in > Perl than the printf-style format of C: > > > > ``` > > sub Gtk3::MessageDialog::format_secondary_text { > > my ($dialog, $format, @args) = @_; > > > > my $text = sprintf $format, @args; > > $dialog->set('secondary-text', $text, 'secondary-use-markup' => 0); > > } > > > > sub Gtk3::MessageDialog::format_secondary_markup { > > my ($dialog, $format, @args) = @_; > > > > my $text = sprintf $format, @args; > > $dialog->set('secondary-text' => $text, 'secondary-use-markup' => 1); > > } > > ``` > > > > Works like a charme ^^ > Thank you very much! > > What is the next step? Will you or Torsten push the code into gtk3-perl? > I've opened an MR: https://gitlab.gnome.org/GNOME/perl-gtk3/-/merge_requests/5 Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-perl-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Re: Re: Gtk3::MessageDialog - missing methods
Hi,
On Sat, 9 Jan 2021 at 02:35, Emmanuele Bassi via gtk-perl-list
wrote:
> As Torsten wrote, those methods are not introspectable because of their use
> of variadic arguments in C; this means you cannot call them from Perl.
>
> You will need to re-implement them; luckily, they are easier to deal in Perl
> than the printf-style format of C:
>
> ```
> sub Gtk3::MessageDialog::format_secondary_text {
> my ($dialog, $format, @args) = @_;
>
> my $text = sprintf $format, @args;
> $dialog->set('secondary-text', $text, 'secondary-use-markup' => 0);
> }
>
> sub Gtk3::MessageDialog::format_secondary_markup {
> my ($dialog, $format, @args) = @_;
>
> my $text = sprintf $format, @args;
> $dialog->set('secondary-text' => $text, 'secondary-use-markup' => 1);
> }
> ```
>
Works like a charme ^^
Thank you very much!
What is the next step? Will you or Torsten push the code into gtk3-perl?
Best Regards,
Thomas
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
