Sun, 22 Jul 2007 08:14:16 +0000
revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
| 7543 | 1 | /* |
| 2 | * Release Notification Plugin | |
| 3 | * | |
| 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU General Public License as | |
| 8 | * published by the Free Software Foundation; either version 2 of the | |
| 9 | * License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, but | |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 19 | * 02111-1307, USA. | |
| 20 | */ | |
| 21 | ||
| 22 | #ifdef HAVE_CONFIG_H | |
| 23 | #include <config.h> | |
| 24 | #endif | |
| 25 | ||
| 15884 | 26 | #ifndef PURPLE_PLUGINS |
| 27 | #define PURPLE_PLUGINS | |
| 7543 | 28 | #endif |
| 29 | ||
| 30 | #include "internal.h" | |
| 31 | ||
| 32 | #include <string.h> | |
| 33 | ||
| 34 | #include "connection.h" | |
| 35 | #include "core.h" | |
| 36 | #include "notify.h" | |
| 37 | #include "prefs.h" | |
| 38 | #include "util.h" | |
| 9943 | 39 | #include "version.h" |
| 7543 | 40 | |
| 15577 | 41 | #include "pidgin.h" |
|
15442
2ff7f5308727
I think this is all the instances of 'Gaim' within pidgin/
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
42 | |
| 7543 | 43 | /* 1 day */ |
| 44 | #define MIN_CHECK_INTERVAL 60 * 60 * 24 | |
| 45 | ||
| 46 | static void | |
| 15884 | 47 | version_fetch_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14281
diff
changeset
|
48 | const gchar *changelog, size_t len, const gchar *error_message) |
| 7543 | 49 | { |
| 50 | char *cur_ver, *formatted; | |
| 51 | GString *message; | |
| 52 | int i=0; | |
| 53 | ||
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14281
diff
changeset
|
54 | if(error_message || !changelog || !len) |
| 7543 | 55 | return; |
| 56 | ||
| 57 | while(changelog[i] && changelog[i] != '\n') i++; | |
| 58 | ||
| 14281 | 59 | /* this basically means the version thing wasn't in the format we were |
| 60 | * looking for so sourceforge is probably having web server issues, and | |
| 61 | * we should try again later */ | |
| 62 | if(i == 0) | |
| 63 | return; | |
| 64 | ||
| 7543 | 65 | cur_ver = g_strndup(changelog, i); |
| 66 | changelog += i; | |
| 67 | ||
| 68 | while(*changelog == '\n') changelog++; | |
| 69 | ||
| 70 | message = g_string_new(""); | |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15928
diff
changeset
|
71 | g_string_append_printf(message, _("You are using %s version %s. The " |
|
17538
a1ae88080722
Two small changes to the release notification plugin:
Mark Doliner <markdoliner@pidgin.im>
parents:
16749
diff
changeset
|
72 | "current version is %s. You can get it from " |
|
18169
2d325551db9e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@pidgin.im>
parents:
17538
diff
changeset
|
73 | "<a href=\"%s\">%s</a><hr>"), |
|
2d325551db9e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@pidgin.im>
parents:
17538
diff
changeset
|
74 | PIDGIN_NAME, purple_core_get_version(), cur_ver, |
|
2d325551db9e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@pidgin.im>
parents:
17538
diff
changeset
|
75 | PURPLE_WEBSITE, PURPLE_WEBSITE); |
| 7543 | 76 | |
| 77 | if(*changelog) { | |
| 15884 | 78 | formatted = purple_strdup_withhtml(changelog); |
|
17538
a1ae88080722
Two small changes to the release notification plugin:
Mark Doliner <markdoliner@pidgin.im>
parents:
16749
diff
changeset
|
79 | g_string_append_printf(message, _("<b>ChangeLog:</b><br>%s"), |
| 7543 | 80 | formatted); |
| 81 | g_free(formatted); | |
| 82 | } | |
| 83 | ||
| 15884 | 84 | purple_notify_formatted(NULL, _("New Version Available"), |
| 7543 | 85 | _("New Version Available"), NULL, message->str, |
| 86 | NULL, NULL); | |
| 87 | ||
| 88 | g_string_free(message, TRUE); | |
| 7599 | 89 | g_free(cur_ver); |
| 7543 | 90 | } |
| 91 | ||
| 92 | static void | |
| 93 | do_check(void) | |
| 94 | { | |
| 15884 | 95 | int last_check = purple_prefs_get_int("/plugins/gtk/relnot/last_check"); |
| 7543 | 96 | if(!last_check || time(NULL) - last_check > MIN_CHECK_INTERVAL) { |
|
15928
7a44b142ee55
More s/purple.sourceforge.net/pidgin.im/, this time for the release notification plugin.
Richard Laager <rlaager@pidgin.im>
parents:
15926
diff
changeset
|
97 | char *url = g_strdup_printf("http://pidgin.im/version.php?version=%s&build=%s", purple_core_get_version(), |
| 7543 | 98 | #ifdef _WIN32 |
| 15884 | 99 | "purple-win32" |
| 7543 | 100 | #else |
| 15884 | 101 | "purple" |
| 7543 | 102 | #endif |
| 7546 | 103 | ); |
| 15884 | 104 | purple_util_fetch_url(url, TRUE, NULL, FALSE, version_fetch_cb, NULL); |
| 105 | purple_prefs_set_int("/plugins/gtk/relnot/last_check", time(NULL)); | |
| 7545 | 106 | g_free(url); |
| 7543 | 107 | } |
| 108 | } | |
| 109 | ||
| 110 | static void | |
| 15884 | 111 | signed_on_cb(PurpleConnection *gc, void *data) { |
| 7543 | 112 | do_check(); |
| 113 | } | |
| 114 | ||
| 115 | /************************************************************************** | |
| 116 | * Plugin stuff | |
| 117 | **************************************************************************/ | |
| 118 | static gboolean | |
| 15884 | 119 | plugin_load(PurplePlugin *plugin) |
| 7543 | 120 | { |
| 15884 | 121 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
| 122 | plugin, PURPLE_CALLBACK(signed_on_cb), NULL); | |
| 7543 | 123 | |
| 124 | /* we don't check if we're offline */ | |
| 15884 | 125 | if(purple_connections_get_all()) |
| 7543 | 126 | do_check(); |
| 127 | ||
| 128 | return TRUE; | |
| 129 | } | |
| 130 | ||
| 15884 | 131 | static PurplePluginInfo info = |
| 7543 | 132 | { |
| 15884 | 133 | PURPLE_PLUGIN_MAGIC, |
| 134 | PURPLE_MAJOR_VERSION, | |
| 135 | PURPLE_MINOR_VERSION, | |
| 136 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
| 7543 | 137 | NULL, /**< ui_requirement */ |
| 138 | 0, /**< flags */ | |
| 139 | NULL, /**< dependencies */ | |
| 15884 | 140 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 7543 | 141 | |
| 142 | "gtk-relnot", /**< id */ | |
| 143 | N_("Release Notification"), /**< name */ | |
| 144 | VERSION, /**< version */ | |
| 145 | /** summary */ | |
| 146 | N_("Checks periodically for new releases."), | |
| 147 | /** description */ | |
| 148 | N_("Checks periodically for new releases and notifies the user " | |
| 149 | "with the ChangeLog."), | |
| 150 | "Nathan Walp <faceprint@faceprint.com>", /**< author */ | |
| 15884 | 151 | PURPLE_WEBSITE, /**< homepage */ |
| 7543 | 152 | |
| 153 | plugin_load, /**< load */ | |
| 154 | NULL, /**< unload */ | |
| 155 | NULL, /**< destroy */ | |
| 156 | ||
| 157 | NULL, /**< ui_info */ | |
| 8993 | 158 | NULL, /**< extra_info */ |
| 159 | NULL, | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
160 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
161 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
162 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
163 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
164 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
165 | NULL, |
| 8993 | 166 | NULL |
| 7543 | 167 | }; |
| 168 | ||
| 169 | static void | |
| 15884 | 170 | init_plugin(PurplePlugin *plugin) |
| 7543 | 171 | { |
| 15884 | 172 | purple_prefs_add_none("/plugins/gtk/relnot"); |
| 173 | purple_prefs_add_int("/plugins/gtk/relnot/last_check", 0); | |
| 7543 | 174 | } |
| 175 | ||
| 15884 | 176 | PURPLE_INIT_PLUGIN(relnot, init_plugin, info) |