summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Harper <jsh@eazel.com>2001-02-21 07:19:48 +0000
committerJohn Harper <jsh@src.gnome.org>2001-02-21 07:19:48 +0000
commit6a12fd5c8f3931d92a3d6e8bfb7ada1dd96152be (patch)
tree8fb63d4b71d60ac74aa399709511fcb84c1745fa
parentf67f6c74d148a62e8fd9fcf5f8f4244af898ecbf (diff)
downloadnautilus-6a12fd5c8f3931d92a3d6e8bfb7ada1dd96152be.tar.gz
reviewed by Maciej Stachowiak <mjs@eazel.com>
2001-02-20 John Harper <jsh@eazel.com> reviewed by Maciej Stachowiak <mjs@eazel.com> Fixed bug where a renamed node in the tree view doesn't get resorted: * libnautilus-extensions/nautilus-ctree.c (set_node_info): if the ctree is in auto-sort mode, sort the branch containing the changed node Fixed a crash in the tree view when expanding nodes that have been moved across directories: * components/tree/nautilus-tree-node.c (nautilus_tree_node_remove_children): new function, unparents all children of the given node (nautilus_tree_node_destroy): emit a warning if the list of children is non-null (then call remove_children). Ideally the remove_children function should get called before the final unref of a directory node * components/tree/nautilus-tree-model.c (report_node_removed_internal): call nautilus_tree_node_remove_children before unref'ing the node Mostly fixed bug where expansion state hash table accumulates cruft over time (e.g. directories that no longer exist or got moved to locations where they can never be displayed): * components/tree/nautilus-tree-view.h (NautilusTreeViewDetails): added `view_node_to_uri_map' hash table. This is used to map view nodes to the URIs we believe they are displaying. This is necessary since by the time we find out about changes to nodes, the names of the underlying NautilusFile objects have often already been changed * components/tree/nautilus-tree-view.c (unlink_view_node_from_uri, link_view_node_with_uri, map_view_node_to_uri): functions accessing the new hash table (nautilus_tree_view_would_include_file): new function, returns true iff the given file may possibly appear in the tree view. Climbs through all parents of the file to do this (nautilus_tree_view_model_node_renamed_callback): only propagates the expansion state if the would_include function indicates that the new URI of the file would be included in the tree view * components/tree/nautilus-tree-model.c (report_node_changed): no need to suppress the `node_removed' signal when renaming the node (now that the view always deletes the expansion state of the correct URI) * libnautilus-extensions/nautilus-file.c, libnautilus-extensions/nautilus-file-private.h, libnautilus-extensions/nautilus-file-utilities.c, libnautilus-extensions/nautilus-file-utilities.h (nautilus_file_name_matches_hidden_pattern, nautilus_file_name_matches_backup_pattern): moved these functions from being private in nautilus-file to being public in nautilus-file-utilities Fixed tree view bug where moving nodes across directories still loses the expansion state: * components/tree/nautilus-tree-model.c (nautilus_tree_model_directory_files_changed_callback): separated the cases of the file being deleted and it being moved across directories. In the move case emit the `being_renamed' signal so the expansion state gets propagated (nautilus_tree_view_remove_model_node, forget_view_node): moved the code to delete the expansion state from forget_view_node to nautilus_tree_view_remove_model_node - avoids deleting expansion state of nodes that will later be renamed. It may leave non-existent directories in the expansion state, but this is a lesser bug than losing the expansion state totally. Also, use the map_view_node_to_uri function to find the URI whose expansion state needs to be removed Fixed the bug where tree view icons often got chopped at top and bottom when they're drawn (if the icon height is greater than the font height). This means that fewer rows may fit in the same vertical space, but visually it's (imho) a huge improvement (I think this is bug 6085): * components/tree/nautilus-tree-view.c (nautilus_tree_view_initialize): call gtk_clist_set_row_height with the maximum of the font height and the icon height * libnautilus-extensions/nautilus-ctree.c (draw_row): always calculate row_center_offset locally, and do it in such a way that the text really is in the center of the row! Fixed bug 5165 - repeatedly expanding and collapsing an empty directory doesn't change how the node's icon is drawn after the first expansion: * libnautilus-extensions/nautilus-ctree.c (real_tree_expand, real_tree_collapse): before returning, call tree_draw_node on the node that changed state
-rw-r--r--ChangeLog110
-rw-r--r--components/tree/nautilus-tree-model.c19
-rw-r--r--components/tree/nautilus-tree-node-private.h1
-rw-r--r--components/tree/nautilus-tree-node.c21
-rw-r--r--components/tree/nautilus-tree-view-private.h1
-rw-r--r--components/tree/nautilus-tree-view.c150
-rw-r--r--libnautilus-extensions/nautilus-ctree.c32
-rw-r--r--libnautilus-extensions/nautilus-file-private.h4
-rw-r--r--libnautilus-extensions/nautilus-file-utilities.c17
-rw-r--r--libnautilus-extensions/nautilus-file-utilities.h4
-rw-r--r--libnautilus-extensions/nautilus-file.c16
-rw-r--r--libnautilus-private/nautilus-ctree.c32
-rw-r--r--libnautilus-private/nautilus-file-private.h4
-rw-r--r--libnautilus-private/nautilus-file-utilities.c17
-rw-r--r--libnautilus-private/nautilus-file-utilities.h4
-rw-r--r--libnautilus-private/nautilus-file.c16
16 files changed, 353 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 16b3f859a..9ab0c8f47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,113 @@
+2001-02-20 John Harper <jsh@eazel.com>
+
+ reviewed by Maciej Stachowiak <mjs@eazel.com>
+
+ Fixed bug where a renamed node in the tree view doesn't get
+ resorted:
+
+ * libnautilus-extensions/nautilus-ctree.c (set_node_info): if
+ the ctree is in auto-sort mode, sort the branch containing the
+ changed node
+
+
+ Fixed a crash in the tree view when expanding nodes that have
+ been moved across directories:
+
+ * components/tree/nautilus-tree-node.c
+ (nautilus_tree_node_remove_children): new function, unparents
+ all children of the given node
+
+ (nautilus_tree_node_destroy): emit a warning if the list of
+ children is non-null (then call remove_children). Ideally the
+ remove_children function should get called before the final
+ unref of a directory node
+
+ * components/tree/nautilus-tree-model.c
+ (report_node_removed_internal): call
+ nautilus_tree_node_remove_children before unref'ing the node
+
+
+ Mostly fixed bug where expansion state hash table accumulates
+ cruft over time (e.g. directories that no longer exist or got
+ moved to locations where they can never be displayed):
+
+ * components/tree/nautilus-tree-view.h
+ (NautilusTreeViewDetails): added `view_node_to_uri_map' hash
+ table. This is used to map view nodes to the URIs we believe
+ they are displaying. This is necessary since by the time we
+ find out about changes to nodes, the names of the underlying
+ NautilusFile objects have often already been changed
+
+ * components/tree/nautilus-tree-view.c
+ (unlink_view_node_from_uri, link_view_node_with_uri,
+ map_view_node_to_uri): functions accessing the new hash table
+
+ (nautilus_tree_view_would_include_file): new function, returns
+ true iff the given file may possibly appear in the tree view.
+ Climbs through all parents of the file to do this
+
+ (nautilus_tree_view_model_node_renamed_callback): only
+ propagates the expansion state if the would_include function
+ indicates that the new URI of the file would be included in the
+ tree view
+
+ * components/tree/nautilus-tree-model.c (report_node_changed):
+ no need to suppress the `node_removed' signal when renaming the
+ node (now that the view always deletes the expansion state of
+ the correct URI)
+
+ * libnautilus-extensions/nautilus-file.c,
+ libnautilus-extensions/nautilus-file-private.h,
+ libnautilus-extensions/nautilus-file-utilities.c,
+ libnautilus-extensions/nautilus-file-utilities.h
+ (nautilus_file_name_matches_hidden_pattern,
+ nautilus_file_name_matches_backup_pattern): moved these
+ functions from being private in nautilus-file to being public
+ in nautilus-file-utilities
+
+
+ Fixed tree view bug where moving nodes across directories still
+ loses the expansion state:
+
+ * components/tree/nautilus-tree-model.c
+ (nautilus_tree_model_directory_files_changed_callback):
+ separated the cases of the file being deleted and it being
+ moved across directories. In the move case emit the
+ `being_renamed' signal so the expansion state gets propagated
+
+ (nautilus_tree_view_remove_model_node, forget_view_node): moved
+ the code to delete the expansion state from forget_view_node to
+ nautilus_tree_view_remove_model_node - avoids deleting
+ expansion state of nodes that will later be renamed. It may
+ leave non-existent directories in the expansion state, but this
+ is a lesser bug than losing the expansion state totally. Also,
+ use the map_view_node_to_uri function to find the URI whose
+ expansion state needs to be removed
+
+
+ Fixed the bug where tree view icons often got chopped at top
+ and bottom when they're drawn (if the icon height is greater
+ than the font height). This means that fewer rows may fit in
+ the same vertical space, but visually it's (imho) a huge
+ improvement (I think this is bug 6085):
+
+ * components/tree/nautilus-tree-view.c
+ (nautilus_tree_view_initialize): call gtk_clist_set_row_height
+ with the maximum of the font height and the icon height
+
+ * libnautilus-extensions/nautilus-ctree.c (draw_row): always
+ calculate row_center_offset locally, and do it in such a way
+ that the text really is in the center of the row!
+
+
+ Fixed bug 5165 - repeatedly expanding and collapsing an empty
+ directory doesn't change how the node's icon is drawn after the
+ first expansion:
+
+ * libnautilus-extensions/nautilus-ctree.c (real_tree_expand,
+ real_tree_collapse): before returning, call tree_draw_node on
+ the node that changed state
+
2001-02-20 Robey Pointer <robey@eazel.com>
* components/services/install/nautilus-view/Makefile.am:
diff --git a/components/tree/nautilus-tree-model.c b/components/tree/nautilus-tree-model.c
index e1ca9bae0..7acbb5f5a 100644
--- a/components/tree/nautilus-tree-model.c
+++ b/components/tree/nautilus-tree-model.c
@@ -710,7 +710,7 @@ report_node_changed (NautilusTreeModel *model,
signals[NODE_BEING_RENAMED],
node->details->uri, file_uri);
- report_node_removed_internal (model, node, FALSE);
+ report_node_removed (model, node);
g_free (node->details->uri);
node->details->uri = file_uri;
@@ -755,6 +755,8 @@ report_node_removed_internal (NautilusTreeModel *model,
nautilus_tree_node_remove_from_parent (node);
}
+ nautilus_tree_node_remove_children (node);
+
g_hash_table_remove (model->details->file_to_node_map,
nautilus_tree_node_get_file (node));
@@ -823,8 +825,19 @@ nautilus_tree_model_directory_files_changed_callback (NautilusDirectory *
uri = nautilus_file_get_uri (file);
g_free (uri);
} else {
- if (!nautilus_directory_contains_file (directory, file)
- || nautilus_file_is_gone (file)) {
+ if (nautilus_file_is_gone (file)) {
+ report_node_removed (model, node);
+ } else if (!nautilus_directory_contains_file (directory, file)) {
+ /* Let the view propagate the expansion state */
+ uri = nautilus_file_get_uri (file);
+ gtk_signal_emit (GTK_OBJECT (model),
+ signals[NODE_BEING_RENAMED],
+ node->details->uri, uri);
+ g_free (uri);
+
+ /* then remove the node - the added callback will get invoked
+ * after this function returns
+ */
report_node_removed (model, node);
} else {
report_node_changed (model, node);
diff --git a/components/tree/nautilus-tree-node-private.h b/components/tree/nautilus-tree-node-private.h
index fc9d89170..4f73c818a 100644
--- a/components/tree/nautilus-tree-node-private.h
+++ b/components/tree/nautilus-tree-node-private.h
@@ -53,6 +53,7 @@ void nautilus_tree_node_set_parent (NautilusTreeNode *node,
void nautilus_tree_node_remove_from_parent (NautilusTreeNode *node);
+void nautilus_tree_node_remove_children (NautilusTreeNode *node);
#endif /* NAUTILUS_TREE_NODE_PRIVATE_H */
diff --git a/components/tree/nautilus-tree-node.c b/components/tree/nautilus-tree-node.c
index 543fe08d2..dfe0ff11e 100644
--- a/components/tree/nautilus-tree-node.c
+++ b/components/tree/nautilus-tree-node.c
@@ -70,9 +70,13 @@ nautilus_tree_node_destroy (GtkObject *object)
node = NAUTILUS_TREE_NODE (object);
+ if (node->details->children != NULL) {
+ g_warning ("Destroyed tree node still has children");
+ nautilus_tree_node_remove_children (node);
+ }
+
nautilus_directory_unref (node->details->directory);
nautilus_file_unref (node->details->file);
- g_list_free (node->details->children);
g_free (node->details->uri);
g_free (node->details);
@@ -147,3 +151,18 @@ nautilus_tree_node_remove_from_parent (NautilusTreeNode *node)
node->details->parent = NULL;
}
}
+
+void
+nautilus_tree_node_remove_children (NautilusTreeNode *node)
+{
+ GList *p;
+ NautilusTreeNode *child;
+
+ for (p = node->details->children; p != NULL; p = p->next) {
+ child = p->data;
+ child->details->parent = NULL;
+ }
+
+ g_list_free (node->details->children);
+ node->details->children = NULL;
+}
diff --git a/components/tree/nautilus-tree-view-private.h b/components/tree/nautilus-tree-view-private.h
index 4addfc4ef..34489d4e8 100644
--- a/components/tree/nautilus-tree-view-private.h
+++ b/components/tree/nautilus-tree-view-private.h
@@ -52,6 +52,7 @@ struct NautilusTreeViewDetails {
NautilusTreeModel *model;
GHashTable *file_to_node_map;
+ GHashTable *view_node_to_uri_map;
gboolean show_hidden_files;
gboolean show_backup_files;
diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c
index c1329187e..a7c06c2f9 100644
--- a/components/tree/nautilus-tree-view.c
+++ b/components/tree/nautilus-tree-view.c
@@ -47,6 +47,7 @@
#include <stdio.h>
+#define DEBUG_TREE 1
#define DISPLAY_TIMEOUT_INTERVAL_MSECS 500
@@ -126,6 +127,42 @@ nautilus_tree_view_initialize_class (NautilusTreeViewClass *klass)
}
+static void
+unlink_view_node_from_uri (NautilusTreeView *view,
+ NautilusCTreeNode *view_node)
+{
+ gpointer orig_key, value;
+
+ if (g_hash_table_lookup_extended (view->details->view_node_to_uri_map,
+ view_node, &orig_key, &value)) {
+ g_hash_table_remove (view->details->view_node_to_uri_map, view_node);
+ g_free (value);
+ }
+}
+
+/* URI will be g_free'd eventually */
+static void
+link_view_node_with_uri (NautilusTreeView *view,
+ NautilusCTreeNode *view_node,
+ const char *uri)
+{
+ unlink_view_node_from_uri (view, view_node);
+ g_hash_table_insert (view->details->view_node_to_uri_map,
+ view_node, (gpointer) uri);
+}
+
+/* Returned string is only valid until next link or unlink of VIEW-NODE */
+static const char *
+map_view_node_to_uri (NautilusTreeView *view,
+ NautilusCTreeNode *view_node)
+{
+ gpointer value = g_hash_table_lookup (view->details->view_node_to_uri_map,
+ view_node);
+ g_assert (value != NULL);
+ return value;
+}
+
+
static gboolean
nautilus_tree_view_should_skip_file (NautilusTreeView *view,
NautilusFile *file)
@@ -137,6 +174,50 @@ nautilus_tree_view_should_skip_file (NautilusTreeView *view,
nautilus_file_is_directory (file)));
}
+/* This is different to the should_skip function above, in that it
+ * also searches all parent files of URI. It will return true iff
+ * URI may be shown in the tree view display. Note that URI may
+ * not exist when this is called.
+ */
+static gboolean
+nautilus_tree_view_would_include_uri (NautilusTreeView *view,
+ const char *uri)
+{
+ char *copy, *component;
+
+ /* The tree view currently only ever shows `file:' URIs */
+
+ if (!nautilus_str_has_prefix (uri, "file:")) {
+ return FALSE;
+ }
+
+ if (!view->details->show_hidden_files
+ || !view->details->show_backup_files) {
+ copy = g_strdup (uri);
+ while (1) {
+ component = strrchr (copy, '/');
+ if (component != NULL) {
+ if ((!view->details->show_hidden_files
+ && nautilus_file_name_matches_hidden_pattern (component + 1))
+ || (!view->details->show_backup_files
+ && nautilus_file_name_matches_backup_pattern (component + 1))) {
+ /* Don't show this file */
+ g_free (copy);
+ return FALSE;
+ } else {
+ /* Chop the bottom-most component from the uri */
+ *component = 0;
+ }
+ } else {
+ break;
+ }
+ }
+ g_free (copy);
+ }
+
+ return TRUE;
+}
+
static void
nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode *node)
{
@@ -166,7 +247,7 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode *
#ifdef DEBUG_TREE
printf ("parent_view_node 0x%x (%s)\n", (unsigned) parent_view_node,
- nautilus_file_get_uri (nautilus_tree_view_node_to_file (view, node)));
+ nautilus_file_get_uri (nautilus_tree_view_node_to_file (view, parent_view_node)));
#endif
@@ -213,9 +294,10 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode *
nautilus_file_ref (file);
g_hash_table_insert (view->details->file_to_node_map, file, view_node);
+ uri = nautilus_file_get_uri (file);
+ link_view_node_with_uri (view, view_node, uri);
+
if (nautilus_file_is_directory (nautilus_tree_node_get_file (node))) {
- uri = nautilus_file_get_uri (file);
-
if (nautilus_tree_expansion_state_is_node_expanded (view->details->expansion_state, uri)) {
if (!ctree_is_node_expanded (NAUTILUS_CTREE (view->details->tree),
view_node)) {
@@ -229,8 +311,6 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode *
view_node);
}
}
-
- g_free (uri);
}
} else {
nautilus_tree_view_update_model_node (view, node);
@@ -246,17 +326,15 @@ forget_view_node (NautilusTreeView *view,
NautilusCTreeNode *view_node)
{
NautilusFile *file;
- char *uri;
file = nautilus_tree_view_node_to_file (view, view_node);
- uri = nautilus_file_get_uri (file);
- nautilus_tree_expansion_state_remove_node
- (view->details->expansion_state, uri);
- g_free (uri);
+ g_message ("forgetting %s", nautilus_file_get_uri (file));
g_hash_table_remove (view->details->file_to_node_map, file);
nautilus_file_unref (file);
+
+ unlink_view_node_from_uri (view, view_node);
}
static void
@@ -279,6 +357,7 @@ nautilus_tree_view_remove_model_node (NautilusTreeView *view, NautilusTreeNode *
{
NautilusCTreeNode *view_node;
NautilusFile *file;
+ const char *uri;
file = nautilus_tree_node_get_file (node);
@@ -289,6 +368,17 @@ nautilus_tree_view_remove_model_node (NautilusTreeView *view, NautilusTreeNode *
view_node = nautilus_tree_view_model_node_to_view_node (view, node);
if (view_node != NULL) {
+ /* The URI associated with FILE may have been renamed by now,
+ * so using nautilus_file_get_uri () is no good (since it would
+ * give the new name, not the old name). Hence the extra hash
+ * table mapping view nodes to URIs..
+ *
+ * Note that it would be better to remove the expansion
+ * state of the children, but that breaks renaming..
+ */
+ uri = map_view_node_to_uri (view, view_node);
+ nautilus_tree_expansion_state_remove_node (view->details->expansion_state, uri);
+
forget_view_node_and_children (view, view_node);
nautilus_ctree_remove_node (NAUTILUS_CTREE (view->details->tree),
view_node);
@@ -350,6 +440,8 @@ nautilus_tree_view_update_model_node (NautilusTreeView *view, NautilusTreeNode *
if (view_node != NULL) {
name = nautilus_file_get_name (file);
+ link_view_node_with_uri (view, view_node, nautilus_file_get_uri (file));
+
nautilus_icon_factory_get_pixmap_and_mask_for_file (file,
NULL,
NAUTILUS_ICON_SIZE_FOR_MENUS,
@@ -574,20 +666,21 @@ nautilus_tree_view_model_node_renamed_callback (NautilusTreeModel *model,
const char *new_uri,
gpointer callback_data)
{
- NautilusTreeView *view;
-
- /* Propagate the expansion state of the old name to the new name */
+ NautilusTreeView *view;
- view = NAUTILUS_TREE_VIEW (callback_data);
+ /* Propagate the expansion state of the old name to the new name */
+ view = NAUTILUS_TREE_VIEW (callback_data);
- if (nautilus_tree_expansion_state_is_node_expanded (view->details->expansion_state, old_uri)) {
- nautilus_tree_expansion_state_expand_node (view->details->expansion_state, new_uri);
- } else {
- nautilus_tree_expansion_state_collapse_node (view->details->expansion_state, new_uri);
- }
+ if (nautilus_tree_view_would_include_uri (view, new_uri)) {
+ if (nautilus_tree_expansion_state_is_node_expanded (view->details->expansion_state, old_uri)) {
+ nautilus_tree_expansion_state_expand_node (view->details->expansion_state, new_uri);
+ } else {
+ nautilus_tree_expansion_state_collapse_node (view->details->expansion_state, new_uri);
+ }
+ }
- nautilus_tree_expansion_state_remove_node (view->details->expansion_state, old_uri);
+ nautilus_tree_expansion_state_remove_node (view->details->expansion_state, old_uri);
}
static void
@@ -691,8 +784,11 @@ nautilus_tree_view_initialize (NautilusTreeView *view)
gtk_clist_set_sort_type (GTK_CLIST (view->details->tree), GTK_SORT_ASCENDING);
gtk_clist_set_column_auto_resize (GTK_CLIST (view->details->tree), 0, TRUE);
gtk_clist_columns_autosize (GTK_CLIST (view->details->tree));
-
gtk_clist_set_reorderable (GTK_CLIST (view->details->tree), FALSE);
+ gtk_clist_set_row_height (GTK_CLIST (view->details->tree),
+ MAX (NAUTILUS_ICON_SIZE_FOR_MENUS,
+ view->details->tree->style->font->ascent
+ + view->details->tree->style->font->descent));
gtk_signal_connect (GTK_OBJECT (view->details->tree),
"tree_expand",
@@ -748,6 +844,7 @@ nautilus_tree_view_initialize (NautilusTreeView *view)
view);
view->details->file_to_node_map = g_hash_table_new (NULL, NULL);
+ view->details->view_node_to_uri_map = g_hash_table_new (NULL, NULL);
nautilus_tree_view_load_from_filesystem (view);
@@ -788,6 +885,12 @@ free_file_to_node_map_entry (gpointer key, gpointer value, gpointer callback_dat
}
static void
+free_view_node_to_uri_map_entry (gpointer key, gpointer value, gpointer callback_data)
+{
+ g_free (value); /* the URI */
+}
+
+static void
nautilus_tree_view_destroy (GtkObject *object)
{
NautilusTreeView *view;
@@ -817,6 +920,11 @@ nautilus_tree_view_destroy (GtkObject *object)
NULL);
g_hash_table_destroy (view->details->file_to_node_map);
+ g_hash_table_foreach (view->details->view_node_to_uri_map,
+ free_view_node_to_uri_map_entry,
+ NULL);
+ g_hash_table_destroy (view->details->view_node_to_uri_map);
+
nautilus_tree_view_free_dnd (view);
disconnect_model_handlers (view);
diff --git a/libnautilus-extensions/nautilus-ctree.c b/libnautilus-extensions/nautilus-ctree.c
index 1ea5ac0c3..c33628fed 100644
--- a/libnautilus-extensions/nautilus-ctree.c
+++ b/libnautilus-extensions/nautilus-ctree.c
@@ -1978,13 +1978,10 @@ draw_row (GtkCList *clist,
offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
case GTK_CELL_TEXT:
- if (style != GTK_WIDGET (clist)->style)
- row_center_offset = (((clist->row_height -
- style->font->ascent -
- style->font->descent - 1) / 2) +
- 1.5 + style->font->ascent);
- else
- row_center_offset = clist->row_center_offset;
+ row_center_offset = ((clist->row_height -
+ (style->font->ascent
+ + style->font->descent)) / 2
+ + style->font->ascent);
gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
gdk_draw_string
@@ -2099,13 +2096,11 @@ draw_row (GtkCList *clist,
offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
}
- if (style != GTK_WIDGET (clist)->style)
- row_center_offset = (((clist->row_height - style->font->ascent -
- style->font->descent - 1) / 2) +
- 1.5 + style->font->ascent);
- else
- row_center_offset = clist->row_center_offset;
-
+ row_center_offset = ((clist->row_height -
+ (style->font->ascent
+ + style->font->descent)) / 2
+ + style->font->ascent);
+
gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
gdk_draw_string (clist->clist_window, style->font, fg_gc, offset,
row_rectangle.y + row_center_offset +
@@ -2784,6 +2779,8 @@ real_tree_expand (NautilusCTree *ctree,
/* resize tree_column if needed */
column_auto_resize (clist, &NAUTILUS_CTREE_ROW (node)->row, ctree->tree_column,
requisition.width);
+
+ tree_draw_node (ctree, node);
}
static void
@@ -2899,6 +2896,7 @@ real_tree_collapse (NautilusCTree *ctree,
column_auto_resize (clist, &NAUTILUS_CTREE_ROW (node)->row, ctree->tree_column,
requisition.width);
+ tree_draw_node (ctree, node);
}
static void
@@ -3208,6 +3206,12 @@ set_node_info (NautilusCTree *ctree,
else
nautilus_ctree_node_set_pixtext (ctree, node, ctree->tree_column,
text, spacing, pixmap_closed, mask_closed);
+
+ if (GTK_CLIST_AUTO_SORT (GTK_CLIST (ctree))
+ && NAUTILUS_CTREE_ROW (node)->parent != NULL)
+ {
+ nautilus_ctree_sort_node (ctree, NAUTILUS_CTREE_ROW (node)->parent);
+ }
}
static void
diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h
index b1a7c696f..da0ce7a9c 100644
--- a/libnautilus-extensions/nautilus-file-private.h
+++ b/libnautilus-extensions/nautilus-file-private.h
@@ -134,7 +134,3 @@ gboolean nautilus_file_should_get_top_left_text (NautilusFile
void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
GList *file_attributes);
GList * nautilus_file_get_all_attributes (void);
-
-/* Recognizing special file names. */
-gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
-gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
diff --git a/libnautilus-extensions/nautilus-file-utilities.c b/libnautilus-extensions/nautilus-file-utilities.c
index 933b1f6b8..dc3588b10 100644
--- a/libnautilus-extensions/nautilus-file-utilities.c
+++ b/libnautilus-extensions/nautilus-file-utilities.c
@@ -819,8 +819,8 @@ uris_match (const char *uri_1, const char *uri_2, gboolean ignore_fragments)
g_free (canonical_2);
return result;
-
}
+
gboolean
nautilus_uris_match (const char *uri_1, const char *uri_2)
{
@@ -833,6 +833,21 @@ nautilus_uris_match_ignore_fragments (const char *uri_1, const char *uri_2)
return uris_match (uri_1, uri_2, TRUE);
}
+gboolean
+nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri)
+{
+ g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
+
+ return name_or_relative_uri[0] == '.';
+}
+
+gboolean
+nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
+{
+ g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
+
+ return nautilus_str_has_suffix (name_or_relative_uri, "~");
+}
/**
* nautilus_make_path:
diff --git a/libnautilus-extensions/nautilus-file-utilities.h b/libnautilus-extensions/nautilus-file-utilities.h
index a5160c915..b8cce15b4 100644
--- a/libnautilus-extensions/nautilus-file-utilities.h
+++ b/libnautilus-extensions/nautilus-file-utilities.h
@@ -56,6 +56,10 @@ char * nautilus_uri_get_scheme (const char
char * nautilus_uri_make_full_from_relative (const char *base_uri,
const char *uri);
+/* Recognizing special file names. */
+gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
+gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
+
/* FIXME bugzilla.eazel.com 2424:
* This is the same as gnome-libs g_concat_dir_and_file except
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index 7fa9ce6c7..40db9376b 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -1776,22 +1776,6 @@ nautilus_file_compare_name (NautilusFile *file,
}
gboolean
-nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri)
-{
- g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
-
- return name_or_relative_uri[0] == '.';
-}
-
-gboolean
-nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
-{
- g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
-
- return nautilus_str_has_suffix (name_or_relative_uri, "~");
-}
-
-gboolean
nautilus_file_is_hidden_file (NautilusFile *file)
{
return nautilus_file_name_matches_hidden_pattern
diff --git a/libnautilus-private/nautilus-ctree.c b/libnautilus-private/nautilus-ctree.c
index 1ea5ac0c3..c33628fed 100644
--- a/libnautilus-private/nautilus-ctree.c
+++ b/libnautilus-private/nautilus-ctree.c
@@ -1978,13 +1978,10 @@ draw_row (GtkCList *clist,
offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
case GTK_CELL_TEXT:
- if (style != GTK_WIDGET (clist)->style)
- row_center_offset = (((clist->row_height -
- style->font->ascent -
- style->font->descent - 1) / 2) +
- 1.5 + style->font->ascent);
- else
- row_center_offset = clist->row_center_offset;
+ row_center_offset = ((clist->row_height -
+ (style->font->ascent
+ + style->font->descent)) / 2
+ + style->font->ascent);
gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
gdk_draw_string
@@ -2099,13 +2096,11 @@ draw_row (GtkCList *clist,
offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
}
- if (style != GTK_WIDGET (clist)->style)
- row_center_offset = (((clist->row_height - style->font->ascent -
- style->font->descent - 1) / 2) +
- 1.5 + style->font->ascent);
- else
- row_center_offset = clist->row_center_offset;
-
+ row_center_offset = ((clist->row_height -
+ (style->font->ascent
+ + style->font->descent)) / 2
+ + style->font->ascent);
+
gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
gdk_draw_string (clist->clist_window, style->font, fg_gc, offset,
row_rectangle.y + row_center_offset +
@@ -2784,6 +2779,8 @@ real_tree_expand (NautilusCTree *ctree,
/* resize tree_column if needed */
column_auto_resize (clist, &NAUTILUS_CTREE_ROW (node)->row, ctree->tree_column,
requisition.width);
+
+ tree_draw_node (ctree, node);
}
static void
@@ -2899,6 +2896,7 @@ real_tree_collapse (NautilusCTree *ctree,
column_auto_resize (clist, &NAUTILUS_CTREE_ROW (node)->row, ctree->tree_column,
requisition.width);
+ tree_draw_node (ctree, node);
}
static void
@@ -3208,6 +3206,12 @@ set_node_info (NautilusCTree *ctree,
else
nautilus_ctree_node_set_pixtext (ctree, node, ctree->tree_column,
text, spacing, pixmap_closed, mask_closed);
+
+ if (GTK_CLIST_AUTO_SORT (GTK_CLIST (ctree))
+ && NAUTILUS_CTREE_ROW (node)->parent != NULL)
+ {
+ nautilus_ctree_sort_node (ctree, NAUTILUS_CTREE_ROW (node)->parent);
+ }
}
static void
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index b1a7c696f..da0ce7a9c 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -134,7 +134,3 @@ gboolean nautilus_file_should_get_top_left_text (NautilusFile
void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
GList *file_attributes);
GList * nautilus_file_get_all_attributes (void);
-
-/* Recognizing special file names. */
-gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
-gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 933b1f6b8..dc3588b10 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -819,8 +819,8 @@ uris_match (const char *uri_1, const char *uri_2, gboolean ignore_fragments)
g_free (canonical_2);
return result;
-
}
+
gboolean
nautilus_uris_match (const char *uri_1, const char *uri_2)
{
@@ -833,6 +833,21 @@ nautilus_uris_match_ignore_fragments (const char *uri_1, const char *uri_2)
return uris_match (uri_1, uri_2, TRUE);
}
+gboolean
+nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri)
+{
+ g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
+
+ return name_or_relative_uri[0] == '.';
+}
+
+gboolean
+nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
+{
+ g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
+
+ return nautilus_str_has_suffix (name_or_relative_uri, "~");
+}
/**
* nautilus_make_path:
diff --git a/libnautilus-private/nautilus-file-utilities.h b/libnautilus-private/nautilus-file-utilities.h
index a5160c915..b8cce15b4 100644
--- a/libnautilus-private/nautilus-file-utilities.h
+++ b/libnautilus-private/nautilus-file-utilities.h
@@ -56,6 +56,10 @@ char * nautilus_uri_get_scheme (const char
char * nautilus_uri_make_full_from_relative (const char *base_uri,
const char *uri);
+/* Recognizing special file names. */
+gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
+gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
+
/* FIXME bugzilla.eazel.com 2424:
* This is the same as gnome-libs g_concat_dir_and_file except
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 7fa9ce6c7..40db9376b 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1776,22 +1776,6 @@ nautilus_file_compare_name (NautilusFile *file,
}
gboolean
-nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri)
-{
- g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
-
- return name_or_relative_uri[0] == '.';
-}
-
-gboolean
-nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
-{
- g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
-
- return nautilus_str_has_suffix (name_or_relative_uri, "~");
-}
-
-gboolean
nautilus_file_is_hidden_file (NautilusFile *file)
{
return nautilus_file_name_matches_hidden_pattern