Commit 80c42099 authored by Dicson's avatar Dicson

roster_tweaks. Added ability to quickly change the status message to all connected accounts.

parent f4200481
......@@ -39,6 +39,20 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="quick_status">
<property name="label" translatable="yes">Show quick-change status field</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_quick_status_toggled"/>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
......
[info]
name: Roster Tweaks
short_name: roster_tweaks
version: 0.2
version: 0.3
description: Allows user to tweak roster window appearance (eg. make it compact).
Based on ticket #3340:
http://trac.gajim.org/ticket/3340.
Added ability to quickly change the status message to all connected accounts.
authors = Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki
......@@ -16,13 +16,23 @@ class RosterTweaksPlugin(GajimPlugin):
self.config_default_values = {'hide_status_combo': (False,''),
'use_ctr_m': (False,''),
'menu_visible': (True,'')}
'menu_visible': (True,''),
'quick_status': (False, '')}
@log_calls('RosterTweaksPlugin')
def activate(self):
gajim.interface.roster.status_combobox.set_property('visible',
not self.config['hide_status_combo'])
gajim.interface.roster.status_combobox.set_no_show_all(True)
self.enable_ctrl_m()
vbox = gajim.interface.roster.xml.get_object('roster_vbox2')
self.status_widget = gtk.Entry(max=0)
self.status_widget.set_property('visible', self.config['quick_status'])
self.status_widget.connect('key-press-event', self.status_changed)
vbox.pack_start(self.status_widget, False)
def enable_ctrl_m(self):
if self.config['use_ctr_m']:
window = gajim.interface.roster.window
self.accel_group = gtk.accel_groups_from_object(window)[0]
......@@ -48,6 +58,18 @@ class RosterTweaksPlugin(GajimPlugin):
self.config['menu_visible'] = not self.config['menu_visible']
return True
def status_changed(self, widget, event):
if event.keyval == gtk.keysyms.Return or \
event.keyval == gtk.keysyms.KP_Enter:
accounts = gajim.connections.keys()
message = widget.get_text()
for account in accounts:
current_show = gajim.SHOW_LIST[
gajim.connections[account].connected]
gajim.interface.roster.send_status(account, current_show,
message)
widget.set_text('')
class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
......@@ -67,17 +89,23 @@ class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def on_run(self):
self.hide_combo.set_active(self.plugin.config['hide_status_combo'])
self.use_ctr_m.set_active(self.plugin.config['use_ctr_m'])
status_widget = self.xml.get_object('quick_status')
status_widget.set_active(self.plugin.config['quick_status'])
def on_hide_combo_toggled(self, button):
self.plugin.config['hide_status_combo'] = button.get_active()
gajim.interface.roster.status_combobox.set_property('visible',
not self.plugin.config['hide_status_combo'])
def on_quick_status_toggled(self, button):
self.plugin.config['quick_status'] = button.get_active()
self.plugin.status_widget.set_property('visible', button.get_active())
def on_use_ctr_m_toggled(self, button):
use_ = button.get_active()
self.plugin.config['use_ctr_m'] = use_
if use_:
self.plugin.activate()
is_ctr_m_enabled = button.get_active()
self.plugin.config['use_ctr_m'] = is_ctr_m_enabled
if is_ctr_m_enabled:
self.plugin.enable_ctrl_m()
else:
self.plugin.accel_group.disconnect_key(gtk.keysyms.m,
gtk.gdk.CONTROL_MASK)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment