This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to remove menus added with setXMLFile?

Tags: None
(comma "," separated)
Spomky
Registered Member
Posts
15
Karma
0
OS
Hi everybody.

I have a main interface with some menus et actions :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui name="fusible" version="1">
   <MenuBar>
      <Menu name="file">
         <Merge />
      </Menu>
      <Menu name="actions">
         <text>&amp;Actions</text>
         <Action name="close-selected" />
         <Action name="close-all" />
         <Separator/>
         <Merge />
      </Menu>
      <Menu name="favorites">
         <text>&amp;Favorites</text>
         <Action name="edit-favorites" />
      </Menu>
      <Menu name="view">
         <Action name="lock_docks" />
         <Separator />
         <Merge />
      </Menu>
      <Menu name="settings">
         <Action name="edit-plugins-manager" />
      </Menu>
   </MenuBar>
   <ToolBar name="mainToolBar">
      <text>Main Toolbar</text>
      <Action name="close-selected" />
      <Action name="close-all" />
      <Action name="quit" />
   </ToolBar>
</gui>


Plugins are loaded and can add other menus.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui name="fusible_plugin_encfs" version="1">
   <MenuBar>
      <Menu name="file" >
         <Menu name="open">
            <text>&amp;Open</text>
            <Action name="open-encfs" />
         </Menu>
         <Menu name="new">
            <text>&amp;New</text>
            <Action name="new-encfs" />
         </Menu>
      </Menu>
      <Menu name="actions">
         <Menu name="encfs">
            <text>&amp;EncFS</text>
            <Action name="get-encfs" />
            <Action name="pass-encfs" />
         </Menu>
      </Menu>
   </MenuBar>
</gui>


When I load my plugin, menus are correctly added and actions work perfectly.
When I unload the plugin, actions are deleted but not the menus or sub-menus even if they are empty.
For example, when I unload the previous plugin, the submenus Open and New are not deleted but are empty.

How can I delete menus and submenus if they are empty?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
KDE applications usually do not unload plugins once loaded. Also, plugins usually do not provide sub-menus, but simply add items to existing menus. This is a corner case currently.

I believe they only way to fix this would be to get the GUI "Rebuilt" by XMLGUI. While I think this is possible, I would recommend talking with the developers of XMLGUI, in #kde-devel on Freenode. They may be able to offer recommendations on how to fix this.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]