From ed5e41fbf46d5820d596c853378bdf45355e6efa Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 22 Jan 2013 07:28:40 +0000 Subject: added safe mode (don't load plug-ins). git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3193 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 5 +++++ src/main.c | 11 ++++++++++- src/plugin.c | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e1d4e1e3..34a30b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-01-22 + + * src/main.c + src/plugin.c: added safe mode (don't load plug-ins). + 2013-01-22 * libsylph/folder.c diff --git a/src/main.c b/src/main.c index ed083801..efe842f5 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2012 Hiroyuki Yamamoto + * Copyright (C) 1999-2013 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 @@ -132,6 +132,7 @@ static struct RemoteCmd { GPtrArray *status_full_folders; gchar *open_msg; gboolean configdir; + gboolean safe_mode; gboolean exit; gboolean restart; gchar *argv0; @@ -607,6 +608,8 @@ static void parse_cmd_opt(int argc, char *argv[]) (argv[i + 1], -1, NULL, NULL, NULL); i++; } + } else if (!strncmp(argv[i], "--safemode", 10)) { + cmd.safe_mode = TRUE; } else if (!strncmp(argv[i], "--exit", 6)) { cmd.exit = TRUE; } else if (!strncmp(argv[i], "--help", 6)) { @@ -633,6 +636,7 @@ static void parse_cmd_opt(int argc, char *argv[]) #endif g_print("%s\n", _(" --exit exit Sylpheed")); g_print("%s\n", _(" --debug debug mode")); + g_print("%s\n", _(" --safemode safe mode")); g_print("%s\n", _(" --help display this help and exit")); g_print("%s\n", _(" --version output version information and exit")); @@ -1249,6 +1253,11 @@ static void plugin_init(void) return; } + if (cmd.safe_mode) { + STATUSBAR_POP(mainwin); + return; + } + ADD_SYM(prog_version); ADD_SYM(app_will_exit); diff --git a/src/plugin.c b/src/plugin.c index c63be7e3..be1636f5 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -299,11 +299,15 @@ static void syl_plugin_class_init(SylPluginClass *klass) void syl_plugin_signal_connect(const gchar *name, GCallback callback, gpointer data) { + g_return_if_fail(plugin_obj != NULL); + g_signal_connect(plugin_obj, name, callback, data); } void syl_plugin_signal_disconnect(gpointer func, gpointer data) { + g_return_if_fail(plugin_obj != NULL); + g_signal_handlers_disconnect_by_func(plugin_obj, func, data); } @@ -311,6 +315,8 @@ void syl_plugin_signal_emit(const gchar *name, ...) { guint signal_id; + g_return_if_fail(plugin_obj != NULL); + if (g_signal_parse_name(name, G_TYPE_FROM_INSTANCE(plugin_obj), &signal_id, NULL, FALSE)) { \ va_list var_args; @@ -345,6 +351,7 @@ gint syl_plugin_load(const gchar *name) SylPluginLoadFunc load_func = NULL; gchar *file; + g_return_val_if_fail(plugin_obj != NULL, -1); g_return_val_if_fail(name != NULL, -1); debug_print("syl_plugin_load: loading %s\n", name); @@ -425,6 +432,8 @@ void syl_plugin_unload_all(void) { GSList *cur; + g_return_if_fail(plugin_obj != NULL); + for (cur = module_list; cur != NULL; cur = cur->next) { GModule *module = (GModule *)cur->data; SylPluginUnloadFunc unload_func = NULL; -- cgit v1.2.3