Thanks for the reply Andriy.  There must be something I'm missing.  I made
the 'content type' consistent, yet leafpad still launches my mimetype
document and my mimetype document doesn't have get it's icon.

Here are my installation steps:

1.  Copy PyGi modules.

cp Story /opt/


3. Create a shell script in /usr/bin/story with this contents:

python /opt/Story/modules/story.py $1


4. Copy this Desktop Entry:

[Desktop Entry]
Exec=story %f
Icon=story
Terminal=false
Type=Application
Categories=Office;WordProcessor;GNOME;GTK;X-Red-Hat-Base;
StartupNotify=true
MimeType=application/x-story
Name=Story
GenericName=Scriptwriter
Comment=Compose, edit, and view scripts


5.  Copy App Icon:

cp story.png /usr/share/icons


6. I open /etc/mime.types and add the following line:

application/x-story                    story


7. I create this xml file: /usr/share/mime/application/story.xml, with this
content:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
   <mime-type type="application/x-story">
     <comment>Example file type </comment>
     <magic priority="50">
       <match value="search-string" type="string" offset="10:140"/>
     </magic>
     <glob pattern="*.story"/>
   </mime-type>
</mime-info>


8.  I update mime database:

sudo update-mime-database /usr/share/mime


9.  Copy my mimetype icon:

sudo cp application-x-story.svg /usr/share/icons/gnome/scalable/mimetypes


10.  Update icon cache:

sudo gtk-update-icon-cache-3.0 /usr/share/icons/gnome/ -f


11. Update desktop database:

sudo update-desktop-database


12. Log out.  Log in.


Result:  Documents in pcmanfm with the ".story" extension do not have the
story.svg icon.  Clicking ".story" documents are opened with leafpad, not
/usr/bin/story

What can I do to make mimetypes display appropriate icons and launch the
appropriate app for the clicked on document?


On Fri, Jun 13, 2014 at 7:57 PM, Andrej N. Gritsenko <[email protected]>
wrote:

>     Hello!
>
> jordan evans has written on Friday, 13 June, at 19:18:
> >I've created a PyGi 'screenwriting/comic book scriptwriting' application
> >that creates documents with the extension ".story".  I want make it
> >installable on Lubuntu specifically.
>
> >(I will briefly tell you how I've installed my app in that really is the
> >issue.)
>
>
> >__________________________________________________________________________________
> >HOW I INSTALLED MY APP
>
> >__________________________________________________________________________________
> >(1) PyGi Modules
> >I have copied my PyGi application folder to /opt/
> >I have a bash script in /usr/bin that lauches the script and sends a
> >filePath (a story document) as the first arguement:
>
> >python /opt/Story/modules/story.py $1
>
> >(2) Desktop Entry
> >I copy a Deskop Entry file with these contents to
> /usr/share/applications/:
>
> >[Desktop Entry]
> >Exec=story %f
> >Icon=story
> >Terminal=false
> >Type=Application
> >Categories=Office;WordProcessor;GNOME;GTK;X-Red-Hat-Base;
> >StartupNotify=true
> >MimeType=application/x-story
>
> The content type here is "application/x-story".
>
> >Name=Story
> >GenericName=Scriptwriter
> >Comment=Compose, edit, and view scripts
>
> >(3) Application Icon
> >I copy my icon to /usr/share/icons
>
> >cp story.png /usr/share/icons
>
> >__________________________________________________________________________________
>
>
> >At this point I can see my desktop shortcut with it's icon.  When I click
> >on it, my application launches fine.  On the command line, if I type:
>
> >story myScreenplayDocument.story
>
> >...it does open the document fine.
>
> >Now, what I am looking are commands that I can put in an 'insallation
> >script' that will create two things:  (1)  I want a double click on a
> >pcmanfm icon that represent a ".story" file and launch the 'story' app.
> >(2)  I want all files with extension ".story" to have the icon of my
> >choice.  I've found these steps online to follow, but they don't work.
> >Where am I going wrong?
>
>
> >__________________________________________________________________________________
> >ADD MIME TYPE, FIRST TRY
>
> >__________________________________________________________________________________
> >(1) I open mime.types:
>
> >gksudo leafpad /etc/mime.types
>
> >(2)  Copy the following text at the end of the file:
>
> >text/story                    story
>
> The content type here is "text/story".
>
>
> >__________________________________________________________________________________
>
> >I save mime.types and close leafpad. I then double click a ".story" file.
> >leafpad opens it, not "story" app.  I'm assuming the above step was
> >supposed to take care of that.  So, I try a second method:
>
>
> >__________________________________________________________________________________
> >ADD MIME TYPE, SECOND TRY
>
> >__________________________________________________________________________________
> >(1) I create the following xml with these contents:
>
> ><?xml version="1.0" encoding="UTF-8"?>
> ><mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
> >   <mime-type type="application/x-story">
>
> The content type here is "application/x-story".
>
> >     <comment>Example file type </comment>
> >     <magic priority="50">
> >       <match value="search-string" type="string" offset="10:140"/>
> >     </magic>
> >     <glob pattern="*.story"/>
> >   </mime-type>
> ></mime-info>
>
> >(2)  I save it at this path:
>
> >/usr/share/mime/application/story.xml
>
> >(3)  I run this command:
>
> >sudo update-mime-database /usr/share/mime
>
> >__________________________________________________________________________________
>
> >No errors with command in step (3) above.  I try to open a ".story"
> >document.  leafpad is launched instead of 'story' app.
>
> >I log out and back in.  Still, leafpad opens it.
>
>
> >__________________________________________________________________________________
> >ADD ICON
>
> >__________________________________________________________________________________
> >(1) I create a simple black star with Inkscape, set it's width and height
> >to the star object, then export as svg with this name:
>
> >text-x-story.svg
>
> This icon assumes content type "text/x-story".
>
> >(2)  I run the following two commands:
>
> >sudo cp text-x-story.svg /usr/share/icons/gnome/scalable/mimetypes
> >sudo gtk-update-icon-cache-3.0
>
> >I get this output:
>
> >gtk-update-icon-cache-3.0: Cache file created successfully.
>
>
> >__________________________________________________________________________________
>
> >I log out and back in.  The Story Icon does not show up for the ".story"
> >extension document in pcmanfm.
>
> >What the heck is going on?
>
>     You see, you have 3 different content types there so how they supposed
> to be handled? Exactly, as 3 different ones - MIME database knows only
> "application/x-story", MIME utilities know only a "text/story", and there
> is an icon for "text/x-story". I think you should leave only one of those
> content types and it will start working for icons (and will be shown in
> the Properties dialog as well).
>
>     To register your desktop entry as a handler for certain MIME type you
> should run "update-desktop-database" command which you apparently missed.
> That will set your application as a handler to open your files (instead
> of Leafpad which used as a generic text/* handler in your case).
>
>     Cheers!
>     Andriy.
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> Pcmanfm-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pcmanfm-develop
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Pcmanfm-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pcmanfm-develop

Reply via email to