pidgin: 4cc664a6: A patch from Casey Ho to move the releas...

grim at pidgin.im grim at pidgin.im
Sun Nov 23 19:35:23 EST 2008


-----------------------------------------------------------------
Revision: 4cc664a6443ef3f3e09d56ac582e9554b3964b3d
Ancestor: 70a6182c551a9b81c9b2110aa79d2f3b86ca49f1
Author: Casey Ho
Date: 2008-11-24T00:30:42
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4cc664a6443ef3f3e09d56ac582e9554b3964b3d

Modified files:
        pidgin/plugins/relnot.c

ChangeLog: 

A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list.  The change log is no longer displayed, but will open a webbrowser to show it.

Closes #7545


-------------- next part --------------
============================================================
--- pidgin/plugins/relnot.c	62e1c6e867ef85bc7d0ed0f3179c7093f21c9a52
+++ pidgin/plugins/relnot.c	4a3ec15609012ab1af1754114999fe0cc80d2bc4
@@ -34,7 +34,10 @@
 #include "connection.h"
 #include "core.h"
 #include "debug.h"
+#include "gtkblist.h"
+#include "gtkutils.h"
 #include "notify.h"
+#include "pidginstock.h"
 #include "prefs.h"
 #include "util.h"
 #include "version.h"
@@ -45,12 +48,26 @@ static void
 #define MIN_CHECK_INTERVAL 60 * 60 * 24
 
 static void
+release_hide()
+{
+	/* No-op.  We may use this method in the future to avoid showing
+	 * the popup twice */
+}
+
+static void
+release_show()
+{
+	purple_notify_uri(NULL, PURPLE_WEBSITE);
+}
+
+static void
 version_fetch_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
 		const gchar *response, size_t len, const gchar *error_message)
 {
-	gchar *cur_ver, *formatted;
+	gchar *cur_ver;
 	const char *tmp, *changelog;
 	char response_code[4];
+	GtkWidget *release_dialog;
 
 	GString *message;
 	int i = 0;
@@ -89,27 +106,21 @@ version_fetch_cb(PurpleUtilFetchUrlData 
 		return;
 
 	cur_ver = g_strndup(changelog, i);
-	changelog += i;
 
-	while(*changelog == '\n') changelog++;
-
 	message = g_string_new("");
-	g_string_append_printf(message, _("You are using %s version %s.  The "
-			"current version is %s.  You can get it from "
-			"<a href=\"%s\">%s</a><hr>"),
-			PIDGIN_NAME, purple_core_get_version(), cur_ver,
-			PURPLE_WEBSITE, PURPLE_WEBSITE);
+	g_string_append_printf(message, _("You can upgrade to %s %s today."),
+			PIDGIN_NAME, cur_ver);
 
-	if(*changelog) {
-		formatted = purple_strdup_withhtml(changelog);
-		g_string_append_printf(message, _("<b>ChangeLog:</b><br>%s"),
-				formatted);
-		g_free(formatted);
-	}
+	release_dialog = pidgin_make_mini_dialog(
+		NULL, PIDGIN_STOCK_DIALOG_INFO,
+		_("New Version Available"),
+		message->str,
+		NULL,
+		_("Later"), PURPLE_CALLBACK(release_hide),
+		_("Download Now"), PURPLE_CALLBACK(release_show),
+		NULL);
 
-	purple_notify_formatted(NULL, _("New Version Available"),
-			_("New Version Available"), NULL, message->str,
-			NULL, NULL);
+	pidgin_blist_add_alert(release_dialog);
 
 	g_string_free(message, TRUE);
 	g_free(cur_ver);


More information about the Commits mailing list