diff --git a/Core/core.py b/Core/core.py
index c094ebb69..3cd2cb328 100644
--- a/Core/core.py
+++ b/Core/core.py
@@ -28,13 +28,12 @@ import common.jabber
import socket
import select
import pickle
+import version
from tempfile import *
from common import i18n
_ = i18n._
-VERSION = '0.6.1'
-
log = logging.getLogger('core.core')
log.setLevel(logging.DEBUG)
@@ -632,7 +631,7 @@ class GajimCore:
iq_obj.setType('result')
qp = iq_obj.getTag('query')
qp.insertTag('name').insertData('Gajim')
- qp.insertTag('version').insertData(VERSION)
+ qp.insertTag('version').insertData(version.version)
qp.insertTag('os').insertData(get_os_info())
con.send(iq_obj)
diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index 24f50042e..e70014fbe 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -46,6 +46,18 @@ class Preferences_window:
def on_preferences_window_show(self, widget):
self.notebook.set_current_page(0)
+
+ def on_checkbutton_toggled(self, widget, config_name, \
+ extra_function = None, change_sensitivity_widgets = None):
+ if widget.get_active():
+ self.plugin.config[config_name] = 1
+ if extra_function != None:
+ apply(extra_function)
+ else:
+ self.plugin.config[config_name] = 0
+ if change_sensitivity_widgets != None:
+ for w in change_sensitivity_widgets:
+ w.set_sensitive(widget.get_active())
def on_tray_icon_checkbutton_toggled(self, widget):
if widget.get_active():
@@ -313,39 +325,17 @@ class Preferences_window:
self.update_text_tags()
def on_use_emoticons_checkbutton_toggled(self, widget):
- self.on_checkbutton_toggled(widget, 'useemoticons',\
- [self.xml.get_widget('button_new_emoticon'),\
- self.xml.get_widget('button_remove_emoticon'),\
- self.xml.get_widget('treeview_emoticons'),\
- self.xml.get_widget('set_image_button'),\
- self.xml.get_widget('emoticons_image')])
+ self.on_checkbutton_toggled(widget, 'useemoticons', None, \
+ self.xml.get_widget('add_remove_emoticons_button'))
+
+ def on_add_remove_emoticons_button_clicked(self, widget):
+ Add_remove_emoticons_window(self.plugin)
- def on_emoticons_treemodel_row_deleted(self, model, path):
- iter = model.get_iter_first()
- emots = []
- while iter:
- emots.append(model.get_value(iter, 0))
- emots.append(model.get_value(iter, 1))
- iter = model.iter_next(iter)
- self.plugin.config['emoticons'] = '\t'.join(emots)
- self.plugin.init_regexp()
-
- def on_emoticons_treemodel_row_changed(self, model, path, iter):
- if model[path][1] != None and len(model[path][1]) != 0:
- iter = model.get_iter_first()
- emots = []
- while iter:
- emots.append(model.get_value(iter, 0))
- emots.append(model.get_value(iter, 1))
- iter = model.iter_next(iter)
- self.plugin.config['emoticons'] = '\t'.join(emots)
- self.plugin.init_regexp()
-
- def on_auto_pop_up_checkbutton_toggled(self, widget):
+ def on_auto_popup_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autopopup', None,\
- [self.auto_pp_away_checkbutton])
+ [self.auto_popup_away_checkbutton])
- def on_auto_pop_up_away_checkbutton_toggled(self, widget):
+ def on_auto_popup_away_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autopopupaway')
def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget):
@@ -355,11 +345,9 @@ class Preferences_window:
self.plugin.config['soundplayer'] = widget.get_text()
def on_prompt_online_status_message_checkbutton_toggled(self, widget):
- """On Prompt Online Status Message Checkbutton Toggled"""
self.on_checkbutton_toggled(widget, 'ask_online_status')
def on_prompt_offline_status_message_checkbutton_toggled(self, widget):
- """On Prompt Offline Status Message Checkbutton Toggled"""
self.on_checkbutton_toggled(widget, 'ask_offline_status')
def on_sounds_treemodel_row_changed(self, model, path, iter):
@@ -454,6 +442,14 @@ class Preferences_window:
self.config_logger['lognotsep'] = 0
self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui'))
+ def on_do_not_send_os_info_checkbutton_toggled(self, widget):
+ if widget.get_active():
+ #FIXME: when threads are removed, make sure this work
+ self.plugin.config['do_not_send_os_info'] = 1
+ else:
+ self.plugin.config['do_not_send_os_info'] = 0
+
+
def fill_msg_treeview(self):
i = 0
self.xml.get_widget('delete_msg_button').set_sensitive(False)
@@ -502,138 +498,6 @@ class Preferences_window:
if event.keyval == gtk.keysyms.Delete:
self.on_delete_msg_button_clicked(widget)
- def image_is_ok(self, image):
- if not os.path.exists(image):
- return 0
- img = gtk.Image()
- try:
- img.set_from_file(image)
- except:
- return 0
- if img.get_storage_type() == gtk.IMAGE_PIXBUF:
- pix = img.get_pixbuf()
- else:
- return 0
- if pix.get_width() > 24 or pix.get_height() > 24:
- return 0
- return 1
-
- def load_emots(self):
- emots = {}
- split_line = self.plugin.config['emoticons'].split('\t')
- for i in range(0, len(split_line)/2):
- if not self.image_is_ok(split_line[2*i+1]):
- continue
- emots[split_line[2*i]] = split_line[2*i+1]
- return emots
-
- def fill_emot_treeview(self):
- model = self.emot_tree.get_model()
- model.clear()
- emots = self.load_emots()
- for i in emots:
- file = emots[i]
- iter = model.append((i, file, None))
- if not os.path.exists(file):
- continue
- img = gtk.Image()
- img.show()
- if file.find('.gif') != -1:
- pix = gtk.gdk.PixbufAnimation(file)
- img.set_from_animation(pix)
- else:
- pix = gtk.gdk.pixbuf_new_from_file(file)
- img.set_from_pixbuf(pix)
- model.set(iter, 2, img)
-
- def on_emot_cell_edited(self, cell, row, new_text):
- model = self.emot_tree.get_model()
- iter = model.get_iter_from_string(row)
- model.set_value(iter, 0, new_text)
-
- def on_set_image_button_clicked(self, widget, data=None):
- (model, iter) = self.emot_tree.get_selection().get_selected()
- if not iter:
- return
- file = model.get_value(iter, 1)
- dialog = gtk.FileChooserDialog("Choose image",
- None,
- gtk.FILE_CHOOSER_ACTION_OPEN,
- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_OPEN, gtk.RESPONSE_OK))
- dialog.set_default_response(gtk.RESPONSE_OK)
- filter = gtk.FileFilter()
- filter.set_name("All files")
- filter.add_pattern("*")
- dialog.add_filter(filter)
-
- filter = gtk.FileFilter()
- filter.set_name("Images")
- filter.add_mime_type("image/png")
- filter.add_mime_type("image/jpeg")
- filter.add_mime_type("image/gif")
- filter.add_pattern("*.png")
- filter.add_pattern("*.jpg")
- filter.add_pattern("*.gif")
- filter.add_pattern("*.tif")
- filter.add_pattern("*.xpm")
- dialog.add_filter(filter)
- dialog.set_filter(filter)
-
- file = os.path.join(os.getcwd(), file)
- dialog.set_filename(file)
- file = ''
- ok = 0
- while(ok == 0):
- response = dialog.run()
- if response == gtk.RESPONSE_OK:
- file = dialog.get_filename()
- if self.image_is_ok(file):
- ok = 1
- else:
- ok = 1
- dialog.destroy()
- if file:
- model.set_value(iter, 1, file)
- img = gtk.Image()
- img.show()
- if file.find('.gif') != -1:
- pix = gtk.gdk.PixbufAnimation(file)
- img.set_from_animation(pix)
- else:
- pix = gtk.gdk.pixbuf_new_from_file(file)
- img.set_from_pixbuf(pix)
- model.set(iter, 2, img)
-
- def on_button_new_emoticon_clicked(self, widget, data=None):
- model = self.emot_tree.get_model()
- iter = model.append()
- model.set(iter, 0, 'smeiley', 1, '')
- col = self.emot_tree.get_column(0)
- self.emot_tree.set_cursor(model.get_path(iter), col, True)
-
- def on_button_remove_emoticon_clicked(self, widget, data=None):
- (model, iter) = self.emot_tree.get_selection().get_selected()
- if not iter:
- return
- model.remove(iter)
-
- def on_checkbutton_toggled(self, widget, config_name, \
- extra_function = None, change_sensitivity_widgets = None):
- if widget.get_active():
- self.plugin.config[config_name] = 1
- if extra_function != None:
- apply(extra_function)
- else:
- self.plugin.config[config_name] = 0
- if change_sensitivity_widgets != None:
- for w in change_sensitivity_widgets:
- w.set_sensitive(widget.get_active())
-
- def on_treeview_emoticons_key_press_event(self, widget, event):
- if event.keyval == gtk.keysyms.Delete:
- self.on_button_remove_emoticon_clicked(widget)
-
def sound_toggled_cb(self, cell, path):
model = self.sound_tree.get_model()
model[path][1] = not model[path][1]
@@ -707,12 +571,10 @@ class Preferences_window:
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP)
self.window = self.xml.get_widget('preferences_window')
self.plugin = plugin
- self.xml.get_widget('emoticons_image').set_from_file(\
- 'plugins/gtkgui/pixmaps/smile.png')
self.iconset_combobox = self.xml.get_widget('iconset_combobox')
- self.auto_pp_checkbutton = self.xml.get_widget('auto_pop_up_checkbutton')
- self.auto_pp_away_checkbutton = self.xml.get_widget \
- ('auto_pop_up_away_checkbutton')
+ self.auto_popup_checkbutton = self.xml.get_widget('auto_popup_checkbutton')
+ self.auto_popup_away_checkbutton = self.xml.get_widget \
+ ('auto_popup_away_checkbutton')
self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton')
self.auto_away_time_spinbutton = self.xml.get_widget \
('auto_away_time_spinbutton')
@@ -840,39 +702,16 @@ class Preferences_window:
#Use emoticons
st = self.plugin.config['useemoticons']
self.xml.get_widget('use_emoticons_checkbutton').set_active(st)
- self.xml.get_widget('button_new_emoticon').set_sensitive(st)
- self.xml.get_widget('button_remove_emoticon').set_sensitive(st)
- self.xml.get_widget('treeview_emoticons').set_sensitive(st)
- self.xml.get_widget('set_image_button').set_sensitive(st)
+ self.xml.get_widget('add_remove_emoticons_button').set_sensitive(st)
- #emoticons
- self.emot_tree = self.xml.get_widget('treeview_emoticons')
- model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gtk.Image)
- self.emot_tree.set_model(model)
- col = gtk.TreeViewColumn(_('Name'))
- self.emot_tree.append_column(col)
- renderer = gtk.CellRendererText()
- renderer.connect('edited', self.on_emot_cell_edited)
- renderer.set_property('editable', True)
- col.pack_start(renderer, True)
- col.set_attributes(renderer, text=0)
-
- col = gtk.TreeViewColumn(_('Image'))
- self.emot_tree.append_column(col)
- renderer = gtkgui.CellRendererImage()
- col.pack_start(renderer, expand = False)
- col.add_attribute(renderer, 'image', 2)
-
- self.fill_emot_treeview()
-
- #Autopopup
+ #autopopup
st = self.plugin.config['autopopup']
- self.auto_pp_checkbutton.set_active(st)
+ self.auto_popup_checkbutton.set_active(st)
- #Autopopupaway
+ #autopopupaway
st = self.plugin.config['autopopupaway']
- self.auto_pp_away_checkbutton.set_active(st)
- self.auto_pp_away_checkbutton.set_sensitive(self.plugin.config['autopopup'])
+ self.auto_popup_away_checkbutton.set_active(st)
+ self.auto_popup_away_checkbutton.set_sensitive(self.plugin.config['autopopup'])
#Ignore messages from unknown contacts
self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\
@@ -982,19 +821,18 @@ class Preferences_window:
st = self.config_logger['lognotsep']
self.xml.get_widget('log_in_extern_checkbutton').set_active(st)
- self.emot_tree.get_model().connect('row-changed', \
- self.on_emoticons_treemodel_row_changed)
- self.emot_tree.get_model().connect('row-deleted', \
- self.on_emoticons_treemodel_row_deleted)
- self.sound_tree.get_model().connect('row-changed', \
- self.on_sounds_treemodel_row_changed)
- self.msg_tree.get_model().connect('row-changed', \
- self.on_msg_treemodel_row_changed)
- self.msg_tree.get_model().connect('row-deleted', \
- self.on_msg_treemodel_row_deleted)
-
- #self.notebook.set_current_page(0)
+ # don't send os info
+ st = self.plugin.config['do_not_send_os_info']
+ self.xml.get_widget('do_not_send_os_info_checkbutton').set_active(st)
self.xml.signal_autoconnect(self)
+
+ self.sound_tree.get_model().connect('row-changed', \
+ self.on_sounds_treemodel_row_changed)
+ self.msg_tree.get_model().connect('row-changed', \
+ self.on_msg_treemodel_row_changed)
+ self.msg_tree.get_model().connect('row-deleted', \
+ self.on_msg_treemodel_row_deleted)
+
class Account_modification_window:
"""Class for account informations"""
@@ -1006,6 +844,11 @@ class Account_modification_window:
"""When Close button is clicked"""
widget.get_toplevel().destroy()
+ def on_checkbutton_toggled(self, widget, widgets):
+ """set or unset sensitivity of widgets when widget is toggled"""
+ for w in widgets:
+ w.set_sensitive(widget.get_active())
+
def init_account(self, infos):
"""Initialize window with defaults values"""
if infos.has_key('accname'):
@@ -1315,11 +1158,6 @@ class Account_modification_window:
gpg_save_password_checkbutton.set_sensitive(True)
gpg_save_password_checkbutton.set_active(False)
self.xml.get_widget('gpg_password_entry').set_text('')
-
- def on_checkbutton_toggled(self, widget, widgets):
- """set or unset sensitivity of widgets when widget is toggled"""
- for w in widgets:
- w.set_sensitive(widget.get_active())
def on_checkbutton_toggled_and_clear(self, widget, widgets):
self.on_checkbutton_toggled(widget, widgets)
@@ -1519,6 +1357,189 @@ class Service_registration_window:
self.window.show_all()
+class Add_remove_emoticons_window:
+ def __init__(self, plugin):
+ self.xml = gtk.glade.XML(GTKGUI_GLADE, 'add_remove_emoticons_window', APP)
+ self.window = self.xml.get_widget('add_remove_emoticons_window')
+ self.plugin = plugin
+
+ #emoticons
+ self.emot_tree = self.xml.get_widget('emoticons_treeview')
+ model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gtk.Image)
+ self.emot_tree.set_model(model)
+ col = gtk.TreeViewColumn(_('Name'))
+ self.emot_tree.append_column(col)
+ renderer = gtk.CellRendererText()
+ renderer.connect('edited', self.on_emot_cell_edited)
+ renderer.set_property('editable', True)
+ col.pack_start(renderer, True)
+ col.set_attributes(renderer, text=0)
+
+ col = gtk.TreeViewColumn(_('Image'))
+ self.emot_tree.append_column(col)
+ renderer = gtkgui.CellRendererImage()
+ col.pack_start(renderer, expand = False)
+ col.add_attribute(renderer, 'image', 2)
+
+ self.fill_emot_treeview()
+ self.emot_tree.get_model().connect('row-changed', \
+ self.on_emoticons_treemodel_row_changed)
+ self.emot_tree.get_model().connect('row-deleted', \
+ self.on_emoticons_treemodel_row_deleted)
+
+ self.plugin = plugin
+ self.xml.signal_autoconnect(self)
+ self.window.show_all()
+
+ def on_add_remove_emoticons_window_delete_event(self, widget, event):
+ self.window.hide()
+ return True # do NOT destroy the window
+
+ def on_close_button_clicked(self, widget):
+ self.window.hide()
+
+ def on_emoticons_treemodel_row_deleted(self, model, path):
+ iter = model.get_iter_first()
+ emots = []
+ while iter:
+ emots.append(model.get_value(iter, 0))
+ emots.append(model.get_value(iter, 1))
+ iter = model.iter_next(iter)
+ self.plugin.config['emoticons'] = '\t'.join(emots)
+ self.plugin.init_regexp()
+
+ def on_emoticons_treemodel_row_changed(self, model, path, iter):
+ if model[path][1] != None and len(model[path][1]) != 0:
+ iter = model.get_iter_first()
+ emots = []
+ while iter:
+ emots.append(model.get_value(iter, 0))
+ emots.append(model.get_value(iter, 1))
+ iter = model.iter_next(iter)
+ self.plugin.config['emoticons'] = '\t'.join(emots)
+ self.plugin.init_regexp()
+
+ def image_is_ok(self, image):
+ if not os.path.exists(image):
+ return 0
+ img = gtk.Image()
+ try:
+ img.set_from_file(image)
+ except:
+ return 0
+ if img.get_storage_type() == gtk.IMAGE_PIXBUF:
+ pix = img.get_pixbuf()
+ else:
+ return 0
+ if pix.get_width() > 24 or pix.get_height() > 24:
+ return 0
+ return 1
+
+ def load_emots(self):
+ emots = {}
+ split_line = self.plugin.config['emoticons'].split('\t')
+ for i in range(0, len(split_line)/2):
+ if not self.image_is_ok(split_line[2*i+1]):
+ continue
+ emots[split_line[2*i]] = split_line[2*i+1]
+ return emots
+
+ def fill_emot_treeview(self):
+ model = self.emot_tree.get_model()
+ model.clear()
+ emots = self.load_emots()
+ for i in emots:
+ file = emots[i]
+ iter = model.append((i, file, None))
+ if not os.path.exists(file):
+ continue
+ img = gtk.Image()
+ img.show()
+ if file.find('.gif') != -1:
+ pix = gtk.gdk.PixbufAnimation(file)
+ img.set_from_animation(pix)
+ else:
+ pix = gtk.gdk.pixbuf_new_from_file(file)
+ img.set_from_pixbuf(pix)
+ model.set(iter, 2, img)
+
+ def on_emot_cell_edited(self, cell, row, new_text):
+ model = self.emot_tree.get_model()
+ iter = model.get_iter_from_string(row)
+ model.set_value(iter, 0, new_text)
+
+ def on_set_image_button_clicked(self, widget, data=None):
+ (model, iter) = self.emot_tree.get_selection().get_selected()
+ if not iter:
+ return
+ file = model.get_value(iter, 1)
+ dialog = gtk.FileChooserDialog("Choose image",
+ None,
+ gtk.FILE_CHOOSER_ACTION_OPEN,
+ (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+ gtk.STOCK_OPEN, gtk.RESPONSE_OK))
+ dialog.set_default_response(gtk.RESPONSE_OK)
+ filter = gtk.FileFilter()
+ filter.set_name("All files")
+ filter.add_pattern("*")
+ dialog.add_filter(filter)
+
+ filter = gtk.FileFilter()
+ filter.set_name("Images")
+ filter.add_mime_type("image/png")
+ filter.add_mime_type("image/jpeg")
+ filter.add_mime_type("image/gif")
+ filter.add_pattern("*.png")
+ filter.add_pattern("*.jpg")
+ filter.add_pattern("*.gif")
+ filter.add_pattern("*.tif")
+ filter.add_pattern("*.xpm")
+ dialog.add_filter(filter)
+ dialog.set_filter(filter)
+
+ file = os.path.join(os.getcwd(), file)
+ dialog.set_filename(file)
+ file = ''
+ ok = 0
+ while(ok == 0):
+ response = dialog.run()
+ if response == gtk.RESPONSE_OK:
+ file = dialog.get_filename()
+ if self.image_is_ok(file):
+ ok = 1
+ else:
+ ok = 1
+ dialog.destroy()
+ if file:
+ model.set_value(iter, 1, file)
+ img = gtk.Image()
+ img.show()
+ if file.find('.gif') != -1:
+ pix = gtk.gdk.PixbufAnimation(file)
+ img.set_from_animation(pix)
+ else:
+ pix = gtk.gdk.pixbuf_new_from_file(file)
+ img.set_from_pixbuf(pix)
+ model.set(iter, 2, img)
+
+ def on_button_new_emoticon_clicked(self, widget, data=None):
+ model = self.emot_tree.get_model()
+ iter = model.append()
+ model.set(iter, 0, 'emoticon', 1, '')
+ col = self.emot_tree.get_column(0)
+ self.emot_tree.set_cursor(model.get_path(iter), col, True)
+
+ def on_button_remove_emoticon_clicked(self, widget, data=None):
+ (model, iter) = self.emot_tree.get_selection().get_selected()
+ if not iter:
+ return
+ model.remove(iter)
+
+ def on_emoticons_treeview_key_press_event(self, widget, event):
+ if event.keyval == gtk.keysyms.Delete:
+ self.on_button_remove_emoticon_clicked(widget)
+
+
class Service_discovery_window:
"""Class for Service Discovery Window:
to know the services on the selected server"""
diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py
index c117ea583..18d2d4430 100644
--- a/plugins/gtkgui/dialogs.py
+++ b/plugins/gtkgui/dialogs.py
@@ -27,6 +27,7 @@ gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
import gtkgui
+import version
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
@@ -555,7 +556,7 @@ class About_dialog:
dlg = gtk.AboutDialog()
dlg.set_name('Gajim')
- dlg.set_version('0.6.1')
+ dlg.set_version(version.version)
s = u'Copyright \xa9 2003-2005 Gajim Team'
dlg.set_copyright(s)
text = open('COPYING').read()
@@ -778,21 +779,32 @@ class Change_password_dialog:
return message
class Popup_window:
- def __init__(self, plugin=None, account=None):
+ def __init__(self, plugin, event_type, event_desc):
self.plugin = plugin
- self.account = account
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = xml.get_widget('popup_window')
close_button = xml.get_widget('close_button')
- event_label = xml.get_widget('event_label')
+ event_type_label = xml.get_widget('event_type_label')
+ event_description_label = xml.get_widget('event_description_label')
+ eventbox = xml.get_widget('eventbox')
- event_label.set_text(str(len(self.plugin.roster.popup_windows)))
-
- self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('green'))
+ event_type_label.set_markup(''+event_type+'')
+ event_description_label.set_text(event_desc)
+ # set colors [ http://www.w3schools.com/html/html_colornames.asp ]
+ self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
+ if event_type == 'Contact Online':
+ close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('forestgreen'))
+ eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('forestgreen'))
+ elif event_type == 'Contact Offline':
+ close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('firebrick'))
+ eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('firebrick'))
+ elif event_type == 'New Message':
+ close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
+ eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
+
# position the window to bottom-right of screen
- gtk.gdk.flush()
window_width, window_height = self.window.get_size()
self.plugin.roster.popups_height += window_height
self.window.move(gtk.gdk.screen_width() - window_width, \
@@ -805,24 +817,19 @@ class Popup_window:
gobject.timeout_add(5000, self.on_timeout, window_height)
def on_close_button_clicked(self, widget, window_height):
- print 'window h', window_height
self.adjust_height_and_move_popup_windows(window_height)
def on_timeout(self, window_height):
self.adjust_height_and_move_popup_windows(window_height)
- print 'window h', window_height
def adjust_height_and_move_popup_windows(self, window_height):
#remove
- print 'self.plugin.roster.popups_height before', self.plugin.roster.popups_height
self.plugin.roster.popups_height -= window_height
- print 'self.plugin.roster.popups_height now', self.plugin.roster.popups_height
- print 'removing', self.window
self.window.destroy()
if len(self.plugin.roster.popup_windows) > 0:
# we want to remove the first window added in the list
- self.plugin.roster.popup_windows.pop(0) # remove
+ self.plugin.roster.popup_windows.pop(0) # remove first item
# move the rest of popup windows
self.plugin.roster.popups_height = 0
@@ -831,3 +838,6 @@ class Popup_window:
self.plugin.roster.popups_height += window_height
window_instance.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height)
+
+ def on_popup_window_button_press_event(self, widget, event):
+ print 'IN YOUR DREAMS ONLY..'
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index 76af651b0..d73cf5c61 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -2871,8 +2871,8 @@
4
- 500
- 380
+ 460
+ 410
Preferences
GTK_WINDOW_TOPLEVEL
GTK_WIN_POS_NONE
@@ -2974,6 +2974,57 @@
+
+
+ True
+ False
+ 10
+
+
+
+ True
+ If checked, Gajim will replace ascii smilies like ':)' with equivalent graphical emoticons
+ True
+ Use _emoticons
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ Add/Remove emoticons...
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ False
+
+
+
True
@@ -2993,6 +3044,7 @@
0.5
0
0
+ iconset_combobox
PANGO_ELLIPSIZE_NONE
-1
False
@@ -3041,7 +3093,7 @@
True
- 4
+ 5
4
False
5
@@ -3413,19 +3465,6 @@
-
-
- 0
- False
- True
-
-
-
-
-
- True
- False
- 0
@@ -3499,20 +3538,19 @@
- 0
- False
- False
+ 0
+ 3
+ 4
+ 5
+ fill
+
-
-
-
-
0
False
- False
+ True
@@ -3955,7 +3993,7 @@
True
4
- 3
+ 2
False
5
20
@@ -4219,8 +4257,8 @@
0
- True
- True
+ False
+ False
@@ -4283,261 +4321,6 @@
-
-
- 5
- True
- False
- 5
-
-
-
- True
- If checked, it will replace ascii smilies eg. :) with equivalent graphical emoticons
- True
- Use _emoticons
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
-
-
- 0
- False
- False
-
-
-
-
-
- True
-
-
- 0
- False
- True
-
-
-
-
-
- True
- False
- 0
-
-
-
- True
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_IN
- GTK_CORNER_TOP_LEFT
-
-
-
- True
- True
- True
- False
- False
- True
- False
- False
- False
-
-
-
-
-
- 0
- True
- True
-
-
-
-
-
- 5
- True
- GTK_BUTTONBOX_SPREAD
- 0
-
-
-
- True
- True
- True
- gtk-add
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
-
-
-
- True
- True
- True
- gtk-remove
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
-
-
-
- True
- True
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
-
- True
- 0.5
- 0.5
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
- True
- False
- 2
-
-
-
- True
- gtk-file
- 4
- 0.5
- 0.5
- 0
- 0
-
-
- 0
- False
- False
-
-
-
-
-
- True
- _Set Image
- True
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
-
-
-
-
-
-
- 0
- False
- True
-
-
-
-
- 0
- True
- True
-
-
-
-
- False
- True
-
-
-
-
-
- True
- False
- 0
-
-
-
- True
- 0.5
- 0.5
- 0
- 0
-
-
- 0
- True
- True
-
-
-
-
-
- True
- Emoticons
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
- tab
-
-
-
5
@@ -4546,38 +4329,97 @@
5
-
+
True
- If checked, Gajim will automatically show the new received message in a new chat window or tab in an existing chat window
- True
- Autopopup _new messages
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
-
-
- 0
- False
- False
-
-
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
-
-
- True
- True
- Allow auto popup when _away/DND
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+ True
+ <b>When new chat nessage is received</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ label_item
+
+
0
@@ -4607,28 +4449,212 @@
-
+
True
-
-
- 0
- False
- True
-
-
-
-
-
- True
- False
- 5
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
-
+
True
- _Sound player:
- True
- False
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ 0
+
+
+
+ True
+ True
+ Play _sounds
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 5
+
+
+
+ True
+ _Player:
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ soundplayer_entry
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ True
+ True
+ True
+ 0
+
+ True
+ *
+ False
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 5
+
+
+
+ True
+ True
+ True
+ True
+ 0
+
+ True
+ *
+ False
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ True
+ ...
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ 0
+ False
+ False
+ GTK_PACK_END
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
+
+
+
+
+
+ True
+ <b>Sounds</b>
+ False
+ True
GTK_JUSTIFY_LEFT
False
False
@@ -4636,69 +4662,15 @@
0.5
0
0
- soundplayer_entry
PANGO_ELLIPSIZE_NONE
-1
False
0
- 0
- False
- False
+ label_item
-
-
-
- True
- True
- True
- True
- 0
-
- True
- *
- False
-
-
-
- 0
- True
- True
-
-
-
-
- 0
- False
- True
-
-
-
-
-
- True
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_IN
- GTK_CORNER_TOP_LEFT
-
-
-
- True
- True
- True
- False
- False
- True
- False
- False
- False
-
-
-
0
@@ -4706,56 +4678,6 @@
True
-
-
-
- True
- False
- 5
-
-
-
- True
- True
- True
- True
- 0
-
- True
- *
- False
-
-
- 0
- True
- True
-
-
-
-
-
- True
- True
- ...
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
- 0
- False
- False
- GTK_PACK_END
-
-
-
-
- 0
- False
- True
-
-
False
@@ -5103,7 +5025,7 @@
0
- True
+ False
False
@@ -5173,9 +5095,9 @@
-
+
True
- False
+ GTK_BUTTONBOX_START
0
@@ -5190,11 +5112,6 @@
True
-
- 0
- False
- False
-
@@ -5209,11 +5126,6 @@
True
-
- 0
- False
- False
-
@@ -5262,7 +5174,7 @@
0
- True
+ False
True
@@ -5746,7 +5658,90 @@ Custom
-
+
+ True
+ 0
+ 0.5
+ GTK_SHADOW_NONE
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Don't send OS Information
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ <b>Miscellaneous</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ True
+ True
+
@@ -9867,25 +9862,91 @@ send a chat message to
GDK_WINDOW_TYPE_HINT_NORMAL
GDK_GRAVITY_SOUTH_EAST
True
+
-
+
True
- False
- 5
+ True
+ False
-
+
+ 2
True
False
5
-
+
True
- <b>type_of_event</b>
+ False
+ 5
+
+
+
+ True
+ <b>event_type_label</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ True
+ GTK_RELIEF_NONE
+ True
+
+
+
+ True
+ gtk-close
+ 1
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ event_description_label
False
- True
+ False
GTK_JUSTIFY_LEFT
False
False
@@ -9900,35 +9961,63 @@ send a chat message to
0
- False
- False
+ True
+ True
+
+
+
+
+
+
+
+ 5
+ 300
+ 350
+ Add/Remove Emoticons
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ False
+ True
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_NORMAL
+ GDK_GRAVITY_NORTH_WEST
+ True
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ 5
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
-
+
True
True
- GTK_RELIEF_NORMAL
- True
-
-
-
- True
- gtk-close
- 1
- 0.5
- 0.5
- 0
- 0
-
-
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
-
- 0
- False
- False
-
@@ -9939,26 +10028,66 @@ send a chat message to
-
+
True
- jid_label
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
+ GTK_BUTTONBOX_START
+ 5
+
+
+
+ True
+ True
+ True
+ gtk-add
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-remove
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+
+
+ True
+ True
+ True
+ Set Image
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-close
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
0
- True
+ False
True
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index a8d9c95e9..679280ebc 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -325,7 +325,7 @@ class plugin:
def handle_event_error(self, unused, msg):
Error_dialog(msg)
- def handle_event_status(self, account, status):
+ def handle_event_status(self, account, status): # OUR status
#('STATUS', account, status)
self.roster.on_status_changed(account, status)
@@ -398,9 +398,19 @@ class plugin:
if old_show < 2 and statuss.index(user1.show) > 1 and \
self.config['sound_contact_connected']:
self.play_sound('sound_contact_connected')
+ if not self.windows[account]['chats'].has_key(jid) and \
+ not self.queues[account].has_key(jid) and \
+ not self.config['autopopup']:
+ instance = Popup_window(self, 'Contact Online', jid )
+ self.roster.popup_windows.append(instance)
elif old_show > 1 and statuss.index(user1.show) < 2 and \
self.config['sound_contact_disconnected']:
self.play_sound('sound_contact_disconnected')
+ if not self.windows[account]['chats'].has_key(jid) and \
+ not self.queues[account].has_key(jid) and \
+ not self.config['autopopup']:
+ instance = Popup_window(self, 'Contact Offline', jid )
+ self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
#it is a groupchat presence
@@ -416,10 +426,14 @@ class plugin:
if self.config['ignore_unknown_contacts'] and \
not self.roster.contacts[account].has_key(jid):
return
- first = 0
+
+ first = False
if not self.windows[account]['chats'].has_key(jid) and \
- not self.queues[account].has_key(jid):
- first = 1
+ not self.queues[account].has_key(jid):
+ first = True
+ if not self.config['autopopup']:
+ instance = Popup_window(self, 'New Message', 'From '+ jid )
+ self.roster.popup_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
if self.config['sound_first_message_received'] and first:
self.play_sound('sound_first_message_received')
@@ -772,7 +786,7 @@ class plugin:
self.basic_pattern_re = sre.compile(basic_pattern, sre.IGNORECASE)
emoticons_pattern = ''
- for emoticon in self.emoticons: # travel tru emoticons list
+ for emoticon in self.emoticons: # travel thru emoticons list
emoticon_escaped = sre.escape(emoticon) # espace regexp metachars
emoticons_pattern += emoticon_escaped + '|'# | means or in regexp
@@ -787,17 +801,17 @@ class plugin:
self.launch_browser_mailer(kind, url)
def init_regexp(self):
- if self.config['useemoticons']:
- """initialize emoticons dictionary"""
- self.emoticons = dict()
- split_line = self.config['emoticons'].split('\t')
- for i in range(0, len(split_line)/2):
- emot_file = split_line[2*i+1]
- if not self.image_is_ok(emot_file):
- continue
- pix = gtk.gdk.pixbuf_new_from_file(emot_file)
- self.emoticons[split_line[2*i]] = pix
-
+ #initialize emoticons dictionary
+ self.emoticons = dict()
+ split_line = self.config['emoticons'].split('\t')
+ for i in range(0, len(split_line)/2):
+ emot_file = split_line[2*i+1]
+ if not self.image_is_ok(emot_file):
+ continue
+ pix = gtk.gdk.pixbuf_new_from_file(emot_file)
+ self.emoticons[split_line[2*i]] = pix
+
+ # update regular expressions
self.make_regexps()
def __init__(self, quIN, quOUT):
@@ -814,8 +828,8 @@ class plugin:
'MYVCARD', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', 'VISUAL', 'GC_MSG', \
'GC_SUBJECT', 'BAD_PASSPHRASE', 'GPG_SECRETE_KEYS', 'ROSTER_INFO', \
'MSGSENT'])
- self.default_config = {'autopopup':1,\
- 'autopopupaway':1,\
+ self.default_config = {'autopopup':0,\
+ 'autopopupaway':0,\
'ignore_unknown_contacts':0,\
'showoffline':0,\
'autoaway':1,\
@@ -882,6 +896,7 @@ class plugin:
'after_time': ']',\
'before_nickname': '<',\
'after_nickname': '>',\
+ 'do_not_send_os_info': 0,\
}
self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', self.default_config))
self.config = self.wait('CONFIG')
diff --git a/plugins/gtkgui/pixmaps/smile.png b/plugins/gtkgui/pixmaps/smile.png
deleted file mode 100644
index 981b7d915..000000000
Binary files a/plugins/gtkgui/pixmaps/smile.png and /dev/null differ
diff --git a/plugins/gtkgui/roster_window.py b/plugins/gtkgui/roster_window.py
index 3b4f0f3cd..3a4d4838b 100644
--- a/plugins/gtkgui/roster_window.py
+++ b/plugins/gtkgui/roster_window.py
@@ -917,8 +917,9 @@ class Roster_window:
New_message_dialog(self.plugin, account)
def on_about_menuitem_activate(self, widget):
- #About_dialog()
- self.popup_windows.append( Popup_window(self.plugin) )
+ About_dialog()
+ #inst = Popup_window(self.plugin, 'Fake Message', 'nkour@')
+ #self.popup_windows.append( inst )
def on_accounts_menuitem_activate(self, widget):
if self.plugin.windows.has_key('accounts'):
diff --git a/version.py b/version.py
new file mode 100644
index 000000000..618bfba40
--- /dev/null
+++ b/version.py
@@ -0,0 +1 @@
+version='0.7'