Skip to content

Commit

Permalink
Follow best practices for Linux app icon
Browse files Browse the repository at this point in the history
Follow https://wiki.gnome.org/Initiatives/GnomeGoals/AppIcon:

1. Update icons cache as part of "make install"
2. Use g_set_application_name() and gtk_window_set_default_icon_name()
instead of setting per-window icon pixmaps
  • Loading branch information
vslavik committed Nov 24, 2020
1 parent 45e6b40 commit 4386237
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
3 changes: 3 additions & 0 deletions artwork/Makefile.am
Expand Up @@ -50,3 +50,6 @@ dist_uiicons_DATA = \
StatusWarning.png \
StatusWarningBlack.png \
window-close.png

install-data-hook:
gtk-update-icon-cache -f -t $(DESTDIR)$(iconsdir)
7 changes: 5 additions & 2 deletions src/edapp.cpp
Expand Up @@ -56,8 +56,9 @@
#include <winsparkle.h>
#endif

#ifdef __WXGTK3__
#ifdef __WXGTK__
#include <glib.h>
#include <gtk/gtk.h>
#endif

#include <unicode/uclean.h>
Expand Down Expand Up @@ -337,7 +338,9 @@ bool PoeditApp::OnInit()
SetDllDirectory(L"");
#endif

#ifdef __WXGTK3__
#ifdef __WXGTK__
gtk_window_set_default_icon_name("net.poedit.Poedit");
g_set_application_name("Poedit");
// Wayland compatibility, see https://wiki.gnome.org/Projects/GnomeShell/ApplicationBased
g_set_prgname("net.poedit.Poedit");
#endif
Expand Down
11 changes: 1 addition & 10 deletions src/edframe.cpp
Expand Up @@ -546,16 +546,7 @@ PoeditFrame::PoeditFrame() :
m_displayIDs = (bool)cfg->Read("display_lines", (long)false);
g_focusToText = (bool)cfg->Read("focus_to_text", (long)false);

#if defined(__WXGTK__)
wxIconBundle appicons;
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(16,16)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(24,24)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(32,32)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(48,48)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(256,256)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(512,512)));
SetIcons(appicons);
#elif defined(__WXMSW__)
#ifdef __WXMSW__
SetIcons(wxIconBundle(wxStandardPaths::Get().GetResourcesDir() + "\\Resources\\Poedit.ico"));
#endif

Expand Down
8 changes: 1 addition & 7 deletions src/manager.cpp
Expand Up @@ -82,13 +82,7 @@ ManagerFrame::ManagerFrame() :
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE,
"manager")
{
#if defined(__WXGTK__)
wxIconBundle appicons;
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(16,16)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(32,32)));
appicons.AddIcon(wxArtProvider::GetIcon("net.poedit.Poedit", wxART_FRAME_ICON, wxSize(48,48)));
SetIcons(appicons);
#elif defined(__WXMSW__)
#ifdef __WXMSW__
SetIcons(wxIconBundle(wxStandardPaths::Get().GetResourcesDir() + "\\Resources\\Poedit.ico"));
#endif

Expand Down

0 comments on commit 4386237

Please sign in to comment.