[Help] Code changes in order to add an icon

Hi,

As I commented at "Modern iconset (light and dark) thread, I have just started designing new icons for default classic iconset (filling the gaps, that is, designing icons that were TODO or just missing). I’m following the guidelines so they are being designed as .sif files using the correct file naming as well.

I have code skills that let me do lots of things (sometimes just by studying a code and “copy pasting it”) but they are pretty basic at the end so, after trying for myself, I wasn’t able to finish a “proof of concept” in this case. I would like to change the “File / Quit” icon as it has a GTK builded it. Here is mine action_doc_quit_icon.sif (70,0 KB)

Would anybody have enough time and skills to show me this proof of concept so that I can replicate it with the other icons (around 33+)?
Another way of doing it is explaining here what I did (what files I edited) and you tell me what is missing…

Thanks in advance!

Hello @pablogil :slightly_smiling_face:

There was another user who contributed Minimalistic icons idea in an effort to modernize decade old Synfig icons.

@rodolforg was very much involved in the post linked below. There were some limitations highlighted by him near the end.

Major obstacle was getting rid of the deprecated gtk main loop and implementing the modern glib one I think. Without which custom app/icon theming was impossible.

I do not know the current status unfortunately. Other priorities got hold of me. But I hope the above linked post helps.

Thanks @Keyikedalube for your comments.

I already read that thread but was old and unfinished, I mean it did focus on tools but not the rest of all icons used inside Synfig.

By the time I’m writing this I have finished the whole icon set but there are around 33+ icons that can’t be changed because they use the GTK Adwaita default icons (for actions like Quit, Close, Copy, Cut, Paste, and so on). I would like to learn how to change them with the ones I already have designed in order to copy the process and do it with all of the 33+ ones.

Maybe it’s not as easy as I think but, well, that’s why I’m asking for hints.

I’m waiting for two PR to be merged (https://github.com/synfig/synfig/pull/2731, [UI Feature 3] Shortcut to switch tabs by mohamedAdhamc · Pull Request #2755 · synfig/synfig · GitHub) so I can work on the needed changes without having an extra effort on merging them after.

Some work was started by nickleus27 (Use GtkBuilder to create App Menu by nickleus27 · Pull Request #2589 · synfig/synfig · GitHub) and me (Commits · rodolforg/synfig · GitHub). I’ll mix both and finish. But, as I said, I’ll wait for the PR #2731 and #2755.

Oh. It’s doable.

I think synfigapp action covers most of those basic functions. In gui source code folder there’ll be lines and lines of code setting icons for each action.

Maybe in canvasview file or main related file. I’m sorry I can’t be specific because I haven’t been contributing to the project lately.

Most of the code changes to be done are in
synfig-studio/src/gui/iconcontroller.cpp
synfig-studio/src/gui/app.cpp
synfig-studio/src/gui/canvasview.cpp
But the goal it to be sure to understand how to override the default icons/actions/menus and not to introduce multiple bugs at once :stuck_out_tongue:

1 Like

Yes, those are the files I was testing but, at least for “Quit” command, it is not straight forward or, as you say, I don’t properly understand how to override them… I mean, I could not change the default “Quit” icon to one I designed (called “action_doc_quit_icon.sif”).

At this point, it makes sense that I continue designing the icons and leave the code changes for later, when you are able to help me :wink:

Thanks

Hi @rodolforg,

How is the development going on?
I’m standing by with the icon design of my Modern iconset (light and dark) as all the icons remaining are those that are “hard coded” and dependent of the “adwaita-legacy” iconset.

In case you don’t remember the conversation, in the next screenshot you have a bunch of icons that aren’t themeable as they are “hard coded”:

And following the actual status of icon development:

So in the red box you see the list of icons that are not themeable, the ones that have the icon visible is because I have already created a SIF format version of it so that it can be added to the default Synfig iconset but, more important, with your code changes it can turn into a themeable icon and I would be able to create a SVG with the modern icon and finally publish it into PNG. (I guess in the future you will add SVG support and it will make things easier).

So, my question is: what is the status of the development and when could you partner me with this subject and turn the whole Synfig iconset themeable?
I’ve seen only one of two PR have been merged but I’m unsure if you need them all to be merged or we can continue the development.

Cheers

PS - in case you feel like starting to tinker here is an example:
edit_delete
edit_delete.sif (138,9 KB)

1 Like

Please try to use gtk-revert-to-saved-ltr.png and gtk-revert-to-saved-rtl.png in your icon theme to check if it works for now.

Whoops. For this icon, gtk-delete.png

I have tried adding a png with that name, that is, gtk-delete.png in the icons folder and it didn’t work…

I guess you meant to add entries in iconcontroller.cpp with that name, right?

Sorry. It should be edit-delete

1 Like

Yes!
it worked out of the box by just adding a edit-delete.png icon into the icons folder.

What about the rest of icons I reported weren’t working? is there a pattern I can follow in order to find the name I should use in order to make it “themeable”?

Thank you!

  • list-add
  • list-remove
  • application-exit

You can see more here:
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
and here:
https://developer-old.gnome.org/gtk3/stable/gtk3-Stock-Items.html

1 Like

Great!
I was able to locate all or most of them: the only ones that I can’t locate are the following ones but I suspect they are or hard-coded or part of the system, please, could you confirm it?


Anyway, you gave me the key to accomplish the very first whole icon replacement and set the foundation for new ones to come :grinning:

Thanks!

New UI? Loving this! :persevere::raised_hands::raised_hands::raised_hands:

The plus/minus signs to increase/decrease the brush size currently are just a text label inside a button.

The check mark in Parameters Panel and the checkboxes in the menus are drawn directly Gtk “framework”. I know how to change the parameter case, but not the one of menu items.

So, my suspects were right, thanks.

I will then finish the icon theme and release it. :grinning:

1 Like

We can change the buttons of brush size to use icons not text.
We can change the parameters panel check mark to an icon too.

If you provide icons to the current (not well) defined theme… :slight_smile:

Not too related but I have to say I am excited to see these icons eventually (hopefully) being used : ).

image

Is that it, pablogil?