From 9ea2a5c677f8618bae085a4112b11d1bed602e7f Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 27 Apr 2009 19:28:53 +0000 Subject: [PATCH] we now depend on GTK2.12. Remove test for older versions. Fixes #4996 --- README.html | 6 ++-- debian/control | 2 +- src/chat_control.py | 74 ++++++++++++------------------------------ src/dialogs.py | 3 +- src/features_window.py | 3 +- src/gajim.py | 19 +++++------ src/htmltextview.py | 48 ++++----------------------- src/message_window.py | 49 +--------------------------- src/systray.py | 11 +++---- src/tooltips.py | 3 +- src/vcard.py | 18 +++------- 11 files changed, 52 insertions(+), 184 deletions(-) diff --git a/README.html b/README.html index d97952ec7..b06d01061 100644 --- a/README.html +++ b/README.html @@ -15,8 +15,8 @@ Welcome to Gajim and thank you for trying out our client.

Runtime Requirements

@@ -143,7 +143,7 @@ That is all, enjoy!


-(C) 2003-2008
+(C) 2003-200888888888
The Gajim Team
http://gajim.org

diff --git a/debian/control b/debian/control index 0f9dfbf0a..1c7c58c88 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/src/chat_control.py b/src/chat_control.py index 4e23ac032..e18acd1ea 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -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 = '%s' % 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 = '%s' % 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 = '' + gobject.markup_escape_text(activity) - if subactivity: - tooltip += ': ' + gobject.markup_escape_text(subactivity) - tooltip += '' - 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 = '' + gobject.markup_escape_text(activity) + if subactivity: + tooltip += ': ' + gobject.markup_escape_text(subactivity) + tooltip += '' + 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( - _('"%(title)s" by %(artist)s\n' - 'from %(source)s') % {'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( + _('"%(title)s" by %(artist)s\n' + 'from %(source)s') % {'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 diff --git a/src/dialogs.py b/src/dialogs.py index e86b11d27..50b31021a 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -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') diff --git a/src/features_window.py b/src/features_window.py index 0a5ed3b29..c350b2cf4 100644 --- a/src/features_window.py +++ b/src/features_window.py @@ -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 diff --git a/src/gajim.py b/src/gajim.py index 59864d836..92e619e09 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -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 diff --git a/src/htmltextview.py b/src/htmltextview.py index 9b0bc5aa0..9045d22c5 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -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): diff --git a/src/message_window.py b/src/message_window.py index eceb90032..7d227206c 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -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''' diff --git a/src/systray.py b/src/systray.py index d55332dfe..79d514bd7 100644 --- a/src/systray.py +++ b/src/systray.py @@ -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, diff --git a/src/tooltips.py b/src/tooltips.py index 451695e53..fa96cbd8c 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -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) diff --git a/src/vcard.py b/src/vcard.py index 06c4bbb89..e5ce7f3c2 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -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: