How I can add an icon to a Linux PureBasic program?
In Linux the icons are external files?
Thanks
Code: Select all
gtk_window_set_icon_name_(*window, stockitem$);Code: Select all
gtk_window_set_icon_(*window,*icon);
Code: Select all
gtk_window_set_icon_from_file_(*window, *filename, *err)
Ok!walker wrote:no bug... gtk expects utf-8 formated strings.... the filename you pass isn't... that's something I had to learn too![]()
see http://www.purebasic.fr/english/viewtopic.php?t=29302 and try that with gtk_window_set_icon_from_file_() it will work
Code: Select all
iconpath.s = GetPathPart(ProgramFilename()) + "Icon.png"
iconerror.l = 0
pathutf8.s = Space(255)
PokeS(@pathutf8,iconpath,#PB_UTF8)
gtk_window_set_icon_from_file_(Wpointer, @pathutf8, @iconerror)
Code: Select all
ImportC "/usr/lib/libgtk-x11-2.0.so"
gtk_window_set_icon_from_file(*window,icon.p-utf8,*error)
EndImport
iconpath.s = GetPathPart(ProgramFilename()) + "Icon.png"
iconerror.l = 0
pathutf8.s = Space(255)
PokeS(@pathutf8,iconpath,-1,#PB_UTF8)
Wpointer=OpenWindow(#PB_Any ,0,0,200,100,"Icon-Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
gtk_window_set_icon_from_file(WindowID(Wpointer), PeekS(@iconpath), iconerror)
Repeat
Until WaitWindowEvent(1)=#PB_Event_CloseWindow
Code: Select all
iconpath.s = GetPathPart(ProgramFilename()) + "Icon.png"
iconerror.l = 0
pathutf8.s = Space(255)
PokeS(@pathutf8,iconpath,-1,#PB_UTF8)
Wpointer=OpenWindow(#PB_Any ,0,0,200,100,"Icon-Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
gtk_window_set_icon_from_file_(WindowID(Wpointer), PeekS(@pathutf8), iconerror)
Repeat
Until WaitWindowEvent(1)=#PB_Event_CloseWindow
Code: Select all
gtk_window_set_icon_(*window,*icon);