From 8137a59ca7d4ed6b355ad47ec9ee0fb013356778 Mon Sep 17 00:00:00 2001
From: Denis Fomin <fominde@gmail.com>
Date: Tue, 10 Apr 2012 00:10:36 +0400
Subject: [PATCH] roster_tweak. always show correct global status message in
 the quich-change status field.

---
 roster_tweaks/manifest.ini     |  6 ++++--
 roster_tweaks/roster_tweaks.py | 17 +++++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/roster_tweaks/manifest.ini b/roster_tweaks/manifest.ini
index 287b44dc..67acc4a2 100644
--- a/roster_tweaks/manifest.ini
+++ b/roster_tweaks/manifest.ini
@@ -1,10 +1,12 @@
 [info]
 name: Roster Tweaks
 short_name: roster_tweaks
-version: 0.5
+version: 0.6
 description: Allows user to tweak roster window appearance (eg. make it compact).
  Based on ticket #3340:
- http://trac.gajim.org/ticket/3340.
+ http://trac.gajim.org/ticket/3340
  Added ability to quickly change the status message to all connected accounts.
+ Based on ticket #5085:
+ http://trac.gajim.org/ticket/5085.
 authors = Denis Fomin <fominde@gmail.com>
 homepage = http://trac-plugins.gajim.org/wiki
diff --git a/roster_tweaks/roster_tweaks.py b/roster_tweaks/roster_tweaks.py
index 6c8c1e17..c9c57f8f 100644
--- a/roster_tweaks/roster_tweaks.py
+++ b/roster_tweaks/roster_tweaks.py
@@ -4,12 +4,11 @@ import gtk
 import pango
 import gobject
 
-from common import gajim
+from common import gajim, ged, helpers, pep
 from plugins import GajimPlugin
 from plugins.helpers import log_calls
 from plugins.gui import GajimPluginConfigDialog
 from dialogs import ChangeActivityDialog, ChangeMoodDialog
-from common import pep
 import gtkgui_helpers
 
 
@@ -21,15 +20,24 @@ class RosterTweaksPlugin(GajimPlugin):
             '(eg. make it compact).\nBased on ticket #3340:\n'
             'http://trac.gajim.org/ticket/3340.\n'
             'Added ability to quickly change the status message '
-            'to all connected accounts.')
+            'to all connected accounts.\n'
+            'Based on ticket #5085:\n'
+            'http://trac.gajim.org/ticket/5085.')
         self.config_dialog = RosterTweaksPluginConfigDialog(self)
-
         self.config_default_values = {'hide_status_combo': (False, ''),
                                       'use_ctr_m': (False, ''),
                                       'menu_visible': (True, ''),
                                       'quick_status': (False, '')}
+        self.events_handlers = {'our-show': (ged.GUI2, self.our_show)}
         self.roster = gajim.interface.roster
 
+    def our_show(self, obj):
+        if self.active:
+            if helpers.get_global_show() != gajim.SHOW_LIST[0]:
+                self.status_widget.set_text(helpers.get_global_status())
+            else:
+                self.status_widget.set_text('')
+
     @log_calls('RosterTweaksPlugin')
     def activate(self):
         self.pep_dict = {}
@@ -192,6 +200,7 @@ class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
         self.plugin.status_widget.set_property('visible', button.get_active())
         self.plugin.mood_button.set_property('visible', button.get_active())
         self.plugin.activity_button.set_property('visible', button.get_active())
+        self.plugin.status_widget.set_text(helpers.get_global_status())
 
     def on_use_ctr_m_toggled(self, button):
         is_ctr_m_enabled = button.get_active()
-- 
GitLab