After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 736367 - GtkSourceView should implement GtkBuildable::get_internal_child()
GtkSourceView should implement GtkBuildable::get_internal_child()
Status: RESOLVED WONTFIX
Product: gtksourceview
Classification: Platform
Component: General
git master
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-10 00:04 UTC by Christian Hergert
Modified: 2018-05-26 13:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Hergert 2014-09-10 00:04:12 UTC
If GtkSourceView implements GtkBuildable::get_internal_child() for the "completion" property, it should be possible to set defaults on the completion window from directly in the GtkBuilder XML.

For example, instead of setting "select-on-show" and "show-headers" in my class constructed vfunc, it would be nice if it could be done in the widget template using:

<child internal-child="completion">
  <object class="GtkSourceCompletion">
    <property name="select_on_show">False</property>
  </object>
</child>

I'm not totally sure this is how it would work, but seems plausible.
Comment 1 Sébastien Wilmet 2014-09-10 17:24:26 UTC
I'll have a look at this this evening or tomorrow.
Comment 2 Sébastien Wilmet 2014-09-10 19:33:45 UTC
It works!

https://git.gnome.org/browse/gtksourceview/log/?h=wip/gtk-buildable

It should be documented in the class description, and maybe the glade description should be updated too.
Comment 3 Christian Hergert 2014-09-10 19:41:21 UTC
Awesome, just what I need, thanks!

Patch looks good too.
Comment 4 Paolo Borelli 2014-09-10 20:13:27 UTC
looks good to me too, feel free to push.

I wonder if the info widget should be buildable as well
Comment 5 Christian Hergert 2014-09-10 20:16:20 UTC
That would just need the same thing done to GtkSourceCompletion right? We should be able to dive down into internal children just fine.
Comment 6 Paolo Borelli 2014-09-10 21:21:55 UTC
I guess so... and now you are making me wonder if we should support specifying gutter renderers in the ui file too :)
Comment 7 Christian Hergert 2014-09-10 21:26:04 UTC
(In reply to comment #6)
> I guess so... and now you are making me wonder if we should support specifying
> gutter renderers in the ui file too :)

I would appreciate this, especially if it came with API to fetch the list of renderers in a GtkSourceGutter.

For example, I need access to the line renderer so that I can select ranges of lines by click/dragging the line numbers.
Comment 8 Sébastien Wilmet 2014-09-10 22:07:33 UTC
Yes, GtkBuilder doesn't complain about nested internal children.

What properties would you set on the CompletionInfo?

I've tried "margin", but it doesn't work well, the label is not centered even when setting the halign and valign.

I've also tried "border_width", but it doesn't work.

For glade, I think internal-child is not supported.
Comment 9 Sébastien Wilmet 2014-09-10 22:21:52 UTC
(In reply to comment #7)
> For example, I need access to the line renderer so that I can select ranges of
> lines by click/dragging the line numbers.

We can maybe implement that directly in GtkSourceView.
Comment 10 Sébastien Wilmet 2014-09-12 17:56:29 UTC
(In reply to comment #8)
> What properties would you set on the CompletionInfo?
> 
> I've tried "margin", but it doesn't work well, the label is not centered even
> when setting the halign and valign.
> 
> I've also tried "border_width", but it doesn't work.

It actually works fine, I thought the border_width draws a black border, but it's a transparent border. So to have some space around the label, setting just the border_width to 3 works fine, the label is centered.

For the gutter, the xpad and ypad properties are deprecated, so I don't know why it is useful to access the gutters in the .ui file.

The patches are available in this branch:
https://git.gnome.org/browse/gtksourceview/log/?h=wip/gtk-buildable

I think it is a good idea to have a border_width of 3 by default, so there is also a commit for that.

But since we are currently in API and UI freeze, it should wait for the next cycle.
Comment 11 Paolo Borelli 2014-09-14 11:30:54 UTC
I think we can sneak part of this in for 3.14 it does not actually add any public API.

I'd say let's push the completion patches and leave the gutter part for next cycle when we figure out how to deal with the renderers
Comment 12 Sébastien Wilmet 2014-09-14 12:17:03 UTC
The API is not just a list of types, functions, signals and properties. What is possible to do with GtkBuilder is also part of the API in my opinion. And implementing an interface is also part of the API.
Comment 13 Paolo Borelli 2014-09-14 12:50:02 UTC
Sure, but the current API already exposes the same concepts and functionality, we are just adding another way to accomplish the same thing in a way that may be more convenient in some cases. Considering this and the fact that the change has no cost in terms of added public methods to the library I think we can get this in. The API freeze is a tool to help us making better decisions, not a burocracy rule to follow blindly.
Comment 14 Sébastien Wilmet 2014-09-14 16:49:04 UTC
Yeah, here in this case there are not a lot of risks. I've pushed the completion commits.
Comment 15 Sébastien Wilmet 2018-05-26 13:53:16 UTC
It's unlikely that this feature is ever going to be implemented, so I close the bug.