adding setting in advanced/misc for not checking for new version. [this is not an expert setting, and should stay in prefs window]. ALSO fixes/typos all over
This commit is contained in:
parent
4e722bd62e
commit
3d7d4c1fff
10 changed files with 214 additions and 135 deletions
115
src/common/cell_renderer_image.py
Normal file
115
src/common/cell_renderer_image.py
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
## cell_renderer_image.py
|
||||||
|
##
|
||||||
|
## Gajim Team:
|
||||||
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
|
## - Vincent Hanquez <tab@snarc.org>
|
||||||
|
## - Nikos Kouremenos <kourem@gmail.com>
|
||||||
|
##
|
||||||
|
## Copyright (C) 2003-2005 Gajim Team
|
||||||
|
##
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published
|
||||||
|
## by the Free Software Foundation; version 2 only.
|
||||||
|
##
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
##
|
||||||
|
|
||||||
|
import gtk
|
||||||
|
import gobject
|
||||||
|
|
||||||
|
class CellRendererImage(gtk.GenericCellRenderer):
|
||||||
|
|
||||||
|
__gproperties__ = {
|
||||||
|
'image': (gobject.TYPE_OBJECT, 'Image',
|
||||||
|
'Image', gobject.PARAM_READWRITE),
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.__gobject_init__()
|
||||||
|
self.image = None
|
||||||
|
|
||||||
|
def do_set_property(self, pspec, value):
|
||||||
|
setattr(self, pspec.name, value)
|
||||||
|
|
||||||
|
def do_get_property(self, pspec):
|
||||||
|
return getattr(self, pspec.name)
|
||||||
|
|
||||||
|
def func(self, model, path, iter, (image, tree)):
|
||||||
|
if model.get_value(iter, 0) == image:
|
||||||
|
self.redraw = 1
|
||||||
|
cell_area = tree.get_cell_area(path, tree.get_column(0))
|
||||||
|
tree.queue_draw_area(cell_area.x, cell_area.y, cell_area.width, \
|
||||||
|
cell_area.height)
|
||||||
|
|
||||||
|
def animation_timeout(self, tree, image):
|
||||||
|
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
|
self.redraw = 0
|
||||||
|
image.get_data('iter').advance()
|
||||||
|
model = tree.get_model()
|
||||||
|
model.foreach(self.func, (image, tree))
|
||||||
|
if self.redraw:
|
||||||
|
gobject.timeout_add(image.get_data('iter').get_delay_time(), \
|
||||||
|
self.animation_timeout, tree, image)
|
||||||
|
else:
|
||||||
|
image.set_data('iter', None)
|
||||||
|
|
||||||
|
def on_render(self, window, widget, background_area,cell_area, \
|
||||||
|
expose_area, flags):
|
||||||
|
if not self.image:
|
||||||
|
return
|
||||||
|
pix_rect = gtk.gdk.Rectangle()
|
||||||
|
pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height = \
|
||||||
|
self.on_get_size(widget, cell_area)
|
||||||
|
|
||||||
|
pix_rect.x += cell_area.x
|
||||||
|
pix_rect.y += cell_area.y
|
||||||
|
pix_rect.width -= 2 * self.get_property('xpad')
|
||||||
|
pix_rect.height -= 2 * self.get_property('ypad')
|
||||||
|
|
||||||
|
draw_rect = cell_area.intersect(pix_rect)
|
||||||
|
draw_rect = expose_area.intersect(draw_rect)
|
||||||
|
|
||||||
|
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
|
if not self.image.get_data('iter'):
|
||||||
|
animation = self.image.get_animation()
|
||||||
|
self.image.set_data('iter', animation.get_iter())
|
||||||
|
gobject.timeout_add(self.image.get_data('iter').get_delay_time(), \
|
||||||
|
self.animation_timeout, widget, self.image)
|
||||||
|
|
||||||
|
pix = self.image.get_data('iter').get_pixbuf()
|
||||||
|
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
||||||
|
pix = self.image.get_pixbuf()
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
window.draw_pixbuf(widget.style.black_gc, pix, \
|
||||||
|
draw_rect.x-pix_rect.x, draw_rect.y-pix_rect.y, draw_rect.x, \
|
||||||
|
draw_rect.y+2, draw_rect.width, draw_rect.height, \
|
||||||
|
gtk.gdk.RGB_DITHER_NONE, 0, 0)
|
||||||
|
|
||||||
|
def on_get_size(self, widget, cell_area):
|
||||||
|
if not self.image:
|
||||||
|
return 0, 0, 0, 0
|
||||||
|
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
|
animation = self.image.get_animation()
|
||||||
|
pix = animation.get_iter().get_pixbuf()
|
||||||
|
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
||||||
|
pix = self.image.get_pixbuf()
|
||||||
|
else:
|
||||||
|
return 0, 0, 0, 0
|
||||||
|
pixbuf_width = pix.get_width()
|
||||||
|
pixbuf_height = pix.get_height()
|
||||||
|
calc_width = self.get_property('xpad') * 2 + pixbuf_width
|
||||||
|
calc_height = self.get_property('ypad') * 2 + pixbuf_height
|
||||||
|
x_offset = 0
|
||||||
|
y_offset = 0
|
||||||
|
if cell_area and pixbuf_width > 0 and pixbuf_height > 0:
|
||||||
|
x_offset = self.get_property('xalign') * (cell_area.width - \
|
||||||
|
calc_width - self.get_property('xpad'))
|
||||||
|
y_offset = self.get_property('yalign') * (cell_area.height - \
|
||||||
|
calc_height - self.get_property('ypad'))
|
||||||
|
return x_offset, y_offset, calc_width, calc_height
|
||||||
|
|
||||||
|
gobject.type_register(CellRendererImage)
|
|
@ -1,3 +1,22 @@
|
||||||
|
## common/check_for_new_version.py
|
||||||
|
##
|
||||||
|
## Gajim Team:
|
||||||
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
|
## - Vincent Hanquez <tab@snarc.org>
|
||||||
|
## - Nikos Kouremenos <kourem@gmail.com>
|
||||||
|
##
|
||||||
|
## Copyright (C) 2003-2005 Gajim Team
|
||||||
|
##
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published
|
||||||
|
## by the Free Software Foundation; version 2 only.
|
||||||
|
##
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
##
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
|
||||||
|
@ -9,7 +28,7 @@ APP = i18n.APP
|
||||||
gtk.glade.bindtextdomain(APP, i18n.DIR)
|
gtk.glade.bindtextdomain(APP, i18n.DIR)
|
||||||
gtk.glade.textdomain(APP)
|
gtk.glade.textdomain(APP)
|
||||||
|
|
||||||
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
class Check_for_new_version_dialog:
|
class Check_for_new_version_dialog:
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
import re
|
import sre
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
OPT_TYPE = 0
|
OPT_TYPE = 0
|
||||||
|
@ -87,6 +87,7 @@ class Config:
|
||||||
'before_nickname': [ opt_str, '<' ],
|
'before_nickname': [ opt_str, '<' ],
|
||||||
'after_nickname': [ opt_str, '>' ],
|
'after_nickname': [ opt_str, '>' ],
|
||||||
'do_not_send_os_info': [ opt_bool, False ],
|
'do_not_send_os_info': [ opt_bool, False ],
|
||||||
|
'do_not_check_for_new_version': [ opt_bool, False ],
|
||||||
'usegpg': [ opt_bool, False ],
|
'usegpg': [ opt_bool, False ],
|
||||||
'lognotusr': [ opt_bool, True ],
|
'lognotusr': [ opt_bool, True ],
|
||||||
'lognotsep': [ opt_bool, True ],
|
'lognotsep': [ opt_bool, True ],
|
||||||
|
@ -236,7 +237,7 @@ class Config:
|
||||||
elif type[0] == 'string':
|
elif type[0] == 'string':
|
||||||
return self.is_valid_string(val)
|
return self.is_valid_string(val)
|
||||||
else:
|
else:
|
||||||
return re.match(type[1], val)
|
return sre.match(type[1], val)
|
||||||
|
|
||||||
def set(self, optname, value):
|
def set(self, optname, value):
|
||||||
if not self.__options.has_key(optname):
|
if not self.__options.has_key(optname):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## Gajim Team:
|
## Gajim Team:
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## - Vincent Hanquez <tab@snarc.org>
|
## - Vincent Hanquez <tab@snarc.org>
|
||||||
|
## - Nikos Kouremenos <kourem@gmail.com>
|
||||||
##
|
##
|
||||||
## Copyright (C) 2003-2005 Gajim Team
|
## Copyright (C) 2003-2005 Gajim Team
|
||||||
##
|
##
|
||||||
|
@ -20,7 +21,7 @@ import logging
|
||||||
import common.config
|
import common.config
|
||||||
import common.logger
|
import common.logger
|
||||||
|
|
||||||
version = "0.7"
|
version = '0.7'
|
||||||
config = common.config.Config()
|
config = common.config.Config()
|
||||||
connections = {}
|
connections = {}
|
||||||
log = logging.getLogger('Gajim')
|
log = logging.getLogger('Gajim')
|
||||||
|
|
|
@ -22,17 +22,19 @@ import gtk.glade
|
||||||
import gobject
|
import gobject
|
||||||
import os
|
import os
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
|
|
||||||
|
import dialogs
|
||||||
|
import gtkgui
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import connection
|
from common import connection
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
from common import cell_renderer_image
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
APP = i18n.APP
|
APP = i18n.APP
|
||||||
gtk.glade.bindtextdomain (APP, i18n.DIR)
|
gtk.glade.bindtextdomain (APP, i18n.DIR)
|
||||||
gtk.glade.textdomain (APP)
|
gtk.glade.textdomain (APP)
|
||||||
|
|
||||||
import dialogs
|
|
||||||
import gtkgui
|
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,6 +497,12 @@ class Preferences_window:
|
||||||
gajim.config.set('do_not_send_os_info', False)
|
gajim.config.set('do_not_send_os_info', False)
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
|
def on_do_not_check_for_new_version_checkbutton_toggled(self, widget):
|
||||||
|
if widget.get_active():
|
||||||
|
gajim.config.set('do_not_check_for_new_version', True)
|
||||||
|
else:
|
||||||
|
gajim.config.set('do_not_check_for_new_version', False)
|
||||||
|
self.plugin.save_config()
|
||||||
|
|
||||||
def fill_msg_treeview(self):
|
def fill_msg_treeview(self):
|
||||||
self.xml.get_widget('delete_msg_button').set_sensitive(False)
|
self.xml.get_widget('delete_msg_button').set_sensitive(False)
|
||||||
|
@ -883,6 +891,12 @@ class Preferences_window:
|
||||||
# don't send os info
|
# don't send os info
|
||||||
st = gajim.config.get('do_not_send_os_info')
|
st = gajim.config.get('do_not_send_os_info')
|
||||||
self.xml.get_widget('do_not_send_os_info_checkbutton').set_active(st)
|
self.xml.get_widget('do_not_send_os_info_checkbutton').set_active(st)
|
||||||
|
|
||||||
|
# don't check for new version
|
||||||
|
st = gajim.config.get('do_not_check_for_new_version')
|
||||||
|
btn = self.xml.get_widget('do_not_check_for_new_version_checkbutton')
|
||||||
|
btn.set_active(st)
|
||||||
|
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
|
|
||||||
self.sound_tree.get_model().connect('row-changed', \
|
self.sound_tree.get_model().connect('row-changed', \
|
||||||
|
@ -1485,7 +1499,7 @@ class Add_remove_emoticons_window:
|
||||||
|
|
||||||
col = gtk.TreeViewColumn(_('Image'))
|
col = gtk.TreeViewColumn(_('Image'))
|
||||||
self.emot_tree.append_column(col)
|
self.emot_tree.append_column(col)
|
||||||
renderer = gtkgui.CellRendererImage()
|
renderer = cell_renderer_image.CellRendererImage()
|
||||||
col.pack_start(renderer, expand = False)
|
col.pack_start(renderer, expand = False)
|
||||||
col.add_attribute(renderer, 'image', 2)
|
col.add_attribute(renderer, 'image', 2)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## plugins/dialogs.py
|
## dialogs.py
|
||||||
##
|
##
|
||||||
## Gajim Team:
|
## Gajim Team:
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
|
|
135
src/gajim.py
135
src/gajim.py
|
@ -29,10 +29,11 @@ import pango
|
||||||
import gobject
|
import gobject
|
||||||
import os
|
import os
|
||||||
import sre
|
import sre
|
||||||
from common import gajim
|
import signal
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
import common.check_for_new_version
|
import common.check_for_new_version
|
||||||
|
|
||||||
|
from common import gajim
|
||||||
from common import i18n
|
from common import i18n
|
||||||
i18n.init()
|
i18n.init()
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
@ -48,102 +49,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class CellRendererImage(gtk.GenericCellRenderer):
|
|
||||||
|
|
||||||
__gproperties__ = {
|
|
||||||
'image': (gobject.TYPE_OBJECT, 'Image',
|
|
||||||
'Image', gobject.PARAM_READWRITE),
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.__gobject_init__()
|
|
||||||
self.image = None
|
|
||||||
|
|
||||||
def do_set_property(self, pspec, value):
|
|
||||||
setattr(self, pspec.name, value)
|
|
||||||
|
|
||||||
def do_get_property(self, pspec):
|
|
||||||
return getattr(self, pspec.name)
|
|
||||||
|
|
||||||
def func(self, model, path, iter, (image, tree)):
|
|
||||||
if model.get_value(iter, 0) == image:
|
|
||||||
self.redraw = 1
|
|
||||||
cell_area = tree.get_cell_area(path, tree.get_column(0))
|
|
||||||
tree.queue_draw_area(cell_area.x, cell_area.y, cell_area.width, \
|
|
||||||
cell_area.height)
|
|
||||||
|
|
||||||
def animation_timeout(self, tree, image):
|
|
||||||
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
|
||||||
self.redraw = 0
|
|
||||||
image.get_data('iter').advance()
|
|
||||||
model = tree.get_model()
|
|
||||||
model.foreach(self.func, (image, tree))
|
|
||||||
if self.redraw:
|
|
||||||
gobject.timeout_add(image.get_data('iter').get_delay_time(), \
|
|
||||||
self.animation_timeout, tree, image)
|
|
||||||
else:
|
|
||||||
image.set_data('iter', None)
|
|
||||||
|
|
||||||
def on_render(self, window, widget, background_area,cell_area, \
|
|
||||||
expose_area, flags):
|
|
||||||
if not self.image:
|
|
||||||
return
|
|
||||||
pix_rect = gtk.gdk.Rectangle()
|
|
||||||
pix_rect.x, pix_rect.y, pix_rect.width, pix_rect.height = \
|
|
||||||
self.on_get_size(widget, cell_area)
|
|
||||||
|
|
||||||
pix_rect.x += cell_area.x
|
|
||||||
pix_rect.y += cell_area.y
|
|
||||||
pix_rect.width -= 2 * self.get_property('xpad')
|
|
||||||
pix_rect.height -= 2 * self.get_property('ypad')
|
|
||||||
|
|
||||||
draw_rect = cell_area.intersect(pix_rect)
|
|
||||||
draw_rect = expose_area.intersect(draw_rect)
|
|
||||||
|
|
||||||
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
|
||||||
if not self.image.get_data('iter'):
|
|
||||||
animation = self.image.get_animation()
|
|
||||||
self.image.set_data('iter', animation.get_iter())
|
|
||||||
gobject.timeout_add(self.image.get_data('iter').get_delay_time(), \
|
|
||||||
self.animation_timeout, widget, self.image)
|
|
||||||
|
|
||||||
pix = self.image.get_data('iter').get_pixbuf()
|
|
||||||
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
|
||||||
pix = self.image.get_pixbuf()
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
window.draw_pixbuf(widget.style.black_gc, pix, \
|
|
||||||
draw_rect.x-pix_rect.x, draw_rect.y-pix_rect.y, draw_rect.x, \
|
|
||||||
draw_rect.y+2, draw_rect.width, draw_rect.height, \
|
|
||||||
gtk.gdk.RGB_DITHER_NONE, 0, 0)
|
|
||||||
|
|
||||||
def on_get_size(self, widget, cell_area):
|
|
||||||
if not self.image:
|
|
||||||
return 0, 0, 0, 0
|
|
||||||
if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
|
||||||
animation = self.image.get_animation()
|
|
||||||
pix = animation.get_iter().get_pixbuf()
|
|
||||||
elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
|
||||||
pix = self.image.get_pixbuf()
|
|
||||||
else:
|
|
||||||
return 0, 0, 0, 0
|
|
||||||
pixbuf_width = pix.get_width()
|
|
||||||
pixbuf_height = pix.get_height()
|
|
||||||
calc_width = self.get_property('xpad') * 2 + pixbuf_width
|
|
||||||
calc_height = self.get_property('ypad') * 2 + pixbuf_height
|
|
||||||
x_offset = 0
|
|
||||||
y_offset = 0
|
|
||||||
if cell_area and pixbuf_width > 0 and pixbuf_height > 0:
|
|
||||||
x_offset = self.get_property('xalign') * (cell_area.width - \
|
|
||||||
calc_width - self.get_property('xpad'))
|
|
||||||
y_offset = self.get_property('yalign') * (cell_area.height - \
|
|
||||||
calc_height - self.get_property('ypad'))
|
|
||||||
return x_offset, y_offset, calc_width, calc_height
|
|
||||||
|
|
||||||
gobject.type_register(CellRendererImage)
|
|
||||||
|
|
||||||
class User:
|
class User:
|
||||||
"""Information concerning each users"""
|
'''Information concerning each users'''
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
self.jid = ''
|
self.jid = ''
|
||||||
|
@ -177,7 +84,7 @@ import config
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
|
|
||||||
class interface:
|
class Interface:
|
||||||
def launch_browser_mailer(self, kind, url):
|
def launch_browser_mailer(self, kind, url):
|
||||||
#kind = 'url' or 'mail'
|
#kind = 'url' or 'mail'
|
||||||
if gajim.config.get('openwith') == 'gnome-open':
|
if gajim.config.get('openwith') == 'gnome-open':
|
||||||
|
@ -207,7 +114,7 @@ class interface:
|
||||||
|
|
||||||
def play_timeout(self, pid):
|
def play_timeout(self, pid):
|
||||||
pidp, r = os.waitpid(pid, os.WNOHANG)
|
pidp, r = os.waitpid(pid, os.WNOHANG)
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
def play_sound(self, event):
|
def play_sound(self, event):
|
||||||
if not gajim.config.get('sounds_on'):
|
if not gajim.config.get('sounds_on'):
|
||||||
|
@ -257,7 +164,7 @@ class interface:
|
||||||
if not resource:
|
if not resource:
|
||||||
resource = ''
|
resource = ''
|
||||||
priority = array[4]
|
priority = array[4]
|
||||||
if jid.find("@") <= 0:
|
if jid.find('@') <= 0:
|
||||||
#It must be an agent
|
#It must be an agent
|
||||||
ji = jid.replace('@', '')
|
ji = jid.replace('@', '')
|
||||||
else:
|
else:
|
||||||
|
@ -280,7 +187,7 @@ class interface:
|
||||||
if user1.show in statuss:
|
if user1.show in statuss:
|
||||||
old_show = statuss.index(user1.show)
|
old_show = statuss.index(user1.show)
|
||||||
if (resources != [''] and (len(luser) != 1 or
|
if (resources != [''] and (len(luser) != 1 or
|
||||||
luser[0].show != 'offline')) and not jid.find("@") <= 0:
|
luser[0].show != 'offline')) and not jid.find('@') <= 0:
|
||||||
old_show = 0
|
old_show = 0
|
||||||
user1 = User(user1.jid, user1.name, user1.groups, user1.show, \
|
user1 = User(user1.jid, user1.name, user1.groups, user1.show, \
|
||||||
user1.status, user1.sub, user1.ask, user1.resource, \
|
user1.status, user1.sub, user1.ask, user1.resource, \
|
||||||
|
@ -309,7 +216,7 @@ class interface:
|
||||||
user1.status = array[2]
|
user1.status = array[2]
|
||||||
user1.priority = priority
|
user1.priority = priority
|
||||||
user1.keyID = keyID
|
user1.keyID = keyID
|
||||||
if jid.find("@") <= 0:
|
if jid.find('@') <= 0:
|
||||||
#It must be an agent
|
#It must be an agent
|
||||||
if self.roster.contacts[account].has_key(ji):
|
if self.roster.contacts[account].has_key(ji):
|
||||||
#Update existing iter
|
#Update existing iter
|
||||||
|
@ -346,7 +253,7 @@ class interface:
|
||||||
def handle_event_msg(self, account, array):
|
def handle_event_msg(self, account, array):
|
||||||
#('MSG', account, (user, msg, time))
|
#('MSG', account, (user, msg, time))
|
||||||
jid = array[0].split('/')[0]
|
jid = array[0].split('/')[0]
|
||||||
if jid.find("@") <= 0:
|
if jid.find('@') <= 0:
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
if gajim.config.get('ignore_unknown_contacts') and \
|
if gajim.config.get('ignore_unknown_contacts') and \
|
||||||
not self.roster.contacts[account].has_key(jid):
|
not self.roster.contacts[account].has_key(jid):
|
||||||
|
@ -370,7 +277,7 @@ class interface:
|
||||||
def handle_event_msgerror(self, account, array):
|
def handle_event_msgerror(self, account, array):
|
||||||
#('MSGERROR', account, (user, error_code, error_msg, msg, time))
|
#('MSGERROR', account, (user, error_code, error_msg, msg, time))
|
||||||
jid = array[0].split('/')[0]
|
jid = array[0].split('/')[0]
|
||||||
if jid.find("@") <= 0:
|
if jid.find('@') <= 0:
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
self.roster.on_message(jid, _('error while sending') + \
|
self.roster.on_message(jid, _('error while sending') + \
|
||||||
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account)
|
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account)
|
||||||
|
@ -523,9 +430,9 @@ class interface:
|
||||||
self.roster.redraw_jid(jid, account)
|
self.roster.redraw_jid(jid, account)
|
||||||
|
|
||||||
def read_sleepy(self):
|
def read_sleepy(self):
|
||||||
"""Check if we are idle"""
|
'''Check if we are idle'''
|
||||||
if not self.sleeper.poll():
|
if not self.sleeper.poll():
|
||||||
return 1
|
return True # renew timeout (loop for ever)
|
||||||
state = self.sleeper.getState()
|
state = self.sleeper.getState()
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if not self.sleeper_state[account]:
|
if not self.sleeper_state[account]:
|
||||||
|
@ -548,10 +455,10 @@ class interface:
|
||||||
#we go extended away
|
#we go extended away
|
||||||
gajim.connections[account].change_status('xa', 'auto away (idle)')
|
gajim.connections[account].change_status('xa', 'auto away (idle)')
|
||||||
self.sleeper_state[account] = 3
|
self.sleeper_state[account] = 3
|
||||||
return 1
|
return True # renew timeout (loop for ever)
|
||||||
|
|
||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
"""auto connect at startup"""
|
'''auto connect at startup'''
|
||||||
ask_message = 0
|
ask_message = 0
|
||||||
for a in gajim.connections:
|
for a in gajim.connections:
|
||||||
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
||||||
|
@ -564,7 +471,7 @@ class interface:
|
||||||
for a in gajim.connections:
|
for a in gajim.connections:
|
||||||
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
||||||
self.roster.send_status(a, 'online', message, 1)
|
self.roster.send_status(a, 'online', message, 1)
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
def show_systray(self):
|
def show_systray(self):
|
||||||
self.systray.show_icon()
|
self.systray.show_icon()
|
||||||
|
@ -681,10 +588,13 @@ class interface:
|
||||||
conn.register_handler('ROSTER_INFO', self.handle_event_roster_info)
|
conn.register_handler('ROSTER_INFO', self.handle_event_roster_info)
|
||||||
|
|
||||||
def process_connections(self):
|
def process_connections(self):
|
||||||
|
try:
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if gajim.connections[account].connected:
|
if gajim.connections[account].connected:
|
||||||
gajim.connections[account].process(0.01)
|
gajim.connections[account].process(0.01)
|
||||||
return True
|
return True # renew timeout (loop for ever)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
def save_config(self):
|
def save_config(self):
|
||||||
parser.read_config()
|
parser.read_config()
|
||||||
|
@ -738,6 +648,7 @@ class interface:
|
||||||
if self.systray_capabilities:
|
if self.systray_capabilities:
|
||||||
self.show_systray()
|
self.show_systray()
|
||||||
|
|
||||||
|
if not gajim.config.get('do_not_check_for_new_version'):
|
||||||
common.check_for_new_version.Check_for_new_version_dialog(self)
|
common.check_for_new_version.Check_for_new_version_dialog(self)
|
||||||
|
|
||||||
self.init_regexp()
|
self.init_regexp()
|
||||||
|
@ -752,10 +663,12 @@ class interface:
|
||||||
self.register_handlers(gajim.connections[account])
|
self.register_handlers(gajim.connections[account])
|
||||||
|
|
||||||
gobject.timeout_add(100, self.autoconnect)
|
gobject.timeout_add(100, self.autoconnect)
|
||||||
gobject.timeout_add(500, self.read_sleepy)
|
|
||||||
gobject.timeout_add(200, self.process_connections)
|
gobject.timeout_add(200, self.process_connections)
|
||||||
|
gobject.timeout_add(500, self.read_sleepy)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application
|
||||||
|
|
||||||
try: # Import Psyco if available
|
try: # Import Psyco if available
|
||||||
import psyco
|
import psyco
|
||||||
psyco.full()
|
psyco.full()
|
||||||
|
@ -764,5 +677,5 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
parser.parseCfgFile()
|
parser.parseCfgFile()
|
||||||
parser.fill_config()
|
parser.fill_config()
|
||||||
interface()
|
Interface()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
|
@ -22,12 +22,11 @@ import gtk.glade
|
||||||
import pango
|
import pango
|
||||||
import gobject
|
import gobject
|
||||||
import time
|
import time
|
||||||
from common import gajim
|
|
||||||
import dialogs
|
import dialogs
|
||||||
import chat
|
import chat
|
||||||
from gtkgui import CellRendererImage
|
from common import gajim
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
from common import cell_renderer_image
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
APP = i18n.APP
|
APP = i18n.APP
|
||||||
|
@ -468,7 +467,7 @@ class Groupchat_window(chat.Chat):
|
||||||
#status_image, nickname, real_jid, status
|
#status_image, nickname, real_jid, status
|
||||||
store = gtk.TreeStore(gtk.Image, str, str, str)
|
store = gtk.TreeStore(gtk.Image, str, str, str)
|
||||||
column = gtk.TreeViewColumn('contacts')
|
column = gtk.TreeViewColumn('contacts')
|
||||||
renderer_image = CellRendererImage()
|
renderer_image = cell_renderer_image.CellRendererImage()
|
||||||
renderer_image.set_property('width', 20)
|
renderer_image.set_property('width', 20)
|
||||||
column.pack_start(renderer_image, expand = False)
|
column.pack_start(renderer_image, expand = False)
|
||||||
column.add_attribute(renderer_image, 'image', 0)
|
column.add_attribute(renderer_image, 'image', 0)
|
||||||
|
|
|
@ -5829,7 +5829,7 @@ Custom</property>
|
||||||
<widget class="GtkCheckButton" id="do_not_send_os_info_checkbutton">
|
<widget class="GtkCheckButton" id="do_not_send_os_info_checkbutton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Don't send OS Information</property>
|
<property name="label" translatable="yes">Do not send OS Information</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
|
@ -5846,7 +5846,23 @@ Custom</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<widget class="GtkCheckButton" id="do_not_check_for_new_version_checkbutton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">Do not check for new version at startup</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="on_do_not_check_for_new_version_checkbutton_toggled" last_modification_time="Mon, 18 Apr 2005 12:41:51 GMT"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## plugins/gtkgui/roster_window.py
|
## roster_window.py
|
||||||
##
|
##
|
||||||
## Gajim Team:
|
## Gajim Team:
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
|
@ -25,14 +25,15 @@ import os
|
||||||
import Queue
|
import Queue
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
|
|
||||||
from common import gajim
|
|
||||||
import tabbed_chat_window
|
import tabbed_chat_window
|
||||||
import groupchat_window
|
import groupchat_window
|
||||||
import history_window
|
import history_window
|
||||||
from gtkgui import CellRendererImage, User
|
|
||||||
import dialogs
|
import dialogs
|
||||||
import config
|
import config
|
||||||
|
|
||||||
|
from gtkgui import User
|
||||||
|
from common import gajim
|
||||||
|
from common import cell_renderer_image
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
@ -1359,7 +1360,7 @@ class Roster_window:
|
||||||
gobject.TYPE_STRING)
|
gobject.TYPE_STRING)
|
||||||
self.status_combobox = gtk.ComboBox()
|
self.status_combobox = gtk.ComboBox()
|
||||||
self.xml.get_widget('vbox1').pack_end(self.status_combobox, False)
|
self.xml.get_widget('vbox1').pack_end(self.status_combobox, False)
|
||||||
cell = CellRendererImage()
|
cell = cell_renderer_image.CellRendererImage()
|
||||||
self.status_combobox.pack_start(cell, False)
|
self.status_combobox.pack_start(cell, False)
|
||||||
self.status_combobox.add_attribute(cell, 'image', 1)
|
self.status_combobox.add_attribute(cell, 'image', 1)
|
||||||
cell = gtk.CellRendererText()
|
cell = gtk.CellRendererText()
|
||||||
|
@ -1386,7 +1387,7 @@ class Roster_window:
|
||||||
|
|
||||||
#this col has two cells: first one img, second one text
|
#this col has two cells: first one img, second one text
|
||||||
col = gtk.TreeViewColumn()
|
col = gtk.TreeViewColumn()
|
||||||
render_pixbuf = CellRendererImage()
|
render_pixbuf = cell_renderer_image.CellRendererImage()
|
||||||
col.pack_start(render_pixbuf, expand = False)
|
col.pack_start(render_pixbuf, expand = False)
|
||||||
col.add_attribute(render_pixbuf, 'image', 0)
|
col.add_attribute(render_pixbuf, 'image', 0)
|
||||||
col.set_cell_data_func(render_pixbuf, self.iconCellDataFunc, None)
|
col.set_cell_data_func(render_pixbuf, self.iconCellDataFunc, None)
|
||||||
|
|
Loading…
Add table
Reference in a new issue