Repository navigation
Add Color "destructive-action" and "suggested-action" to dialog when trying to quit before saving changes - #2498
Conversation
|
Another PR? |
|
@rodolforg Yes. I can close the previous PR if this is what you are looking for instead? |
|
This change only colors the |
|
Hmm. Aren't you coloring any dialog this way? |
|
Yes. The code change is in |
|
@rodolforg I see what you mean. It doesn't make sense to color the buttons when importing a sequence. I pushed changes. I am comparing strings to check for "Close without Saving". |
|
Sorry my long delay for a feddback, @nickleus27
|
|
@rodolforg thank you for the suggestions. I have never used |
|
@nickleus27 |
|
@ice0 Hi Ice, I made the changes you suggested. The only downside is I had to make more changes in the code because |
What button should be colored in what way? :/ |
|
@rodolforg I changed |
|
@rodolforg @ice0 Hey guys, I just made a build from the synfig master branch, and all I do is open synfig-studio app and close it and I get a segfault. I am on a mac with m1 chip. Should I open an issue about this? Maybe you guys could try for yourself and see if this is true. Maybe I just made a rookie mistake some how.. |
What about
It's fine that way for me.
Make sure that happens on a clean repo clone. If so, then open it. My guess: the problem came from #2497 |
|
@rodolforg Thanks for the suggestion noButton_isDestructiveAction. I changed it per your suggestion XD |
|
@ice0 what do you think? |
|
Hi guys! Sorry for the late reply. I was thinking about the name |
|
I like having the bool variable describe what button is being colored in what way. I do agree that the idea of color is left out with |
Well, we're setting a class to the button: It could be colored as blue (in Adwaita theme) as a suggested action. Oh I lost myself in my arguments... lol English is a barrier for me, but my mind is now confused too XD |
Hmm. I thought https://developer.apple.com/documentation/appkit/nsbutton/3622469-hasdestructiveaction?language=objc |
|
What about |
I think from the user's point of view |
|
@rodolforg What do you think? Is |
|
Well, just "hasDestructiveAction" .... Some future dialog may have "Yes" as the destructive action. |
|
@nickleus27 please squash all commits into a single one and force-push here! |
69590e2 to
22c0a94
Compare
Would the current method be Converting to |
Yes.
I'm not sure, but as far as I know,
|
|
@ice0 Great, that makes sense. I will approach the problem in the way you described. Thank you. |
You could try |
|
@ice0 Before I go too far down this path I wanted to checkin to see if this was the correct way of updating this method. For After trying this I ran into this problem when changing to |
Yes.
GTK Stock Items are prebuilt common menu/toolbar items and corresponding icons. So they can be replaced with the corresponding label + icon + accelerator. For example
This information is available here: https://valadoc.org/gtk+-3.0/Gtk.Stock.html or in the header file Let's summarize: |
|
Yes that is why I am stuck, |
|
The Gtk made Actions be independent of GUI stuff. They can even be called by DBus, for example. That's why they move them from "Gtk" (the GUI part) to Gio (their I/O base). The menu is done via Gio::MenuModel. Take a look here: (C, but better explains the concepts) https://wiki.gnome.org/HowDoI/GMenu |
|
Sweet thanks @rodolforg ! This is great material. I will spend sometime studying this. |
|
@ice0 @rodolforg Hey guys, I am starting to get an understanding of the menu with |
|
The menu looks good with the |
This is because static methods doesn't have access to
Great news! |
|
@ice0 From you previous comment I realized about the nature of this being static so I added this line: |
|
The problem is the method signature:
using Gio::ActionMap::ActivateSlot = sigc::slot<void>i.e.: it expects something like |
|
@rodolforg Thank you for explaining the slot needs to be void. That makes sense now. However, using |
|
Oops. Sorry. |
@rodolforg oh geez, that makes so much sense! That worked, and taught me a lot. Thank you! |
|
Hi @ice0 @rodolforg , So at the moment I have been hardcoding the icons and accelerators into the I have not found any methods for adding them in |
|
@rodolforg @ice0 |
Looks awesome!
Some icons in the menu are standard icons, some are custom icons (for example, the icons near
I'm not sure if these accelerators can be changed, so it's ok to hard-code them until the problem is found. |
Also I wanted to note that I suggested using a static method to ease porting.
If you want to alter return type, you can use sigc::bind_return. If not, then can you describe your task in more detail? |
@ice0 sorry, I am not sure what method you suggested making static? If you mean the method I am creating I am not adding function to |
I meant this:
Ah, ok. |
|
@iCEO Sorry for the bombardment of questions at this moment. Here is a screenshot of where I am having trouble adding the This line of code is not working. The error says |
This is the same as with
Next you need to discard the return value because So the final code should looks like: |
Ah yes, very nice. |
I suggest you to open a draft PR:
I hope we can use the icons without full icon path o.O by pointing them to icon themes (that currently Synfig doesn't use yet. Some draft work was done here in #1508. Feel free to implement/correct/improve/discard it :)
I suppose with Gio::ActionMap, similar as we do now. However, we still use the deprecated Gtk::UIManager, and now it should be done via Gtk::Application (that heirs Gio::ActionMap, by the way).
I think it's missing a deference here ;) |
|
Btw, it is recommended to use
But in the case of an application ( |
UPD. I mean this:
Optionally, a reference or pointer to an object can be bound to the functor. |








fix #2208
@rodolforg Hi Rodolfo, is this the change you are looking for?
This only creates "destructive-action"
cancelbutton when the user tries to exit without saving.