diff options
author | Dan Winship <danw@src.gnome.org> | 2002-04-05 04:01:31 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-04-05 04:01:31 +0800 |
commit | 54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d (patch) | |
tree | 5db3acedbe64f229af7052db4ec38e7ac5c19a3d /shell/e-shell.c | |
parent | 97e99e459e9a32c96ade6b1fbf9bd0da201de591 (diff) | |
download | gsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.tar.gz gsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.tar.zst gsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.zip |
New widget for a button that displays a folder selection in a standard
* evolution-folder-selector-button.c: New widget for a button that
displays a folder selection in a standard form, and when clicked
lets the user select a new folder.
* Evolution-Shell.idl (FolderSelectionListener:notifySelected):
Make this take an Evolution:Folder instead of a pair of uris.
(Shell:getIconByType): New method to get the icon for a type from
the folder type registry.
* Evolution-common.idl (Folder): add "evolutionUri" to the folder
structure.
* Evolution-Storage.idl (StorageRegistry:getFolderByUri): get an
Evolution:Folder for a given uri.
* evolution-shell-client.c
(evolution_shell_client_user_select_folder): Update this to
reflect the IDL change: return a GNOME_Evolution_Folder instead of
a pair of URIs. Make sure it always sets *@folder_return to %NULL
if it fails (even if it's a g_return_if_fail).
(evolution_shell_client_get_storage_registry_interface): New.
(evolution_shell_client_get_pixbuf_for_type): New. Uses
Shell_getIconByType, but caches results.
* e-shell.c (folder_selection_dialog_folder_selected_cb): Update
for API change. (Return a GNOME_Evolution_Folder.)
(impl_Shell_getIconByType): Implement.
* e-corba-storage-registry.c
(impl_StorageRegistry_getFolderByUri): Implement.
* evolution-storage.c (evolution_storage_new_folder): Add a
(dummy) evolutionUri to the folder.
* Makefile.am (libeshell_la_SOURCES): add
evolution-folder-selector-button.c
(eshellinclude_HEADERS): and .h
svn path=/trunk/; revision=16352
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r-- | shell/e-shell.c | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index d16ff306b3..f15348e95f 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -58,6 +58,7 @@ #include "e-folder-type-registry.h" #include "e-local-storage.h" #include "e-shell-constants.h" +#include "e-shell-corba-icon-utils.h" #include "e-shell-folder-selection-dialog.h" #include "e-shell-offline-handler.h" #include "e-shell-startup-wizard.h" @@ -239,8 +240,7 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_ GNOME_Evolution_FolderSelectionListener listener; EStorageSet *storage_set; EFolder *folder; - char *uri; - const char *physical_uri; + GNOME_Evolution_Folder corba_folder; shell = E_SHELL (data); listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener"); @@ -250,15 +250,28 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_ storage_set = e_shell_get_storage_set (shell); folder = e_storage_set_get_folder (storage_set, path); - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - - if (folder == NULL) - physical_uri = ""; - else - physical_uri = e_folder_get_physical_uri (folder); + if (folder == NULL) { + corba_folder.type = ""; + corba_folder.description = ""; + corba_folder.displayName = ""; + corba_folder.physicalUri = ""; + corba_folder.evolutionUri = ""; + corba_folder.unreadCount = -1; + } else { + corba_folder.type = (CORBA_char *)e_folder_get_type_string (folder); + corba_folder.description = (CORBA_char *)e_folder_get_description (folder); + if (corba_folder.description == NULL) + corba_folder.description = ""; + corba_folder.displayName = (CORBA_char *)e_folder_get_name (folder); + corba_folder.physicalUri = (CORBA_char *)e_folder_get_physical_uri (folder); + if (corba_folder.physicalUri == NULL) + corba_folder.physicalUri = ""; + corba_folder.evolutionUri = (CORBA_char *)g_strconcat (E_SHELL_URI_PREFIX, path, NULL); + corba_folder.unreadCount = e_folder_get_unread_count (folder); + } - GNOME_Evolution_FolderSelectionListener_notifySelected (listener, uri, physical_uri, &ev); - g_free (uri); + GNOME_Evolution_FolderSelectionListener_notifySelected (listener, &corba_folder, &ev); + g_free (corba_folder.evolutionUri); CORBA_exception_free (&ev); @@ -336,6 +349,36 @@ impl_Shell_getComponentByType (PortableServer_Servant servant, return CORBA_Object_duplicate (corba_component, ev); } +static GNOME_Evolution_Icon * +impl_Shell_getIconByType (PortableServer_Servant servant, + const CORBA_char *type, + const CORBA_boolean mini, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + EFolderTypeRegistry *folder_type_registry; + GdkPixbuf *pixbuf; + GNOME_Evolution_Icon *icon; + EShell *shell; + + if (raise_exception_if_not_ready (servant, ev)) + return CORBA_OBJECT_NIL; + + bonobo_object = bonobo_object_from_servant (servant); + shell = E_SHELL (bonobo_object); + folder_type_registry = shell->priv->folder_type_registry; + + pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, type, mini); + + if (pixbuf == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_NotFound, NULL); + return CORBA_OBJECT_NIL; + } + + icon = e_new_corba_icon_from_pixbuf (pixbuf); + return icon; +} + static GNOME_Evolution_ShellView impl_Shell_createNewView (PortableServer_Servant servant, const CORBA_char *uri, @@ -1050,6 +1093,7 @@ class_init (EShellClass *klass) epv = & klass->epv; epv->_get_displayName = impl_Shell__get_displayName; epv->getComponentByType = impl_Shell_getComponentByType; + epv->getIconByType = impl_Shell_getIconByType; epv->createNewView = impl_Shell_createNewView; epv->handleURI = impl_Shell_handleURI; epv->selectUserFolder = impl_Shell_selectUserFolder; |