summaryrefslogtreecommitdiff
path: root/Mozo
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-09-02 15:45:45 -0400
committerLuke from DC <[email protected]>2026-09-02 20:33:51 +0000
commit786de5a1b127b0496b52655851f58bf85b911402 (patch)
tree9c2a84b994da8a4498ff01be6138519d574c4e72 /Mozo
parent129b1e13bff0d1430bcc8c3fb56b49081de59f0f (diff)
downloadmozo-master.tar.bz2
mozo-master.tar.xz
Use Gio instead of typelibHEADmaster
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')
-rw-r--r--Mozo/MainWindow.py6
-rw-r--r--Mozo/MenuEditor.py10
-rw-r--r--Mozo/util.py6
3 files changed, 13 insertions, 9 deletions
diff --git a/Mozo/MainWindow.py b/Mozo/MainWindow.py
index f135a0e..7a1dfdc 100644
--- a/Mozo/MainWindow.py
+++ b/Mozo/MainWindow.py
@@ -263,10 +263,12 @@ class MainWindow:
if isinstance(item, MateMenu.TreeSeparator):
name = '---'
elif isinstance(item, MateMenu.TreeEntry):
+ app_info = Gio.DesktopAppInfo.new(item.get_desktop_file_id())
+ display_name = app_info.get_display_name() if app_info else item.get_desktop_file_id()
if show:
- name = html.escape(item.get_app_info().get_display_name())
+ name = html.escape(display_name)
else:
- name = '<small><i>' + html.escape(item.get_app_info().get_display_name()) + '</i></small>'
+ name = '<small><i>' + html.escape(display_name) + '</i></small>'
else:
if show:
name = html.escape(item.get_name())
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:
diff --git a/Mozo/util.py b/Mozo/util.py
index a9bde70..d01df2f 100644
--- a/Mozo/util.py
+++ b/Mozo/util.py
@@ -24,7 +24,7 @@ import gi
gi.require_version('Gtk', '3.0')
gi.require_version('MateMenu', '2.0')
from collections.abc import Sequence
-from gi.repository import GLib, Gtk, Gdk, GdkPixbuf
+from gi.repository import GLib, Gtk, Gdk, GdkPixbuf, Gio
from gi.repository import MateMenu
DESKTOP_GROUP = GLib.KEY_FILE_DESKTOP_GROUP
@@ -149,8 +149,8 @@ def getIcon(item):
if isinstance(item, MateMenu.TreeDirectory):
gicon = item.get_icon()
elif isinstance(item, MateMenu.TreeEntry):
- app_info = item.get_app_info()
- gicon = app_info.get_icon()
+ app_info = Gio.DesktopAppInfo.new(item.get_desktop_file_id())
+ gicon = app_info.get_icon() if app_info else None
elif isinstance(item, str):
iconName = item
if iconName and not '/' in iconName and iconName[-3:] in ('png', 'svg', 'xpm'):