QuickRepliesPlugin,GuiForMePlugin.change buttons state when the status has changed

This commit is contained in:
Denis Fomin
2013-07-22 20:35:09 +04:00
parent 1e62bf7315
commit b48e4619f1
2 changed files with 8 additions and 5 deletions

View File

@@ -41,7 +41,8 @@ class GuiForMe(GajimPlugin):
for base in self.controls: for base in self.controls:
if base.chat_control != chat_control: if base.chat_control != chat_control:
continue continue
base.button.set_sensitive(chat_control.msg_textview.get_sensitive()) base.button.set_sensitive(chat_control.contact.show != 'offline' \
and gajim.connections[chat_control.account].connected > 0)
class Base(object): class Base(object):

View File

@@ -1,5 +1,6 @@
import gtk import gtk
import gtkgui_helpers import gtkgui_helpers
from common import gajim
from plugins import GajimPlugin from plugins import GajimPlugin
from plugins.gui import GajimPluginConfigDialog from plugins.gui import GajimPluginConfigDialog
@@ -37,8 +38,8 @@ class QuickRepliesPlugin(GajimPlugin):
def connect_with_chat_control(self, chat_control): def connect_with_chat_control(self, chat_control):
self.chat_control = chat_control self.chat_control = chat_control
control = Base(self, self.chat_control) base = Base(self, chat_control)
self.controls.append(control) self.controls.append(base)
@log_calls('QuickRepliesPlugin') @log_calls('QuickRepliesPlugin')
def disconnect_from_chat_control(self, chat_control): def disconnect_from_chat_control(self, chat_control):
@@ -47,12 +48,13 @@ class QuickRepliesPlugin(GajimPlugin):
control.disconnect_from_chat_control() control.disconnect_from_chat_control()
self.controls = [] self.controls = []
@log_calls('GuiForMePlugin') @log_calls('QuickRepliesPlugin')
def update_button_state(self, chat_control): def update_button_state(self, chat_control):
for base in self.controls: for base in self.controls:
if base.chat_control != chat_control: if base.chat_control != chat_control:
continue continue
base.button.set_sensitive(chat_control.msg_textview.get_sensitive()) base.button.set_sensitive(chat_control.contact.show != 'offline' \
and gajim.connections[chat_control.account].connected > 0)
class Base(object): class Base(object):