diff options
| author | Victor Kareh <[email protected]> | 2026-09-02 15:45:45 -0400 |
|---|---|---|
| committer | Luke from DC <[email protected]> | 2026-09-02 20:33:51 +0000 |
| commit | 786de5a1b127b0496b52655851f58bf85b911402 (patch) | |
| tree | 9c2a84b994da8a4498ff01be6138519d574c4e72 /Mozo/MenuEditor.py | |
| parent | 129b1e13bff0d1430bcc8c3fb56b49081de59f0f (diff) | |
| download | mozo-master.tar.bz2 mozo-master.tar.xz | |
This changes mozo to look up desktop entries through Gio directly
instead of the mate-menus binding, so mozo works regardless of the
installed mate-menus version.
Fixes #97
Fixes #105
Diffstat (limited to 'Mozo/MenuEditor.py')
| -rw-r--r-- | Mozo/MenuEditor.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 892fab1..875a587 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -24,7 +24,7 @@ import xml.parsers.expat import locale import gi gi.require_version('MateMenu', '2.0') -from gi.repository import MateMenu, GLib +from gi.repository import MateMenu, GLib, Gio from Mozo import util class Menu: @@ -371,8 +371,8 @@ class MenuEditor(object): def editItem(self, item, icon, name, comment, command, use_term, parent=None, final=True): #if nothing changed don't make a user copy - app_info = item.get_app_info() - if icon == app_info.get_icon() and name == app_info.get_display_name() and comment == item.get_comment() and command == item.get_exec() and use_term == item.get_launch_in_terminal(): + app_info = Gio.DesktopAppInfo.new(item.get_desktop_file_id()) + if app_info is not None and icon == app_info.get_icon() and name == app_info.get_display_name() and comment == item.get_comment() and command == item.get_exec() and use_term == item.get_launch_in_terminal(): return #hack, item.get_parent() seems to fail a lot if not parent: @@ -577,7 +577,9 @@ class MenuEditor(object): def __isVisible(self, item): if isinstance(item, MateMenu.TreeEntry): - app_info = item.get_app_info() + app_info = Gio.DesktopAppInfo.new(item.get_desktop_file_id()) + if app_info is None: + return not item.get_is_excluded() return not (item.get_is_excluded() or app_info.get_nodisplay()) menu = self.__getMenu(item) if menu == self.applications: |
