altering a patch by denis craven and commiting
This commit is contained in:
parent
3d59234f7f
commit
f82addfce5
|
@ -60,12 +60,6 @@ class Groupchat_window(chat.Chat):
|
||||||
self.on_chat_notebook_key_press_event)
|
self.on_chat_notebook_key_press_event)
|
||||||
self.xml.signal_connect('on_chat_notebook_switch_page',
|
self.xml.signal_connect('on_chat_notebook_switch_page',
|
||||||
self.on_chat_notebook_switch_page)
|
self.on_chat_notebook_switch_page)
|
||||||
self.xml.signal_connect('on_change_subject_menuitem_activate',
|
|
||||||
self.on_change_subject_menuitem_activate)
|
|
||||||
self.xml.signal_connect('on_configure_room_menuitem_activate',
|
|
||||||
self.on_configure_room_menuitem_activate)
|
|
||||||
self.xml.signal_connect('on_add_bookmark_menuitem_activate',
|
|
||||||
self.on_add_bookmark_menuitem_activate)
|
|
||||||
self.xml.signal_connect('on_close_window_activate',
|
self.xml.signal_connect('on_close_window_activate',
|
||||||
self.on_close_window_activate)
|
self.on_close_window_activate)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
@ -351,6 +345,8 @@ class Groupchat_window(chat.Chat):
|
||||||
if not self.last_key_tabs[room_jid]: # if we are nick cycling, last char will always be space
|
if not self.last_key_tabs[room_jid]: # if we are nick cycling, last char will always be space
|
||||||
return False
|
return False
|
||||||
splitted_text = text.split()
|
splitted_text = text.split()
|
||||||
|
# check if tab is pressed with empty message
|
||||||
|
if len(splitted_text): # if there are any words
|
||||||
begin = splitted_text[-1] # last word we typed
|
begin = splitted_text[-1] # last word we typed
|
||||||
|
|
||||||
if len(self.nick_hits[room_jid]) and self.nick_hits[room_jid][0].startswith(begin.replace(':', '')) \
|
if len(self.nick_hits[room_jid]) and self.nick_hits[room_jid][0].startswith(begin.replace(':', '')) \
|
||||||
|
@ -396,15 +392,8 @@ class Groupchat_window(chat.Chat):
|
||||||
if (event.state & gtk.gdk.SHIFT_MASK):
|
if (event.state & gtk.gdk.SHIFT_MASK):
|
||||||
self.last_key_tabs[room_jid] = False
|
self.last_key_tabs[room_jid] = False
|
||||||
return False
|
return False
|
||||||
if message != '' or message != '\n':
|
self.send_gc_message(message)
|
||||||
self.save_sent_message(room_jid, message)
|
|
||||||
if message == '/clear':
|
|
||||||
self.on_clear(None, conversation_textview) # clear conversation
|
|
||||||
self.on_clear(None, widget) # clear message textview too
|
|
||||||
return True
|
|
||||||
gajim.connections[self.account].send_gc_message(room_jid, message)
|
|
||||||
message_buffer.set_text('', -1)
|
message_buffer.set_text('', -1)
|
||||||
widget.grab_focus()
|
|
||||||
return True
|
return True
|
||||||
elif event.keyval == gtk.keysyms.Up:
|
elif event.keyval == gtk.keysyms.Up:
|
||||||
if event.state & gtk.gdk.CONTROL_MASK: #Ctrl+UP
|
if event.state & gtk.gdk.CONTROL_MASK: #Ctrl+UP
|
||||||
|
@ -415,6 +404,36 @@ class Groupchat_window(chat.Chat):
|
||||||
else:
|
else:
|
||||||
self.last_key_tabs[room_jid] = False
|
self.last_key_tabs[room_jid] = False
|
||||||
|
|
||||||
|
def on_send_button_clicked(self, widget):
|
||||||
|
"""When send button is pressed: send the current message"""
|
||||||
|
room_jid = self.get_active_jid()
|
||||||
|
message_textview = self.xmls[room_jid].get_widget(
|
||||||
|
'message_textview')
|
||||||
|
message_buffer = message_textview.get_buffer()
|
||||||
|
start_iter = message_buffer.get_start_iter()
|
||||||
|
end_iter = message_buffer.get_end_iter()
|
||||||
|
message = message_buffer.get_text(start_iter, end_iter, 0)
|
||||||
|
|
||||||
|
# send the message
|
||||||
|
self.send_gc_message(message)
|
||||||
|
|
||||||
|
message_buffer.set_text('', -1)
|
||||||
|
|
||||||
|
def send_gc_message(self, message):
|
||||||
|
room_jid = self.get_active_jid()
|
||||||
|
message_textview = self.xmls[room_jid].get_widget(
|
||||||
|
'message_textview')
|
||||||
|
message_buffer = message_textview.get_buffer()
|
||||||
|
if message != '' or message != '\n':
|
||||||
|
self.save_sent_message(room_jid, message)
|
||||||
|
if message == '/clear':
|
||||||
|
self.on_clear(None, conversation_textview) # clear conversation
|
||||||
|
self.on_clear(None, widget) # clear message textview too
|
||||||
|
return True
|
||||||
|
gajim.connections[self.account].send_gc_message(room_jid, message)
|
||||||
|
message_buffer.set_text('', -1)
|
||||||
|
message_textview.grab_focus()
|
||||||
|
|
||||||
def print_conversation(self, text, room_jid, contact = '', tim = None):
|
def print_conversation(self, text, room_jid, contact = '', tim = None):
|
||||||
"""Print a line in the conversation:
|
"""Print a line in the conversation:
|
||||||
if contact is set: it's a message from someone
|
if contact is set: it's a message from someone
|
||||||
|
@ -634,6 +653,27 @@ class Groupchat_window(chat.Chat):
|
||||||
bgcolor = gajim.config.get('accountbgcolor')
|
bgcolor = gajim.config.get('accountbgcolor')
|
||||||
banner_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
banner_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
||||||
|
|
||||||
|
# connect the menuitems to their respective functions
|
||||||
|
xm = gtk.glade.XML(GTKGUI_GLADE, 'gc_actions_menu', APP)
|
||||||
|
self.gc_actions_menu = xm.get_widget('gc_actions_menu')
|
||||||
|
|
||||||
|
configure_menuitem, change_subject_menuitem, add_bookmark_menuitem = self.gc_actions_menu.get_children()
|
||||||
|
|
||||||
|
configure_menuitem.connect('activate',
|
||||||
|
self.on_configure_room_menuitem_activate)
|
||||||
|
change_subject_menuitem.connect('activate',
|
||||||
|
self.on_change_subject_menuitem_activate)
|
||||||
|
add_bookmark_menuitem.connect('activate',
|
||||||
|
self.on_add_bookmark_menuitem_activate)
|
||||||
|
|
||||||
|
# connect the buttons to their respective functions
|
||||||
|
actions_button = self.xmls[room_jid].get_widget(
|
||||||
|
'actions_button')
|
||||||
|
actions_button.connect('clicked', self.on_actions_button_clicked)
|
||||||
|
send_button = self.xmls[room_jid].get_widget(
|
||||||
|
'send_button')
|
||||||
|
send_button.connect('clicked', self.on_send_button_clicked)
|
||||||
|
|
||||||
#status_image, nickname, real_jid, show
|
#status_image, nickname, real_jid, show
|
||||||
store = gtk.TreeStore(gtk.Image, str, str, str)
|
store = gtk.TreeStore(gtk.Image, str, str, str)
|
||||||
store.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
store.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
||||||
|
@ -661,6 +701,11 @@ class Groupchat_window(chat.Chat):
|
||||||
self.show_title()
|
self.show_title()
|
||||||
conversation_textview.grab_focus()
|
conversation_textview.grab_focus()
|
||||||
|
|
||||||
|
def on_actions_button_clicked(self, button):
|
||||||
|
"""popup action menu"""
|
||||||
|
self.gc_actions_menu.popup(None, None, None, 1, 0)
|
||||||
|
self.gc_actions_menu.show_all()
|
||||||
|
|
||||||
def on_list_treeview_button_press_event(self, widget, event):
|
def on_list_treeview_button_press_event(self, widget, event):
|
||||||
"""popup user's group's or agent menu"""
|
"""popup user's group's or agent menu"""
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
|
|
|
@ -15028,4 +15028,67 @@ the Jabber network.</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<widget class="GtkMenu" id="gc_actions_menu">
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="configure_room_menuitem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Configure _Room</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image664">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-properties</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="change_subject_menuitem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Change _Subject</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image665">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-refresh</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="add_bookmark1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Add _Bookmark</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image666">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-add</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|
|
@ -112,7 +112,6 @@ class Vcard_window:
|
||||||
dialog.set_filter(filter)
|
dialog.set_filter(filter)
|
||||||
dialog.set_use_preview_label(False)
|
dialog.set_use_preview_label(False)
|
||||||
dialog.set_preview_widget(gtk.Image())
|
dialog.set_preview_widget(gtk.Image())
|
||||||
dialog.set_preview_widget(True)
|
|
||||||
dialog.connect('selection-changed', self.update_preview)
|
dialog.connect('selection-changed', self.update_preview)
|
||||||
|
|
||||||
ok = False
|
ok = False
|
||||||
|
@ -129,7 +128,7 @@ class Vcard_window:
|
||||||
if file:
|
if file:
|
||||||
filesize = os.path.getsize(file) # in bytes
|
filesize = os.path.getsize(file) # in bytes
|
||||||
if filesize > 8192:
|
if filesize > 8192:
|
||||||
dialogs.ErrorDialog(_('The filesize of image "%s" is too large') % file, _('The file must not be more than 8 kilobytes'))
|
dialogs.ErrorDialog(_('The filesize of image "%s" is too large') % file, _('The file must not be more than 8 kilobytes')).get_response()
|
||||||
return
|
return
|
||||||
fd = open(file)
|
fd = open(file)
|
||||||
data = fd.read()
|
data = fd.read()
|
||||||
|
|
Loading…
Reference in New Issue