Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2007-03-31 12:11:25 +0400
committerYann Leboulanger <asterix@lagaule.org>2007-03-31 12:11:25 +0400
commita26d9c028a5a02260a2021f30e2abfe0fbe9d349 (patch)
tree281d7558be8d6c7a7657bb8aed5b9a91383d6bd8
parent6ab511eee246cfa3c512d052a999c1f16fc06dfc (diff)
make mood dialog not use blocking run() function
-rw-r--r--data/glade/change_mood_dialog.glade2
-rw-r--r--src/dialogs.py28
-rw-r--r--src/roster_window.py12
3 files changed, 21 insertions, 21 deletions
diff --git a/data/glade/change_mood_dialog.glade b/data/glade/change_mood_dialog.glade
index 4294d0197..94f632e02 100644
--- a/data/glade/change_mood_dialog.glade
+++ b/data/glade/change_mood_dialog.glade
@@ -44,6 +44,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
+ <signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Sat, 31 Mar 2007 07:58:52 GMT"/>
</widget>
</child>
@@ -58,6 +59,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
+ <signal name="clicked" handler="on_ok_button_clicked" last_modification_time="Sat, 31 Mar 2007 07:57:55 GMT"/>
</widget>
</child>
</widget>
diff --git a/src/dialogs.py b/src/dialogs.py
index 30d7517cf..7cf14666d 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -308,8 +308,9 @@ class ChooseGPGKeyDialog:
class ChangeMoodDialog:
- def __init__(self):
- self.moods = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cold', 'confused', 'contented', 'cranky', 'curious', 'depressed', 'disappointed', 'disgusted', 'distracted', 'embarrassed', 'excited', 'flirtatious', 'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled', 'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', 'indignant', 'interested', 'intoxicated', 'invincible', 'jealous', 'lonely', 'mean', 'moody', 'nervous', 'neutral', 'offended', 'playful', 'proud', 'relieved', 'remorseful', 'restless', 'sad', 'sarcastic', 'serious', 'shocked', 'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried', ]
+ moods = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cold', 'confused', 'contented', 'cranky', 'curious', 'depressed', 'disappointed', 'disgusted', 'distracted', 'embarrassed', 'excited', 'flirtatious', 'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled', 'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', 'indignant', 'interested', 'intoxicated', 'invincible', 'jealous', 'lonely', 'mean', 'moody', 'nervous', 'neutral', 'offended', 'playful', 'proud', 'relieved', 'remorseful', 'restless', 'sad', 'sarcastic', 'serious', 'shocked', 'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried', ]
+ def __init__(self, account):
+ self.account = account
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
self.window = self.xml.get_widget('change_mood_dialog')
self.window.set_transient_for(gajim.interface.roster.window)
@@ -327,22 +328,23 @@ class ChangeMoodDialog:
cellrenderertext = gtk.CellRendererText()
self.combo.pack_start(cellrenderertext, True)
self.combo.add_attribute(cellrenderertext, 'text', 0)
+ self.xml.signal_autoconnect(self)
+ self.window.show_all()
- message_entry = self.xml.get_widget('entry')
-# self.message_buffer = message_entry.get_buffer()
-
- def run(self):
- '''Wait for OK or Cancel button to be pressed and return mood
- and messsage (None if users pressed Cancel or x button of WM'''
- rep = self.window.run()
+ def on_ok_button_clicked(self, widget):
+ '''Return mood and messsage (None if no mood selected)'''
mood = None
message = None
- if rep == gtk.RESPONSE_OK:
- mood = self.liststore[self.combo.get_active()][0].decode('utf-8')
+ active = self.combo.get_active()
+ if active > -1:
+ mood = self.liststore[active][0].decode('utf-8')
message = self.entry.get_text().decode('utf-8')
- self.window.destroy()
- return (mood, message)
+ from common import pep
+ pep.user_send_mood(self.account, mood, message)
+ self.window.destroy()
+ def on_cancel_button_clicked(self, widget):
+ self.window.destroy()
class ChangeStatusMessageDialog:
def __init__(self, show = None):
diff --git a/src/roster_window.py b/src/roster_window.py
index a682a93c0..8af767a64 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -39,7 +39,6 @@ from common import helpers
from common import passwords
from common.exceptions import GajimGeneralException
from common import i18n
-from common import pep
from message_window import MessageWindowMgr
from chat_control import ChatControl
@@ -2270,10 +2269,10 @@ class RosterWindow:
helpers.launch_browser_mailer('url', url)
def on_change_mood_activate(self, widget, account):
- dlg = dialogs.ChangeMoodDialog()
- (mood, message) = dlg.run()
- if mood is not None: # None is if user pressed Cancel
- self.send_mood(account, mood, message)
+ dlg = dialogs.ChangeMoodDialog(account)
+# (mood, message) = dlg.run()
+# if mood is not None: # None is if user pressed Cancel
+# self.send_mood(account, mood, message)
def on_change_status_message_activate(self, widget, account):
show = gajim.SHOW_LIST[gajim.connections[account].connected]
@@ -2740,9 +2739,6 @@ class RosterWindow:
if gajim.interface.systray_enabled:
gajim.interface.systray.change_status('connecting')
- def send_mood(self, account, mood, message):
- pep.user_send_mood(account, mood, message)
-
def send_status(self, account, status, txt, auto = False):
model = self.tree.get_model()
accountIter = self.get_account_iter(account)