can-lehmann / owlkettle

A declarative user interface framework based on GTK 4
https://can-lehmann.github.io/owlkettle/README
MIT License
367 stars 14 forks source link

Add password entry #110

Closed PhilippMDoerner closed 8 months ago

PhilippMDoerner commented 8 months ago

Adds password entry.

This is not the full password entry wrapped. It also has a field menuModel that somehow interacts with GMenu's. I started added bindings for those, but given that that is a larger task I'd like to outsource wrapping of GMenu into a different PR and do that at a different time when I'm a bit more mentally present.

On its own this widget is still useful, as you can enter stuff into it, hit enter and that triggers a callback. So yay, login screens or sth.

PhilippMDoerner commented 8 months ago

Okay not sure what this error is about, all the examples run and compile locally on my end =/

PhilippMDoerner commented 8 months ago

I don't understand.

The error is in my property hook:

  hooks activatesDefault:
    property:
      let value = g_value_new(state.activatesDefault)
      g_object_set_property(state.internalWidget.pointer, "activates-default", value.addr)
      g_value_unset(value.addr)

The value.addr blows up on 1.6.12 (and I assume 1.6. generally).

Meanwhile there's other hooks that do the exact same thing, e.g. ModelButton and its text property:

  hooks text:
    property:
      var value = g_value_new(state.text)
      g_object_set_property(state.internalWidget.pointer, "text", value.addr)
      g_value_unset(value.addr)

I don't quite get what makes mine so different that it triggers compiler errors.

can-lehmann commented 8 months ago

The error says owlkettle/widgets.nim(3651, 88) Error: expression has no address; maybe use 'unsafeAddr', so you need to use var.

PhilippMDoerner commented 8 months ago

The var vs let change completely whiffed past me. Thanks! Yep that fixed it.

can-lehmann commented 8 months ago

Looks good.