aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-14 04:55:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-14 04:55:07 +0800
commitb4f97aea9b6681c3483f355c9081e2b3b9ee5fd3 (patch)
tree9b17b0d61c3fb2e62dab36b6984a23c930f6dbe4 /shell/main.c
parent9108b38d83a16110e5973d73a15ab4d3b8188ca4 (diff)
downloadgsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.gz
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.zst
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.zip
Bug 461769 - Add a --force-online command line option
Use it to override network availability detection as reported by NetworkManager or other network monitoring software.
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/shell/main.c b/shell/main.c
index efface344e..cf39a47967 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -97,6 +97,7 @@ static gboolean hide_icons = FALSE;
static gboolean unregister_handlers = FALSE;
#endif /* G_OS_WIN32 */
static gboolean express_mode = FALSE;
+static gboolean force_online = FALSE;
static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
@@ -337,6 +338,8 @@ static GOptionEntry entries[] = {
N_("Start in offline mode"), NULL },
{ "online", '\0', 0, G_OPTION_ARG_NONE, &start_online,
N_("Start in online mode"), NULL },
+ { "force-online", '\0', 0, G_OPTION_ARG_NONE, &force_online,
+ N_("Ignore network availability"), NULL },
{ "express", '\0', 0, G_OPTION_ARG_NONE, &express_mode,
N_("Start in \"express\" mode"), NULL },
#ifdef KILL_PROCESS_CMD
@@ -387,7 +390,7 @@ create_default_shell (void)
key = "/apps/evolution/shell/start_offline";
- if (start_online) {
+ if (start_online || force_online) {
online = TRUE;
gconf_client_set_bool (client, key, FALSE, &error);
} else if (start_offline) {
@@ -432,6 +435,9 @@ create_default_shell (void)
"online", online,
NULL);
+ if (force_online)
+ e_shell_lock_network_available (shell);
+
g_object_unref (client);
return shell;
@@ -575,8 +581,14 @@ main (gint argc, gchar **argv)
if (start_online && start_offline) {
g_printerr (
_("%s: --online and --offline cannot be used "
- "together.\n Use %s --help for more information.\n"),
- argv[0], argv[0]);
+ "together.\n Run '%s --help' for more "
+ "information.\n"), argv[0], argv[0]);
+ exit (1);
+ } else if (force_online && start_offline) {
+ g_printerr (
+ _("%s: --force-online and --offline cannot be used "
+ "together.\n Run '%s --help' for more "
+ "information.\n"), argv[0], argv[0]);
exit (1);
}