Fix remotinator get_tab_title for tabs with more than a single terminal (Nix)

This commit is contained in:
Stephen Boddy 2017-02-13 15:36:55 +01:00
parent 1c0f934529
commit 8213b828c9
2 changed files with 24 additions and 4 deletions

View File

@ -11,7 +11,7 @@ from borg import Borg
from terminator import Terminator
from config import Config
from factory import Factory
from util import dbg
from util import dbg, enumerate_descendants
CONFIG = Config()
if not CONFIG['dbus']:
@ -158,7 +158,15 @@ class DBusService(Borg, dbus.service.Object):
window = terminal.get_toplevel()
root_widget = window.get_children()[0]
if maker.isinstance(root_widget, 'Notebook'):
return root_widget.uuid.urn
#return root_widget.uuid.urn
for tab_child in root_widget.get_children():
terms = [tab_child]
if not maker.isinstance(terms[0], "Terminal"):
terms = enumerate_descendants(tab_child)[1]
if terminal in terms:
# FIXME: There are no uuid's assigned to the the notebook, or the actual tabs!
# This would fail: return root_widget.uuid.urn
return ""
@dbus.service.method(BUS_NAME)
def get_tab_title(self, uuid=None):
@ -168,7 +176,12 @@ class DBusService(Borg, dbus.service.Object):
window = terminal.get_toplevel()
root_widget = window.get_children()[0]
if maker.isinstance(root_widget, "Notebook"):
return root_widget.get_tab_label(terminal).get_label()
for tab_child in root_widget.get_children():
terms = [tab_child]
if not maker.isinstance(terms[0], "Terminal"):
terms = enumerate_descendants(tab_child)[1]
if terminal in terms:
return root_widget.get_tab_label(tab_child).get_label()
def with_proxy(func):
"""Decorator function to connect to the session dbus bus"""

View File

@ -17,13 +17,20 @@
"""Terminator.util - misc utility functions"""
import sys
from gi.repository import Gtk, Gdk
import cairo
import os
import pwd
import inspect
import uuid
import subprocess
import gi
try:
gi.require_version('Gtk','3.0')
from gi.repository import Gtk, Gdk
except ImportError:
print('You need Gtk 3.0+ to run Remotinator.')
sys.exit(1)
# set this to true to enable debugging output
DEBUG = False