Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WRAP_WIDTH, WRAP_MODE tags to cell_properties_text, supported since gtk 2.8 #146

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

nguermond
Copy link
Contributor

Allow text wrapping in cells in tree view.

Description of wrap-width:
https://docs.gtk.org/gtk3/property.CellRendererText.wrap-width.html

I can't figure out how to get wrap-mode to work:
https://docs.gtk.org/gtk3/property.CellRendererText.wrap-mode.html

@garrigue
Copy link
Owner

Since it is there since 2.8, this should also probably go into lablgtk2.

@garrigue
Copy link
Owner

What is your problem with wrap-mode.
Since pango_wrap_mode is already defined, the conversions should be available.

@nguermond
Copy link
Contributor Author

nguermond commented Dec 16, 2021

When I recompile gtkTree.props I get

      propcc src/gtkTreeProps.ml,src/ogtkTreeProps.ml
Warning: no conversion for type PangoAttrList in class GtkCellRendererText
Warning: no conversion for type PangoWrapMode in class GtkCellRendererText

As a result, when cell_renderer_text_param x is called in gTree.ml,

Error: This expression has type
         [> ...
          | `WRAP_MODE of Pango.Tags.wrap_mode
          | `WRAP_WIDTH of int ]
       but an expression was expected of type
         [< ...
          | `WRAP_WIDTH of int ]
       The second variant type does not allow tag(s) `WRAP_MODE

@garrigue
Copy link
Owner

I see. You just need to add WrapMode in propcc.ml4, line 79:

  [ "Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode"; "WrapMode" ];

Then run make dev.

@nguermond nguermond changed the title Add WRAP_WIDTH tag to cell_properties_text, supported since gtk 2.8 Add WRAP_WIDTH, WRAP_MODE tags to cell_properties_text, supported since gtk 2.8 Dec 17, 2021
@nguermond
Copy link
Contributor Author

This seems to work!

@nguermond
Copy link
Contributor Author

Should I make a similar pull request to master?

@garrigue
Copy link
Owner

Should I make a similar pull request to master?

No need, I'll take care of this.

@garrigue garrigue merged commit 9d8553e into garrigue:lablgtk3 Dec 18, 2021
garrigue added a commit that referenced this pull request Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants