Remove send button

This commit is contained in:
Philipp Hörist 2017-10-03 00:02:45 +02:00
parent e7d1a2d511
commit ef748c6d46
5 changed files with 4 additions and 84 deletions

View File

@ -324,11 +324,6 @@ class ChatControl(ChatControlBase):
app.events.event_removed_unsubscribe(self.on_event_removed) app.events.event_removed_unsubscribe(self.on_event_removed)
def _update_toolbar(self): def _update_toolbar(self):
if (app.connections[self.account].connected > 1 and not \
self.TYPE_ID == 'pm') or (self.contact.show != 'offline' and \
self.TYPE_ID == 'pm'):
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(True)
# Formatting # Formatting
# TODO: find out what encryption allows for xhtml and which not # TODO: find out what encryption allows for xhtml and which not
if self.contact.supports(NS_XHTML_IM): if self.contact.supports(NS_XHTML_IM):
@ -1648,13 +1643,8 @@ class ChatControl(ChatControlBase):
if contact: if contact:
self.contact = contact self.contact = contact
self.draw_banner() self.draw_banner()
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(True)
def got_disconnected(self): def got_disconnected(self):
# Emoticons button
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(False)
# Add to roster # Add to roster
self._add_to_roster_button.hide() self._add_to_roster_button.hide()
# Audio button # Audio button

View File

@ -353,12 +353,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.msg_textview.drag_dest_set(Gtk.DestDefaults.MOTION | self.msg_textview.drag_dest_set(Gtk.DestDefaults.MOTION |
Gtk.DestDefaults.HIGHLIGHT, self.dnd_list, Gdk.DragAction.COPY) Gtk.DestDefaults.HIGHLIGHT, self.dnd_list, Gdk.DragAction.COPY)
# Hook up send button
widget = self.xml.get_object('send_button')
id_ = widget.connect('clicked', self._on_send_button_clicked)
widget.set_sensitive(False)
self.handlers[id_] = widget
# the following vars are used to keep history of user's messages # the following vars are used to keep history of user's messages
self.sent_history = [] self.sent_history = []
self.sent_history_pos = 0 self.sent_history_pos = 0
@ -566,20 +560,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
if event.button == 3: # right click if event.button == 3: # right click
self.parent_win.popup_menu(event) self.parent_win.popup_menu(event)
def _on_send_button_clicked(self, widget):
"""
When send button is pressed: send the current message
"""
message_buffer = self.msg_textview.get_buffer()
emoticons.replace_with_codepoint(message_buffer)
start_iter = message_buffer.get_start_iter()
end_iter = message_buffer.get_end_iter()
message = message_buffer.get_text(start_iter, end_iter, False)
xhtml = self.msg_textview.get_xhtml()
# send the message
self.send_message(message, xhtml=xhtml)
def _conv_textview_key_press_event(self, widget, event): def _conv_textview_key_press_event(self, widget, event):
# translate any layout to latin_layout # translate any layout to latin_layout
valid, entries = self.keymap.get_entries_for_keyval(event.keyval) valid, entries = self.keymap.get_entries_for_keyval(event.keyval)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="upper">110</property> <property name="upper">110</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
@ -358,11 +358,6 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-jump-to</property>
</object>
<object class="GtkBox" id="chat_control_hbox"> <object class="GtkBox" id="chat_control_hbox">
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="margin_left">7</property> <property name="margin_left">7</property>
@ -1055,25 +1050,7 @@ audio-mic-volume-low</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="send_button"> <placeholder/>
<property name="label" translatable="yes">_Send</property>
<property name="width_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup" translatable="yes">Send message</property>
<property name="tooltip_text" translatable="yes">Send message</property>
<property name="image">image4</property>
<property name="use_underline">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">15</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>

View File

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-jump-to</property>
</object>
<object class="GtkBox" id="groupchat_control_hbox"> <object class="GtkBox" id="groupchat_control_hbox">
<property name="can_focus">True</property> <property name="can_focus">True</property>
<child> <child>
@ -438,23 +433,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="send_button"> <placeholder/>
<property name="label" translatable="yes">_Send</property>
<property name="width_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Send message</property>
<property name="image">image1</property>
<property name="use_underline">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">11</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>

View File

@ -296,8 +296,6 @@ class GroupchatControl(ChatControlBase):
# Keep error dialog instance to be sure to have only once at a time # Keep error dialog instance to be sure to have only once at a time
self.error_dialog = None self.error_dialog = None
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(False)
self.actions_button = self.xml.get_object('muc_window_actions_button') self.actions_button = self.xml.get_object('muc_window_actions_button')
id_ = self.actions_button.connect('clicked', id_ = self.actions_button.connect('clicked',
@ -1439,8 +1437,6 @@ class GroupchatControl(ChatControlBase):
if self.parent_win: if self.parent_win:
self.parent_win.redraw_tab(self) self.parent_win.redraw_tab(self)
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(True)
formattings_button = self.xml.get_object('formattings_button') formattings_button = self.xml.get_object('formattings_button')
formattings_button.set_sensitive(True) formattings_button.set_sensitive(True)
change_nick_button = self.xml.get_object('change_nick_button') change_nick_button = self.xml.get_object('change_nick_button')
@ -1449,8 +1445,6 @@ class GroupchatControl(ChatControlBase):
change_subject_button.set_sensitive(True) change_subject_button.set_sensitive(True)
def got_disconnected(self): def got_disconnected(self):
send_button = self.xml.get_object('send_button')
send_button.set_sensitive(False)
formattings_button = self.xml.get_object('formattings_button') formattings_button = self.xml.get_object('formattings_button')
formattings_button.set_sensitive(False) formattings_button.set_sensitive(False)
change_nick_button = self.xml.get_object('change_nick_button') change_nick_button = self.xml.get_object('change_nick_button')