aboutsummaryrefslogtreecommitdiffstats
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
parent9108b38d83a16110e5973d73a15ab4d3b8188ca4 (diff)
downloadgsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.gz
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.bz2
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.lz
gsoc2013-evolution-b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3.tar.xz
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.
-rw-r--r--doc/reference/shell/eshell-sections.txt1
-rw-r--r--doc/reference/shell/tmpl/e-shell-backend.sgml17
-rw-r--r--doc/reference/shell/tmpl/e-shell.sgml8
-rw-r--r--shell/e-shell.c42
-rw-r--r--shell/e-shell.h1
-rw-r--r--shell/main.c18
6 files changed, 75 insertions, 12 deletions
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index 5ef1b146d9..2f25154d7f 100644
--- a/doc/reference/shell/eshell-sections.txt
+++ b/doc/reference/shell/eshell-sections.txt
@@ -22,6 +22,7 @@ e_shell_get_small_screen_mode
e_shell_get_module_directory
e_shell_get_network_available
e_shell_set_network_available
+e_shell_lock_network_available
e_shell_get_online
e_shell_set_online
e_shell_get_preferences_window
diff --git a/doc/reference/shell/tmpl/e-shell-backend.sgml b/doc/reference/shell/tmpl/e-shell-backend.sgml
index f0c2d3ebd4..44fb560b38 100644
--- a/doc/reference/shell/tmpl/e-shell-backend.sgml
+++ b/doc/reference/shell/tmpl/e-shell-backend.sgml
@@ -85,6 +85,23 @@ EShellBackend
@activity:
+<!-- ##### FUNCTION e_shell_backend_cancel_all ##### -->
+<para>
+
+</para>
+
+@shell_backend:
+
+
+<!-- ##### FUNCTION e_shell_backend_is_busy ##### -->
+<para>
+
+</para>
+
+@shell_backend:
+@Returns:
+
+
<!-- ##### FUNCTION e_shell_backend_start ##### -->
<para>
diff --git a/doc/reference/shell/tmpl/e-shell.sgml b/doc/reference/shell/tmpl/e-shell.sgml
index d862b0bed2..14eb06e40e 100644
--- a/doc/reference/shell/tmpl/e-shell.sgml
+++ b/doc/reference/shell/tmpl/e-shell.sgml
@@ -323,6 +323,14 @@ EShell
@network_available:
+<!-- ##### FUNCTION e_shell_lock_network_available ##### -->
+<para>
+
+</para>
+
+@shell:
+
+
<!-- ##### FUNCTION e_shell_get_online ##### -->
<para>
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 28abe028dc..62cae09cfc 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -65,15 +65,16 @@ struct _EShellPrivate {
gchar *startup_view;
- guint auto_reconnect : 1;
- guint modules_loaded : 1;
- guint network_available : 1;
- guint online : 1;
- guint quit_cancelled : 1;
- guint safe_mode : 1;
- guint express_mode : 1;
- guint meego_mode : 1;
- guint small_screen_mode : 1;
+ guint auto_reconnect : 1;
+ guint express_mode : 1;
+ guint meego_mode : 1;
+ guint modules_loaded : 1;
+ guint network_available : 1;
+ guint network_available_locked : 1;
+ guint online : 1;
+ guint quit_cancelled : 1;
+ guint safe_mode : 1;
+ guint small_screen_mode : 1;
};
enum {
@@ -1801,6 +1802,9 @@ e_shell_set_network_available (EShell *shell,
{
g_return_if_fail (E_IS_SHELL (shell));
+ if (shell->priv->network_available_locked)
+ return;
+
if (network_available == shell->priv->network_available)
return;
@@ -1821,6 +1825,26 @@ e_shell_set_network_available (EShell *shell,
}
/**
+ * e_shell_lock_network_available:
+ * @shell: an #EShell
+ *
+ * Locks the value of #EShell:network-available to %TRUE. Further
+ * attempts to set the property will be ignored.
+ *
+ * This is used for the --force-online command-line option, which is
+ * intended to override the network availability status as reported
+ * by NetworkManager or other network monitoring software.
+ **/
+void
+e_shell_lock_network_available (EShell *shell)
+{
+ g_return_if_fail (E_IS_SHELL (shell));
+
+ e_shell_set_network_available (shell, TRUE);
+ shell->priv->network_available_locked = TRUE;
+}
+
+/**
* e_shell_get_online:
* @shell: an #EShell
*
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 6962ff6d0f..15bcbb3694 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -143,6 +143,7 @@ const gchar * e_shell_get_module_directory (EShell *shell);
gboolean e_shell_get_network_available (EShell *shell);
void e_shell_set_network_available (EShell *shell,
gboolean network_available);
+void e_shell_lock_network_available (EShell *shell);
gboolean e_shell_get_online (EShell *shell);
void e_shell_set_online (EShell *shell,
gboolean online);
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);
}