![]() |
![]() |
![]() |
Libfm Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define FM_MODULE_gtk_menu_mime_VERSION FmFileMenu; struct FmFileMenuMimeAddonInit; void (*FmFileMenuUpdatePopup) (GtkWindow *window
,GtkUIManager *ui
,GString *xml
,GtkActionGroup *act_grp
,FmFileMenu *menu
,FmFileInfoList *files
,gboolean single_file
); void fm_file_menu_destroy (FmFileMenu *menu
); GtkActionGroup * fm_file_menu_get_action_group (FmFileMenu *menu
); FmFileInfoList * fm_file_menu_get_file_info_list (FmFileMenu *menu
); GtkMenu * fm_file_menu_get_menu (FmFileMenu *menu
); GtkUIManager * fm_file_menu_get_ui (FmFileMenu *menu
); gboolean fm_file_menu_is_single_file_type (FmFileMenu *menu
); FmFileMenu * fm_file_menu_new_for_file (GtkWindow *parent
,FmFileInfo *fi
,FmPath *cwd
,gboolean auto_destroy
); FmFileMenu * fm_file_menu_new_for_files (GtkWindow *parent
,FmFileInfoList *files
,FmPath *cwd
,gboolean auto_destroy
); void fm_file_menu_set_folder_func (FmFileMenu *menu
,FmLaunchFolderFunc func
,gpointer user_data
); extern FmFileMenuMimeAddonInit fm_module_init_gtk_menu_mime;
include
: libfm/fm-gtk.h
The FmFileMenu can be used to create context menu on some file(s).
The menu consists of items:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
Open <placeholder name='ph1'/> ------------------------ <placeholder name='ph2'/> ------------------------ AddBookmark <placeholder name='SendToCategory'/> ------------------------ Cut Copy Paste Del CopyPath <placeholder name='MoveCategory'/> ------------------------ Rename ------------------------ <placeholder name='ph3'/> ------------------------ Prop |
You can modity the menu replacing placeholders. Note that internally the menu constructor also puts some conditional elements into those placeholders:
ph2: 'OpenWith' list+selector (optionally in submenu 'OpenWithMenu');
SendToCategory: elements of category 'Send To': 'Compress' if there is archiver defined; 'Extract' if this is an archive
MoveCategory: 'Hide' or 'Unhide' if the attribute is changeable.
Element 'AddBookmark' is visible only if menu is created for one directory. Element 'Rename' is hidden if menu is created for more than one file or if that file cannot be renamed. Element 'Paste' is visible only if menu is created for one directory and that directory is writable.
struct FmFileMenuMimeAddonInit { void (*init)(void); void (*finalize)(void); FmFileMenuUpdatePopup update_file_menu_for_mime_type; };
The init
and finalize
callbacks are called on application start and exit.
The update_file_menu_for_mime_type
callback will be called each time
context menu is created for files that have the same context type.
This structure is used for "gtk_menu_mime" module initialization. The key for module of this type is content type (MIME name) to support. No wildcards are supported.
callback for plugin initialization. [allow-none] | |
callback to free resources allocated by init . [allow-none]
|
|
FmFileMenuUpdatePopup |
callback to update selection context menu. [allow-none] |
Since 1.2.0
void (*FmFileMenuUpdatePopup) (GtkWindow *window
,GtkUIManager *ui
,GString *xml
,GtkActionGroup *act_grp
,FmFileMenu *menu
,FmFileInfoList *files
,gboolean single_file
);
The callback to update popup menu. It can disable items of menu, add some new, replace actions, etc. depending of the window and files.
|
the parent window for popup |
|
the object to add interface |
|
container where callback should append XML definition |
|
group of actions to add action |
|
the menu descriptor |
|
list of files for current popup menu |
|
TRUE is menu was created for single file |
void fm_file_menu_destroy (FmFileMenu *menu
);
Destroys menu object.
|
a menu |
Since 0.1.0
GtkActionGroup * fm_file_menu_get_action_group (FmFileMenu *menu
);
Retrieves action group for menu
. Returned data are owned by
menu
and should be not freed by caller.
|
a menu |
Returns : |
the action group. [transfer none] |
Since 0.1.0
FmFileInfoList * fm_file_menu_get_file_info_list (FmFileMenu *menu
);
Retrieves list of files menu
was created for. Returned data are owned
by menu
and should be not freed by caller.
|
a menu |
Returns : |
list of files. [transfer none] |
Since 0.1.0
GtkMenu * fm_file_menu_get_menu (FmFileMenu *menu
);
Retrieves GtkMenu widget built with GtkUIManager. Returned data are
owned by menu
and should be not freed by caller.
|
a menu |
Returns : |
created GtkMenu widget. [transfer none] |
Since 0.1.0
GtkUIManager * fm_file_menu_get_ui (FmFileMenu *menu
);
Retrieves UI manager object for menu
. Returned data are owned by
menu
and should be not freed by caller.
|
a menu |
Returns : |
UI manager. [transfer none] |
Since 0.1.0
gboolean fm_file_menu_is_single_file_type (FmFileMenu *menu
);
Checks if menu
was created for files of the same type.
|
a menu |
Returns : |
TRUE if menu is single-type. |
Since 0.1.0
FmFileMenu * fm_file_menu_new_for_file (GtkWindow *parent
,FmFileInfo *fi
,FmPath *cwd
,gboolean auto_destroy
);
Creates new menu for the file.
|
window to place menu over |
|
target file |
|
working directory |
|
TRUE if manu should be destroyed after some action was activated |
Returns : |
a new FmFileMenu object. |
Since 0.1.0
FmFileMenu * fm_file_menu_new_for_files (GtkWindow *parent
,FmFileInfoList *files
,FmPath *cwd
,gboolean auto_destroy
);
Creates new menu for some files list.
|
window to place menu over |
|
target files |
|
working directory |
|
TRUE if manu should be destroyed after some action was activated |
Returns : |
a new FmFileMenu object. |
Since 0.1.0
void fm_file_menu_set_folder_func (FmFileMenu *menu
,FmLaunchFolderFunc func
,gpointer user_data
);
Sets up function to open folders for menu
. Function will be called
if action 'Open' was activated for some folder.
|
a menu |
|
function to open folder |
|
data supplied for func
|
Since 0.1.0