From 193477e2da6bda2ff149ce981adb838a7b2328a0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 18 May 2016 17:23:14 +0000 Subject: [PATCH] GTK: set application icon. --- res/CMakeLists.txt | 2 ++ src/platform/gtkmain.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index c97e207f..8b864ba5 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -114,6 +114,8 @@ elseif(APPLE) add_xib (cocoa/MainMenu.xib) add_xib (cocoa/SaveFormatAccessory.xib) else() + add_resource(freedesktop/solvespace-48x48.png) + install(FILES freedesktop/solvespace.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) diff --git a/src/platform/gtkmain.cpp b/src/platform/gtkmain.cpp index 6b67589b..315ef428 100644 --- a/src/platform/gtkmain.cpp +++ b/src/platform/gtkmain.cpp @@ -1601,11 +1601,18 @@ int main(int argc, char** argv) { CnfLoad(); + SolveSpace::Pixmap icon = LoadPNG("freedesktop/solvespace-48x48.png"); + Glib::RefPtr icon_gdk = + Gdk::Pixbuf::create_from_data(&icon.data[0], Gdk::COLORSPACE_RGB, + icon.hasAlpha, 8, icon.width, icon.height, icon.stride); + TW.reset(new TextWindowGtk); GW.reset(new GraphicsWindowGtk); InitMainMenu(&GW->get_menubar()); GW->get_menubar().accelerate(*TW); TW->set_transient_for(*GW); + GW->set_icon(icon_gdk); + TW->set_icon(icon_gdk); TW->show_all(); GW->show_all();