GTK: set application icon.

pull/10/head
whitequark 2016-05-18 17:23:14 +00:00
parent d37d77a257
commit 193477e2da
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -1601,11 +1601,18 @@ int main(int argc, char** argv) {
CnfLoad();
SolveSpace::Pixmap icon = LoadPNG("freedesktop/solvespace-48x48.png");
Glib::RefPtr<Gdk::Pixbuf> 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();