diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/plugin.c | 42 | ||||
-rw-r--r-- | src/plugin.h | 8 | ||||
-rw-r--r-- | src/update_check.c | 41 | ||||
-rw-r--r-- | src/update_check.h | 11 |
5 files changed, 106 insertions, 10 deletions
@@ -201,7 +201,7 @@ static void send_queue (void); static void load_cb(GObject *obj, GModule *module, gpointer data) { - g_print("load_cb: %p (%s), %p\n", module, module ? g_module_name(module) : "(null)", data); + debug_print("load_cb: %p (%s), %p\n", module, module ? g_module_name(module) : "(null)", data); } int main(int argc, char *argv[]) @@ -1177,6 +1177,18 @@ static void plugin_init(void) syl_plugin_add_symbol("inc_lock", inc_lock); syl_plugin_add_symbol("inc_unlock", inc_unlock); +#if USE_UPDATE_CHECK + syl_plugin_add_symbol("update_check", update_check); + syl_plugin_add_symbol("update_check_set_check_url", + update_check_set_check_url); + syl_plugin_add_symbol("update_check_get_check_url", + update_check_get_check_url); + syl_plugin_add_symbol("update_check_set_jump_url", + update_check_set_jump_url); + syl_plugin_add_symbol("update_check_get_jump_url", + update_check_get_jump_url); +#endif + syl_plugin_signal_connect("plugin-load", G_CALLBACK(load_cb), NULL); /* loading plug-ins from user plug-in directory */ diff --git a/src/plugin.c b/src/plugin.c index 108573b7..e382bfd2 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * Copyright (C) 1999-2010 Hiroyuki Yamamoto * * 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 @@ -818,3 +818,43 @@ void syl_plugin_inc_unlock(void) func = syl_plugin_lookup_symbol("inc_unlock"); SAFE_CALL(func); } + +void syl_plugin_update_check(gboolean show_dialog_always) +{ + void (*func)(gboolean); + + func = syl_plugin_lookup_symbol("update_check"); + SAFE_CALL_ARG1(func, show_dialog_always); +} + +void syl_plugin_update_check_set_check_url(const gchar *url) +{ + void (*func)(const gchar *); + + func = syl_plugin_lookup_symbol("update_check_set_check_url"); + SAFE_CALL_ARG1(func, url); +} + +const gchar *syl_plugin_update_check_get_check_url(void) +{ + const gchar * (*func)(void); + + func = syl_plugin_lookup_symbol("update_check_get_check_url"); + return SAFE_CALL_RET(func); +} + +void syl_plugin_update_check_set_jump_url(const gchar *url) +{ + void (*func)(const gchar *); + + func = syl_plugin_lookup_symbol("update_check_set_jump_url"); + SAFE_CALL_ARG1(func, url); +} + +const gchar *syl_plugin_update_check_get_jump_url(void) +{ + const gchar * (*func)(void); + + func = syl_plugin_lookup_symbol("update_check_get_jump_url"); + return SAFE_CALL_RET(func); +} diff --git a/src/plugin.h b/src/plugin.h index 806a5b3d..678c05a4 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -45,7 +45,7 @@ typedef void (*SylPluginLoadFunc) (void); typedef void (*SylPluginUnloadFunc) (void); typedef void (*SylPluginCallbackFunc) (void); -#define SYL_PLUGIN_INTERFACE_VERSION 0x0104 +#define SYL_PLUGIN_INTERFACE_VERSION 0x0105 struct _SylPlugin { @@ -204,4 +204,10 @@ gboolean syl_plugin_inc_is_active (void); void syl_plugin_inc_lock (void); void syl_plugin_inc_unlock (void); +void syl_plugin_update_check (gboolean show_dialog_always); +void syl_plugin_update_check_set_check_url (const gchar *url); +const gchar *syl_plugin_update_check_get_check_url (void); +void syl_plugin_update_check_set_jump_url (const gchar *url); +const gchar *syl_plugin_update_check_get_jump_url (void); + #endif /* __PLUGIN_H__ */ diff --git a/src/update_check.c b/src/update_check.c index 11ce93ec..7a65cc7c 100644 --- a/src/update_check.c +++ b/src/update_check.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * Copyright (C) 1999-2010 Hiroyuki Yamamoto * * 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 @@ -44,6 +44,8 @@ #include "utils.h" #include "version.h" +static gchar *check_url = NULL; +static gchar *jump_url = NULL; static gboolean compare_version(gint major, gint minor, gint micro, const gchar *extra, gboolean remote_is_release, @@ -111,6 +113,9 @@ static void update_dialog(const gchar *new_ver, gboolean manual) gchar buf[1024]; AlertValue val; + if (!jump_url) + update_check_set_jump_url(HOMEPAGE_URI); + if (new_ver) g_snprintf(buf, sizeof(buf), "%s\n\n%s -> %s", _("A newer version of Sylpheed has been found.\n" @@ -127,7 +132,7 @@ static void update_dialog(const gchar *new_ver, gboolean manual) manual ? FALSE : TRUE, GTK_STOCK_YES, GTK_STOCK_NO, NULL); if ((val & G_ALERT_VALUE_MASK) == G_ALERTDEFAULT) { - open_uri(HOMEPAGE_URI, prefs_common.uri_cmd); + open_uri(jump_url, prefs_common.uri_cmd); } if (val & G_ALERTDISABLE) { prefs_common.auto_update_check = FALSE; @@ -240,6 +245,10 @@ void update_check(gboolean show_dialog_always) GPid pid; GError *error = NULL; + if (!check_url) + update_check_set_check_url + ("http://sylpheed.sraoss.jp/version.txt?"); + if (child_stdout > 0) { debug_print("update check is in progress\n"); return; @@ -247,9 +256,9 @@ void update_check(gboolean show_dialog_always) child_stdout = 0; - debug_print("update_check: getting latest version from http://sylpheed.sraoss.jp/version.txt\n"); + debug_print("update_check: getting latest version from %s\n", check_url); - cmdline[4] = "http://sylpheed.sraoss.jp/version.txt?"; + cmdline[4] = check_url; if (prefs_common.use_http_proxy && prefs_common.http_proxy_host && prefs_common.http_proxy_host[0] != '\0') { cmdline[5] = "--proxy"; @@ -283,4 +292,28 @@ void update_check(gboolean show_dialog_always) g_child_watch_add(pid, update_check_cb, (gpointer)show_dialog_always); } +void update_check_set_check_url(const gchar *url) +{ + if (check_url) + g_free(check_url); + check_url = g_strdup(url); +} + +const gchar *update_check_get_check_url(void) +{ + return check_url; +} + +void update_check_set_jump_url(const gchar *url) +{ + if (jump_url) + g_free(jump_url); + jump_url = g_strdup(url); +} + +const gchar *update_check_get_jump_url(void) +{ + return jump_url; +} + #endif /* USE_UPDATE_CHECK */ diff --git a/src/update_check.h b/src/update_check.h index 6ca4ae5b..86d6a7e9 100644 --- a/src/update_check.h +++ b/src/update_check.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * Copyright (C) 1999-2010 Hiroyuki Yamamoto * * 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 @@ -28,8 +28,13 @@ #include <glib.h> -void update_check(gboolean show_dialog_always); +void update_check (gboolean show_dialog_always); + +void update_check_set_check_url (const gchar *url); +const gchar *update_check_get_check_url (void); +void update_check_set_jump_url (const gchar *url); +const gchar *update_check_get_jump_url (void); #endif /* USE_UPDATE_CHECK */ -#endif /* __PLUGIN_MANAGER_H__ */ +#endif /* __UPDATE_CHECK_H__ */ |