Hello,
after extensive searching and testing many codes, I finally was lucky to have found a way to get a program icon showing for good.
With all examples from here or from
[Linux] Window icon creator I always experience the same issue:
- the tray-icon always shows
- the title-icon only shows once in a while in the actual IDE-compilation, but never if I'd run the pb-compilation.out nor ever in any compiled executable.
If anybody has an idea why that is, please let me know.
[Maybe it's Suse 11.1 missing a lib or alike. But even years ago nothing had worked out.]Now, in case someone else has similar issues, I'd like to share my solution using "
gtk_window_set_default_icon_from_file". And benefitting from the codes around me, I managed to make it work for both ASCII and Unicode compilations.
Code:
; **********
; Linux - Program Icon via "...default_icon_from_file"
; ASCII and Unicode compilation
; **********
EnableExplicit
Enumeration
#MainWin = 0
#Tex1 = 0
EndEnumeration
Global *err, compil, IconPath.s
; Adjust your icon path here ...
IconPath.s = #PB_Compiler_Home + "examples/sources/Data/world.png"
CompilerIf #PB_Compiler_Unicode
compil = 1
ImportC ""
gtk_window_set_default_icon_from_file(file.p-utf8, *err) As "gtk_window_set_default_icon_from_file"
EndImport
; gtk_window_set_default_icon_from_file("/home/path/to.png", @*err)
gtk_window_set_default_icon_from_file(IconPath, @*err)
CompilerElse
; gtk_window_set_default_icon_from_file_(@"/home/path/to.png", @*err)
gtk_window_set_default_icon_from_file_(@IconPath, @*err)
CompilerEndIf
If OpenWindow(#MainWin, 300, 200, 200, 100, "show prog icon", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(#Tex1, 50, 30, 140, 25, "")
If compil = 1 : SetGadgetText(#Tex1, "unicode")
Else :: SetGadgetText(#Tex1, "ASCII") : EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
thanks

nd greetings ~ Vera