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: ``` ui_add_tab(const gchar *unique_id, gint placement, GtkWidget *widget); ui_remove_tab(GtkWidget *widget); ui_make_tab_active(GtkWidget *widget); ``` 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 the `placement` 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 using `gtk_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? You can view, comment on, or merge this pull request online at: https://github.com/geany/geany/pull/4411 -- Commit Summary -- * filebrowser: Don't use stored sidebar page number index * Move ui_sidebar_show_hide() to sidebar.c * sidebar.c: Don't use stored indices of Symbols and Documents pages * Make sidebar pages reorderable * Save sidebar notebook tab order into config file * Load sidebar tab order from config file * Reorder pages based on saved tab names -- File Changes -- M plugins/filebrowser.c (6) M src/callbacks.c (2) M src/keyfile.c (19) M src/libmain.c (4) M src/prefs.c (2) M src/sidebar.c (98) M src/sidebar.h (4) M src/ui_utils.c (29) M src/ui_utils.h (3) -- Patch Links -- https://github.com/geany/geany/pull/4411.patch https://github.com/geany/geany/pull/4411.diff -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/4411 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany/pull/4...@github.com>