Skip to content

[Workbench] Sync with selected open file#1576

Open
WrapEarnPass wants to merge 6 commits into
geany:masterfrom
WrapEarnPass:syncwithopen
Open

[Workbench] Sync with selected open file#1576
WrapEarnPass wants to merge 6 commits into
geany:masterfrom
WrapEarnPass:syncwithopen

Conversation

@WrapEarnPass

@WrapEarnPass WrapEarnPass commented Jun 18, 2026

Copy link
Copy Markdown

About this:
As requested in #1227 this change adds bi-directional file-tree select to Workbench.
When clicking on a file in the file tree, if that file is open, that tab is selected.
When clicking on a tab in the editor, if that file exists in the file-tree, it is scrolled to (vertically only), and selected.

@fireclawthefox

Copy link
Copy Markdown

From my limited knowledge of geany plugin and gtk development I think this looks good so far aside of the two minor points I commented on in the files.

@WrapEarnPass

Copy link
Copy Markdown
Author

@fireclawthefox

From my limited knowledge of geany plugin and gtk development I think this looks good so far aside of the two minor points I commented on in the files.

I reviewed the pull request looking for comments, but github isn't showing me anything. I don't normally use github, so I am not sure if I am looking in the wrong place, or if it only shows comments to the pull reviewers.

I welcome any feedback though, as I haven't written C since the 90s and just started GTK last week.

/* it seems odd to assert this here,
* as an untitled doc (new one) would have no filename.
*/
g_return_if_fail(doc != NULL && doc->file_name != NULL);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comment states uncertainty if this should be here or not. Has this been clarified yet? If there is actual reason to check for the file_name, it should probably be specified in the comment as for why this is done. Otherwise, if it works without this filename check, maybe removing it is the better option to not cause more confusion.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems confusing because I am confused. I copied this guard to honor the pattern established by the project maintainer. Until I get clarification, I am afraid to remove it, as I have already had to close one pull due to changing something that actually turned out to be load-bearing elsewhere.

Comment thread workbench/src/wb_project.c
@fireclawthefox

Copy link
Copy Markdown

I reviewed the pull request looking for comments, but github isn't showing me anything. I don't normally use github, so I am not sure if I am looking in the wrong place, or if it only shows comments to the pull reviewers.

sorry, it seems github doesn't automatically puts those comments in the PR but requires me to actually "finish" the PR-review. I haven't used githubs' review system before and this wasn't quite clear to me as the comments even appeared here in the comment section.

@fireclawthefox

Copy link
Copy Markdown

Both your comments sound reasonable and as I won't be able to tell you how both of them could be tested, I'd say it's good enough for now so I would approve it in this state but maybe add some cleanup tasks so those topics may get clarified sometime in the future. But that's just what I would recommend, not sure if there are already rulings for geany plugin development that define a certain path to follow here.

@WrapEarnPass

Copy link
Copy Markdown
Author

Moved this so I could change the Pull request to About this
$ git log | head
commit 7f2c113
built against:
geany@98bcbee3b99d71dfcdd9d3556ace9530ceda818d

make is clean

$ make all
Making all in src
make[1]: Entering directory '/home/build/Projects/geany-plugins-remote/geany-plugins/workbench/src'
  CC       workbench_la-plugin_main.lo
  CC       workbench_la-wb_globals.lo
  CC       workbench_la-wb_project.lo
  CC       workbench_la-workbench.lo
  CC       workbench_la-dialogs.lo
  CC       workbench_la-wb_monitor.lo
  CC       workbench_la-search_projects.lo
  CC       workbench_la-menu.lo
  CC       workbench_la-popup_menu.lo
  CC       workbench_la-sidebar.lo
  CC       workbench_la-utils.lo
  CC       workbench_la-idle_queue.lo
  CC       workbench_la-tm_control.lo
  CCLD     workbench.la
make[1]: Leaving directory '/home/build/Projects/geany-plugins-remote/geany-plugins/workbench/src'
make[1]: Entering directory '/home/build/Projects/geany-plugins-remote/geany-plugins/workbench'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/build/Projects/geany-plugins-remote/geany-plugins/workbench'
Peek 2026-06-18 11-13-2

geany verbose log has a lot of messages, but unrelated to my changes

Workbench-Message: 17:07:34.352: wb_monitor_file_changed_cb: event: 0
Workbench-Message: 17:07:34.352: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:34.352: wb_monitor_file_changed_cb: event: 0
Workbench-Message: 17:07:34.352: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:34.357: wb_monitor_file_changed_cb: event: 3
Workbench-Message: 17:07:34.357: wb_monitor_file_changed_cb: Prj: "geany-plugins-remote" Dir: ".." FILE_CREATED: "/home/build/Projects/geany-plugins-remote/geany-plugins/.git/objects/maintenance.lock"
Workbench-Message: 17:07:34.357: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:34.357: wb_monitor_file_changed_cb: event: 2
Workbench-Message: 17:07:34.357: wb_monitor_file_changed_cb: Prj: "geany-plugins-remote" Dir: ".." FILE_DELETED: "/home/build/Projects/geany-plugins-remote/geany-plugins/.git/objects/maintenance.lock"
Workbench-Message: 17:07:36.351: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: event: 3
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: Prj: "geany-plugins-remote" Dir: ".." FILE_CREATED: "/home/build/Projects/geany-plugins-remote/geany-plugins/.git/refs/remotes/my-geany-plugins/syncwithopen.lock"
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: event: 0
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: event: 2
Workbench-Message: 17:07:54.353: wb_monitor_file_changed_cb: Prj: "geany-plugins-remote" Dir: ".." FILE_DELETED: "/home/build/Projects/geany-plugins-remote/geany-plugins/.git/refs/remotes/my-geany-plugins/syncwithopen.lock"
Workbench-Message: 17:07:54.354: wb_monitor_file_changed_cb: event: 3
Workbench-Message: 17:07:54.354: wb_monitor_file_changed_cb: Prj: "geany-plugins-remote" Dir: ".." FILE_CREATED: "/home/build/Projects/geany-plugins-remote/geany-plugins/.git/refs/remotes/my-geany-plugins/syncwithopen"
Workbench-Message: 17:07:54.354: wb_monitor_file_changed_cb: event: 1
Workbench-Message: 17:07:54.354: wb_monitor_file_changed_cb: event: 0
Workbench-Message: 17:07:54.354: wb_monitor_file_changed_cb: event: 1

Closes #1227

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