[Fix #3029, Offline mode should be preserved across sessions.]
* main.c (idle_cb): Use the e_shell_new() API below so that we use the saved offline settings at the next start-up if neither --offline nor --online has been specified. * e-shell.c (save_misc_settings): New function. For now, just save `/Shell/StartOffline' indicating whether the shell should start in offline mode or not. (e_shell_construct): Replace @start_online with @startup_line_mode. (e_shell_new): Likewise. * e-shell.h: New enum EShellStartupLineMode. svn path=/trunk/; revision=15804
This commit is contained in:
@ -1,3 +1,20 @@
|
||||
2002-02-22 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
[Fix #3029, Offline mode should be preserved across sessions.]
|
||||
|
||||
* main.c (idle_cb): Use the e_shell_new() API below so that we use
|
||||
the saved offline settings at the next start-up if neither
|
||||
--offline nor --online has been specified.
|
||||
|
||||
* e-shell.c (save_misc_settings): New function. For now, just
|
||||
save `/Shell/StartOffline' indicating whether the shell should
|
||||
start in offline mode or not.
|
||||
(e_shell_construct): Replace @start_online with
|
||||
@startup_line_mode.
|
||||
(e_shell_new): Likewise.
|
||||
|
||||
* e-shell.h: New enum EShellStartupLineMode.
|
||||
|
||||
2002-02-22 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* e-shell-view.c (remove_uri_from_history): New helper function to
|
||||
|
@ -1055,7 +1055,7 @@ init (EShell *shell)
|
||||
* @iid: OAFIID for registering the shell into the name server
|
||||
* @local_directory: Local directory for storing local information and folders
|
||||
* @show_splash: Whether to display a splash screen.
|
||||
* @start_online: Whether to start up in on-line mode.
|
||||
* @startup_line_mode: How to set up the line mode (online or offline) initally.
|
||||
*
|
||||
* Construct @shell so that it uses the specified @local_directory and
|
||||
* @corba_object.
|
||||
@ -1067,17 +1067,23 @@ e_shell_construct (EShell *shell,
|
||||
const char *iid,
|
||||
const char *local_directory,
|
||||
gboolean show_splash,
|
||||
gboolean start_online)
|
||||
EShellStartupLineMode startup_line_mode)
|
||||
{
|
||||
GtkWidget *splash;
|
||||
EShellPrivate *priv;
|
||||
CORBA_Object corba_object;
|
||||
CORBA_Environment ev;
|
||||
gchar *shortcut_path;
|
||||
gboolean start_online;
|
||||
|
||||
g_return_val_if_fail (shell != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
|
||||
g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
|
||||
g_return_val_if_fail (local_directory != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
|
||||
g_return_val_if_fail (g_path_is_absolute (local_directory), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
|
||||
g_return_val_if_fail (startup_line_mode == E_SHELL_STARTUP_LINE_MODE_CONFIG
|
||||
|| startup_line_mode == E_SHELL_STARTUP_LINE_MODE_ONLINE
|
||||
|| startup_line_mode == E_SHELL_STARTUP_LINE_MODE_OFFLINE,
|
||||
E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
|
||||
|
||||
priv = shell->priv;
|
||||
|
||||
@ -1180,6 +1186,21 @@ e_shell_construct (EShell *shell,
|
||||
|
||||
priv->is_initialized = TRUE;
|
||||
|
||||
switch (startup_line_mode) {
|
||||
case E_SHELL_STARTUP_LINE_MODE_CONFIG:
|
||||
start_online = ! bonobo_config_get_boolean_with_default (priv->db, "/Shell/StartOffline", FALSE, NULL);
|
||||
break;
|
||||
case E_SHELL_STARTUP_LINE_MODE_ONLINE:
|
||||
start_online = TRUE;
|
||||
break;
|
||||
case E_SHELL_STARTUP_LINE_MODE_OFFLINE:
|
||||
start_online = FALSE;
|
||||
break;
|
||||
default:
|
||||
start_online = FALSE; /* Make compiler happy. */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (start_online)
|
||||
e_shell_go_online (shell, NULL);
|
||||
|
||||
@ -1201,7 +1222,7 @@ e_shell_construct (EShell *shell,
|
||||
EShell *
|
||||
e_shell_new (const char *local_directory,
|
||||
gboolean show_splash,
|
||||
gboolean start_online,
|
||||
EShellStartupLineMode startup_line_mode,
|
||||
EShellConstructResult *construct_result_return)
|
||||
{
|
||||
EShell *new;
|
||||
@ -1213,7 +1234,11 @@ e_shell_new (const char *local_directory,
|
||||
|
||||
new = gtk_type_new (e_shell_get_type ());
|
||||
|
||||
construct_result = e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash, start_online);
|
||||
construct_result = e_shell_construct (new,
|
||||
E_SHELL_OAFIID,
|
||||
local_directory,
|
||||
show_splash,
|
||||
startup_line_mode);
|
||||
|
||||
if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) {
|
||||
*construct_result_return = construct_result;
|
||||
@ -1497,6 +1522,20 @@ save_settings_for_components (EShell *shell)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_misc_settings (EShell *shell)
|
||||
{
|
||||
EShellPrivate *priv;
|
||||
gboolean is_offline;
|
||||
|
||||
priv = shell->priv;
|
||||
|
||||
is_offline = ( e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_OFFLINE );
|
||||
bonobo_config_set_boolean (priv->db, "/Shell/StartOffline", is_offline, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_shell_save_settings:
|
||||
* @shell:
|
||||
@ -1512,14 +1551,16 @@ e_shell_save_settings (EShell *shell)
|
||||
{
|
||||
gboolean views_saved;
|
||||
gboolean components_saved;
|
||||
gboolean misc_saved;
|
||||
|
||||
g_return_val_if_fail (shell != NULL, FALSE);
|
||||
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
|
||||
|
||||
views_saved = save_settings_for_views (shell);
|
||||
components_saved = save_settings_for_components (shell);
|
||||
misc_saved = save_misc_settings (shell);
|
||||
|
||||
return views_saved && components_saved;
|
||||
return views_saved && components_saved && misc_saved;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,6 +60,13 @@ enum _EShellLineStatus {
|
||||
};
|
||||
typedef enum _EShellLineStatus EShellLineStatus;
|
||||
|
||||
enum _EShellStartupLineMode {
|
||||
E_SHELL_STARTUP_LINE_MODE_CONFIG,
|
||||
E_SHELL_STARTUP_LINE_MODE_ONLINE,
|
||||
E_SHELL_STARTUP_LINE_MODE_OFFLINE
|
||||
};
|
||||
typedef enum _EShellStartupLineMode EShellStartupLineMode;
|
||||
|
||||
struct _EShell {
|
||||
BonoboXObject parent;
|
||||
|
||||
@ -95,10 +102,10 @@ EShellConstructResult e_shell_construct (EShell *shell,
|
||||
const char *iid,
|
||||
const char *local_directory,
|
||||
gboolean show_splash,
|
||||
gboolean start_online);
|
||||
EShellStartupLineMode startup_line_mode);
|
||||
EShell *e_shell_new (const char *local_directory,
|
||||
gboolean show_splash,
|
||||
gboolean start_online,
|
||||
EShellStartupLineMode startup_line_mode,
|
||||
EShellConstructResult *construct_result_return);
|
||||
|
||||
EShellView *e_shell_create_view (EShell *shell,
|
||||
|
10
shell/main.c
10
shell/main.c
@ -187,6 +187,7 @@ idle_cb (void *data)
|
||||
GNOME_Evolution_Shell corba_shell;
|
||||
CORBA_Environment ev;
|
||||
EShellConstructResult result;
|
||||
EShellStartupLineMode startup_line_mode;
|
||||
GSList *p;
|
||||
gboolean have_evolution_uri;
|
||||
gboolean display_default;
|
||||
@ -195,7 +196,14 @@ idle_cb (void *data)
|
||||
|
||||
uri_list = (GSList *) data;
|
||||
|
||||
shell = e_shell_new (evolution_directory, ! no_splash, ! start_offline, &result);
|
||||
if (! start_online && ! start_offline)
|
||||
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_CONFIG;
|
||||
else if (start_online)
|
||||
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_ONLINE;
|
||||
else
|
||||
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
|
||||
|
||||
shell = e_shell_new (evolution_directory, ! no_splash, startup_line_mode, &result);
|
||||
g_free (evolution_directory);
|
||||
|
||||
switch (result) {
|
||||
|
Reference in New Issue
Block a user