diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 13 | ||||
-rw-r--r-- | shell/e-folder.c | 33 | ||||
-rw-r--r-- | shell/e-folder.h | 11 | ||||
-rw-r--r-- | shell/e-storage.c | 18 |
4 files changed, 61 insertions, 14 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 3621b3585b..b4acb5d56c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2001-02-20 Dan Winship <danw@ximian.com> + + * e-folder.c (_EFolderPrivate): split "highlighted" into + self_highlight and child_highligh. + (e_folder_get_highlighted): Return TRUE if either self_highlight + is true or any child is highlighted. + (e_folder_set_child_highlight): New function to tell the folder + about a child highlight change. + + * e-storage.c (folder_changed_cb): Update child highlights + correctly on folders so that folders will be highlighted whenever + their children are. + 2001-02-17 Christopher James Lahey <clahey@ximian.com> * e-shell-view-menu.c (file_verbs): Cast this fucntion pointer. diff --git a/shell/e-folder.c b/shell/e-folder.c index bad986fac6..f76829b0d4 100644 --- a/shell/e-folder.c +++ b/shell/e-folder.c @@ -41,7 +41,8 @@ struct _EFolderPrivate { char *type; char *description; char *physical_uri; - gboolean highlighted; + gboolean self_highlight; + int child_highlight; }; #define EF_CLASS(obj) \ @@ -142,11 +143,12 @@ init (EFolder *folder) EFolderPrivate *priv; priv = g_new (EFolderPrivate, 1); - priv->type = NULL; - priv->name = NULL; - priv->description = NULL; - priv->physical_uri = NULL; - priv->highlighted = FALSE; + priv->type = NULL; + priv->name = NULL; + priv->description = NULL; + priv->physical_uri = NULL; + priv->self_highlight = FALSE; + priv->child_highlight = 0; folder->priv = priv; } @@ -235,7 +237,7 @@ 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; + return folder->priv->self_highlight || folder->priv->child_highlight; } @@ -302,7 +304,22 @@ e_folder_set_highlighted (EFolder *folder, g_return_if_fail (folder != NULL); g_return_if_fail (E_IS_FOLDER (folder)); - folder->priv->highlighted = highlighted; + folder->priv->self_highlight = highlighted; + + gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); +} + +void +e_folder_set_child_highlight (EFolder *folder, + gboolean highlighted) +{ + g_return_if_fail (folder != NULL); + g_return_if_fail (E_IS_FOLDER (folder)); + + if (highlighted) + folder->priv->child_highlight++; + else + folder->priv->child_highlight--; gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); } diff --git a/shell/e-folder.h b/shell/e-folder.h index 5a720a957e..81bbd54448 100644 --- a/shell/e-folder.h +++ b/shell/e-folder.h @@ -77,11 +77,12 @@ 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); +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); +void e_folder_set_child_highlight (EFolder *folder, gboolean highlighted); #ifdef __cplusplus } diff --git a/shell/e-storage.c b/shell/e-storage.c index 6eb746e8a7..7045ef47d5 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -92,7 +92,8 @@ folder_changed_cb (EFolder *folder, { EStorage *storage; EStoragePrivate *priv; - const char *path; + const char *path, *p; + gboolean highlight; g_assert (E_IS_STORAGE (data)); @@ -103,6 +104,21 @@ folder_changed_cb (EFolder *folder, g_assert (path != NULL); gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path); + + highlight = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (folder), "last_highlight")); + if (highlight != e_folder_get_highlighted (folder)) { + highlight = !highlight; + gtk_object_set_data (GTK_OBJECT (folder), "last_highlight", + GINT_TO_POINTER (highlight)); + p = strrchr (path, '/'); + if (p && p != path) { + path = g_strndup (path, p - path); + folder = e_folder_tree_get_folder (priv->folder_tree, path); + if (folder) + e_folder_set_child_highlight (folder, highlight); + g_free (path); + } + } } |