# \[Help\] Code changes in order to add an icon

**URL:** <https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585>\
**Category:** Development\
**Created:** [November 19, 2022, 9:03am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585 "2022-11-19T09:03:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [November 19, 2022, 9:04am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/1 "2022-11-19T09:04:00Z")

</div>

Hi,

As I commented at ["Modern iconset (light and dark)](https://forums.synfig.org/t/modern-iconset-light-and-dark/13560/17) 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](https://forums.synfig.org/uploads/short-url/lbEOKmZCjed6R862fQaxc8RCP8r.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!

---

<div class="post-metadata">

**Author:** ![Keyikedalube](https://forums.synfig.org/user_avatar/forums.synfig.org/keyikedalube/32/7725_2.png) [@Keyikedalube](https://forums.synfig.org/u/Keyikedalube)\
**Post date:** [November 19, 2022, 12:48pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/2 "2022-11-19T12:48:32Z")

</div>

Hello @pablogil 🙂

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.

> <https://github.com/synfig/synfig/issues/1458>
>
> I propose to make a minimalistic theme. Like Adobe. 
> I can design it and draw i…cons, but I need someone to collect the theme from this. I started with a toolbar. Background color #323232
> !\[image\](https://user-images.githubusercontent.com/25137502/83355909-0b9eb500-a36b-11ea-9417-a9791b5995c6.png)  
> !\[image\](https://user-images.githubusercontent.com/25137502/83355977-9089ce80-a36b-11ea-99d4-c48326c29bf3.png)
> 
> Here's what an instrument might look like when it is on and off.
> 
> !\[image\](https://user-images.githubusercontent.com/25137502/83356081-46551d00-a36c-11ea-9d16-093c0da539bf.png)

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.

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [November 19, 2022, 4:23pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/3 "2022-11-19T16:23:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [November 19, 2022, 4:35pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/4 "2022-11-19T16:35:19Z")

</div>

I’m waiting for two PR to be merged ([https://github.com/synfig/synfig/pull/2731](https://github.com/synfig/synfig/pull/2731), [[UI Feature 3] Shortcut to switch tabs by mohamedAdhamc · Pull Request #2755 · synfig/synfig · GitHub](https://github.com/synfig/synfig/pull/2755)) 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](https://github.com/synfig/synfig/pull/2589)) and me ([Commits · rodolforg/synfig · GitHub](https://github.com/rodolforg/synfig/commits/go-gactions-)). I’ll mix both and finish. But, as I said, I’ll wait for the PR #2731 and #2755.

---

<div class="post-metadata">

**Author:** ![Keyikedalube](https://forums.synfig.org/user_avatar/forums.synfig.org/keyikedalube/32/7725_2.png) [@Keyikedalube](https://forums.synfig.org/u/Keyikedalube)\
**Post date:** [November 19, 2022, 6:15pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/5 "2022-11-19T18:15:56Z")

</div>

> [@pablogil](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![BobSynfig](https://forums.synfig.org/user_avatar/forums.synfig.org/bobsynfig/32/175_2.png) [@BobSynfig](https://forums.synfig.org/u/BobSynfig)\
**Post date:** [November 19, 2022, 6:34pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/6 "2022-11-19T18:34:34Z")

</div>

Most of the code changes to be done are in  
[synfig-studio/src/gui/iconcontroller.cpp](https://github.com/synfig/synfig/blob/master/synfig-studio/src/gui/iconcontroller.cpp)  
[synfig-studio/src/gui/app.cpp](https://github.com/synfig/synfig/blob/master/synfig-studio/src/gui/app.cpp)  
[synfig-studio/src/gui/canvasview.cpp](https://github.com/synfig/synfig/blob/master/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 😛

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [November 21, 2022, 12:41pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/7 "2022-11-21T12:41:14Z")

</div>

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 😉

Thanks

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [May 5, 2023, 8:52am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/8 "2023-05-05T08:52:00Z")

</div>

Hi @rodolforg,

How is the development going on?  
I’m standing by with the icon design of my [Modern iconset (light and dark)](https://forums.synfig.org/t/modern-iconset-light-and-dark/13560/17) 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”:

 ![missing_icons_v01a](https://forums.synfig.org/uploads/default/original/2X/4/47d8fc985880f3f5bea15bb229dd7983e4cf98f4.jpeg)

 ![missing_icons_v01b](https://forums.synfig.org/uploads/default/original/2X/b/bae2d7e9afa0205aa495c30252d2b6cc1cf78173.jpeg)

And following the actual status of icon development:

 ![icons_list_v05_no_editables](https://forums.synfig.org/uploads/default/original/2X/2/2427be7bc31236c19d72f474a27821cd80ad13c1.jpeg)

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](https://forums.synfig.org/uploads/default/original/2X/e/e5cf7d1ab9e3b91221ed7b5b65ae37f9fa364732.png)  
[edit\_delete.sif](https://forums.synfig.org/uploads/short-url/uDmFHWWXuk1NofMHmuYg4xkphAH.sif) (138,9 KB)

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 6, 2023, 5:58pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/9 "2023-05-06T17:58:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [May 19, 2023, 7:35am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/10 "2023-05-19T07:35:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 22, 2023, 2:07am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/11 "2023-05-22T02:07:04Z")

</div>

Sorry. It should be `edit-delete`

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [May 22, 2023, 11:49am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/12 "2023-05-22T11:49:02Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 23, 2023, 12:27am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/13 "2023-05-23T00:27:56Z")

</div>

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

You can see more here:  
[https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html](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](https://developer-old.gnome.org/gtk3/stable/gtk3-Stock-Items.html)

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [May 23, 2023, 3:24pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/14 "2023-05-23T15:24:56Z")

</div>

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?

 ![missing_icons_v01d](https://forums.synfig.org/uploads/default/original/2X/d/dc4e7c57b656c4f6b0680bf2882e427452faf365.jpeg)  
 ![missing_icons_v01e](https://forums.synfig.org/uploads/default/original/2X/7/7a2e9f84b5f509af1a0800b93385af613364532a.jpeg)

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

Thanks!

---

<div class="post-metadata">

**Author:** ![Rhvy1](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Rhvy1](https://forums.synfig.org/u/Rhvy1)\
**Post date:** [May 24, 2023, 11:50am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/15 "2023-05-24T11:50:53Z")

</div>

New UI? Loving this! 😣🙌🙌🙌

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 24, 2023, 10:51pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/16 "2023-05-24T22:51:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pablogil](https://forums.synfig.org/user_avatar/forums.synfig.org/pablogil/32/6743_2.png) [@pablogil](https://forums.synfig.org/u/pablogil)\
**Post date:** [May 25, 2023, 11:02am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/17 "2023-05-25T11:02:57Z")

</div>

So, my suspects were right, thanks.

I will then finish the icon theme and release it. 😀

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 26, 2023, 12:12am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/18 "2023-05-26T00:12:10Z")

</div>

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… 🙂

---

<div class="post-metadata">

**Author:** ![mohamed.Adhamc](https://forums.synfig.org/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@mohamed.Adhamc](https://forums.synfig.org/u/mohamed.Adhamc)\
**Post date:** [May 26, 2023, 6:43pm UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/19 "2023-05-26T18:43:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 27, 2023, 11:23am UTC](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585/20 "2023-05-27T11:23:45Z")

</div>

![image](https://forums.synfig.org/uploads/default/original/2X/8/8e553fa40a84f7efdc56b63969c48e8d38702004.png)

Is that it, pablogil?

[Next page](https://forums.synfig.org/t/help-code-changes-in-order-to-add-an-icon/13585.md?page=2)
