summaryrefslogtreecommitdiff
path: root/cut-n-paste-code/widgets
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-03-28 18:17:45 +0000
committerDarin Adler <darin@src.gnome.org>2001-03-28 18:17:45 +0000
commit93cbca73721dfc444b3e216a93169aa0690d74a0 (patch)
treec333a571141d023b0ce67d9587b4a017669a5c2b /cut-n-paste-code/widgets
parent0493af3ec786eed6bc3a6ecb6b684c449483b9c8 (diff)
downloadnautilus-93cbca73721dfc444b3e216a93169aa0690d74a0.tar.gz
reviewed by: Gene Ragan <gzr@eazel.com>
Followup on my recent tree change to get rid of some flicker. * components/tree/nautilus-tree-view.c: (set_selected_row_position): Only scroll the view if the row isn't already in the right position. Prevents the case where it scrolls by less than a whole row. * cut-n-paste-code/widgets/nautilusclist/nautilusclist.h: * cut-n-paste-code/widgets/nautilusclist/nautilusclist.c: (nautilus_clist_thaw), (nautilus_clist_check_unfrozen), (real_resize_column), (real_row_move), (resync_selection), (nautilus_clist_map), (nautilus_clist_style_set), (real_sort_list): Add code to detect changes and only redraw when actual changes happen. Also make freeze/thaw with no changes between them a no-op by having the frozen check schedule a refresh at thaw time as a side effect. It used to do a refresh every time it got thawed. Add calls to do refresh for all cases where the old code was counting on thaw implying a full refresh. * libnautilus-extensions/nautilus-ctree.c: (real_tree_move), (real_select_all), (nautilus_ctree_insert_gnode), (nautilus_ctree_remove_node), (nautilus_ctree_expand_recursive), (nautilus_ctree_expand_to_depth), (nautilus_ctree_collapse_recursive), (nautilus_ctree_collapse_to_depth), (nautilus_ctree_toggle_expansion_recursive), (nautilus_ctree_real_select_recursive), (nautilus_ctree_set_node_info), (nautilus_ctree_set_indent), (nautilus_ctree_set_spacing), (nautilus_ctree_set_line_style), (nautilus_ctree_sort_recursive), (nautilus_ctree_sort_node), (nautilus_ctree_sort_single_node): Use the new unfrozen check that has a side effect of making the next thaw do a refresh. Add the new refresh calls that are needed now that thaw doesn't always do a refresh. Removed some unnecessary drawing for cases where things haven't changed. * libnautilus-extensions/nautilus-list.c: (nautilus_list_track_new_column_width): Use the new unfrozen check that has a side effect of making the next thaw do a refresh. * src/file-manager/fm-list-view.c: (fm_list_view_set_zoom_level): Formatting tweak.
Diffstat (limited to 'cut-n-paste-code/widgets')
-rw-r--r--cut-n-paste-code/widgets/nautilusclist/nautilusclist.c41
-rw-r--r--cut-n-paste-code/widgets/nautilusclist/nautilusclist.h3
2 files changed, 29 insertions, 15 deletions
diff --git a/cut-n-paste-code/widgets/nautilusclist/nautilusclist.c b/cut-n-paste-code/widgets/nautilusclist/nautilusclist.c
index 4a7f2c0cb..696b3c413 100644
--- a/cut-n-paste-code/widgets/nautilusclist/nautilusclist.c
+++ b/cut-n-paste-code/widgets/nautilusclist/nautilusclist.c
@@ -131,7 +131,7 @@ LIST_WIDTH (NautilusCList * clist)
#define NAUTILUS_CLIST_CLASS_FW(_widget_) NAUTILUS_CLIST_CLASS (((GtkObject*) (_widget_))->klass)
/* redraw the list if it's not frozen */
-#define CLIST_UNFROZEN(clist) (((NautilusCList *) (clist))->freeze_count == 0)
+#define CLIST_UNFROZEN(clist) nautilus_clist_check_unfrozen (clist)
#define CLIST_REFRESH(clist) G_STMT_START { \
if (CLIST_UNFROZEN (clist)) \
NAUTILUS_CLIST_CLASS_FW (clist)->refresh ((NautilusCList *) (clist)); \
@@ -281,11 +281,6 @@ static GList *selection_find (NautilusCList *clist,
GList *row_list_element);
static void real_select_all (NautilusCList *clist);
static void real_unselect_all (NautilusCList *clist);
-static void move_vertical (NautilusCList *clist,
- gint row,
- gfloat align);
-static void move_horizontal (NautilusCList *clist,
- gint diff);
static void real_undo_selection (NautilusCList *clist);
static void fake_unselect_all (NautilusCList *clist,
gint row);
@@ -1245,10 +1240,25 @@ nautilus_clist_thaw (NautilusCList *clist)
if (clist->freeze_count)
{
clist->freeze_count--;
- CLIST_REFRESH (clist);
+ if (clist->freeze_count == 0)
+ {
+ if (clist->refresh_at_unfreeze_time)
+ NAUTILUS_CLIST_CLASS_FW (clist)->refresh (clist);
+ clist->refresh_at_unfreeze_time = FALSE;
+ }
}
}
+gboolean
+nautilus_clist_check_unfrozen (NautilusCList *clist)
+{
+ if (clist->freeze_count == 0)
+ return TRUE;
+
+ clist->refresh_at_unfreeze_time = TRUE;
+ return FALSE;
+}
+
/* PUBLIC COLUMN FUNCTIONS
* nautilus_clist_column_titles_show
* nautilus_clist_column_titles_hide
@@ -1853,6 +1863,10 @@ real_resize_column (NautilusCList *clist,
width > clist->column[column].max_width)
width = clist->column[column].max_width;
+ if (clist->column[column].width == width
+ && clist->column[column].width_set)
+ return;
+
clist->column[column].width = width;
clist->column[column].width_set = TRUE;
@@ -2971,8 +2985,6 @@ real_row_move (NautilusCList *clist,
source_row == dest_row)
return;
- nautilus_clist_freeze (clist);
-
/* unlink source row */
clist_row = ROW_ELEMENT (clist, source_row)->data;
if (source_row == clist->rows - 1)
@@ -3014,7 +3026,7 @@ real_row_move (NautilusCList *clist,
else if (clist->focus_row > first)
clist->focus_row += d;
- nautilus_clist_thaw (clist);
+ CLIST_REFRESH (clist);
}
/* PUBLIC ROW FUNCTIONS
@@ -4167,6 +4179,7 @@ resync_selection (NautilusCList *clist,
clist->anchor = -1;
clist->drag_pos = -1;
+ CLIST_REFRESH (clist);
nautilus_clist_thaw (clist);
}
@@ -4787,6 +4800,7 @@ nautilus_clist_map (GtkWidget *widget)
/* unfreeze the list */
clist->freeze_count = 0;
+ clist->refresh_at_unfreeze_time = FALSE;
}
}
@@ -4859,13 +4873,12 @@ nautilus_clist_expose (GtkWidget *widget,
GdkEventExpose *event)
{
g_error ("this should not be called, the NautilusList drawing would be disrupted by this");
-
return FALSE;
}
static void
nautilus_clist_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
+ GtkStyle *previous_style)
{
NautilusCList *clist;
@@ -7005,8 +7018,6 @@ real_sort_list (NautilusCList *clist)
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
return;
- nautilus_clist_freeze (clist);
-
if (clist->anchor != -1 && clist->selection_mode == GTK_SELECTION_EXTENDED)
{
NAUTILUS_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
@@ -7032,7 +7043,7 @@ real_sort_list (NautilusCList *clist)
clist->row_list_end = list;
}
- nautilus_clist_thaw (clist);
+ CLIST_REFRESH (clist);
}
static GList *
diff --git a/cut-n-paste-code/widgets/nautilusclist/nautilusclist.h b/cut-n-paste-code/widgets/nautilusclist/nautilusclist.h
index 23c8a4e00..768558854 100644
--- a/cut-n-paste-code/widgets/nautilusclist/nautilusclist.h
+++ b/cut-n-paste-code/widgets/nautilusclist/nautilusclist.h
@@ -161,6 +161,7 @@ struct NautilusCList
GMemChunk *cell_mem_chunk;
guint freeze_count;
+ gboolean refresh_at_unfreeze_time;
/* allocation rectangle after the conatiner_border_width
* and the width of the shadow border */
@@ -779,6 +780,8 @@ void nautilus_clist_sort (NautilusCList *clist);
void nautilus_clist_set_auto_sort (NautilusCList *clist,
gboolean auto_sort);
+gboolean nautilus_clist_check_unfrozen (NautilusCList *clist);
+
#ifdef __cplusplus
}