1
# -*- coding: utf-8; -*-
3
Copyright (C) 2007-2013 Guake authors
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as
7
published by the Free Software Foundation; either version 2 of the
8
License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
General Public License for more details.
15
You should have received a copy of the GNU General Public
16
License along with this program; if not, write to the
17
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301 USA
23
dbus.glib.threads_init()
25
DBUS_PATH = '/org/guake/RemoteControl'
26
DBUS_NAME = 'org.guake.RemoteControl'
29
class DbusManager(dbus.service.Object):
31
def __init__(self, guakeinstance):
32
self.guake = guakeinstance
33
self.bus = dbus.SessionBus()
34
bus_name = dbus.service.BusName(DBUS_NAME, bus=self.bus)
35
super(DbusManager, self).__init__(bus_name, DBUS_PATH)
37
@dbus.service.method(DBUS_NAME)
39
self.guake.show_hide()
41
@dbus.service.method(DBUS_NAME)
44
self.guake.set_terminal_focus()
46
@dbus.service.method(DBUS_NAME)
50
@dbus.service.method(DBUS_NAME, in_signature='s')
51
def add_tab(self, directory=''):
52
self.guake.add_tab(directory)
54
@dbus.service.method(DBUS_NAME, in_signature='i')
55
def select_tab(self, tab_index=0):
56
self.guake.select_tab(int(tab_index))
58
@dbus.service.method(DBUS_NAME, out_signature='i')
59
def get_selected_tab(self):
60
return self.guake.get_selected_tab()
62
@dbus.service.method(DBUS_NAME, out_signature='i')
63
def get_tab_count(self):
64
return len(self.guake.term_list)
66
@dbus.service.method(DBUS_NAME, in_signature='s')
67
def set_bgcolor(self, bgcolor):
68
self.guake.set_bgcolor(bgcolor)
70
@dbus.service.method(DBUS_NAME, in_signature='s')
71
def set_fgcolor(self, fgcolor):
72
self.guake.set_fgcolor(fgcolor)
74
@dbus.service.method(DBUS_NAME, in_signature='s')
75
def execute_command(self, command):
76
self.guake.execute_command(command)
78
@dbus.service.method(DBUS_NAME, in_signature='i', out_signature='s')
79
def get_tab_name(self, tab_index=0):
80
return self.guake.term_list[int(tab_index)].get_window_title() or ''
82
@dbus.service.method(DBUS_NAME, in_signature='is')
83
def rename_tab(self, tab_index, new_text):
84
self.guake.rename_tab(tab_index, new_text)
86
@dbus.service.method(DBUS_NAME, in_signature='s')
87
def rename_current_tab(self, new_text):
88
self.guake.rename_current_tab(new_text)
90
@dbus.service.method(DBUS_NAME)
92
self.guake.show_about()
94
@dbus.service.method(DBUS_NAME)
96
self.guake.show_prefs()
98
@dbus.service.method(DBUS_NAME)