diff --git a/plugins/gtkgui/chat.py b/plugins/gtkgui/chat.py
index 823a5ee4d..8f4e80d04 100644
--- a/plugins/gtkgui/chat.py
+++ b/plugins/gtkgui/chat.py
@@ -51,7 +51,7 @@ class Chat:
self.nb_unread = {}
self.last_message_time = {}
self.print_time_timeout_id = {}
- self.names = {} # what is printed in the tab : user.name for example
+ self.names = {} # what is printed in the tab (eg. user.name)
self.childs = {}
self.window = self.xml.get_widget(widget_name)
self.widget_name = widget_name
diff --git a/plugins/gtkgui/check_for_new_version.py b/plugins/gtkgui/check_for_new_version.py
new file mode 100644
index 000000000..fb7080e60
--- /dev/null
+++ b/plugins/gtkgui/check_for_new_version.py
@@ -0,0 +1,62 @@
+import gtk
+import gtk.glade
+import version
+
+from common import i18n
+
+_ = i18n._
+APP = i18n.APP
+gtk.glade.bindtextdomain(APP, i18n.DIR)
+gtk.glade.textdomain(APP)
+
+GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
+
+class Check_for_new_version_dialog:
+ def __init__(self, plugin):
+ self.plugin = plugin
+ 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)
+ self.check_for_new_version()
+
+
+ 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='
+ self.plugin.launch_browser_mailer('url', url)
+
+ def check_for_new_version(self):
+ '''parse online Changelog to find out last version
+ and the changes for that latest version'''
+ check_for_new_version_available = True
+ if check_for_new_version_available:
+ import urllib
+ import version
+
+ url = 'http://trac.gajim.org/file/trunk/Changelog?rev=latest&format=txt'
+ changelog = urllib.urlopen(url)
+ # 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 latest_version > version.version:
+ start_date = finish_version + 2 # one space and one (
+ date = first_line[start_date:-2] # remove the last ) and \n
+ text = 'Gajim ' + latest_version + ' was released in ' + date + '!'
+ self.information_label.set_text(text)
+ changes = ''
+ while True:
+ line = changelog.readline()
+ if line.startswith('Gajim'):
+ break
+ else:
+ if line != '\n':
+ changes += line
+
+ buf = self.changes_textview.get_buffer()
+ buf.set_text(changes)
+ self.window.show_all()
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index e23d5e39c..ff3c11699 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -10049,7 +10049,7 @@ send a chat message to
- 5
+ 4
300
350
Add/Remove Emoticons
@@ -10172,4 +10172,167 @@ send a chat message to
+
+ 4
+ 490
+ 250
+ New version of Gajim available
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ False
+ True
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+
+
+
+
+ True
+ False
+ 5
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+
+ True
+ True
+ True
+ True
+ True
+ Open Download Page
+ True
+ GTK_RELIEF_NORMAL
+ True
+ 0
+
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_NONE
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ False
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ GTK_WRAP_NONE
+ False
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+ True
+ <b>Changes in latest version</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
+
+
+
+
+
+
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 4042bc4f3..f66d9d7c3 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -63,6 +63,7 @@ import sys
import Queue
import sre
import common.sleepy
+import check_for_new_version
try:
import winsound # windows-only built-in module for playing wav
@@ -990,7 +991,8 @@ class plugin:
self.systray = Systray(self)
if self.config['trayicon']:
self.show_systray()
-
+
+ check_for_new_version.Check_for_new_version_dialog(self)
self.init_regexp()
# get instances for windows/dialogs that will show_all()/hide()