Skip to content

Commit 9ac9bcb

Browse files
committed
Simplified the as_root functionality
1 parent a84146b commit 9ac9bcb

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

qui/tray/domains.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,6 @@ async def perform_action(self):
293293
class RunTerminalItem(VMActionMenuItem):
294294
"""Run Terminal menu Item. When activated runs a terminal emulator."""
295295

296-
__gsignals__ = {
297-
"set-terminal-user-root": (
298-
GObject.SignalFlags.RUN_FIRST,
299-
GObject.TYPE_NONE,
300-
(bool,),
301-
),
302-
}
303-
304296
def __init__(self, vm, icon_cache, as_root=False):
305297
label = Gtk.Label(label=RunTerminalItem.dynamic_label(as_root))
306298
super().__init__(
@@ -311,17 +303,16 @@ def __init__(self, vm, icon_cache, as_root=False):
311303
)
312304
self.as_root = as_root
313305
self.label = label
314-
self.connect("set-terminal-user-root", self.set_as_root)
315306

316307
@staticmethod
317308
def dynamic_label(as_root):
318309
if as_root:
319310
return _("Run Root Terminal")
320311
return _("Run Terminal")
321312

322-
def set_as_root(self, _item, as_root):
313+
def set_as_root(self, as_root):
323314
self.as_root = as_root
324-
self.label.set_text(RunTerminalItem.dynamic_label(as_root))
315+
self.label.set_text(RunTerminalItem.dynamic_label(self.as_root))
325316

326317
async def perform_action(self):
327318
service_args = {}
@@ -1117,10 +1108,8 @@ def terminal_as_root(self, as_root):
11171108
continue
11181109

11191110
def do_emit(child):
1120-
try:
1121-
child.emit("set-terminal-user-root", as_root)
1122-
except Exception: # pylint: disable=broad-except
1123-
pass
1111+
if isinstance(child, RunTerminalItem):
1112+
child.set_as_root(as_root)
11241113

11251114
submenu.foreach(do_emit)
11261115

0 commit comments

Comments
 (0)