How to add a menuitem in nautilus context menu.

xiaoxiao2021-03-06  69

1. In src / file-manager / directory, add command section and meuts, add commiLUS-DIRECTORY-View-UI.XML. ... ... .... ... < Menuitem name = "name convert" verb = "name control" /> ... ... 2. in fm-directory-view.c: #define fm_directory_view_command_name_convert "/ commands / name convert" In real_merge_menus () function, BonoboUIVerb verbs [] array, add the following item:. BONOBO_UI_VERB ( "Name Convert", name_convert_callback), You could use nautilus_bonobo_set_sensitive () or nautilus_bonobo_hidden () to show or hide this menuitem.3 How to launch the Corresponding Program in Callback Function: gnomevfsmimeApplication * test; test = g_new0 (gnomevfsmimeapplication, 1); test-> id = g_strdup ("test"); t est-> name = g_strdup ( "this is a test"); test-> command = g_strdup ( "test"); test-> expects_uris = GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS; file = NAUTILUS_FILE (selection-> data); nautilus_launch_application (test, file, NULL); g_free (test-> id); g_free (test-> name); g_free (test-> name); g_free (test); You could use gnome_vfs-get_local_path_from_uri (nautilus_file_get_uri (file)) to get the actuall file name .

转载请注明原文地址:https://www.9cbs.com/read-87574.html

New Post(0)