Welcome to TalkGraphics.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    Prague, Czech Republic
    Posts
    231

    Default Thumbnails for Xar files in Gnome

    Edit: Wrong forum, Xtreme for Linux suits better... my mistake :/

    Xara Xtreme for Linux is great tool but there are no previews of xar files anywhere. Its real pain if you're used to thumbnails in Windows Explorer and preview integrated into Xtremes open dialog. I couldn't stand it anymore, here's quick solution for Gnome (and Nautilus file manager)

    It's python script using gif2png tool for conversions, make sure you have both of these installed.
    First create the script file:
    Code:
    sudo gedit /usr/bin/xar-thumbnailer
    ... and put following code inside
    Code:
    #!/usr/bin/python
    
    import sys
    import struct
    import os
    import gnomevfs
    
    inputFile = gnomevfs.get_local_path_from_uri(sys.argv[1])
    xar = open( inputFile,"rb")
    xar.seek(12,0) # skip ID and TAG_FILEHEADER
    fhSize = xar.read(4) # read Fileheader size
    fhSize = struct.unpack("=I",fhSize)[0]
    xar.seek(fhSize,1) # skip Fileheader
    tag = struct.unpack("=I",xar.read(4))[0]
    if tag == 61: # 61 == TAG_PREVIEWBITMAP_GIF
    	prevSize = xar.read(4) # read preview size
    	prevSize = struct.unpack("=I",prevSize)[0]
    	os.system("dd if="+inputFile+" bs=1 count="+str(prevSize)+" skip="+str(xar.tell())+"| gif2png -f > "+sys.argv[2]);
    
    xar.close()
    Make it executable:
    Code:
    sudo chmod +x /usr/bin/xar-thumbnailer
    Script is ready now we need schema file to register the thumbnailer with gnome.
    Create schema file:
    Code:
    sudo gedit /usr/share/gconf/schemas/xar.schemas
    Fill it with following:
    Code:
    <gconfschemafile>
        <schemalist>
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@xara/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@xara/enable</applyto>
                <owner>xar-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@xara/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@xara/command</applyto>
                <owner>xar-thumb</owner>
                <type>string</type>
                <default>/usr/bin/xar-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
        </schemalist>
    </gconfschemafile>
    Note that this expects xar files to be associated with mime type application@xara, I don't know what mime type gnome automaticaly assigns to xar files so you may need to change application@xara to something else in this file or change mimetype of your xar files to application@xara to make this work.

    Install schema:
    Code:
    gconftool-2 --install-schema-file /usr/share/gconf/schemas/xar.schemas
    Now restart nautilus or restrat gnome.
    Code:
    killall -9 nautilus
    IP

  2. #2

    Default Re: Thumbnails for Xar files in Gnome

    Quote Originally Posted by Suvek View Post
    Edit: Wrong forum, Xtreme for Linux suits better... my mistake :/]
    I moved your thread Suvek.
    IP

  3. #3

    Default Re: Thumbnails for Xar files in Gnome

    Cool! Good job
    IP

  4. #4
    Join Date
    Aug 2007
    Location
    Right here......
    Posts
    1,568

    Default Re: Thumbnails for Xar files in Gnome

    Suvek, any idea if this could be worked to KDE for konqueror? or even dolphine?

    I use quite a few Gnome apps n scripts on KDE so... I wonder.....

    Nice job by the way.
    IP

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •