From 99a8c05bb8cfab0bfe3adfa6f2a4735260ec6f7f Mon Sep 17 00:00:00 2001
From: js <js-gajim@webkeks.org>
Date: Wed, 7 May 2008 15:34:00 +0000
Subject: [PATCH] * Converted GC to new GUI as well. * Moved some code so we
 can get rid of a few ifs.

What still needs to be done for the GUI redesign to be complete:
Don't show entries in the actions menu that have buttons.
---
 data/glade/message_window.glade | 342 +++++++++++++++++++-------------
 src/chat_control.py             |  36 ++--
 src/groupchat_control.py        |  12 ++
 3 files changed, 225 insertions(+), 165 deletions(-)

diff --git a/data/glade/message_window.glade b/data/glade/message_window.glade
index ea73d3c0c..4cb47f797 100644
--- a/data/glade/message_window.glade
+++ b/data/glade/message_window.glade
@@ -70,7 +70,7 @@
                                 <child>
                                   <widget class="GtkImage" id="avatar_image">
                                     <property name="visible">True</property>
-                                    <property name="stock">None</property>
+                                    <property name="stock">gtk-missing-image</property>
                                   </widget>
                                 </child>
                               </widget>
@@ -156,7 +156,7 @@
                       <widget class="GtkButton" id="emoticons_button">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="tooltip" translatable="yes">Show a list of emoticons</property>
+                        <property name="tooltip" translatable="yes">Show a list of emoticons (Alt-M)</property>
                         <property name="relief">GTK_RELIEF_NONE</property>
                         <property name="focus_on_click">False</property>
                         <property name="response_id">0</property>
@@ -209,7 +209,7 @@
                       <widget class="GtkButton" id="convert_to_gc_button">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="tooltip" translatable="yes">Invite contacts to conversation</property>
+                        <property name="tooltip" translatable="yes">Invite contacts to the conversation</property>
                         <property name="relief">GTK_RELIEF_NONE</property>
                         <property name="focus_on_click">False</property>
                         <property name="response_id">0</property>
@@ -231,7 +231,7 @@
                       <widget class="GtkButton" id="contact_information_button">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="tooltip" translatable="yes">Show contact information</property>
+                        <property name="tooltip" translatable="yes">Show contact's profile (Ctrl-I)</property>
                         <property name="relief">GTK_RELIEF_NONE</property>
                         <property name="focus_on_click">False</property>
                         <property name="response_id">0</property>
@@ -253,7 +253,7 @@
                       <widget class="GtkButton" id="history_button">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="tooltip" translatable="yes">Browse history</property>
+                        <property name="tooltip" translatable="yes">Browse the chat history (Ctrl-H)</property>
                         <property name="relief">GTK_RELIEF_NONE</property>
                         <property name="focus_on_click">False</property>
                         <property name="response_id">0</property>
@@ -332,7 +332,6 @@
                                   <widget class="GtkImage" id="image1339">
                                     <property name="visible">True</property>
                                     <property name="stock">gtk-jump-to</property>
-                                    <property name="icon_size">4</property>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -570,171 +569,228 @@
                 <child>
                   <widget class="GtkHBox" id="actions_hbox">
                     <property name="visible">True</property>
-                    <property name="border_width">3</property>
                     <child>
                       <widget class="GtkHBox" id="hbox3023">
                         <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkButton" id="emoticons_button">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="tooltip" translatable="yes">Show a list of emoticons (Alt-M)</property>
+                            <property name="relief">GTK_RELIEF_NONE</property>
+                            <property name="response_id">0</property>
+                            <child>
+                              <widget class="GtkImage" id="emoticons_button_image">
+                                <property name="visible">True</property>
+                                <property name="stock">gtk-missing-image</property>
+                                <property name="icon_size">1</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkVSeparator" id="vseparator2">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="change_nick_button">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="tooltip" translatable="yes">Change your nickname</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image4">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="stock">gtk-edit</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="change_subject_button">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="tooltip" translatable="yes">Change the room's subject</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image6">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="stock">gtk-properties</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="bookmark_button">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="tooltip" translatable="yes">Bookmark this room</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image7">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="stock">gtk-add</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="history_button">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="tooltip" translatable="yes">Browse the chat history (Ctrl-H)</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image8">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="stock">gtk-justify-fill</property>
+                            <property name="icon_size">1</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkVSeparator" id="vseparator4">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="muc_window_actions_button">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="tooltip" translatable="yes">Show a menu of advanced functions</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkAlignment" id="alignment104">
+                            <property name="visible">True</property>
+                            <property name="xscale">0</property>
+                            <property name="yscale">0</property>
+                            <child>
+                              <widget class="GtkImage" id="image1344">
+                                <property name="visible">True</property>
+                                <property name="stock">gtk-execute</property>
+                                <property name="icon_size">1</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment2">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <child>
                           <placeholder/>
                         </child>
                       </widget>
+                      <packing>
+                        <property name="position">8</property>
+                      </packing>
                     </child>
                     <child>
-                      <widget class="GtkHBox" id="hbox3013">
+                      <widget class="GtkButton" id="send_button">
                         <property name="visible">True</property>
-                        <property name="spacing">6</property>
+                        <property name="can_focus">True</property>
+                        <property name="response_id">0</property>
                         <child>
-                          <widget class="GtkButton" id="emoticons_button">
+                          <widget class="GtkAlignment" id="alignment105">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="tooltip" translatable="yes">Click to insert an emoticon (Alt+M)</property>
-                            <property name="response_id">0</property>
+                            <property name="xscale">0</property>
+                            <property name="yscale">0</property>
                             <child>
-                              <widget class="GtkHBox" id="hbox3014">
+                              <widget class="GtkHBox" id="hbox3016">
                                 <property name="visible">True</property>
+                                <property name="spacing">2</property>
                                 <child>
-                                  <widget class="GtkImage" id="emoticons_button_image">
+                                  <widget class="GtkImage" id="image1345">
                                     <property name="visible">True</property>
-                                    <property name="xpad">2</property>
-                                    <property name="stock">gtk-missing-image</property>
-                                  </widget>
-                                </child>
-                                <child>
-                                  <widget class="GtkArrow" id="arrow5">
-                                    <property name="visible">True</property>
-                                    <property name="arrow_type">GTK_ARROW_DOWN</property>
+                                    <property name="stock">gtk-jump-to</property>
+                                    <property name="icon_size">2</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label377">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes" comments="Make sure the character after &quot;_&quot; is not M/m (conflicts with Alt+M that is supposed to show the Emoticon Selector)">_Send</property>
+                                    <property name="use_underline">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </widget>
                             </child>
                           </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="muc_window_actions_button">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</property>
-                            <child>
-                              <widget class="GtkAlignment" id="alignment104">
-                                <property name="visible">True</property>
-                                <property name="xscale">0</property>
-                                <property name="yscale">0</property>
-                                <child>
-                                  <widget class="GtkHBox" id="gc_actions_hbox">
-                                    <property name="visible">True</property>
-                                    <property name="spacing">2</property>
-                                    <child>
-                                      <widget class="GtkImage" id="image1344">
-                                        <property name="visible">True</property>
-                                        <property name="stock">gtk-execute</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkLabel" id="label376">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes" comments="Make sure the character after &quot;_&quot; is not M/m (conflicts with Alt+M that is supposed to show the Emoticon Selector)">_Actions</property>
-                                        <property name="use_underline">True</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkArrow" id="arrow6">
-                                        <property name="visible">True</property>
-                                        <property name="arrow_type">GTK_ARROW_DOWN</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">2</property>
-                                      </packing>
-                                    </child>
-                                  </widget>
-                                </child>
-                              </widget>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkVSeparator" id="vseparator6">
-                            <property name="visible">True</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="padding">2</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="send_button">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</property>
-                            <child>
-                              <widget class="GtkAlignment" id="alignment105">
-                                <property name="visible">True</property>
-                                <property name="xscale">0</property>
-                                <property name="yscale">0</property>
-                                <child>
-                                  <widget class="GtkHBox" id="hbox3016">
-                                    <property name="visible">True</property>
-                                    <property name="spacing">2</property>
-                                    <child>
-                                      <widget class="GtkImage" id="image1345">
-                                        <property name="visible">True</property>
-                                        <property name="stock">gtk-jump-to</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkLabel" id="label377">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes" comments="Make sure the character after &quot;_&quot; is not M/m (conflicts with Alt+M that is supposed to show the Emoticon Selector)">_Send</property>
-                                        <property name="use_underline">True</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                  </widget>
-                                </child>
-                              </widget>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
-                          </packing>
                         </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="position">1</property>
+                        <property name="fill">False</property>
+                        <property name="position">9</property>
                       </packing>
                     </child>
                   </widget>
diff --git a/src/chat_control.py b/src/chat_control.py
index 568dad42c..7fe48402b 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -138,29 +138,9 @@ class ChatControlBase(MessageControl):
 		MessageControl.__init__(self, type_id, parent_win, widget_name,
 			contact, acct, resource = resource);
 
-		widget = self.xml.get_widget('contact_information_button')
-		# FIXME: Required as it's not in GC yet
-		if widget != None:
-			id = widget.connect('clicked', self._on_contact_information_menuitem_activate)
-			self.handlers[id] = widget
-
 		widget = self.xml.get_widget('history_button')
-		# FIXME: Required as it's not in GC yet
-		if widget != None:
-			id = widget.connect('clicked', self._on_history_menuitem_activate)
-			self.handlers[id] = widget
-
-		widget = self.xml.get_widget('send_file_button')
-		# FIXME: Required as it's not in GC yet
-		if widget != None:
-			id = widget.connect('clicked', self._on_send_file_menuitem_activate)
-			self.handlers[id] = widget
-
-		widget = self.xml.get_widget('convert_to_gc_button')
-		# FIXME: Required as it's not in GC yet
-		if widget != None:
-			id = widget.connect('clicked', self._on_convert_to_gc_menuitem_activate)
-			self.handlers[id] = widget
+		id = widget.connect('clicked', self._on_history_menuitem_activate)
+		self.handlers[id] = widget
 
 		# when/if we do XHTML we will put formatting buttons back
 		widget = self.xml.get_widget('emoticons_button')
@@ -1049,6 +1029,18 @@ class ChatControl(ChatControlBase):
 		id = widget.connect('clicked', self.on_actions_button_clicked)
 		self.handlers[id] = widget
 
+		widget = self.xml.get_widget('send_file_button')
+		id = widget.connect('clicked', self._on_send_file_menuitem_activate)
+		self.handlers[id] = widget
+
+		widget = self.xml.get_widget('convert_to_gc_button')
+		id = widget.connect('clicked', self._on_convert_to_gc_menuitem_activate)
+		self.handlers[id] = widget
+
+		widget = self.xml.get_widget('contact_information_button')
+		id = widget.connect('clicked', self._on_contact_information_menuitem_activate)
+		self.handlers[id] = widget
+
 		compact_view = gajim.config.get('compact_view')
 		self.chat_buttons_set_visible(compact_view)
 		self.widget_set_visible(self.xml.get_widget('banner_eventbox'),
diff --git a/src/groupchat_control.py b/src/groupchat_control.py
index 5dd0e2c9a..863589a9e 100644
--- a/src/groupchat_control.py
+++ b/src/groupchat_control.py
@@ -177,6 +177,18 @@ class GroupchatControl(ChatControlBase):
 		id = widget.connect('clicked', self.on_actions_button_clicked)
 		self.handlers[id] = widget
 
+		widget = self.xml.get_widget('change_nick_button')
+		id = widget.connect('clicked', self._on_change_nick_menuitem_activate)
+		self.handlers[id] = widget
+
+		widget = self.xml.get_widget('change_subject_button')
+		id = widget.connect('clicked', self._on_change_subject_menuitem_activate)
+		self.handlers[id] = widget
+
+		widget = self.xml.get_widget('bookmark_button')
+		id = widget.connect('clicked', self._on_bookmark_room_menuitem_activate)
+		self.handlers[id] = widget
+
 		widget = self.xml.get_widget('list_treeview')
 		id = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
 		self.handlers[id] = widget