Get files in my own file format for its own dynamic icon

0 votes
The file format of my application is very similar to the OpenDocument file format, i.e. zipped with a manifest file, a thumbnail image, etc. (check - http://en.wikipedia.org/wiki/OpenDocument). Now, in both Windows and Linux, the OpenOffice files have a preview image of the Open Office file as their icons. Can the same be done for my files, i.e. a dynamic icon based on the internal thumbnail.png? Plus, some info or links to how OpenOffice does their IconHandler stuff would be very helpful as it is similar to that of my app. TIA!
Jan 8 in Others by Bharani
• 4,550 points
20 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Regarding MAC support, "The Mac and Windows operating systems have different methods of enabling this type of thumbnail, and in the case of the Mac OS, this support has been inconsistent from version to version so it hasn't been pursued [for Adobe InDesign]."

Windows

An Icon Handler is what you are looking for. It is also known as a Thumbnail Handler. Check out this sample example written as an active x control. Also, look up Property Handlers, which points to the latest and the best way of having dynamic metadata handled properly in windows.

Now, you won't be needing such dynamic solutions if you just want an icon to be associated with all your files. So, use them only when you'd want windows explorer to display an icon based on the file's content and not just the extension. That means when the file changes, the icon is also updated to reflect those changes. But, it doesn't necessarily have to be an image of that file itself as the thumbnail handler can generate any image based on what's in the file.

Since the property handler updates other metadata such as audio or video length, you can use all the metadata that Windows Explorer supports.

OS X

The Launch Services Database determines the icons for Mac OSX. But, it refers to a static icon file for all files handled by a registered application. So, it's not based on the extension. Rather, each file has attached metadata to determine its respective application. Although, extensions do help when no metadata exists, like when getting the file from a different OS or file system. The dynamic icon functionality in OSX seems to be provided by Finder.

Gnome

You can use a thumbnailer for Gnome. It's a very simple program, which has 3 command line arguments:

  • input file name, the file you are describing with the thumbnail (or URI if you're accepting those instead)
  • output file name, where you need to write the PNG
  • size in pixels, a number that describes the maximum square image size you should produce (128 --> 128x128 or smaller)

In contrast to all the difficult to implement plugins on other systems, this system is simpler but doesn't support animation and a few other features.

KDE

Konqueror is the file manager here and displays the icons. So, it supports dynamic icons for some inbuilt types, but I can't say if they are hardcoded or are  just plugins that you can write. Read: Embedded Components Tutorial for more info.
Also, there's this new or upcoming feature called Plasma that deals with icons and icon functionality. Here's the announcment.
You might have to dig into the source of Konqueror to underdstand how they did it for text files and other files that are already implemented.

answered Jan 8 by DataKing99
• 8,100 points

Related Questions In Others

0 votes
1 answer

Change the permission for a file created by me in linux

If you are the system administrator or ...READ MORE

answered Mar 8 in Others by Nabarupa
33 views
0 votes
1 answer
0 votes
1 answer

How to get the URL of the current tab in Google Chrome?

There are different ways of doing this:- You ...READ MORE

answered Dec 21, 2018 in Others by Nabarupa
55 views
0 votes
1 answer
0 votes
1 answer

In Python, how do I read a file line-by-line into a list?

with open(fname) as f:     content = f.readlines() # you ...READ MORE

answered Oct 9, 2018 in Python by SDeb
• 11,100 points
79 views
0 votes
1 answer

When to use file vs open in Python?

File() has been removed since Python 3.0 ...READ MORE

answered Oct 30, 2018 in Python by SDeb
• 11,100 points
21 views
0 votes
1 answer

How to write to CSV line by line in python

The simple way of doing this will ...READ MORE

answered Nov 15, 2018 in Python by findingbugs
• 3,140 points
114 views
0 votes
1 answer

Open file in Python

There is this code I used for ...READ MORE

answered Nov 16, 2018 in Python by Jino
• 5,520 points
21 views
0 votes
1 answer

Reducing sequences in an array of strings

I've written a C# app to solves ...READ MORE

answered Nov 2, 2018 in Others by DataKing99
• 8,100 points
36 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.