Gtk2::Ex::DesktopEntryMenu.3pm

Langue: en

Autres versions - même langue

Version: 2009-03-16 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Gtk2::Ex::DesktopEntryMenu - Generate menu items to open files

SYNOPSIS

         use Gtk2::Ex::DesktopEntryMenu style => 'auto';
 
         sub on_populate_popup {
                 # ...
                 Gtk2::Ex::DesktopEntryMenu->populate_menu($menu, $hyperlink)
                         if $hyperlink =~ m#^file://# ;
                 # ..
         }
 
 

DESCRIPTION

This module offers an ``open with'' menu and a simple editor dialog to allow users to open a file with an application that can handle it.

This is a GUI wrapper for "File::MimeInfo::Applications".

TODO: add Dialog to select application or set custom command

TODO: win32 exec code

TODO: way to force using magic

OPTIONS

There is one option which can be given with the "use" statement.

This is the style option. The style can be either ``plain'', ``menu'' or ``auto''. When not given it defaults to ``auto''. When the style is ``plain'' all items are included in the menu, when the style is ``menu'' all items are put in a ``Open With'' submenu. In the case of ``auto'' the items are put into a submenu when there are more than 4 applications.

METHODS

"populate_menu(MENU, FILE, MIMETYPE, STYLE)"
Convenience method that adds all applictions that can open this file to the menu.

MENU should be of class Gtk2::Menu. MIMETYPE is optional and FILE can either be a filename or an array reference with filenames.

STYLE can be used to override the default style.

"menuitems(FILE, MIMETYPE)"
Returns a list with Gtk2::MenuItem objects for FILE with MIMETYPE.

MIMETYPE is optional and FILE can either be a filename or an array reference with filenames.

"menuitem(ENTRY, FILE, IS_DEFAULT)"
Returns a Gtk2::MenuItem object for a File::DesktopEntry object that opens FILE when activated.

IS_DEFAULT can be used to tell that this is the default application.

"icon_pixbuf(NAME, SIZE)"
Returns a pixbuf for the application icon or undef. NAME can either be a full file name, a partial file name or just the name of something in the theme directories. SIZE is a Gtk2::IconSize name.

AUTHOR

Jaap Karssenberg (Pardus) <pardus@cpan.org>

Copyright (c) 2006 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO