auto-enable XML logging when opening XML console, and destroy window on closing. Fixes #5664
This commit is contained in:
parent
50f1567bc8
commit
1d6378e5c1
|
@ -6,7 +6,7 @@
|
||||||
<property name="border_width">12</property>
|
<property name="border_width">12</property>
|
||||||
<property name="default_width">550</property>
|
<property name="default_width">550</property>
|
||||||
<property name="default_height">450</property>
|
<property name="default_height">450</property>
|
||||||
<signal name="delete_event" handler="on_xml_console_window_delete_event"/>
|
<signal name="destroy" handler="on_xml_console_window_destroy"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox">
|
<object class="GtkVBox" id="vbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -3007,10 +3007,11 @@ class XMLConsoleWindow:
|
||||||
self.tagOutIq.set_property('foreground', color)
|
self.tagOutIq.set_property('foreground', color)
|
||||||
buffer_.create_tag('') # Default tag
|
buffer_.create_tag('') # Default tag
|
||||||
|
|
||||||
self.enabled = False
|
self.enabled = True
|
||||||
|
self.xml.get_object('enable_checkbutton').set_active(True)
|
||||||
|
|
||||||
self.input_textview.modify_text(
|
self.input_textview.modify_text(
|
||||||
gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
|
gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
|
||||||
|
|
||||||
if len(gajim.connections) > 1:
|
if len(gajim.connections) > 1:
|
||||||
title = _('XML Console for %s') % self.account
|
title = _('XML Console for %s') % self.account
|
||||||
|
@ -3022,9 +3023,8 @@ class XMLConsoleWindow:
|
||||||
|
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
|
|
||||||
def on_xml_console_window_delete_event(self, widget, event):
|
def on_xml_console_window_destroy(self, widget):
|
||||||
self.window.hide()
|
del gajim.interface.instances[self.account]['xml_console']
|
||||||
return True # do NOT destroy the window
|
|
||||||
|
|
||||||
def on_clear_button_clicked(self, widget):
|
def on_clear_button_clicked(self, widget):
|
||||||
buffer_ = self.stanzas_log_textview.get_buffer()
|
buffer_ = self.stanzas_log_textview.get_buffer()
|
||||||
|
@ -3103,42 +3103,41 @@ class XMLConsoleWindow:
|
||||||
type_ = kind # 'incoming' or 'outgoing'
|
type_ = kind # 'incoming' or 'outgoing'
|
||||||
|
|
||||||
if kind == 'incoming':
|
if kind == 'incoming':
|
||||||
buffer.insert_with_tags_by_name(end_iter, '<!-- In -->\n',
|
buffer.insert_with_tags_by_name(end_iter, '<!-- In -->\n', type_)
|
||||||
type_)
|
|
||||||
elif kind == 'outgoing':
|
elif kind == 'outgoing':
|
||||||
buffer.insert_with_tags_by_name(end_iter, '<!-- Out -->\n',
|
buffer.insert_with_tags_by_name(end_iter, '<!-- Out -->\n', type_)
|
||||||
type_)
|
|
||||||
end_iter = buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
buffer.insert_with_tags_by_name(end_iter, stanza.replace('><', '>\n<') +\
|
buffer.insert_with_tags_by_name(end_iter, stanza.replace('><', '>\n<') \
|
||||||
'\n\n', type_)
|
+ '\n\n', type_)
|
||||||
if at_the_end:
|
if at_the_end:
|
||||||
gobject.idle_add(self.scroll_to_end)
|
gobject.idle_add(self.scroll_to_end)
|
||||||
|
|
||||||
def on_send_button_clicked(self, widget):
|
def on_send_button_clicked(self, widget):
|
||||||
if gajim.connections[self.account].connected <= 1:
|
if gajim.connections[self.account].connected <= 1:
|
||||||
#if offline or connecting
|
# if offline or connecting
|
||||||
ErrorDialog(_('Connection not available'),
|
ErrorDialog(_('Connection not available'),
|
||||||
_('Please make sure you are connected with "%s".') % self.account)
|
_('Please make sure you are connected with "%s".') % \
|
||||||
|
self.account)
|
||||||
return
|
return
|
||||||
begin_iter, end_iter = self.input_tv_buffer.get_bounds()
|
begin_iter, end_iter = self.input_tv_buffer.get_bounds()
|
||||||
stanza = self.input_tv_buffer.get_text(begin_iter, end_iter).decode(
|
stanza = self.input_tv_buffer.get_text(begin_iter, end_iter).decode(
|
||||||
'utf-8')
|
'utf-8')
|
||||||
if stanza:
|
if stanza:
|
||||||
gajim.connections[self.account].send_stanza(stanza)
|
gajim.connections[self.account].send_stanza(stanza)
|
||||||
self.input_tv_buffer.set_text('') # we sent ok, clear the textview
|
self.input_tv_buffer.set_text('') # we sent ok, clear the textview
|
||||||
|
|
||||||
def on_presence_button_clicked(self, widget):
|
def on_presence_button_clicked(self, widget):
|
||||||
self.input_tv_buffer.set_text(
|
self.input_tv_buffer.set_text(
|
||||||
'<presence><show></show><status></status><priority></priority>'
|
'<presence><show></show><status></status><priority></priority>'
|
||||||
'</presence>')
|
'</presence>')
|
||||||
|
|
||||||
def on_iq_button_clicked(self, widget):
|
def on_iq_button_clicked(self, widget):
|
||||||
self.input_tv_buffer.set_text(
|
self.input_tv_buffer.set_text(
|
||||||
'<iq to="" type=""><query xmlns=""></query></iq>')
|
'<iq to="" type=""><query xmlns=""></query></iq>')
|
||||||
|
|
||||||
def on_message_button_clicked(self, widget):
|
def on_message_button_clicked(self, widget):
|
||||||
self.input_tv_buffer.set_text(
|
self.input_tv_buffer.set_text(
|
||||||
'<message to="" type=""><body></body></message>')
|
'<message to="" type=""><body></body></message>')
|
||||||
|
|
||||||
def on_expander_activate(self, widget):
|
def on_expander_activate(self, widget):
|
||||||
if not widget.get_expanded(): # it's the opposite!
|
if not widget.get_expanded(): # it's the opposite!
|
||||||
|
@ -3147,7 +3146,7 @@ class XMLConsoleWindow:
|
||||||
|
|
||||||
#Action that can be done with an incoming list of contacts
|
#Action that can be done with an incoming list of contacts
|
||||||
TRANSLATED_ACTION = {'add': _('add'), 'modify': _('modify'),
|
TRANSLATED_ACTION = {'add': _('add'), 'modify': _('modify'),
|
||||||
'remove': _('remove')}
|
'remove': _('remove')}
|
||||||
class RosterItemExchangeWindow:
|
class RosterItemExchangeWindow:
|
||||||
"""
|
"""
|
||||||
Windows used when someone send you a exchange contact suggestion
|
Windows used when someone send you a exchange contact suggestion
|
||||||
|
|
Loading…
Reference in New Issue