Re: Cannot call Gio::File::new_for_path



On 31.03.20 18:53, David Breeding via gtk-perl-list wrote:
Trying to implement the following code:

my $cs = Gtk3::CssProvider->new();
$cs->load_from_file(Gio2::File::new_for_path("$ENV{HOME}/.config/poolstore/ps.css"));
my $context = $w_main->get_style_context();
Gtk3::StyleContext::add_provider_for_screen($context->get_screen(),
        $cs, 600);

However, I get error that Gio2::file_new_for_path does not exist.  I've tried using simply Gio (it appears from doc that it is now Gio2). Also tried other variations like GFile in place of Gio with no success.

You need to either setup the gio bindings yourself:

  Glib::Object::Introspection->setup(
    basename => 'Gio',
    version => '2.0',
    package => 'Gio'); # or 'Gio2' or 'Glib::IO' or whatever you like

Or install and use Glib::IO, which does this for you.

-Torsten


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