Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Missing documentation/examples for subclassing & few questions #279

@haecker-felix

Description

@haecker-felix

I started to play with subclassing gtk-rs widgets. It took me a while, to understand few basic things. In my opinion we need more examples, or at least a more basic one with more explanations.

As a starter I had following questions:

  • Why we need a ExampleObjectPrivate and a ExampleObject struct
  • What does the glib_wrapper! macro
  • How I can access from the ExampleObject struct stuff from the ExampleObjectPrivate struct

Now I managed to subclass my first widget. It resulted into this:
https://gitlab.gnome.org/World/Shortwave/commit/4a4e2442f9c15f92b5a2ea32c5eb0d874496793f

Now I wonder...

I'm refering to this example:
https://github.com/gtk-rs/examples/blob/master/src/bin/basic_subclass.rs

And BTW, there's an issue with it:
grafik
Shouldn't be it SimpleWindow instead of the SimpleWindowPrivate in the inspector?

To be fair, I should admit that I have no knowledge with handling gobject boilerplate manually (Thanks Vala 😄 ), so I might missing few bits.

As soon as I understand everything correctly, I want to submit one more basic example for subclassing (like just subclassing a simple gtk::Box with more explanations)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions