diff options
author | Dan Winship <danw@src.gnome.org> | 2002-04-09 22:59:26 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-04-09 22:59:26 +0800 |
commit | 2a3a53e9cf40ab9a43f7b6106019325990f7ac63 (patch) | |
tree | f3c1d989948a78a4b7fdc7220223bf155328a701 | |
parent | 73f6d42fbdab7797f61832db9540c65edb582b59 (diff) | |
download | gsoc2013-evolution-2a3a53e9cf40ab9a43f7b6106019325990f7ac63.tar.gz gsoc2013-evolution-2a3a53e9cf40ab9a43f7b6106019325990f7ac63.tar.zst gsoc2013-evolution-2a3a53e9cf40ab9a43f7b6106019325990f7ac63.zip |
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
-rw-r--r-- | shell/ChangeLog | 28 | ||||
-rw-r--r-- | shell/Evolution-ShellComponent.idl | 3 | ||||
-rw-r--r-- | shell/e-corba-storage-registry.c | 4 | ||||
-rw-r--r-- | shell/e-shell-constants.h | 3 | ||||
-rw-r--r-- | shell/e-shell-view.c | 33 | ||||
-rw-r--r-- | shell/e-shell.c | 53 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.c | 4 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.h | 1 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 3 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 1 | ||||
-rw-r--r-- | shell/evolution-test-component.c | 20 | ||||
-rw-r--r-- | shell/main.c | 3 |
12 files changed, 127 insertions, 29 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 2c18525284..7548df9586 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,31 @@ +2002-04-09 Dan Winship <danw@ximian.com> + + * 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 + 2002-04-08 Dan Winship <danw@ximian.com> Fix "evolution evolution:/path/to/folder" to use default view diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index 5ca38e3bdb..ad8b7af118 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -69,7 +69,8 @@ module Evolution { exception InternalError {}; Bonobo::Control createView (in string physical_uri, - in string type) + in string type, + in string view_info) raises (NotFound, UnsupportedType, InternalError); void handleExternalURI (in string external_uri) diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c index c93ac2caa5..72ddf075a8 100644 --- a/shell/e-corba-storage-registry.c +++ b/shell/e-corba-storage-registry.c @@ -318,8 +318,10 @@ impl_StorageRegistry_getFolderByUri (PortableServer_Servant servant, strcat (corba_evolution_uri, path); folder = e_storage_set_get_folder (storage_set, path); g_free (path); - } else + } else { + corba_evolution_uri = NULL; folder = NULL; + } } if (!folder) { diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h index ce21d5db8e..b7382bed67 100644 --- a/shell/e-shell-constants.h +++ b/shell/e-shell-constants.h @@ -26,6 +26,9 @@ #define E_SHELL_URI_PREFIX "evolution:" #define E_SHELL_URI_PREFIX_LEN 10 +#define E_SHELL_DEFAULTURI_PREFIX "default:" +#define E_SHELL_DEFAULTURI_PREFIX_LEN 8 + #define E_SHELL_MINI_ICON_SUFFIX "-mini" #define E_SHELL_MINI_ICON_SUFFIX_LEN 5 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)); diff --git a/shell/e-shell.c b/shell/e-shell.c index 36fc5f3049..a05e53e665 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -421,6 +421,43 @@ impl_Shell_createNewView (PortableServer_Servant servant, } static void +handle_default_uri (EShell *shell, const char *uri, CORBA_Environment *ev) +{ + char *component, *dbpath, *extra_info, *new_uri; + gboolean def; + + component = g_strdup (uri + E_SHELL_DEFAULTURI_PREFIX_LEN); + extra_info = strchr (component, '#'); + if (extra_info) + *extra_info++ = '\0'; + + dbpath = g_strdup_printf ("/DefaultFolder/%s_path", component); + new_uri = bonobo_config_get_string_with_default (shell->priv->db, + dbpath, NULL, &def); + g_free (dbpath); + + if (new_uri == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Shell_NotFound, NULL); + g_free (component); + return; + } + + if (extra_info) { + char *tmp; + + tmp = new_uri; + new_uri = g_strdup_printf ("%s#%s", new_uri, extra_info); + g_free (tmp); + } + + e_shell_create_view_from_uri_and_settings (shell, new_uri, 0); + g_free (new_uri); + g_free (component); + return; +} + +static void impl_Shell_handleURI (PortableServer_Servant servant, const CORBA_char *uri, CORBA_Environment *ev) @@ -438,7 +475,12 @@ impl_Shell_handleURI (PortableServer_Servant servant, priv = shell->priv; if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { - GNOME_Evolution_Shell_createNewView (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), uri, ev); + e_shell_create_view_from_uri_and_settings (shell, uri, 0); + return; + } + + if (strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) { + handle_default_uri (shell, uri, ev); return; } @@ -955,13 +997,8 @@ create_view (EShell *shell, gtk_signal_connect (GTK_OBJECT (view), "destroy", GTK_SIGNAL_FUNC (view_destroy_cb), shell); - if (uri != NULL) { - if (!e_shell_view_display_uri (E_SHELL_VIEW (view), uri)) { - /* FIXME: Consider popping a dialog box up about how the provided URI does not - exist/could not be displayed. */ - e_shell_view_display_uri (E_SHELL_VIEW (view), E_SHELL_VIEW_DEFAULT_URI); - } - } + if (uri != NULL) + e_shell_view_display_uri (E_SHELL_VIEW (view), uri); shell->priv->views = g_list_prepend (shell->priv->views, view); diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index 9f570cf6da..2a1b2e0a2d 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -588,6 +588,7 @@ evolution_shell_component_client_create_view (EvolutionShellComponentClient *she BonoboUIComponent *uih, const char *physical_uri, const char *type_string, + const char *view_info, BonoboControl **control_return) { EvolutionShellComponentResult result; @@ -601,12 +602,13 @@ evolution_shell_component_client_create_view (EvolutionShellComponentClient *she RETURN_ERROR_IF_FAIL (BONOBO_IS_UI_COMPONENT (uih)); RETURN_ERROR_IF_FAIL (physical_uri != NULL); RETURN_ERROR_IF_FAIL (type_string != NULL); + RETURN_ERROR_IF_FAIL (view_info != NULL); RETURN_ERROR_IF_FAIL (control_return != NULL); CORBA_exception_init (&ev); corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - corba_control = GNOME_Evolution_ShellComponent_createView (corba_component, physical_uri, type_string, &ev); + corba_control = GNOME_Evolution_ShellComponent_createView (corba_component, physical_uri, type_string, view_info, &ev); result = corba_exception_to_result (&ev); diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h index 19e79f8dbe..9973f9a931 100644 --- a/shell/evolution-shell-component-client.h +++ b/shell/evolution-shell-component-client.h @@ -94,6 +94,7 @@ EvolutionShellComponentResult evolution_shell_component_client_create_view (Ev BonoboUIComponent *uih, const char *physical_uri, const char *type_string, + const char *view_info, BonoboControl **control_return); EvolutionShellComponentResult evolution_shell_component_client_handle_external_uri (EvolutionShellComponentClient *shell_component_client, diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index e552073c97..b1eab010de 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -478,6 +478,7 @@ static Bonobo_Control impl_createView (PortableServer_Servant servant, const CORBA_char *physical_uri, const CORBA_char *type, + const CORBA_char *view_info, CORBA_Environment *ev) { BonoboObject *bonobo_object; @@ -491,7 +492,7 @@ impl_createView (PortableServer_Servant servant, priv = shell_component->priv; result = (* priv->create_view_fn) (shell_component, physical_uri, type, - &control, priv->closure); + view_info, &control, priv->closure); if (result != EVOLUTION_SHELL_COMPONENT_OK) { switch (result) { diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index 2364f48450..b10613cb34 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -77,6 +77,7 @@ typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateViewFn) (EvolutionShellComponent *shell_component, const char *physical_uri, const char *type, + const char *view_info, BonoboControl **control_return, void *closure); typedef void (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent *shell_component, diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c index 71b41d7627..cf6f0ba53f 100644 --- a/shell/evolution-test-component.c +++ b/shell/evolution-test-component.c @@ -260,16 +260,23 @@ static EvolutionShellComponentResult create_view_fn (EvolutionShellComponent *shell_component, const char *physical_uri, const char *folder_type, + const char *view_data, BonoboControl **control_return, void *closure) { GtkWidget *vbox; - GtkWidget *label_1, *label_2; + GtkWidget *label_1, *label_2, *label_3, *label_4; GtkWidget *event_box_1, *event_box_2; label_1 = gtk_label_new ("This is just a test component, displaying the following URI:"); label_2 = gtk_label_new (physical_uri); + if (*view_data) { + label_3 = gtk_label_new ("And the following view_data:"); + label_4 = gtk_label_new (view_data); + } else + label_3 = label_4 = NULL; + event_box_1 = gtk_event_box_new (); event_box_2 = gtk_event_box_new (); @@ -278,14 +285,13 @@ create_view_fn (EvolutionShellComponent *shell_component, gtk_box_pack_start (GTK_BOX (vbox), event_box_1, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label_1, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label_2, FALSE, TRUE, 0); + if (label_3) { + gtk_box_pack_start (GTK_BOX (vbox), label_3, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), label_4, FALSE, TRUE, 0); + } gtk_box_pack_start (GTK_BOX (vbox), event_box_2, TRUE, TRUE, 0); - gtk_widget_show (label_1); - gtk_widget_show (label_2); - gtk_widget_show (event_box_1); - gtk_widget_show (event_box_2); - - gtk_widget_show (vbox); + gtk_widget_show_all (vbox); *control_return = bonobo_control_new (vbox); diff --git a/shell/main.c b/shell/main.c index 48bce215d3..61ad7c7ef6 100644 --- a/shell/main.c +++ b/shell/main.c @@ -242,7 +242,8 @@ idle_cb (void *data) const char *uri; uri = (const char *) p->data; - if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) + if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0 || + strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) have_evolution_uri = TRUE; } |