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.
This commit is contained in:
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -323,6 +323,14 @@ EShell
|
||||
@network_available:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION e_shell_lock_network_available ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@shell:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION e_shell_get_online ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1820,6 +1824,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
|
||||
|
||||
@ -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);
|
||||
|
||||
18
shell/main.c
18
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user