commit gui to enable/disable dbus on the fly
This commit is contained in:
parent
c092189373
commit
e9696514e6
|
@ -84,11 +84,8 @@ def gtk_quit():
|
|||
|
||||
argv_len = len(sys.argv)
|
||||
|
||||
if argv_len < 2:
|
||||
send_error('Usage: ' + sys.argv[0] + ' command [arguments]')
|
||||
|
||||
if sys.argv[1] not in commands:
|
||||
send_error(compose_help())
|
||||
if argv_len < 2 or sys.argv[1] not in commands: # no args or bad args
|
||||
end_error(compose_help())
|
||||
|
||||
command = sys.argv[1]
|
||||
|
||||
|
|
|
@ -365,15 +365,20 @@ class PreferencesWindow:
|
|||
st = gajim.config.get('log_notif_in_sep_file')
|
||||
self.xml.get_widget('log_in_extern_checkbutton').set_active(st)
|
||||
|
||||
# don't send os info
|
||||
# send os info
|
||||
st = gajim.config.get('send_os_info')
|
||||
self.xml.get_widget('send_os_info_checkbutton').set_active(st)
|
||||
|
||||
# don't check for new version
|
||||
# check for new version
|
||||
st = gajim.config.get('check_for_new_version')
|
||||
btn = self.xml.get_widget('check_for_new_version_checkbutton')
|
||||
btn.set_active(st)
|
||||
|
||||
# use dbus
|
||||
st = gajim.config.get('use_dbus')
|
||||
btn = self.xml.get_widget('enable_dbus_checkbutton')
|
||||
btn.set_active(st)
|
||||
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
self.sound_tree.get_model().connect('row-changed',
|
||||
|
@ -790,6 +795,17 @@ class PreferencesWindow:
|
|||
gajim.config.set('check_for_new_version', widget.get_active())
|
||||
self.plugin.save_config()
|
||||
|
||||
def on_enable_dbus_checkbutton_toggled(self, widget):
|
||||
isactive = widget.get_active()
|
||||
gajim.config.set('use_dbus', isactive)
|
||||
self.plugin.save_config()
|
||||
if isactive:
|
||||
if self.plugin.remote is None:
|
||||
self.plugin.enable_dbus()
|
||||
else:
|
||||
if self.plugin.remote is not None:
|
||||
self.plugin.disable_dbus()
|
||||
|
||||
def fill_msg_treeview(self):
|
||||
self.xml.get_widget('delete_msg_button').set_sensitive(False)
|
||||
model = self.msg_tree.get_model()
|
||||
|
|
14
src/gajim.py
14
src/gajim.py
|
@ -823,6 +823,15 @@ class Interface:
|
|||
def save_config(self):
|
||||
parser.write()
|
||||
|
||||
def enable_dbus(self):
|
||||
import remote_control
|
||||
self.remote = remote_control.Remote(self)
|
||||
|
||||
def disable_dbus(self):
|
||||
if self.remote: # FIXME: A handler is already registered for the path starting with path[0] = "org"
|
||||
del (self.remote)
|
||||
self.remote = None
|
||||
|
||||
def __init__(self):
|
||||
self.default_values = {
|
||||
'inmsgcolor': gajim.config.get('inmsgcolor'),
|
||||
|
@ -886,10 +895,9 @@ class Interface:
|
|||
|
||||
self.roster = roster_window.RosterWindow(self)
|
||||
if gajim.config.get('use_dbus'):
|
||||
import remote_control
|
||||
self.remote = remote_control.Remote(self)
|
||||
self.enable_dbus()
|
||||
else:
|
||||
self.remote = None
|
||||
self.disable_dbus()
|
||||
|
||||
path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png')
|
||||
pix = gtk.gdk.pixbuf_new_from_file(path_to_file)
|
||||
|
|
|
@ -5531,6 +5531,27 @@ Custom</property>
|
|||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="enable_dbus_checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">If checked, Gajim can be controlled by other programs that support DBus</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable DBus capabilities</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_enable_dbus_checkbutton_toggled" last_modification_time="Sun, 17 Jul 2005 22:44:29 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue