Re: [Geany-Devel] Toggle menu and status bars

2016-07-04 Thread Colomban Wendling
Le 02/07/2016 à 11:08, Vasiliy Faronov a écrit :
> Hi,
> 
> Most of the time, when using Geany, I don't need the menu and status
> bars; they are just noise. But occasionally I want to check the status
> bar (e.g. for the line/column number) or browse the menu. So I want to
> toggle their visibility with a keystroke.
> 
> I wrote a simple plugin for that: https://github.com/vfaronov/geany-togglebars
> 
> The problem is, the menu and status bars are not exposed in
> geany.main_widgets, so I have to find them manually, which makes the
> plugin brittle as it relies on a specific window layout.
> 
> Perhaps there is a better way to do it?

You could use a more solid resolve_widget() function, that doesn't rely
on the layout, something like that:

> def resolve_widget(widget, expected_type):
> if isinstance(widget, expected_type):
> return widget
> elif isinstance(widget, Gtk.Container):
> for child in widget.get_children():
> ret = resolve_widget(child, expected_type)
> if ret:
> return ret
> return None

Also, your plugin is a bit dangerous for the new user if I read it
correctly: you do not bind the keybinding by default (which is good),
but you hide the menubar by default.  This means that the user enabling
your plugin might be totally lost with no way of recovering his/her
menubar to even access the preferences and set a keybinding.

I guess you did that because you didn't wanna bother about a
configuration file for saving the state for such a little thing you
probably didn't mean to publish so much, but if you do want to publish
it it'd be important to resolve this.

Regards,
Colomban
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


[Geany-Devel] Improving the navqueue

2016-07-04 Thread Vasiliy Faronov
Hi,

Geany's navigation history (navqueue) would be more useful to me if I
could add positions into it manually.

For example, I want to peek into another location in the code (page up
/ page down) and then return. The navqueue fits this case much better
than bookmarks.

A plugin can emulate this by doing navqueue_goto_line() to the current
line, but this doesn't work very well: it adds two positions (unless
the cursor happens to be on the beginning of the line) and also
scrolls the view.

Do you think it would be a good idea to have a keybinding for this in
Geany core? I have a patch in the works [1].

[1] https://github.com/geany/geany/compare/master...vfaronov:add-position


-- 
Vasiliy
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel