we now depend on GTK2.12. Remove test for older versions. Fixes #4996

This commit is contained in:
Yann Leboulanger 2009-04-27 19:28:53 +00:00
parent 6f3b32d9fd
commit 9ea2a5c677
11 changed files with 52 additions and 184 deletions

View File

@ -15,8 +15,8 @@ Welcome to Gajim and thank you for trying out our client.
<h2>Runtime Requirements</h2>
<ul>
<li>python2.4 or higher</li>
<li>pygtk2.8 or higher</li>
<li>python2.5 or higher</li>
<li>pygtk2.12 or higher</li>
<li>python-libglade</li>
<li>pysqlite2 (if you have python 2.5, you already have this)</li>
</ul>
@ -143,7 +143,7 @@ That is all, <strong>enjoy!</strong>
<br/>
<br/>
<br/>
(C) 2003-2008<br/>
(C) 2003-200888888888<br/>
The Gajim Team<br/>
http://gajim.org<br/>
<br/>

2
debian/control vendored
View File

@ -13,7 +13,7 @@ Vcs-Browser: http://trac.gajim.org/browser
Package: gajim
Architecture: any
XB-Python-Version: ${python:Versions}
Depends: python (>= 2.4), python-support (>= 0.7.1), python-glade2 (>= 2.8.0), python-gtk2 (>= 2.8.0), python-pysqlite2 | python (>= 2.5), dnsutils, libc6
Depends: python (>= 2.4), python-support (>= 0.7.1), python-glade2 (>= 2.8.0), python-gtk2 (>= 2.12.0), python-pysqlite2 | python (>= 2.5), dnsutils, libc6
Recommends: dbus, python-dbus, notification-daemon, python-gnupginterface, python-openssl
Suggests: python-gnome2, nautilus-sendto, avahi-daemon, python-avahi, network-manager, libgtkspell0, aspell-en, python-gnome2-desktop (>= 2.16.0), gnome-keyring, python-sexy, python-kerberos (>= 1.1)
Description: Jabber client written in PyGTK

View File

@ -57,8 +57,6 @@ try:
except ImportError:
HAS_GTK_SPELL = False
HAVE_MARKUP_TOOLTIPS = gtk.pygtk_version >= (2, 12, 0)
# the next script, executed in the "po" directory,
# generates the following list.
##!/bin/sh
@ -453,8 +451,6 @@ class ChatControlBase(MessageControl):
self.connect_style_event(widget, opts[0], opts[1])
def _conv_textview_key_press_event(self, widget, event):
if gtk.gtk_version < (2, 12, 0):
return
if (event.state & gtk.gdk.CONTROL_MASK and event.keyval in (gtk.keysyms.c,
gtk.keysyms.Insert)) or (event.state & gtk.gdk.SHIFT_MASK and \
event.keyval in (gtk.keysyms.Page_Down, gtk.keysyms.Page_Up)):
@ -1188,11 +1184,6 @@ class ChatControl(ChatControlBase):
self._activity_image = self.xml.get_widget('activity_image')
self._tune_image = self.xml.get_widget('tune_image')
if not HAVE_MARKUP_TOOLTIPS:
self._mood_tooltip = gtk.Tooltips()
self._activity_tooltip = gtk.Tooltips()
self._tune_tooltip = gtk.Tooltips()
self.update_mood()
self.update_activity()
self.update_tune()
@ -1338,19 +1329,13 @@ class ChatControl(ChatControlBase):
self._mood_image.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
'unknown').get_pixbuf())
if HAVE_MARKUP_TOOLTIPS:
mood = gobject.markup_escape_text(mood)
mood = gobject.markup_escape_text(mood)
tooltip = '<b>%s</b>' % mood
if text:
text = gobject.markup_escape_text(text)
tooltip += '\n' + text
self._mood_image.set_tooltip_markup(tooltip)
else:
tooltip = mood
if text:
tooltip += '\n' + text
self._mood_tooltip.set_tip(self._mood_image, tooltip)
tooltip = '<b>%s</b>' % mood
if text:
text = gobject.markup_escape_text(text)
tooltip += '\n' + text
self._mood_image.set_tooltip_markup(tooltip)
self._mood_image.show()
else:
self._mood_image.hide()
@ -1388,21 +1373,13 @@ class ChatControl(ChatControlBase):
# Translate standard subactivities
if HAVE_MARKUP_TOOLTIPS:
tooltip = '<b>' + gobject.markup_escape_text(activity)
if subactivity:
tooltip += ': ' + gobject.markup_escape_text(subactivity)
tooltip += '</b>'
if text:
tooltip += '\n' + gobject.markup_escape_text(text)
self._activity_image.set_tooltip_markup(tooltip)
else:
tooltip = activity
if subactivity:
tooltip += ': ' + subactivity
if text:
tooltip += '\n' + text
self._activity_tooltip.set_tip(self._activity_image, tooltip)
tooltip = '<b>' + gobject.markup_escape_text(activity)
if subactivity:
tooltip += ': ' + gobject.markup_escape_text(subactivity)
tooltip += '</b>'
if text:
tooltip += '\n' + gobject.markup_escape_text(text)
self._activity_image.set_tooltip_markup(tooltip)
self._activity_image.show()
else:
@ -1418,16 +1395,13 @@ class ChatControl(ChatControlBase):
if 'artist' in self.contact.tune:
artist = self.contact.tune['artist'].strip()
if HAVE_MARKUP_TOOLTIPS:
artist = gobject.markup_escape_text(artist)
artist = gobject.markup_escape_text(artist)
if 'title' in self.contact.tune:
title = self.contact.tune['title'].strip()
if HAVE_MARKUP_TOOLTIPS:
title = gobject.markup_escape_text(title)
title = gobject.markup_escape_text(title)
if 'source' in self.contact.tune:
source = self.contact.tune['source'].strip()
if HAVE_MARKUP_TOOLTIPS:
source = gobject.markup_escape_text(source)
source = gobject.markup_escape_text(source)
if artist or title:
if not artist:
@ -1437,15 +1411,10 @@ class ChatControl(ChatControlBase):
if not source:
source = _('Unknown Source')
if HAVE_MARKUP_TOOLTIPS:
self._tune_image.set_tooltip_markup(
_('<b>"%(title)s"</b> by <i>%(artist)s</i>\n'
'from <i>%(source)s</i>') % {'title': title, 'artist': artist,
'source': source})
else:
self._tune_tooltip.set_tip(self._tune_image,
_('%(title)s by %(artist)s\nfrom %(source)s') % {'title': title,
'artist': artist, 'source': source})
self._tune_image.set_tooltip_markup(
_('<b>"%(title)s"</b> by <i>%(artist)s</i>\n'
'from <i>%(source)s</i>') % {'title': title, 'artist': artist,
'source': source})
self._tune_image.show()
else:
self._tune_image.hide()
@ -2656,8 +2625,7 @@ class ChatControl(ChatControlBase):
# so this line adds that
window.set_events(gtk.gdk.POINTER_MOTION_MASK)
window.set_app_paintable(True)
if gtk.gtk_version >= (2, 10, 0) and gtk.pygtk_version >= (2, 10, 0):
window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
window.realize()
window.window.set_back_pixmap(pixmap, False) # make it transparent

View File

@ -2106,8 +2106,7 @@ class PopupNotificationWindow:
xml = gtkgui_helpers.get_glade('popup_notification_window.glade')
self.window = xml.get_widget('popup_notification_window')
if gtk.gtk_version >= (2, 10, 0) and gtk.pygtk_version >= (2, 10, 0):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
close_button = xml.get_widget('close_button')
event_type_label = xml.get_widget('event_type_label')
event_description_label = xml.get_widget('event_description_label')

View File

@ -240,8 +240,7 @@ class FeaturesWindow:
return True
def trayicon_available(self):
if os.name == 'nt' and gtk.pygtk_version >= (2, 10, 0) and \
gtk.gtk_version >= (2, 10, 0):
if os.name == 'nt':
return True
try:
import systray

View File

@ -170,12 +170,12 @@ else:
except Exception:
pass
if gtk.pygtk_version < (2, 8, 0):
pritext = _('Gajim needs PyGTK 2.8 or above')
sectext = _('Gajim needs PyGTK 2.8 or above to run. Quiting...')
elif gtk.gtk_version < (2, 8, 0):
pritext = _('Gajim needs GTK 2.8 or above')
sectext = _('Gajim needs GTK 2.8 or above to run. Quiting...')
if gtk.pygtk_version < (2, 12, 0):
pritext = _('Gajim needs PyGTK 2.12 or above')
sectext = _('Gajim needs PyGTK 2.12 or above to run. Quiting...')
elif gtk.gtk_version < (2, 12, 0):
pritext = _('Gajim needs GTK 2.12 or above')
sectext = _('Gajim needs GTK 2.12 or above to run. Quiting...')
try:
import gtk.glade # check if user has libglade (in pygtk and in gtk)
@ -3317,8 +3317,7 @@ class Interface:
# gtk hooks
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
gtk.link_button_set_uri_hook(self.on_launch_browser_mailer, 'url')
gtk.link_button_set_uri_hook(self.on_launch_browser_mailer, 'url')
self.instances = {}
@ -3407,9 +3406,7 @@ class Interface:
self.systray_enabled = False
self.systray_capabilities = False
if (((os.name == 'nt') or (sys.platform == 'darwin')) and
(gtk.pygtk_version >= (2, 10, 0)) and
(gtk.gtk_version >= (2, 10, 0))):
if (((os.name == 'nt') or (sys.platform == 'darwin'):
import statusicon
self.systray = statusicon.StatusIcon()
self.systray_capabilities = True

View File

@ -244,48 +244,12 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
tag.set_property('paragraph-background-gdk', color)
#FIXME: when we migrate to 2.10 rm this
if gtk.gtk_version >= (2, 8, 5) or gobject.pygtk_version >= (2, 8, 1):
def _get_current_attributes(self):
attrs = self.textview.get_default_attributes()
self.iter.backward_char()
self.iter.get_attributes(attrs)
self.iter.forward_char()
return attrs
else:
# Workaround http://bugzilla.gnome.org/show_bug.cgi?id=317455
def _get_current_style_attr(self, propname, comb_oper=None):
tags = [tag for tag in self.styles if tag is not None]
tags.reverse()
is_set_name = propname + '-set'
value = None
for tag in tags:
if tag.get_property(is_set_name):
if value is None:
value = tag.get_property(propname)
if comb_oper is None:
return value
else:
value = comb_oper(value, tag.get_property(propname))
return value
class _FakeAttrs(object):
__slots__ = ('font', 'font_scale')
def _get_current_attributes(self):
attrs = self._FakeAttrs()
attrs.font_scale = self._get_current_style_attr('scale',
operator.mul)
if attrs.font_scale is None:
attrs.font_scale = 1.0
attrs.font = self._get_current_style_attr('font-desc')
if attrs.font is None:
attrs.font = self.textview.style.font_desc
return attrs
def _get_current_attributes(self):
attrs = self.textview.get_default_attributes()
self.iter.backward_char()
self.iter.get_attributes(attrs)
self.iter.forward_char()
return attrs
def __parse_length_frac_size_allocate(self, textview, allocation,
frac, callback, args):

View File

@ -147,14 +147,6 @@ class MessageWindow(object):
self.notebook.set_show_tabs(False)
self.notebook.set_show_border(gajim.config.get('tabs_border'))
# if GTK+ version < 2.10, use OUR way to reorder tabs (set up DnD)
if gtk.pygtk_version < (2, 10, 0) or gtk.gtk_version < (2, 10, 0):
self.hid = self.notebook.connect('drag_data_received',
self.on_tab_label_drag_data_received_cb)
self.handlers[self.hid] = self.notebook
self.notebook.drag_dest_set(gtk.DEST_DEFAULT_ALL, self.DND_TARGETS,
gtk.gdk.ACTION_MOVE)
def change_account_name(self, old_name, new_name):
if old_name in self._controls:
self._controls[new_name] = self._controls[old_name]
@ -288,11 +280,7 @@ class MessageWindow(object):
control.handlers[id_] = tab_label_box
self.notebook.append_page(control.widget, tab_label_box)
# If GTK+ version >= 2.10, use gtk native way to reorder tabs
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
self.notebook.set_tab_reorderable(control.widget, True)
else:
self.setup_tab_dnd(control.widget)
self.notebook.set_tab_reorderable(control.widget, True)
self.redraw_tab(control)
if self.parent_paned:
@ -511,10 +499,6 @@ class MessageWindow(object):
fjid in gajim.last_message_time[ctrl.account]:
del gajim.last_message_time[ctrl.account][fjid]
# Disconnect tab DnD only if GTK version < 2.10
if gtk.pygtk_version < (2, 10, 0) or gtk.gtk_version < (2, 10, 0):
self.disconnect_tab_dnd(ctrl.widget)
self.notebook.remove_page(self.notebook.page_num(ctrl.widget))
del self._controls[ctrl.account][fjid]
@ -792,31 +776,6 @@ class MessageWindow(object):
control.msg_textview.emit('key_press_event', event)
control.msg_textview.grab_focus()
def setup_tab_dnd(self, child):
'''Set tab label as drag source and connect the drag_data_get signal'''
tab_label = self.notebook.get_tab_label(child)
tab_label.dnd_handler = tab_label.connect('drag_data_get',
self.on_tab_label_drag_data_get_cb)
self.handlers[tab_label.dnd_handler] = tab_label
tab_label.drag_source_set(gtk.gdk.BUTTON1_MASK, self.DND_TARGETS,
gtk.gdk.ACTION_MOVE)
tab_label.page_num = self.notebook.page_num(child)
def on_tab_label_drag_data_get_cb(self, widget, drag_context, selection,
info, time):
source_page_num = self.find_page_num_according_to_tab_label(widget)
# 8 is the data size for the string
selection.set(selection.target, 8, str(source_page_num))
def on_tab_label_drag_data_received_cb(self, widget, drag_context, x, y,
selection, type_, time):
'''Reorder the tabs according to the drop position'''
source_page_num = int(selection.data)
dest_page_num = self.get_tab_at_xy(x, y)[0]
source_child = self.notebook.get_nth_page(source_page_num)
if dest_page_num != source_page_num:
self.notebook.reorder_child(source_child, dest_page_num)
def get_tab_at_xy(self, x, y):
'''Thanks to Gaim
Return the tab under xy and
@ -858,12 +817,6 @@ class MessageWindow(object):
break
return page_num
def disconnect_tab_dnd(self, child):
'''Clean up DnD signals, source and dest'''
tab_label = self.notebook.get_tab_label(child)
tab_label.drag_source_unset()
tab_label.disconnect(tab_label.dnd_handler)
################################################################################
class MessageWindowMgr(gobject.GObject):
'''A manager and factory for MessageWindow objects'''

View File

@ -288,12 +288,11 @@ class Systray:
sounds_mute_menuitem.set_active(not gajim.config.get('sounds_on'))
if os.name == 'nt':
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
if self.added_hide_menuitem is False:
self.systray_context_menu.prepend(gtk.SeparatorMenuItem())
item = gtk.MenuItem(_('Hide this menu'))
self.systray_context_menu.prepend(item)
self.added_hide_menuitem = True
if self.added_hide_menuitem is False:
self.systray_context_menu.prepend(gtk.SeparatorMenuItem())
item = gtk.MenuItem(_('Hide this menu'))
self.systray_context_menu.prepend(item)
self.added_hide_menuitem = True
self.systray_context_menu.show_all()
self.systray_context_menu.popup(None, None, None, 0,

View File

@ -77,8 +77,7 @@ class BaseTooltip:
self.win.set_border_width(3)
self.win.set_resizable(False)
self.win.set_name('gtk-tooltips')
if gtk.gtk_version >= (2, 10, 0) and gtk.pygtk_version >= (2, 10, 0):
self.win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
self.win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
self.win.set_events(gtk.gdk.POINTER_MOTION_MASK)
self.win.connect_after('expose_event', self.expose)

View File

@ -164,13 +164,8 @@ class VcardWindow:
def set_value(self, entry_name, value):
try:
if value and entry_name == 'URL_label':
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
widget = gtk.LinkButton(value, value)
widget.set_alignment(0, 0)
else:
widget = gtk.Label(value)
widget.set_alignment(0, 0)
widget.set_selectable(True)
widget = gtk.LinkButton(value, value)
widget.set_alignment(0, 0)
widget.show()
table = self.xml.get_widget('personal_info_table')
table.attach(widget, 1, 4, 3, 4, yoptions = 0)
@ -492,13 +487,8 @@ class ZeroconfVcardWindow:
def set_value(self, entry_name, value):
try:
if value and entry_name == 'URL_label':
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
widget = gtk.LinkButton(value, value)
widget.set_alignment(0, 0)
else:
widget = gtk.Label(value)
widget.set_selectable(True)
widget.set_alignment(0, 0)
widget = gtk.LinkButton(value, value)
widget.set_alignment(0, 0)
table = self.xml.get_widget('personal_info_table')
table.attach(widget, 1, 4, 3, 4, yoptions = 0)
else: