Re: [Gtk-osx-users] Trouble loading images with gtk-osx ('Couldn't recognize the image file format for file')



John Ralls wrote:
> On Nov 2, 2009, at 7:53 PM, John Pye wrote:
>
>   
>> John Ralls wrote:
>>     
>>> On Sep 23, 2009, at 11:28 PM, John Pye wrote:
>>>
>>>       
>>>> 24/09/09 4:21:47 PM [0x0-0x8f08f].edu.cmu.cheme.ascend[3877]
>>>> (ascend:3877): libglade-WARNING **: Error loading image: Couldn't
>>>> recognize the image file format for file
>>>> '/Users/john/ascinst/Applications/ASCEND.app/Contents/Resources/
>>>> glade/incidence.png'
>>>>
>>>>
>>>>         
>>> When you run "open foo.app" from the command line, your shell
>>> environment is passed in to the application; when you double-click in
>>> Finder, a default environment is passed in, modified by ~/.MacOS/
>>> environment.sh.
>>>
>>> Make sure that your startup script sets all the environment variables
>>> your app needs before exec-ing your program.
>>>
>>>       
>> I finally identified what the offending/missing environment variables
>> were here. What needs to be added to the environment can be seen here:
>>
>>    if platform.system()=="Darwin":
>>        if not 'XDG_DATA_HOME' in os.environ:
>>            os.environ['XDG_DATA_HOME']=os.path.expanduser('~/.local/ 
>> share')
>> #            os.environ['XDG_CONFIG_HOME']=os.path.expanduser 
>> ('~/.config')
>> #            os.environ['XDG_CACHE_HOME']=os.path.expanduser 
>> ('~/.cache')
>> #            os.environ['XDG_CONFIG_DIRS']='/sw/etc/xdg'
>>            os.environ['XDG_DATA_DIRS']='/sw/share'
>> #            os.environ['XML_CATALOG_FILES']='/sw/etc/xml/catalog'
>>            restart = 1
>>
>> So, basically, I need to have XDG_DATA_DIRS and XDG_DATA_HOME in my
>> environment in order for GTK's image loading routines to work  
>> correctly!
>>
>> What is this XDG thing, and why does GTK-OSX (or at least my copy of  
>> it)
>> depend upon it?
>>
>> Does this imply that I didn't have a clean environment when I built  
>> GTK?
>>
>> Cheers
>> JP
>>
>>     
>
>
> XDG is a way for applications to have an extra set of directories for  
> configuration and data storage, which can be configured in the  
> environment at runtime.
>
> What's with the /sw tree? That usually comes from Fink -- which  
> certainly would suggest that you don't have a clean environement.
>
> The other directories you're pointing XDG at are a bit odd, too. Gtk- 
> OSX uses .local by default only for build tools like jhbuild and ige- 
> mac-bundler. The completed application shouldn't need to refer to  
> anything there. ~/.cache/jhbuild is used by jhbuild to cache  
> downloaded patches and modulesets; again, something that the finished  
> application shouldn't need to worry about. ~/.config is used by gtk+,  
> but it's a default location, so I can't think of a good reason why  
> you'd need XDG to find it unless your app needs dbus.
>   

It's very puzzling... I thought I had a clean environment at the time of 
building GTK+, but perhaps I didn't, after all.

What is strange is that my GUI loads and displays and looks more or less 
functional, with only problem, AFAICT being that gtk_image_set_from_file 
fails with a message 'couldn't recognise the file format'. Weird.

Cheers
JP




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]