diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-10 23:26:31 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-10 23:26:31 +0800 |
commit | 090af2cb0e680190161fa4fb204f32c2c432dc26 (patch) | |
tree | 98c5993e67e3bf3d0c6d7d2fb9da57621c6ed763 /shell/e-folder.c | |
parent | a3a24835e896c685201c7dfc0aea405c92b953b3 (diff) | |
download | gsoc2013-evolution-090af2cb0e680190161fa4fb204f32c2c432dc26.tar.gz gsoc2013-evolution-090af2cb0e680190161fa4fb204f32c2c432dc26.tar.zst gsoc2013-evolution-090af2cb0e680190161fa4fb204f32c2c432dc26.zip |
Pass zero as the @sorting_priority to evolution_storage_new_folder().
* gui/component/addressbook-storage.c (load_source_data): Pass
zero as the @sorting_priority to evolution_storage_new_folder().
(addressbook_storage_add_source): Likewise.
* subscribe-dialog.c (recursive_add_folder): Pass zero as
@sorting_priority to evolution_storage_new_folder().
* mail-folder-cache.c (real_flush_updates): Pass zero as
@sorting_priority to evolution_storage_new_folder().
* evolution-test-component.c (setup_custom_storage): Pass
@sorting_priority to evolution_storage_new_folder() so we test it.
Also make /FirstFolder have an "inbox" custom icon.
* e-local-storage.c (new_folder): Pass zero as @sorting_priority
to evolution_storage_new_folder().
* evolution-storage.c (evolution_storage_new_folder): New arg
@sorting_priority; put it in the CORBA folder struct.
* evolution-shell-client.c
(impl_FolderSelectionListener_selected): Copy the sortingPriority
as well.
* e-folder.c (e_folder_to_corba): Set sortingPriority.
* e-corba-storage-registry.c
(impl_StorageRegistry_getFolderByUri): Set sortingPriority in the
new CORBA Folder struct.
* e-corba-storage.c (impl_StorageListener_notifyFolderCreated):
Set the custom_icon if folder->customIconName is not an empty
string. Likewise, set the sorting_priority
* Evolution-common.idl: New member sortingPriority in struct
Folder.
* e-storage-set-view.c (folder_sort_callback): Sort according to
the sorting_priorities.
* e-folder.c: New member sorting_priority in EFolderPrivate.
(init): Init to zero.
(e_folder_set_custom_icon): Emit "changed" if required.
(e_folder_set_sorting_priority): New.
svn path=/trunk/; revision=17404
Diffstat (limited to 'shell/e-folder.c')
-rw-r--r-- | shell/e-folder.c | 80 |
1 files changed, 66 insertions, 14 deletions
diff --git a/shell/e-folder.c b/shell/e-folder.c index 6f36e5b487..64083a6d31 100644 --- a/shell/e-folder.c +++ b/shell/e-folder.c @@ -46,6 +46,13 @@ struct _EFolderPrivate { int child_highlight; int unread_count; + /* Folders have a default sorting priority of zero; when deciding the + sort order in the Evolution folder tree, folders with the same + priority value are compared by name, while folders with a higher + priority number always come after the folders with a lower priority + number. */ + int sorting_priority; + unsigned int self_highlight : 1; unsigned int is_stock : 1; unsigned int can_sync_offline : 1; @@ -161,6 +168,7 @@ init (EFolder *folder) priv->physical_uri = NULL; priv->child_highlight = 0; priv->unread_count = 0; + priv->sorting_priority = 0; priv->self_highlight = FALSE; priv->is_stock = FALSE; priv->can_sync_offline = FALSE; @@ -287,7 +295,7 @@ e_folder_get_can_sync_offline (EFolder *folder) * @folder: An EFolder * * Get the name of the custom icon for @folder, or NULL if no custom icon is - * associated with it + * associated with it. **/ const char * e_folder_get_custom_icon_name (EFolder *folder) @@ -297,6 +305,22 @@ e_folder_get_custom_icon_name (EFolder *folder) return folder->priv->custom_icon_name; } +/** + * e_folder_get_sorting_priority: + * @folder: An EFolder + * + * Get the sorting priority for @folder. + * + * Return value: Sorting priority value for @folder. + **/ +int +e_folder_get_sorting_priority (EFolder *folder) +{ + g_return_val_if_fail (E_IS_FOLDER (folder), 0); + + return folder->priv->sorting_priority; +} + void e_folder_set_name (EFolder *folder, @@ -425,16 +449,43 @@ e_folder_set_custom_icon (EFolder *folder, { g_return_if_fail (E_IS_FOLDER (folder)); - if (icon_name != folder->priv->custom_icon_name) { + if (icon_name == folder->priv->custom_icon_name) + return; + + if (folder->priv->custom_icon_name == NULL + || (icon_name != NULL && strcmp (icon_name, folder->priv->custom_icon_name) != 0)) { g_free (folder->priv->custom_icon_name); + folder->priv->custom_icon_name = g_strdup (icon_name); - if (icon_name == NULL) - folder->priv->custom_icon_name = NULL; - else - folder->priv->custom_icon_name = g_strdup (icon_name); + gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); } } +/** + * e_folder_set_sorting_priority: + * @folder: An EFolder + * @sorting_priority: A sorting priority number + * + * Set the sorting priority for @folder. Folders have a default sorting + * priority of zero; when deciding the sort order in the Evolution folder tree, + * folders with the same priority value are compared by name, while folders + * with a higher priority number always come after the folders with a lower + * priority number. + **/ +void +e_folder_set_sorting_priority (EFolder *folder, + int sorting_priority) +{ + g_return_if_fail (E_IS_FOLDER (folder)); + + if (folder->priv->sorting_priority == sorting_priority) + return; + + folder->priv->sorting_priority = sorting_priority; + + gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); +} + /* Gotta love CORBA. */ @@ -455,14 +506,15 @@ e_folder_to_corba (EFolder *folder, g_return_if_fail (E_IS_FOLDER (folder)); g_return_if_fail (folder_return != NULL); - folder_return->type = safe_corba_string_dup (e_folder_get_type_string (folder)); - folder_return->description = safe_corba_string_dup (e_folder_get_description (folder)); - folder_return->displayName = safe_corba_string_dup (e_folder_get_name (folder)); - folder_return->physicalUri = safe_corba_string_dup (e_folder_get_physical_uri (folder)); - folder_return->evolutionUri = safe_corba_string_dup (evolution_uri); - folder_return->customIconName = safe_corba_string_dup (e_folder_get_custom_icon_name (folder)); - folder_return->unreadCount = e_folder_get_unread_count (folder); - folder_return->canSyncOffline = e_folder_get_can_sync_offline (folder); + folder_return->type = safe_corba_string_dup (e_folder_get_type_string (folder)); + folder_return->description = safe_corba_string_dup (e_folder_get_description (folder)); + folder_return->displayName = safe_corba_string_dup (e_folder_get_name (folder)); + folder_return->physicalUri = safe_corba_string_dup (e_folder_get_physical_uri (folder)); + folder_return->evolutionUri = safe_corba_string_dup (evolution_uri); + folder_return->customIconName = safe_corba_string_dup (e_folder_get_custom_icon_name (folder)); + folder_return->unreadCount = e_folder_get_unread_count (folder); + folder_return->canSyncOffline = e_folder_get_can_sync_offline (folder); + folder_return->sortingPriority = e_folder_get_sorting_priority (folder); } |