diff options
-rw-r--r-- | shell/ChangeLog | 33 | ||||
-rw-r--r-- | shell/Evolution-LocalStorage.idl | 11 | ||||
-rw-r--r-- | shell/Evolution-Storage.idl | 5 | ||||
-rw-r--r-- | shell/e-corba-storage.c | 30 | ||||
-rw-r--r-- | shell/e-folder.c | 34 | ||||
-rw-r--r-- | shell/e-folder.h | 5 | ||||
-rw-r--r-- | shell/e-local-storage.c | 17 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 90 | ||||
-rw-r--r-- | shell/e-storage-set.c | 26 | ||||
-rw-r--r-- | shell/e-storage-set.h | 1 | ||||
-rw-r--r-- | shell/e-storage.c | 30 | ||||
-rw-r--r-- | shell/e-storage.h | 2 | ||||
-rw-r--r-- | shell/evolution-local-storage.c | 34 | ||||
-rw-r--r-- | shell/evolution-local-storage.h | 7 | ||||
-rw-r--r-- | shell/evolution-storage-listener.c | 29 | ||||
-rw-r--r-- | shell/evolution-storage-listener.h | 15 | ||||
-rw-r--r-- | shell/evolution-storage.c | 61 | ||||
-rw-r--r-- | shell/evolution-storage.h | 4 |
18 files changed, 373 insertions, 61 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 3d150b2f90..1e4f15fd59 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,36 @@ +2000-11-01 Dan Winship <danw@helixcode.com> + + * Evolution-Storage.idl: Add "highligted" field to Folder. Add + update_folder method to StorageListener to change display_name and + highlight status. + + * e-folder.c: Add "highlighted" to EFolder to match the + Evolution::Folder type. + (e_folder_get_highlighted, e_folder_set_highlighted): Added + + * evolution-storage-listener.c + (impl_Evolution_StorageListener_update_folder, etc): + * e-storage.c (e_storage_updated_folder, etc): + * e-corba-storage.c (impl_StorageListener_update_folder, etc): + Implement update_folder. + + * e-storage-set.c (storage_updated_folder_cb, etc): Re-emit + updated_folder signals received from EStorage. + + * e-storage-set-view.c (various): Add another model column to the + ETable and set it up as a bold_column based on + e_folder_get_highligted. + (updated_folder_cb, etc): Listen to EStorageSet update_folder + signal and emit ETree node_changed signals. + + * evolution-storage.c (evolution_storage_update_folder): Client + function to update a folder's display_name and highlighted status. + + * Evolution-LocalStorage.idl: + * evolution-local-storage.c: + * e-local-storage.c: Change set_display_name to update_folder to + match Evolution::StorageListener + 2000-10-25 <jpr@helixcode.com> * e-shortcuts-view-model.c (load_group_into_model): Set folder to NULL to diff --git a/shell/Evolution-LocalStorage.idl b/shell/Evolution-LocalStorage.idl index 0a31105c3e..4ca81670e4 100644 --- a/shell/Evolution-LocalStorage.idl +++ b/shell/Evolution-LocalStorage.idl @@ -13,14 +13,17 @@ module Evolution { interface LocalStorage : Evolution::Storage { /** - * set_display_name: + * update_folder: * @path: Path of a folder within the storage. - * @display: Name to be displayed in the tree view for this folder + * @display_name: Name to be displayed in the tree view for + * this folder + * @highlighted: Whether or not to highlight the name. * * Set the name to display for the folder at the specified * @path. */ - void set_display_name (in string path, - in string display_name); + void update_folder (in string path, + in string display_name, + in boolean highlighted); }; }; diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl index 42fc043047..5aadf8eb19 100644 --- a/shell/Evolution-Storage.idl +++ b/shell/Evolution-Storage.idl @@ -16,6 +16,7 @@ module Evolution { string description; string display_name; string physical_uri; + boolean highlighted; }; interface Storage; @@ -45,6 +46,10 @@ module Evolution { void new_folder (in string path, in Folder folder) raises (Exists); + void update_folder (in string path, in string display_name, + in boolean highlighted) + raises (NotFound); + void removed_folder (in string path) raises (NotFound); }; diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c index 9efdec36c9..a62af2fd60 100644 --- a/shell/e-corba-storage.c +++ b/shell/e-corba-storage.c @@ -125,6 +125,35 @@ impl_StorageListener_new_folder (PortableServer_Servant servant, } static void +impl_StorageListener_update_folder (PortableServer_Servant servant, + const CORBA_char *path, + const CORBA_char *display_name, + CORBA_boolean highlighted, + CORBA_Environment *ev) +{ + StorageListenerServant *storage_listener_servant; + EStorage *storage; + EFolder *e_folder; + + storage_listener_servant = (StorageListenerServant *) servant; + storage = storage_listener_servant->storage; + + e_folder = e_storage_get_folder (storage, path); + if (e_folder == NULL) { + CORBA_exception_set (ev, + CORBA_USER_EXCEPTION, + ex_Evolution_StorageListener_NotFound, + NULL); + return; + } + + e_folder_set_name (e_folder, display_name); + e_folder_set_highlighted (e_folder, highlighted); + + e_storage_updated_folder (storage, path); +} + +static void impl_StorageListener_removed_folder (PortableServer_Servant servant, const CORBA_char *path, CORBA_Environment *ev) @@ -254,6 +283,7 @@ corba_class_init (void) epv = g_new0 (POA_Evolution_StorageListener__epv, 1); epv->new_folder = impl_StorageListener_new_folder; + epv->update_folder = impl_StorageListener_update_folder; epv->removed_folder = impl_StorageListener_removed_folder; vepv = &storage_listener_vepv; diff --git a/shell/e-folder.c b/shell/e-folder.c index d490db99bf..28f72fc705 100644 --- a/shell/e-folder.c +++ b/shell/e-folder.c @@ -41,6 +41,7 @@ struct _EFolderPrivate { char *type; char *description; char *physical_uri; + gboolean highlighted; }; #define EF_CLASS(obj) \ @@ -145,6 +146,7 @@ init (EFolder *folder) priv->name = NULL; priv->description = NULL; priv->physical_uri = NULL; + priv->highlighted = FALSE; folder->priv = priv; } @@ -218,6 +220,24 @@ e_folder_get_description (EFolder *folder) return folder->priv->description; } +const char * +e_folder_get_physical_uri (EFolder *folder) +{ + g_return_val_if_fail (folder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (folder), NULL); + + return folder->priv->physical_uri; +} + +gboolean +e_folder_get_highlighted (EFolder *folder) +{ + g_return_val_if_fail (folder != NULL, FALSE); + g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); + + return folder->priv->highlighted; +} + void e_folder_set_name (EFolder *folder, @@ -275,14 +295,16 @@ e_folder_set_physical_uri (EFolder *folder, gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); } - -const char * -e_folder_get_physical_uri (EFolder *folder) +void +e_folder_set_highlighted (EFolder *folder, + gboolean highlighted) { - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); + g_return_if_fail (folder != NULL); + g_return_if_fail (E_IS_FOLDER (folder)); - return folder->priv->physical_uri; + folder->priv->highlighted = highlighted; + + gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); } diff --git a/shell/e-folder.h b/shell/e-folder.h index d7bbd6ba9e..1f3a5885f0 100644 --- a/shell/e-folder.h +++ b/shell/e-folder.h @@ -75,16 +75,17 @@ EFolder *e_folder_new (const char *name, const char *type, const char *description); -const char *e_folder_get_physical_uri (EFolder *folder); - const char *e_folder_get_name (EFolder *folder); const char *e_folder_get_type_string (EFolder *folder); const char *e_folder_get_description (EFolder *folder); +const char *e_folder_get_physical_uri (EFolder *folder); +gboolean e_folder_get_highlighted (EFolder *folder); void e_folder_set_name (EFolder *folder, const char *name); void e_folder_set_type_string (EFolder *folder, const char *type); void e_folder_set_description (EFolder *folder, const char *description); void e_folder_set_physical_uri (EFolder *folder, const char *physical_uri); +void e_folder_set_highlighted (EFolder *folder, gboolean highlighted); #ifdef __cplusplus } diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 173bdf2991..25db4ab988 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -530,24 +530,23 @@ impl_async_remove_folder (EStorage *storage, /* Callbacks for the `Evolution::LocalStorage' interface we are exposing to the outside world. */ static void -bonobo_interface_set_display_name_cb (EvolutionLocalStorage *bonobo_local_storage, - const char *path, - const char *display_name, - void *data) +bonobo_interface_update_folder_cb (EvolutionLocalStorage *bonobo_local_storage, + const char *path, + const char *display_name, + gboolean highlighted, + void *data) { ELocalStorage *local_storage; EFolder *folder; local_storage = E_LOCAL_STORAGE (data); - g_print ("%s -- %s %s\n", __FUNCTION__, path, display_name); - folder = e_storage_get_folder (E_STORAGE (local_storage), path); if (folder == NULL) return; e_folder_set_name (folder, display_name); - + e_folder_set_highlighted (folder, highlighted); } @@ -613,8 +612,8 @@ construct (ELocalStorage *local_storage, g_assert (priv->bonobo_interface == NULL); priv->bonobo_interface = evolution_local_storage_new (E_LOCAL_STORAGE_NAME); - gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "set_display_name", - GTK_SIGNAL_FUNC (bonobo_interface_set_display_name_cb), + gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "update_folder", + GTK_SIGNAL_FUNC (bonobo_interface_update_folder_cb), local_storage); return load_all_folders (local_storage); diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 3fdd555acc..7ea9465f54 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -40,7 +40,7 @@ #include <gal/e-table/e-cell-text.h> #define ETABLE_SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" draw-grid=\"true\"> \ - <ETableColumn model_col=\"0\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"tree-string\" compare=\"string\"/> \ + <ETableColumn model_col=\"0\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"render_tree\" compare=\"string\"/> \ <ETableState> \ <column source=\"0\"/> \ <grouping></grouping> \ @@ -116,8 +116,6 @@ add_node_to_hash (EStorageSetView *storage_set_view, return FALSE; } - g_print ("EStorageSetView: Adding -- %s\n", path); - hash_path = g_strdup (path); g_hash_table_insert (priv->path_to_etree_node, hash_path, node); @@ -126,6 +124,22 @@ add_node_to_hash (EStorageSetView *storage_set_view, } static ETreePath * +lookup_node_in_hash (EStorageSetView *storage_set_view, + const char *path) +{ + EStorageSetViewPrivate *priv; + ETreePath *node; + + priv = storage_set_view->priv; + + node = g_hash_table_lookup (priv->path_to_etree_node, path); + if (node == NULL) + g_warning ("EStorageSetView: Node not found while updating -- %s", path); + + return node; +} + +static ETreePath * remove_node_from_hash (EStorageSetView *storage_set_view, const char *path) { @@ -140,8 +154,6 @@ remove_node_from_hash (EStorageSetView *storage_set_view, return NULL; } - g_print ("EStorageSetView: Removing -- %s\n", path); - g_hash_table_remove (priv->path_to_etree_node, path); return node; @@ -424,42 +436,55 @@ etable_drag_data_get (EStorageSetView *storage_set_view, static int etree_col_count (ETableModel *etc, void *data) { - return 1; + return 2; } /* This function duplicates the value passed to it. */ static void * etree_duplicate_value (ETableModel *etc, int col, const void *value, void *data) { - return g_strdup (value); + if (col == 0) + return g_strdup (value); + else + return (void *)value; } /* This function frees the value passed to it. */ static void etree_free_value (ETableModel *etc, int col, void *value, void *data) { - g_free (value); + if (col == 0) + g_free (value); } /* This function creates an empty value. */ static void * etree_initialize_value (ETableModel *etc, int col, void *data) { - return g_strdup (""); + if (col == 0) + return g_strdup (""); + else + return NULL; } /* This function reports if a value is empty. */ static gboolean etree_value_is_empty (ETableModel *etc, int col, const void *value, void *data) { - return !(value && *(char *)value); + if (col == 0) + return !(value && *(char *)value); + else + return !value; } /* This function reports if a value is empty. */ static char * etree_value_to_string (ETableModel *etc, int col, const void *value, void *data) { - return g_strdup(value); + if (col == 0) + return g_strdup(value); + else + return g_strdup(value ? "Yes" : "No"); } /* ETreeModel Methods */ @@ -504,11 +529,15 @@ etree_value_at (ETreeModel *etree, ETreePath *tree_path, int col, void *model_da path = (char *) e_tree_model_node_get_data (etree, tree_path); folder = e_storage_set_get_folder (storage_set, path); - if (folder != NULL) - return (void *) e_folder_get_name (folder); + if (folder != NULL) { + if (col == 0) + return (void *) e_folder_get_name (folder); + else + return (void *) e_folder_get_highlighted (folder); + } storage = e_storage_set_get_storage (storage_set, path + 1); - if (storage != NULL) + if (storage != NULL && col == 0) return (void *) e_storage_get_name (storage); return NULL; @@ -643,6 +672,25 @@ new_folder_cb (EStorageSet *storage_set, } static void +updated_folder_cb (EStorageSet *storage_set, + const char *path, + void *data) +{ + EStorageSetView *storage_set_view; + EStorageSetViewPrivate *priv; + ETreeModel *etree; + ETreePath *node; + char *node_data; + + storage_set_view = E_STORAGE_SET_VIEW (data); + priv = storage_set_view->priv; + etree = priv->etree_model; + + node = lookup_node_in_hash (storage_set_view, path); + e_tree_model_node_changed (etree, node); +} + +static void removed_folder_cb (EStorageSet *storage_set, const char *path, void *data) @@ -892,6 +940,8 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, EStorageSet *storage_set) { EStorageSetViewPrivate *priv; + ETableExtras *extras; + ECell *cell; g_return_if_fail (storage_set_view != NULL); g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); @@ -915,8 +965,15 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node"); - e_table_construct (E_TABLE (storage_set_view), E_TABLE_MODEL(priv->etree_model), NULL, + extras = e_table_extras_new (); + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + gtk_object_set (GTK_OBJECT (cell), "bold_column", 1, NULL); + e_table_extras_add_cell (extras, "render_tree", + e_cell_tree_new (NULL, NULL, TRUE, cell)); + + e_table_construct (E_TABLE (storage_set_view), E_TABLE_MODEL(priv->etree_model), extras, ETABLE_SPEC, NULL); + gtk_object_unref (GTK_OBJECT (extras)); e_table_drag_source_set (E_TABLE (storage_set_view), GDK_BUTTON1_MASK, drag_types, num_drag_types, GDK_ACTION_MOVE); @@ -933,6 +990,9 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_folder", GTK_SIGNAL_FUNC (new_folder_cb), storage_set_view, GTK_OBJECT (storage_set_view)); + gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "updated_folder", + GTK_SIGNAL_FUNC (updated_folder_cb), storage_set_view, + GTK_OBJECT (storage_set_view)); gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "removed_folder", GTK_SIGNAL_FUNC (removed_folder_cb), storage_set_view, GTK_OBJECT (storage_set_view)); diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 7d3fb84a59..246af39f68 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -59,6 +59,7 @@ enum { NEW_STORAGE, REMOVED_STORAGE, NEW_FOLDER, + UPDATED_FOLDER, REMOVED_FOLDER, LAST_SIGNAL }; @@ -136,6 +137,21 @@ storage_new_folder_cb (EStorage *storage, } static void +storage_updated_folder_cb (EStorage *storage, + const char *path, + void *data) +{ + EStorageSet *storage_set; + char *full_path; + + storage_set = E_STORAGE_SET (data); + + full_path = make_full_path (storage, path); + gtk_signal_emit (GTK_OBJECT (storage_set), signals[UPDATED_FOLDER], full_path); + g_free (full_path); +} + +static void storage_removed_folder_cb (EStorage *storage, const char *path, void *data) @@ -242,6 +258,14 @@ class_init (EStorageSetClass *klass) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[UPDATED_FOLDER] = + gtk_signal_new ("updated_folder", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EStorageSetClass, updated_folder), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); signals[REMOVED_FOLDER] = gtk_signal_new ("removed_folder", GTK_RUN_FIRST, @@ -347,6 +371,8 @@ e_storage_set_add_storage (EStorageSet *storage_set, gtk_signal_connect (GTK_OBJECT (storage), "new_folder", GTK_SIGNAL_FUNC (storage_new_folder_cb), storage_set); + gtk_signal_connect (GTK_OBJECT (storage), "updated_folder", + GTK_SIGNAL_FUNC (storage_updated_folder_cb), storage_set); gtk_signal_connect (GTK_OBJECT (storage), "removed_folder", GTK_SIGNAL_FUNC (storage_removed_folder_cb), storage_set); diff --git a/shell/e-storage-set.h b/shell/e-storage-set.h index cc0d34811a..887eac5134 100644 --- a/shell/e-storage-set.h +++ b/shell/e-storage-set.h @@ -64,6 +64,7 @@ struct _EStorageSetClass { void (* removed_storage) (EStorageSet *storage_set, EStorage *storage); /* FIXME? Inconsistency between storage and folders. */ void (* new_folder) (EStorageSet *storage_set, const char *path); + void (* updated_folder) (EStorageSet *storage_set, const char *path); void (* removed_folder) (EStorageSet *storage_set, const char *path); }; diff --git a/shell/e-storage.c b/shell/e-storage.c index 384e88af33..3ea687716c 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -49,6 +49,7 @@ struct _EStoragePrivate { enum { NEW_FOLDER, + UPDATED_FOLDER, REMOVED_FOLDER, LAST_SIGNAL }; @@ -174,6 +175,14 @@ class_init (EStorageClass *class) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[UPDATED_FOLDER] = + gtk_signal_new ("updated_folder", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EStorageClass, updated_folder), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); signals[REMOVED_FOLDER] = gtk_signal_new ("removed_folder", GTK_RUN_FIRST, @@ -437,6 +446,27 @@ e_storage_new_folder (EStorage *storage, } gboolean +e_storage_updated_folder (EStorage *storage, + const char *path) +{ + EStoragePrivate *priv; + + g_return_val_if_fail (storage != NULL, FALSE); + g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); + g_return_val_if_fail (path != NULL, FALSE); + g_return_val_if_fail (g_path_is_absolute (path), FALSE); + + priv = storage->priv; + + if (e_folder_tree_get_folder (priv->folder_tree, path) == NULL) + return FALSE; + + gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path); + + return TRUE; +} + +gboolean e_storage_removed_folder (EStorage *storage, const char *path) { diff --git a/shell/e-storage.h b/shell/e-storage.h index 0988e94250..4500d9bb4f 100644 --- a/shell/e-storage.h +++ b/shell/e-storage.h @@ -77,6 +77,7 @@ struct _EStorageClass { /* Signals. */ void * (* new_folder) (EStorage *storage, const char *path); + void * (* updated_folder) (EStorage *storage, const char *path); void * (* removed_folder) (EStorage *storage, const char *path); /* Virtual methods. */ @@ -129,6 +130,7 @@ char *e_storage_get_path_for_physical_uri (EStorage *storage, /* Protected. C++ anyone? */ gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder); +gboolean e_storage_updated_folder (EStorage *storage, const char *path); gboolean e_storage_removed_folder (EStorage *storage, const char *path); #ifdef __cplusplus diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c index f8ddfb5c88..d1460488df 100644 --- a/shell/evolution-local-storage.c +++ b/shell/evolution-local-storage.c @@ -41,7 +41,7 @@ struct _EvolutionLocalStoragePrivate { enum { - SET_DISPLAY_NAME, + UPDATE_FOLDER, LAST_SIGNAL }; @@ -53,10 +53,11 @@ static guint signals[LAST_SIGNAL] = { 0 }; static POA_Evolution_LocalStorage__vepv LocalStorage_vepv; static void -impl_Evolution_LocalStorage_set_display_name (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_Environment *ev) +impl_Evolution_LocalStorage_update_folder (PortableServer_Servant servant, + const CORBA_char *path, + const CORBA_char *display_name, + CORBA_boolean highlighted, + CORBA_Environment *ev) { BonoboObject *bonobo_object; EvolutionLocalStorage *local_storage; @@ -64,7 +65,7 @@ impl_Evolution_LocalStorage_set_display_name (PortableServer_Servant servant, bonobo_object = bonobo_object_from_servant (servant); local_storage = EVOLUTION_LOCAL_STORAGE (bonobo_object); - gtk_signal_emit (GTK_OBJECT (local_storage), signals[SET_DISPLAY_NAME], path, display_name); + gtk_signal_emit (GTK_OBJECT (local_storage), signals[UPDATE_FOLDER], path, display_name, highlighted); } static POA_Evolution_LocalStorage * @@ -135,15 +136,16 @@ class_init (EvolutionLocalStorageClass *klass) parent_class = gtk_type_class (PARENT_TYPE); - signals[SET_DISPLAY_NAME] = gtk_signal_new ("set_display_name", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionLocalStorageClass, - set_display_name), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, - GTK_TYPE_STRING); + signals[UPDATE_FOLDER] = gtk_signal_new ("update_folder", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionLocalStorageClass, + update_folder), + e_marshal_NONE__POINTER_POINTER_INT, + GTK_TYPE_NONE, 3, + GTK_TYPE_STRING, + GTK_TYPE_STRING, + GTK_TYPE_BOOL); gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); @@ -167,7 +169,7 @@ evolution_local_storage_get_epv (void) POA_Evolution_LocalStorage__epv *epv; epv = g_new0 (POA_Evolution_LocalStorage__epv, 1); - epv->set_display_name = impl_Evolution_LocalStorage_set_display_name; + epv->update_folder = impl_Evolution_LocalStorage_update_folder; return epv; } diff --git a/shell/evolution-local-storage.h b/shell/evolution-local-storage.h index 0034c33648..a97b0b7e81 100644 --- a/shell/evolution-local-storage.h +++ b/shell/evolution-local-storage.h @@ -57,9 +57,10 @@ struct _EvolutionLocalStorage { struct _EvolutionLocalStorageClass { EvolutionStorageClass parent_class; - void (* set_display_name) (EvolutionLocalStorage *local_storage, - const char *path, - const char *display_name); + void (* update_folder) (EvolutionLocalStorage *local_storage, + const char *path, + const char *display_name, + gboolean highlighted); }; diff --git a/shell/evolution-storage-listener.c b/shell/evolution-storage-listener.c index 3e1085ab10..293dd972f5 100644 --- a/shell/evolution-storage-listener.c +++ b/shell/evolution-storage-listener.c @@ -45,6 +45,7 @@ struct _EvolutionStorageListenerPrivate { enum { DESTROYED, NEW_FOLDER, + UPDATE_FOLDER, REMOVED_FOLDER, LAST_SIGNAL }; @@ -93,6 +94,23 @@ impl_Evolution_StorageListener_new_folder (PortableServer_Servant servant, } static void +impl_Evolution_StorageListener_update_folder (PortableServer_Servant servant, + const CORBA_char *path, + const CORBA_char *display_name, + CORBA_boolean highlighted, + CORBA_Environment *ev) +{ + EvolutionStorageListener *listener; + EvolutionStorageListenerPrivate *priv; + + listener = gtk_object_from_servant (servant); + priv = listener->priv; + + gtk_signal_emit (GTK_OBJECT (listener), signals[UPDATE_FOLDER], path, + display_name, highlighted); +} + +static void impl_Evolution_StorageListener_removed_folder (PortableServer_Servant servant, const CORBA_char *path, CORBA_Environment *ev) @@ -207,6 +225,7 @@ corba_class_init (void) epv = g_new0 (POA_Evolution_StorageListener__epv, 1); epv->destroyed = impl_Evolution_StorageListener_destroyed; epv->new_folder = impl_Evolution_StorageListener_new_folder; + epv->update_folder = impl_Evolution_StorageListener_update_folder; epv->removed_folder = impl_Evolution_StorageListener_removed_folder; vepv = & my_Evolution_StorageListener_vepv; @@ -240,6 +259,16 @@ class_init (EvolutionStorageListenerClass *klass) GTK_TYPE_STRING, GTK_TYPE_POINTER); + signals[UPDATE_FOLDER] = gtk_signal_new ("new_folder", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionStorageListenerClass, update_folder), + e_marshal_NONE__POINTER_POINTER_INT, + GTK_TYPE_NONE, 3, + GTK_TYPE_STRING, + GTK_TYPE_STRING, + GTK_TYPE_BOOL); + signals[REMOVED_FOLDER] = gtk_signal_new ("removed_folder", GTK_RUN_FIRST, object_class->type, diff --git a/shell/evolution-storage-listener.h b/shell/evolution-storage-listener.h index 2ac6ddd5d4..50a1ef7f72 100644 --- a/shell/evolution-storage-listener.h +++ b/shell/evolution-storage-listener.h @@ -58,12 +58,15 @@ struct _EvolutionStorageListenerClass { GtkObjectClass parent_class; /* Signals. */ - void (* destroyed) (EvolutionStorageListener *storage_listener); - void (* new_folder) (EvolutionStorageListener *storage_listener, - const char *path, - const Evolution_Folder *folder); - void (* removed_folder) (EvolutionStorageListener *storage_listener, - const char *path); + void (* destroyed) (EvolutionStorageListener *storage_listener); + void (* new_folder) (EvolutionStorageListener *storage_listener, + const char *path, + const Evolution_Folder *folder); + void (* update_folder) (EvolutionStorageListener *storage_listener, + const char *path, + const char *display_name); + void (* removed_folder) (EvolutionStorageListener *storage_listener, + const char *path); }; diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 4d271cefa8..d1a1285297 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -545,6 +545,67 @@ evolution_storage_new_folder (EvolutionStorage *evolution_storage, } EvolutionStorageResult +evolution_storage_update_folder (EvolutionStorage *evolution_storage, + const char *path, const char *display_name, + gboolean highlighted) +{ + EvolutionStorageResult result; + EvolutionStoragePrivate *priv; + CORBA_Environment ev; + GList *p; + Evolution_Folder *corba_folder; + + g_return_val_if_fail (evolution_storage != NULL, + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (path != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + + priv = evolution_storage->priv; + + if (priv->corba_storage_listeners == NULL) + return EVOLUTION_STORAGE_ERROR_NOTREGISTERED; + + CORBA_exception_init (&ev); + + result = EVOLUTION_STORAGE_OK; + + for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { + Evolution_StorageListener listener; + + listener = p->data; + Evolution_StorageListener_update_folder (listener, path, display_name, highlighted, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + continue; + + if (ev._major != CORBA_USER_EXCEPTION) + result = EVOLUTION_STORAGE_ERROR_CORBA; + else if (strcmp (CORBA_exception_id (&ev), ex_Evolution_StorageListener_NotFound) == 0) + result = EVOLUTION_STORAGE_ERROR_NOTFOUND; + else + result = EVOLUTION_STORAGE_ERROR_GENERIC; + + break; + } + + CORBA_exception_free (&ev); + + if (result == EVOLUTION_STORAGE_OK) { + corba_folder = e_folder_tree_get_folder (priv->folder_tree, path); + if (corba_folder != NULL) { + CORBA_free (corba_folder->display_name); + corba_folder->display_name = CORBA_string_dup (display_name); + corba_folder->highlighted = highlighted; + } else + result = EVOLUTION_STORAGE_ERROR_NOTFOUND; + } + + return result; +} + +EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage, const char *path) { diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h index d32b716f86..45a5e4a543 100644 --- a/shell/evolution-storage.h +++ b/shell/evolution-storage.h @@ -90,6 +90,10 @@ EvolutionStorageResult evolution_storage_new_folder (EvolutionStora const char *type, const char *physical_uri, const char *description); +EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage, + const char *path, + const char *display_name, + gboolean highlighted); EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage, const char *path); |