Repository navigation
Use GtkBuilder to create App Menu - #2589
nickleus27 wants to merge 92 commits into
Conversation
|
@ice0 @rodolforg This is a draft for the new menu bar. |
|
@nickleus27 |
|
@ice0 @rodolforg Starting at |
There are two different approaches:
This is not the best idea because you need to rebuild the main menu every time the dynamic element changes.
And it looks like the same approach can be used with
synfig/synfig-studio/src/gui/canvasview.cpp Lines 1475 to 1477 in 042c737 It calls
Same here: synfig/synfig-studio/src/gui/canvasview.cpp Lines 1487 to 1489 in 042c737 |
I see how recent files can be added dynamically in the method Second, when I click on I also noticed that the |
|
When using the new GMenu, dynamic menus should be implemented via Gio::MenuModel / Gio::Menu. |
They are (currently) controlled by an ActionGroup of the active CanvasView. Check |
|
I have files adding dynamically now to Open Recent submenu. But duplicate files are added to the list. Here is before opening file: Here is where I think duplicate files are prevented from going into menu: This code snippet is in |
I also did not find a solution using the
It looks like removing duplicates in action groups not in menus.
Since you are adding all recent items every time there is no need to remove duplicates, you can just remove all items in the menu using |
Do I need to worry about removing duplicate actions? I looked into this and I could not find a way to insert
There is no But it seems that |
…ove_all in MainWindow::on_recent_files_changed
|
are the icon images in I am having trouble with finding how to activate/deactivate the items in the edit menu. So far undo/redo is in |
From documentation:
It looks like we can use @rodolforg
Icons are located in
Try to use full path to menu. Something like this:
You need to set This can be done with |
|
@ice0 thank you. Looks like I might need to go with glade instead of .xml |
|
I cannot seem to get .glade to work, and I cannot seem to get the widget I need for inserting action groups with the .xml I have that does work. If i am using I tried using App::main_window for widget, but I wasn't able to get the actions to work in the menubar. I am confused how
This full path to the icons worked Edit:
But there is still the issue of remove actions that are no longer used. |
I just want to say that I need time to test this. I'll be back when there's news. |
…ion in mainwindow.cpp
|
Thank you for this great work! I plan to start merging it step by step after the PR with themes is merged. Before: After:
This menu action can be disabled for MacOS using define: There is currently no main menu on Linux, but I plan to solve this issue in the merge step. |
|
Thanks @ice0 ! That sounds great. Also, thank you for explaining how to remove show menubar from apple platform. I just pushed that commit. No need to have |
|
@ice0 I tried building this PR on an linux (ubuntu) docker container and I see what you mean that there is no main menubar on. That is really weird, and I am not sure why that is. I am glad you have an idea how to fix it. I tried in mainwindow.cpp but that didn't seem to add the menubar. |
|
I merged PR with IconTheme support. You can now use icon names instead of file paths in UI descriptions. Before: After: This will allow to extract the UI description into an external file and merge it via separate PR (because it won't change the current behavior). I also found a non-intrusive way to switch from Gtk::Action to Gio::Action. (Currently testing it). |
|
@ice0 @rodolforg hey all, when it comes time, I might need some help on how to squash these commits. Since I have merged with other commits. Newbie mistake I guess. Maybe with |
Yes you can squash commits using After you will fix the merge conflicts, this should remove the already merged changes (I mean glade files). |
|
@ice0 @rodolforg sorry guys I let this commit history get so sloppy. I downloaded smart git, but I am not sure how to approach cleaning up commit history, because it is not just my commits in a straight line on the graph. I do not want to mess things up. The history graph has multiple branches, and I am not sure what to do. Any articles you can direct me to show me how to do this when it is not the last n commits that you are trying to squash. Thank you. edit: i found this solution, (https://stackoverflow.com/a/17141512/1388104) , and I am not sure if this is a good idea or not. Also, I am not sure how important it is to clean up history, vs preserving history. |
The commit history should help to understand why a particular change was made. In the case of this PR, I suppose to leave things as they are. I plan to merge changes from it step by step as separate PRs until all changes are merged. |
|
hi @nickleus27 :) do you still have interest on work on it? I have some suggestions here - even some important changes. |
|
@rodolforg sure whats up? |
|
Sorry my delay. again :( I created a new class (badly) called ActionManager that is a database for binding action names to labels, (default) shortcuts, etc. What do you think? |
|
@rodolforg Right on, this looks cool! Thank you. |


This is a draft to update deprecated
Gtk::UIManagermethods to create the applications menu bar. Instead this pull request usesGtk::Builderto creae application menu bar. This is currently a work in progress.UPD:
Discussion start here: #2498 (comment)