[evolution] Bug 461769 - Add a --force-online command line option
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 461769 - Add a --force-online command line option
- Date: Wed, 13 Oct 2010 20:56:21 +0000 (UTC)
commit b4f97aea9b6681c3483f355c9081e2b3b9ee5fd3
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Oct 13 16:55:07 2010 -0400
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.
doc/reference/shell/eshell-sections.txt | 1 +
doc/reference/shell/tmpl/e-shell-backend.sgml | 17 ++++++++++
doc/reference/shell/tmpl/e-shell.sgml | 8 +++++
shell/e-shell.c | 42 +++++++++++++++++++-----
shell/e-shell.h | 1 +
shell/main.c | 18 +++++++++--
6 files changed, 75 insertions(+), 12 deletions(-)
---
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index 5ef1b14..2f25154 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 f0c2d3e..44fb560 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 d862b0b..14eb06e 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 28abe02..62cae09 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 6962ff6..15bcbb3 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 efface3..cf39a47 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]