I am using a 48 pixel square image.
I thought that after I compile the code into an executable,
then the .png data is available at runtime just as if the local file were there.
But after creating an executable, I can only get it to work properly with the png file in the same folder.
Code: Select all
ImportC ""
gtk_window_set_icon_from_file(a.l, b.l, c.l)
EndImport
DataSection
LINUXICON:
IncludeBinary "S48.png"
EndDataSection
Procedure SETLINUXICON(iWindow.i)
Protected.l lError
gtk_window_set_icon_from_file_(WindowID(iWindow),"S48.png",lError)
EndProcedure
OpenWindow(0,100,100,300,200,"SOFTWARE",#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SETLINUXICON(0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
End
gtk_window_set_icon_from_file_(WindowID(iWindow),?LINUXICON,lError)
and then running yields the error: Failed to open file (random garbage)PNG
(garbage) No such file or directory.
The documentation at https://developer.gnome.org/ states:
gtk_window_set_icon_from_file (GtkWindow *window,
const gchar *filename,
GError **err);
Sets the icon for window . Warns on failure if err is NULL.
This function is equivalent to calling gtk_window_set_icon() with a pixbuf created by loading the image from filename .
Parameters:
window - a GtkWindow
filename - location of icon file. [type filename]
err - location to store error, or NULL.[allow-none]
Does anyone know how to accomplish setting the GTK icon, without having the file actually existing in a folder?