From 2a3a53e9cf40ab9a43f7b6106019325990f7ac63 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 9 Apr 2002 14:59:26 +0000 Subject: Add a "view_info" argument. * Evolution-ShellComponent.idl (createView): Add a "view_info" argument. * e-shell-view.c (get_view_for_uri): if the URI contains a '#', split it into a URI and a "view_info" at that point. (Otherwise, pass "" for the view_info to ShellComponent_createView.) This can be used for things like specifying day/month/week view to the calendar. * e-shell.c (create_view): Ignore e_shell_view_display_uri's return code: it's possible/likely that the requested URL is remote and hasn't been filled in yet. (impl_Shell_handleURI): Don't use Shell_createNewView directly, call e_shell_create_view_from_uri_and_settings. (For the above fix and some others.) * evolution-shell-component.c (impl_createView): Add view_info. * evolution-shell-component-client.c (evolution_shell_component_client_create_view): Add view_info. * evolution-test-component.c (create_view_fn): add view_data. * e-corba-storage-registry.c (impl_StorageRegistry_getFolderByUri): kill a warning svn path=/trunk/; revision=16397 --- shell/e-shell-view.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'shell/e-shell-view.c') diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 3c7330fe35..901e599a3d 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -2042,7 +2042,8 @@ get_type_for_folder (EShellView *shell_view, /* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */ static View * get_view_for_uri (EShellView *shell_view, - const char *uri) + const char *uri, + const char *view_info) { EShellViewPrivate *priv; CORBA_Environment ev; @@ -2082,7 +2083,7 @@ get_view_for_uri (EShellView *shell_view, CORBA_exception_init (&ev); - corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, &ev); + corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, view_info, &ev); if (ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); @@ -2136,7 +2137,8 @@ show_existing_view (EShellView *shell_view, static gboolean create_new_view_for_uri (EShellView *shell_view, - const char *uri) + const char *uri, + const char *view_info) { View *view; EShellViewPrivate *priv; @@ -2144,7 +2146,7 @@ create_new_view_for_uri (EShellView *shell_view, priv = shell_view->priv; - view = get_view_for_uri (shell_view, uri); + view = get_view_for_uri (shell_view, uri, view_info); if (view == NULL) return FALSE; @@ -2172,6 +2174,8 @@ display_uri (EShellView *shell_view, EShellViewPrivate *priv; View *view; gboolean retval; + const char *view_info; + char *real_uri; priv = shell_view->priv; @@ -2190,23 +2194,32 @@ display_uri (EShellView *shell_view, set_current_notebook_page (shell_view, 0); g_free (priv->uri); - priv->uri = NULL; + priv->uri = real_uri = NULL; retval = TRUE; goto end; } + view_info = strchr (uri, '#'); + if (view_info) { + real_uri = g_strndup (uri, view_info - uri); + view_info++; + } else { + view_info = ""; + real_uri = g_strdup (uri); + } + if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) { retval = FALSE; goto end; } - view = g_hash_table_lookup (priv->uri_to_view, uri); + view = g_hash_table_lookup (priv->uri_to_view, real_uri); if (view != NULL) { - show_existing_view (shell_view, uri, view); - } else if (! create_new_view_for_uri (shell_view, uri)) { + show_existing_view (shell_view, real_uri, view); + } else if (! create_new_view_for_uri (shell_view, real_uri, view_info)) { cleanup_delayed_selection (shell_view); - priv->delayed_selection = g_strdup (uri); + priv->delayed_selection = g_strdup (real_uri); gtk_signal_connect_full (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), "new_folder", GTK_SIGNAL_FUNC (new_folder_cb), NULL, shell_view, NULL, FALSE, TRUE); @@ -2217,6 +2230,8 @@ display_uri (EShellView *shell_view, retval = TRUE; end: + g_free (real_uri); + if (add_to_history && retval == TRUE && priv->uri != NULL) e_history_add (priv->history, g_strdup (priv->uri)); -- cgit