Allow DnD for sidebar tabs #4411
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables DnD for sidebar tabs so the order of tabs can be customized by users. The order is saved into a config file and restored after Geany relaunch. Eventually, I'd like to something like this for the messages window too, see below.
I tried to be careful and eliminate all uses of stored indices referring to individual tabs in Geany (basically affecting only the Symbols and Documents tabs). I did the same for geany-plugins (I'll open a separate PR for this) which most of the time did the right thing already.
The current limitation is that tab order has to be remembered and saved somehow - the only "unique" identifier of a tab I could think of is the tab name so the sequence of tab names determines the order of tabs. This works most of the time but when plugins use identical tab names (the biggest offenders are various project management plugins adding the "Project" tab), the order isn't deterministic for these.
If we wanted, we could solve this problem by deprecating direct use of
geany_data->main_widgets->sidebar_notebook
which plugins could access through a new API which could look something like this:Such an API would cover all current uses present inside geany-plugins from what I have seen. Plugins would be responsible for providing a sufficiently unique string
unique_id
that would be used for determining the order of the tabs. The idea behind theplacement
argument is that I'd like to do something similar for the messages window as well and plugins could determine the initial placement here (SIDEBAR
,MSGWINDOW
). In addition, I've been thinking it would even be possible for users to drag and drop tabs between the sidebar window and the messages window (should work usinggtk_notebook_set_group_name()
) so the sidebar and the messages window would become interchangeable for users.Alternatively, we could just leave it as it is and just discourage plugin developers from directly using tab indices.
Thoughts?