aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-08 23:30:02 +0800
committerDan Winship <danw@src.gnome.org>2002-04-08 23:30:02 +0800
commitc357c638049b6a83ec05fa95f236818e8d0528e5 (patch)
tree281935c79bbdb701d2a307d186dd7442701d69cb /shell
parent851c96fac4f9a670dc260fddc9aeaf675aeb2227 (diff)
downloadgsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar.gz
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar.bz2
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar.lz
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar.xz
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.tar.zst
gsoc2013-evolution-c357c638049b6a83ec05fa95f236818e8d0528e5.zip
Fix "evolution evolution:/path/to/folder" to use default view
prefs. * e-shell.c (impl_Shell_createNewView): Use e_shell_create_view_from_uri_and_settings to create the new view based on saved view 0 instead of always using the initial evolution defaults. (e_shell_create_view_from_uri_and_settings): Renamed and simplified; the template_view argument was useless and settings_found would always be set to TRUE in the context it was being used it. (e_shell_restore_from_settings): Simplify for e_shell_create_view_from_uri_and_settings changes. * e-shell-view.c (e_shell_view_load_settings): Only load the DisplayedURI if the view isn't already displaying a URI. Also, pass an &ev to the first bonobo_config_get_long so we can tell if it failed and bail out. * e-shell-view.h: Remove a prototype for a non-existent function (e_shell_view_remove_control_for_uri). * main.c (idle_cb): Add some comments here and remove some dead code. svn path=/trunk/; revision=16389
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog27
-rw-r--r--shell/e-shell-view.c26
-rw-r--r--shell/e-shell-view.h2
-rw-r--r--shell/e-shell.c33
-rw-r--r--shell/e-shell.h14
-rw-r--r--shell/main.c11
6 files changed, 67 insertions, 46 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 8e4276c7eb..2c18525284 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,30 @@
+2002-04-08 Dan Winship <danw@ximian.com>
+
+ Fix "evolution evolution:/path/to/folder" to use default view
+ prefs.
+
+ * e-shell.c (impl_Shell_createNewView): Use
+ e_shell_create_view_from_uri_and_settings to create the new view
+ based on saved view 0 instead of always using the initial
+ evolution defaults.
+ (e_shell_create_view_from_uri_and_settings): Renamed and
+ simplified; the template_view argument was useless and
+ settings_found would always be set to TRUE in the context it was
+ being used it.
+ (e_shell_restore_from_settings): Simplify for
+ e_shell_create_view_from_uri_and_settings changes.
+
+ * e-shell-view.c (e_shell_view_load_settings): Only load the
+ DisplayedURI if the view isn't already displaying a URI. Also,
+ pass an &ev to the first bonobo_config_get_long so we can tell if
+ it failed and bail out.
+
+ * e-shell-view.h: Remove a prototype for a non-existent function
+ (e_shell_view_remove_control_for_uri).
+
+ * main.c (idle_cb): Add some comments here and remove some dead
+ code.
+
2002-04-06 JP Rosevear <jpr@ximian.com>
* e-shell-settings-dialog.c (page_new): set type
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 165c9800b2..3c7330fe35 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -2621,6 +2621,7 @@ e_shell_view_load_settings (EShellView *shell_view,
int num_groups, group, val;
long width, height;
char *stringval, *prefix, *filename, *key;
+ CORBA_Environment ev;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
@@ -2634,9 +2635,14 @@ e_shell_view_load_settings (EShellView *shell_view,
prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
+ CORBA_exception_init (&ev);
key = g_strconcat (prefix, "Width", NULL);
- width = bonobo_config_get_long (db, key, NULL);
+ width = bonobo_config_get_long (db, key, &ev);
g_free (key);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ CORBA_exception_free (&ev);
+ return FALSE;
+ }
key = g_strconcat (prefix, "Height", NULL);
height = bonobo_config_get_long (db, key, NULL);
@@ -2673,16 +2679,18 @@ e_shell_view_load_settings (EShellView *shell_view,
priv->view_hpaned_position = val;
g_free (key);
- key = g_strconcat (prefix, "DisplayedURI", NULL);
- stringval = bonobo_config_get_string (db, key, NULL);
- if (stringval) {
- if (! e_shell_view_display_uri (shell_view, stringval))
+ if (priv->uri == NULL && priv->delayed_selection == NULL) {
+ key = g_strconcat (prefix, "DisplayedURI", NULL);
+ stringval = bonobo_config_get_string (db, key, NULL);
+ if (stringval) {
+ if (! e_shell_view_display_uri (shell_view, stringval))
+ e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
+ } else
e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
- } else
- e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
- g_free (stringval);
- g_free (key);
+ g_free (stringval);
+ g_free (key);
+ }
num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index c5ba207e24..85a5c9ac95 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -110,8 +110,6 @@ gboolean e_shell_view_save_settings (EShellView *shell_view,
gboolean e_shell_view_load_settings (EShellView *shell_view,
int view_num);
-gboolean e_shell_view_remove_control_for_uri (EShellView *shell_view, const char *uri);
-
int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view);
void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view,
int group_num);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index f15348e95f..36fc5f3049 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -402,7 +402,7 @@ impl_Shell_createNewView (PortableServer_Servant servant,
return CORBA_OBJECT_NIL;
}
- shell_view = e_shell_create_view (shell, uri, NULL);
+ shell_view = e_shell_create_view_from_uri_and_settings (shell, uri, 0);
if (shell_view == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_NotFound, NULL);
@@ -1388,20 +1388,17 @@ e_shell_create_view (EShell *shell,
}
EShellView *
-e_shell_create_view_from_settings (EShell *shell,
- const char *uri,
- EShellView *template_view,
- int view_num,
- gboolean *settings_found)
+e_shell_create_view_from_uri_and_settings (EShell *shell,
+ const char *uri,
+ int view_num)
{
EShellView *view;
g_return_val_if_fail (shell != NULL, NULL);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- view = create_view (shell, uri, template_view);
-
- *settings_found = e_shell_view_load_settings (view, view_num);
+ view = create_view (shell, uri, NULL);
+ e_shell_view_load_settings (view, view_num);
gtk_widget_show (GTK_WIDGET (view));
while (gtk_events_pending ())
@@ -1672,7 +1669,6 @@ gboolean
e_shell_restore_from_settings (EShell *shell)
{
EShellPrivate *priv;
- gboolean retval;
int num_views;
int i;
@@ -1684,21 +1680,10 @@ e_shell_restore_from_settings (EShell *shell)
num_views = bonobo_config_get_long_with_default (priv->db, "/Shell/Views/NumberOfViews", 0, NULL);
- if (num_views == 0)
- return FALSE;
-
- retval = TRUE;
+ for (i = 0; i < num_views; i++)
+ e_shell_create_view_from_uri_and_settings (shell, NULL, i);
- for (i = 0; i < num_views; i++) {
- EShellView *view;
- gboolean settings_found;
-
- view = e_shell_create_view_from_settings (shell, NULL, NULL, i, &settings_found);
- if (! settings_found)
- retval = FALSE;
- }
-
- return retval;
+ return (num_views > 0);
}
/**
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 818ba0233f..ef4bd8d709 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -108,14 +108,12 @@ EShell *e_shell_new (const char *local_director
EShellStartupLineMode startup_line_mode,
EShellConstructResult *construct_result_return);
-EShellView *e_shell_create_view (EShell *shell,
- const char *uri,
- EShellView *template_view);
-EShellView *e_shell_create_view_from_settings (EShell *shell,
- const char *uri,
- EShellView *template_view,
- int view_num,
- gboolean *settings_found);
+EShellView *e_shell_create_view (EShell *shell,
+ const char *uri,
+ EShellView *template_view);
+EShellView *e_shell_create_view_from_uri_and_settings (EShell *shell,
+ const char *uri,
+ int view_num);
const char *e_shell_get_local_directory (EShell *shell);
EShortcuts *e_shell_get_shortcuts (EShell *shell);
diff --git a/shell/main.c b/shell/main.c
index 0775904fbf..48bce215d3 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -247,11 +247,19 @@ idle_cb (void *data)
}
if (shell == NULL) {
+ /* We're talking to a remote shell. If the user didn't
+ * ask us to open any particular URI, then open another
+ * view of the default URI
+ */
if (uri_list == NULL)
display_default = TRUE;
else
display_default = FALSE;
} else {
+ /* We're starting a new shell. If the user didn't specify
+ * any evolution: URIs to view, AND we can't load the
+ * user's previous settings, then show the default URI.
+ */
if (! have_evolution_uri) {
if (! e_shell_restore_from_settings (shell))
display_default = TRUE;
@@ -278,9 +286,6 @@ idle_cb (void *data)
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri);
-
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0)
- have_evolution_uri = TRUE;
}
g_slist_free (uri_list);