Re: Viewport and style (gtk3)

On 08.10.2012 14:27, Juergen Harms wrote:
I had hoped that my problem with viewports in gtk2 might have gone away
in gkt3. It apparently has not, and I have hit additional problems
- I do not manage to call provider->load_from_file ( <path> )
- I cannot even attach a child to the viewport

With a couple of modifications, it works for me:

â Loading from files works like this:

    use Glib::IO;
    $css_provider->load_from_file (
       Glib::IO::File::new_for_path ('style.css'));

Glib::IO has not been released yet; get it from <>. As I said earlier, I'm thinking about making Gtk3 depend on it so that stuff like this works automatically.

â The "map ord" incantation for load_from_data is not needed anymore as of Gtk3 0.008:

   $css_provider->load_from_data ( "
                GtkEventBox {   background-color: blue }
                GtkWindow {     background-color: green }
                GtkViewport {   background-color: pink }        " );

â You cannot use 0.0 for the adjustment args of the Gtk3::Viewport constructor. You should be able to use undef:

    my $view_port = Gtk3::Viewport->new ( undef, undef );

But that needs a patch in gtk+ first: <>. In the meantime, use:

   my $view_port = Gtk3::Viewport->new (
      Gtk3::Adjustment->new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
      Gtk3::Adjustment->new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );

â I had to remove all the event box code to actually see the CSS take effect.

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