aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-05-28 06:59:51 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-05-28 06:59:51 +0000
commitb6d060aa8a6dddb734ca6f1f188b4e71d0ec9b75 (patch)
tree5d947eed0820a1fc10ff688c5e5f89df008f5b55
parente5ad1b40d7174f432bc7ce6c71f518dda3fca374 (diff)
added functions to modify URLs for update check.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2551 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--src/main.c14
-rw-r--r--src/plugin.c42
-rw-r--r--src/plugin.h8
-rw-r--r--src/update_check.c41
-rw-r--r--src/update_check.h11
6 files changed, 112 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 8545b1a1..e33defab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-28
+
+ * src/update_check.[ch]
+ src/plugin.[ch]
+ src/main.c: added functions to modify URLs for update check.
+
2010-05-27
* src/prefs_common_dialog.c: prefs_colorlabel_create(): added
diff --git a/src/main.c b/src/main.c
index e0923141..7248747f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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__ */