check for new version [one of the first thing I did for Gajim :)] is not needed anymore as most distros have us. remove it. this also means we can now update Changelog periodically in svn. YUPPIE!

This commit is contained in:
Nikos Kouremenos 2005-12-06 00:09:28 +00:00
parent fa33b1ad30
commit 881e1e3609
5 changed files with 0 additions and 128 deletions

View File

@ -1,96 +0,0 @@
## 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.glade
from common import gajim
from common import helpers
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='gtkgui.glade'
class Check_for_new_version_dialog:
def __init__(self):
try:
self.check_for_new_version()
except:
pass
def parse_glade(self):
xml = gtk.glade.XML(GTKGUI_GLADE, 'new_version_available_dialog', APP)
self.window = xml.get_widget('new_version_available_dialog')
self.information_label = xml.get_widget('information_label')
self.changes_textview = xml.get_widget('changes_textview')
xml.signal_autoconnect(self)
def on_new_version_available_dialog_delete_event(self, widget, event):
self.window.destroy()
def on_open_download_page_button_clicked(self, widget):
url = 'http://www.gajim.org/downloads.php?lang='
helpers.launch_browser_mailer('url', url)
self.window.destroy()
def check_for_new_version(self):
'''parse online Changelog to find out last version
and the changes for that latest version'''
import urllib2
import socket
dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(5)
url = 'http://trac.gajim.org/file/trunk/Changelog?rev=latest&format=txt'
changelog = urllib2.urlopen(url)
socket.setdefaulttimeout(dto)
# format is 'Gajim version (date)'
first_line = changelog.readline()
finish_version = first_line.find(' ', 6) # start search after 'Gajim'
latest_version = first_line[6:finish_version]
if float(latest_version) > float(gajim.version):
start_date = finish_version + 2 # one space and one (
date = first_line[start_date:-2] # remove the last ) and \n
info = 'Gajim ' + latest_version + ' was released in ' + date + '!'
changes = ''
while True:
line = changelog.readline().lstrip()
if line.startswith('Gajim'):
break
else:
if line != '\n' or line !='': # line has some content
if not line.startswith('*'):
# the is not a new *real* line
# but a continuation from previous line.
# So remove \n from previous 'line' beforing adding it
changes = changes[:-1]
changes += line
self.parse_glade()
self.information_label.set_text(info)
buf = self.changes_textview.get_buffer()
buf.set_text(changes)
self.window.show_all()

View File

@ -113,7 +113,6 @@ class Config:
'before_nickname': [ opt_str, '' ],
'after_nickname': [ opt_str, ':' ],
'send_os_info': [ opt_bool, True ],
'check_for_new_version': [ opt_bool, False ],
'usegpg': [ opt_bool, False ],
'use_gpg_agent': [ opt_bool, False ],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],

View File

@ -397,11 +397,6 @@ class PreferencesWindow:
st = gajim.config.get('send_os_info')
self.xml.get_widget('send_os_info_checkbutton').set_active(st)
# check for new version
st = gajim.config.get('check_for_new_version')
btn = self.xml.get_widget('check_for_new_version_checkbutton')
btn.set_active(st)
self.xml.signal_autoconnect(self)
self.sound_tree.get_model().connect('row-changed',
@ -879,9 +874,6 @@ class PreferencesWindow:
def on_send_os_info_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'send_os_info')
def on_check_for_new_version_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'check_for_new_version')
def fill_msg_treeview(self):
self.xml.get_widget('delete_msg_button').set_sensitive(False)
model = self.msg_tree.get_model()

View File

@ -94,7 +94,6 @@ import gtkgui_helpers
import notify
import common.sleepy
import check_for_new_version
from common import socks5
from common import gajim
@ -1377,8 +1376,6 @@ class Interface:
if self.systray_capabilities and gajim.config.get('trayicon'):
self.show_systray()
if gajim.config.get('check_for_new_version'):
check_for_new_version.Check_for_new_version_dialog()
self.init_emoticons()
self.make_regexps()

View File

@ -6126,26 +6126,6 @@ Custom</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_for_new_version_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Check for new _version on Gajim 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_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>
</widget>
</child>
</widget>