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:
authorPiotr Gaczkowski <doomhammerng@gmail.com>2007-03-31 11:43:33 +0400
committerPiotr Gaczkowski <doomhammerng@gmail.com>2007-03-31 11:43:33 +0400
commit37de10d82ff1616a800f82e093cd073f1b5bc304 (patch)
tree31ba5cb9fa1eb631f301a756597475b8bf304bd5
parent4f68782ec7234d5d4a69e12790f384ff58d1cfa9 (diff)
Properish mood dialog
-rw-r--r--data/glade/change_mood_dialog.glade198
-rw-r--r--src/dialogs.py26
-rw-r--r--src/roster_window.py1
3 files changed, 33 insertions, 192 deletions
diff --git a/data/glade/change_mood_dialog.glade b/data/glade/change_mood_dialog.glade
index f8e1e6f0f..4294d0197 100644
--- a/data/glade/change_mood_dialog.glade
+++ b/data/glade/change_mood_dialog.glade
@@ -19,6 +19,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="key_press_event" handler="on_change_status_message_dialog_key_press_event" last_modification_time="Wed, 16 Mar 2005 00:53:06 GMT"/>
@@ -95,123 +96,10 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow24">
+ <widget class="GtkComboBox" id="combobox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTextView" id="message_textview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="editable">True</property>
- <property name="overwrite">False</property>
- <property name="accepts_tab">True</property>
- <property name="justification">GTK_JUSTIFY_LEFT</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="cursor_visible">True</property>
- <property name="pixels_above_lines">0</property>
- <property name="pixels_below_lines">0</property>
- <property name="pixels_inside_wrap">0</property>
- <property name="left_margin">0</property>
- <property name="right_margin">0</property>
- <property name="indent">0</property>
- <property name="text" translatable="yes"></property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox33">
- <property name="visible">False</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkButton" id="save_as_preset_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="on_save_as_preset_button_clicked" last_modification_time="Thu, 26 Jan 2006 17:31:47 GMT"/>
-
- <child>
- <widget class="GtkAlignment" id="alignment106">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox3021">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image1369">
- <property name="visible">True</property>
- <property name="stock">gtk-save-as</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label380">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Save as Preset...</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -221,83 +109,27 @@
</child>
<child>
- <widget class="GtkHBox" id="hbox3022">
- <property name="visible">False</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label165">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Preset messages:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="message_combobox">
- <property name="visible">True</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- <signal name="changed" handler="on_message_combobox_changed" last_modification_time="Tue, 07 Mar 2006 13:25:23 GMT"/>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <widget class="GtkEntry" id="entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
-
- <child>
- <widget class="GtkLabel" id="label383">
- <property name="visible">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Type your new status message&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/src/dialogs.py b/src/dialogs.py
index 1eb2f5dd0..30d7517cf 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -309,15 +309,27 @@ 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', ]
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)
self.window.set_title('Mood')
- message_textview = self.xml.get_widget('message_textview')
- self.message_buffer = message_textview.get_buffer()
- #self.message_buffer.connect('changed',
- # self.toggle_sensitiviy_of_save_as_preset)
+ self.entry = self.xml.get_widget('entry')
+
+ self.combo = self.xml.get_widget('combobox')
+ self.liststore = gtk.ListStore(str)
+ self.combo.set_model(self.liststore)
+
+ for mood in self.moods:
+ self.liststore.append((mood,))
+
+ cellrenderertext = gtk.CellRendererText()
+ self.combo.pack_start(cellrenderertext, True)
+ self.combo.add_attribute(cellrenderertext, 'text', 0)
+
+ 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
@@ -326,10 +338,8 @@ class ChangeMoodDialog:
mood = None
message = None
if rep == gtk.RESPONSE_OK:
- beg, end = self.message_buffer.get_bounds()
- message = self.message_buffer.get_text(beg, end).decode('utf-8')\
- .strip()
- msg = helpers.to_one_line(message)
+ mood = self.liststore[self.combo.get_active()][0].decode('utf-8')
+ message = self.entry.get_text().decode('utf-8')
self.window.destroy()
return (mood, message)
diff --git a/src/roster_window.py b/src/roster_window.py
index fe7417dd4..a108ca9f3 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -2273,7 +2273,6 @@ class RosterWindow:
dlg = dialogs.ChangeMoodDialog()
(mood, message) = dlg.run()
mood = 'happy'
- print account, mood, message
if mood is not None: # None is if user pressed Cancel
self.send_mood(account, mood, message)