diff options
author | John Harper <jsh@eazel.com> | 2001-03-29 00:23:37 +0000 |
---|---|---|
committer | John Harper <jsh@src.gnome.org> | 2001-03-29 00:23:37 +0000 |
commit | 7b47ef76953417e207aeb666b2b4d9242464e5f1 (patch) | |
tree | e3f9dde6da11fb69e56dbb27437a34cfb4dab5cb | |
parent | 8f90fd57aefcd03f9c8226aa2d27c408531dc1a1 (diff) | |
download | nautilus-7b47ef76953417e207aeb666b2b4d9242464e5f1.tar.gz |
reviewed by: Darin Adler <darin@eazel.com>
2001-03-28 John Harper <jsh@eazel.com>
reviewed by: Darin Adler <darin@eazel.com>
Re-fixed bug 6820 (directory sort order is different in tree
view):
* components/tree/nautilus-tree-view.c: realized that I can get
the tree model node directly from the row's data pointer,
there's no need to map the row to a node (which is a linear
operation). Also, cache the clist->tree-view mapping to avoid a
call to gtk_object_data_get each comparison
(create_tree): enabled the custom comparison function
Work to share more drawing code between NautilusList and
NautilusCTree:
* libnautilus-extensions/nautilus-ctree.c (get_cell_style,
draw_cell_pixbuf): deleted. Use similarly named nautilus_list_
functions instead
(draw_row): only draw the special tree pixbuf if `height > 0'.
This fixes a weird clipping bug
* libnautilus-extensions/nautilus-list.c (get_cell_style,
draw_cell_pixbuf): renamed as nautilus_list_X
Ensure that the list view fetches the correct icons (i.e.
special anti-aliased images if the view is in smooth mode)
* libnautilus-extensions/nautilus-list.c
(nautilus_list_is_anti_aliased): new function
* src/file-manager/fm-list-view.c
(fm_list_view_update_smooth_graphics_mode): call update_icons
(fm_list_view_get_emblem_pixbufs_for_file, install_row_images):
pass the correct aa mode to the icon factory
Draw tree-view icons in smooth mode when appropriate:
* components/tree/nautilus-tree-view.c
(update_smooth_graphics_mode,
smooth_graphics_mode_changed_callback): new functions. As yet
they don't refetch all icons when the smooth preference
changes..
Fixed the bug introduced recently where the tree gets a title
bar:
* libnautilus-extensions/nautilus-list.c
(nautilus_list_realize): don't turn on titles
* src/file-manager/fm-list-view.c (create_list): set the
CLIST_SHOW_TITLES flag
-rw-r--r-- | ChangeLog | 60 | ||||
-rw-r--r-- | components/tree/nautilus-tree-view.c | 92 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-ctree.c | 182 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-list.c | 81 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-list.h | 20 | ||||
-rw-r--r-- | libnautilus-private/nautilus-ctree.c | 182 | ||||
-rw-r--r-- | libnautilus-private/nautilus-list.c | 81 | ||||
-rw-r--r-- | libnautilus-private/nautilus-list.h | 20 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 22 |
9 files changed, 355 insertions, 385 deletions
@@ -1,3 +1,63 @@ +2001-03-28 John Harper <jsh@eazel.com> + + reviewed by: Darin Adler <darin@eazel.com> + + Re-fixed bug 6820 (directory sort order is different in tree + view): + + * components/tree/nautilus-tree-view.c: realized that I can get + the tree model node directly from the row's data pointer, + there's no need to map the row to a node (which is a linear + operation). Also, cache the clist->tree-view mapping to avoid a + call to gtk_object_data_get each comparison + + (create_tree): enabled the custom comparison function + + + Work to share more drawing code between NautilusList and + NautilusCTree: + + * libnautilus-extensions/nautilus-ctree.c (get_cell_style, + draw_cell_pixbuf): deleted. Use similarly named nautilus_list_ + functions instead + + (draw_row): only draw the special tree pixbuf if `height > 0'. + This fixes a weird clipping bug + + * libnautilus-extensions/nautilus-list.c (get_cell_style, + draw_cell_pixbuf): renamed as nautilus_list_X + + + Ensure that the list view fetches the correct icons (i.e. + special anti-aliased images if the view is in smooth mode) + + * libnautilus-extensions/nautilus-list.c + (nautilus_list_is_anti_aliased): new function + + * src/file-manager/fm-list-view.c + (fm_list_view_update_smooth_graphics_mode): call update_icons + (fm_list_view_get_emblem_pixbufs_for_file, install_row_images): + pass the correct aa mode to the icon factory + + + Draw tree-view icons in smooth mode when appropriate: + + * components/tree/nautilus-tree-view.c + (update_smooth_graphics_mode, + smooth_graphics_mode_changed_callback): new functions. As yet + they don't refetch all icons when the smooth preference + changes.. + + + Fixed the bug introduced recently where the tree gets a title + bar: + + * libnautilus-extensions/nautilus-list.c + (nautilus_list_realize): don't turn on titles + + * src/file-manager/fm-list-view.c (create_list): set the + CLIST_SHOW_TITLES flag + 2001-03-28 Michael Engber <engber@eazel.com> reviewed by: Darin Adler <darin@eazel.com> diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c index 41a633294..ffc47a3bb 100644 --- a/components/tree/nautilus-tree-view.c +++ b/components/tree/nautilus-tree-view.c @@ -91,6 +91,7 @@ static void forget_unparented_node (NautilusTreeView *vie static void insert_unparented_nodes (NautilusTreeView *view, NautilusTreeNode *node); static void expand_uri_sequence_and_select_end (NautilusTreeView *view); +static gboolean is_anti_aliased (NautilusTreeView *view); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusTreeView, nautilus_tree_view, @@ -235,9 +236,11 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode * if (nautilus_tree_view_model_node_to_view_node (view, node) == NULL) { closed_pixbuf = nautilus_icon_factory_get_pixbuf_for_file - (file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE); + (file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS, + is_anti_aliased (view)); open_pixbuf = nautilus_icon_factory_get_pixbuf_for_file - (file, "accept", NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE); + (file, "accept", NAUTILUS_ICON_SIZE_FOR_MENUS, + is_anti_aliased (view)); view->details->inserting_node = TRUE; NAUTILUS_CLIST_UNSET_FLAG (NAUTILUS_CLIST (view->details->tree), @@ -427,9 +430,11 @@ nautilus_tree_view_update_model_node (NautilusTreeView *view, NautilusTreeNode * link_view_node_with_uri (view, view_node, nautilus_file_get_uri (file)); closed_pixbuf = nautilus_icon_factory_get_pixbuf_for_file - (file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE); + (file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS, + is_anti_aliased (view)); open_pixbuf = nautilus_icon_factory_get_pixbuf_for_file - (file, "accept", NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE); + (file, "accept", NAUTILUS_ICON_SIZE_FOR_MENUS, + is_anti_aliased (view)); name = nautilus_file_get_name (file); @@ -821,17 +826,48 @@ filtering_changed_callback (gpointer callback_data) } } -#if 0 -/* FIXME bugzilla.eazel.com 6820: - * See the comment below (search for nautilus_clist_set_compare_func) - * explaining why this is disabled. Basically, it's too slow. - */ +static void +update_smooth_graphics_mode (NautilusTreeView *view) +{ + gboolean aa_mode, old_aa_mode; + + if (view->details->tree != NULL) { + aa_mode = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE); + old_aa_mode = is_anti_aliased (view); + + if (old_aa_mode != aa_mode) { + nautilus_list_set_anti_aliased_mode (NAUTILUS_LIST (view->details->tree), aa_mode); + + /* FIXME: refetch icons using correct aa mode... */ + } + } +} + +static void +smooth_graphics_mode_changed_callback (gpointer callback_data) +{ + NautilusTreeView *view; + + view = NAUTILUS_TREE_VIEW (callback_data); + + update_smooth_graphics_mode (view); +} + +static gboolean +is_anti_aliased (NautilusTreeView *view) +{ + return nautilus_list_is_anti_aliased (NAUTILUS_LIST (view->details->tree)); +} + +static gpointer compare_cached_key, compare_cached_value; + static gint ctree_compare_rows (NautilusCList *clist, gconstpointer ptr1, gconstpointer ptr2) { NautilusTreeView *view; + NautilusTreeNode *node1, *node2; NautilusFile *file1, *file2; gint result; @@ -843,21 +879,32 @@ ctree_compare_rows (NautilusCList *clist, */ result = -1; - view = gtk_object_get_data (GTK_OBJECT (clist), "tree_view"); + /* Avoid fetching the view from the object data more than once + * per sort. + */ + if (compare_cached_key == clist) { + view = compare_cached_value; + } else { + view = gtk_object_get_data (GTK_OBJECT (clist), "tree_view"); + compare_cached_key = clist; + compare_cached_value = view; + } g_assert (view != NULL); if (!view->details->inserting_node) { - file1 = nautilus_tree_view_node_to_file (view, nautilus_ctree_find_node_ptr (NAUTILUS_CTREE (view->details->tree), (NautilusCTreeRow *) ptr1)); - file2 = nautilus_tree_view_node_to_file (view, nautilus_ctree_find_node_ptr (NAUTILUS_CTREE (view->details->tree), (NautilusCTreeRow *) ptr2)); + node1 = ((NautilusCTreeRow *) ptr1)->row.data; + node2 = ((NautilusCTreeRow *) ptr2)->row.data; + + file1 = node1 ? nautilus_tree_node_get_file (node1) : NULL; + file2 = node2 ? nautilus_tree_node_get_file (node2) : NULL; if (file1 != NULL && file2 != NULL) { - result = nautilus_file_compare_for_sort (file1, file2, NAUTILUS_FILE_SORT_BY_NAME); + result = nautilus_file_compare_for_sort (file1, file2, NAUTILUS_FILE_SORT_BY_NAME, FALSE, FALSE); } } return result; } -#endif static void create_tree (NautilusTreeView *view) @@ -878,7 +925,8 @@ create_tree (NautilusTreeView *view) nautilus_clist_set_auto_sort (NAUTILUS_CLIST (view->details->tree), TRUE); nautilus_clist_set_sort_type (NAUTILUS_CLIST (view->details->tree), GTK_SORT_ASCENDING); -#if 0 + update_smooth_graphics_mode (view); + /* FIXME bugzilla.eazel.com 6820: * Using the NautilusFile comparison function to sort by * is way too slow when opening large directories (those with @@ -887,7 +935,6 @@ create_tree (NautilusTreeView *view) */ nautilus_clist_set_compare_func (NAUTILUS_CLIST (view->details->tree), ctree_compare_rows); -#endif nautilus_clist_set_column_auto_resize (NAUTILUS_CLIST (view->details->tree), 0, TRUE); nautilus_clist_columns_autosize (NAUTILUS_CLIST (view->details->tree)); @@ -929,6 +976,10 @@ create_tree (NautilusTreeView *view) filtering_changed_callback, view); + nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE, + smooth_graphics_mode_changed_callback, + 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); @@ -1061,6 +1112,10 @@ nautilus_tree_view_destroy (GtkObject *object) if (view->details->tree != NULL) { gtk_object_unref (GTK_OBJECT (view->details->change_queue)); + if (compare_cached_key == view->details->tree) { + compare_cached_key = NULL; + } + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, filtering_changed_callback, view); @@ -1070,6 +1125,10 @@ nautilus_tree_view_destroy (GtkObject *object) nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES, filtering_changed_callback, view); + + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE, + smooth_graphics_mode_changed_callback, + view); g_hash_table_foreach (view->details->file_to_node_map, free_file_to_node_map_entry, @@ -1090,7 +1149,6 @@ nautilus_tree_view_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (view->details->expansion_state)); } - nautilus_gtk_object_list_free (view->details->unparented_tree_nodes); g_free (view->details->current_main_view_uri); diff --git a/libnautilus-extensions/nautilus-ctree.c b/libnautilus-extensions/nautilus-ctree.c index 353e4aead..4337c8a0a 100644 --- a/libnautilus-extensions/nautilus-ctree.c +++ b/libnautilus-extensions/nautilus-ctree.c @@ -121,13 +121,6 @@ static void ctree_attach_styles (NautilusCTree *ctree, static void ctree_detach_styles (NautilusCTree *ctree, NautilusCTreeNode *node, gpointer data); -static void get_cell_style (NautilusCList *clist, - NautilusCListRow *clist_row, - gint state, - gint column, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc); static gint nautilus_ctree_draw_expander (NautilusCTree *ctree, NautilusCTreeRow *ctree_row, GtkStyle *style, @@ -1113,105 +1106,6 @@ nautilus_ctree_set_prelight (NautilusCTree *ctree, } } -static int -draw_cell_pixbuf (GdkWindow *window, GdkRectangle *clip_rectangle, - GdkGC *fg_gc, GdkPixbuf *pixbuf, int x, int y) -{ - GdkRectangle image_rectangle; - GdkRectangle intersect_rectangle; - - if (pixbuf == NULL) { - return x; - } - - image_rectangle.width = gdk_pixbuf_get_width (pixbuf); - image_rectangle.height = gdk_pixbuf_get_height (pixbuf); - image_rectangle.x = x; - image_rectangle.y = y; - - if (!gdk_rectangle_intersect (clip_rectangle, &image_rectangle, &intersect_rectangle)) { - return x; - } - - gdk_pixbuf_render_to_drawable_alpha (pixbuf, window, - intersect_rectangle.x - x, - intersect_rectangle.y - y, - image_rectangle.x, image_rectangle.y, - intersect_rectangle.width, - intersect_rectangle.height, - GDK_PIXBUF_ALPHA_BILEVEL, - NAUTILUS_STANDARD_ALPHA_THRESHHOLD, - GDK_RGB_DITHER_MAX, 0, 0); - - return x + intersect_rectangle.width; -} - -static void -get_cell_style (NautilusCList *clist, - NautilusCListRow *clist_row, - gint state, - gint column, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc) -{ - gint fg_state; - - if ((state == GTK_STATE_NORMAL) && - (GTK_WIDGET (clist)->state == GTK_STATE_INSENSITIVE)) - fg_state = GTK_STATE_INSENSITIVE; - else - fg_state = state; - - if (clist_row->cell[column].style) - { - if (style) - *style = clist_row->cell[column].style; - if (fg_gc) - *fg_gc = clist_row->cell[column].style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = clist_row->cell[column].style->bg_gc[state]; - else - *bg_gc = clist_row->cell[column].style->base_gc[state]; - } - } - else if (clist_row->style) - { - if (style) - *style = clist_row->style; - if (fg_gc) - *fg_gc = clist_row->style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = clist_row->style->bg_gc[state]; - else - *bg_gc = clist_row->style->base_gc[state]; - } - } - else - { - if (style) - *style = GTK_WIDGET (clist)->style; - if (fg_gc) - *fg_gc = GTK_WIDGET (clist)->style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = GTK_WIDGET (clist)->style->bg_gc[state]; - else - *bg_gc = GTK_WIDGET (clist)->style->base_gc[state]; - } - - if (state != GTK_STATE_SELECTED) - { - if (fg_gc && clist_row->fg_set) - *fg_gc = clist->fg_gc; - if (bg_gc && clist_row->bg_set) - *bg_gc = clist->bg_gc; - } - } -} - static gint nautilus_ctree_draw_expander (NautilusCTree *ctree, NautilusCTreeRow *ctree_row, GtkStyle *style, GdkRectangle *clip_rectangle, gint x) @@ -1404,8 +1298,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, if (!area || gdk_rectangle_intersect (area, &tree_rectangle, &tc_rectangle)) { - get_cell_style (clist, &NAUTILUS_CTREE_ROW (node)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (node)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground @@ -1460,8 +1355,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, { if (parent) { - get_cell_style (clist, &NAUTILUS_CTREE_ROW (parent)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (parent)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, @@ -1487,8 +1383,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, tc_rectangle.height); } - get_cell_style (clist, &NAUTILUS_CTREE_ROW (node)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (node)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, &NAUTILUS_CTREE_ROW (node)->row.background); @@ -1555,8 +1452,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, xcenter = offset + (justification_factor * ctree->tree_indent / 2); - get_cell_style (clist, &ctree_row->row, state, column, NULL, NULL, - &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &ctree_row->row, state, row, column, + NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, &ctree_row->row.background); @@ -1845,6 +1743,7 @@ draw_row (NautilusCList *clist, GtkStyle *style; GdkGC *fg_gc; GdkGC *bg_gc; + guint bg_rgb; gint width; gint height; @@ -1856,7 +1755,8 @@ draw_row (NautilusCList *clist, if (!clist->column[i].visible) continue; - get_cell_style (clist, clist_row, state, i, &style, &fg_gc, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), clist_row, state, row, i, + &style, &fg_gc, &bg_gc, &bg_rgb); /* calculate clipping region */ clip_rectangle.x = clist->column[i].area.x + clist->hoffset; @@ -1947,19 +1847,21 @@ draw_row (NautilusCList *clist, switch (clist_row->cell[i].type) { case NAUTILUS_CELL_PIXBUF: - offset = draw_cell_pixbuf (clist->clist_window, &cell_rectangle, fg_gc, - NAUTILUS_CELL_PIXBUF (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXBUF (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); break; case NAUTILUS_CELL_PIXTEXT: - offset = draw_cell_pixbuf (clist->clist_window, &clip_rectangle, fg_gc, - NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); - + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &clip_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); + offset += NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->spacing; case NAUTILUS_CELL_TEXT: row_center_offset = ((clist->row_height - @@ -2016,7 +1918,7 @@ draw_row (NautilusCList *clist, offset += clist_row->cell[i].horizontal; old_offset = offset; - { + if (height > 0) { GdkPixbuf *src_pixbuf, *dark_pixbuf; if (((NautilusCListRow *)ctree->dnd_prelighted_row) == clist_row) { @@ -2029,20 +1931,22 @@ draw_row (NautilusCList *clist, 0.8 * 255, 0.8 * 255); if (dark_pixbuf != NULL) { - offset = draw_cell_pixbuf (clist->clist_window, &cell_rectangle, fg_gc, - dark_pixbuf, offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); - + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + dark_pixbuf, offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); + gdk_pixbuf_unref (dark_pixbuf); } } } else { - offset = draw_cell_pixbuf (clist->clist_window, &clip_rectangle, fg_gc, - NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &clip_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); } @@ -2913,7 +2817,9 @@ cell_size_request (NautilusCList *clist, ctree = NAUTILUS_CTREE (clist); - get_cell_style (clist, clist_row, GTK_STATE_NORMAL, column, &style, NULL, NULL); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), clist_row, + GTK_STATE_NORMAL, 0, column, + &style, NULL, NULL, NULL); switch (clist_row->cell[column].type) { diff --git a/libnautilus-extensions/nautilus-list.c b/libnautilus-extensions/nautilus-list.c index 342d7d822..478eccbb8 100644 --- a/libnautilus-extensions/nautilus-list.c +++ b/libnautilus-extensions/nautilus-list.c @@ -217,15 +217,6 @@ static int get_cell_horizontal_start_position (NautilusCList *c NautilusCListRow *row, int column_index, int content_width); -static void get_cell_style (NautilusList *clist, - NautilusCListRow *row, - int state, - int row_index, - int column_index, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc, - guint32 *bg_rgb); static void nautilus_list_initialize_class (NautilusListClass *class); static void nautilus_list_initialize (NautilusList *list); static void nautilus_list_destroy (GtkObject *object); @@ -543,6 +534,12 @@ nautilus_list_set_anti_aliased_mode (NautilusList *list, gtk_widget_queue_draw (GTK_WIDGET (list)); } +gboolean +nautilus_list_is_anti_aliased (NautilusList *list) +{ + return list->details->anti_aliased_mode; +} + void nautilus_list_initialize_dnd (NautilusList *list) @@ -1108,7 +1105,7 @@ nautilus_list_button_release (GtkWidget *widget, GdkEventButton *event) /* One final test. Check whether the click was in the * horizontal bounds of the displayed text. */ - get_cell_style (list, row, GTK_STATE_NORMAL, row_index, column_index, &style, NULL, NULL, NULL); + nautilus_list_get_cell_style (list, row, GTK_STATE_NORMAL, row_index, column_index, &style, NULL, NULL, NULL); text_width = gdk_string_width (style->font, NAUTILUS_CELL_TEXT (row->cell[column_index])->text); text_x = get_cell_horizontal_start_position (clist, row, column_index, text_width); if (event->x >= text_x && event->x <= text_x + text_width) { @@ -1728,8 +1725,6 @@ nautilus_list_realize (GtkWidget *widget) g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget))); window = GTK_WINDOW (gtk_widget_get_toplevel (widget)); gtk_window_set_focus (window, widget); - - NAUTILUS_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES); } static void @@ -1996,10 +1991,10 @@ get_column_background (NautilusList *list, GdkGC **selected, GdkGC **plain) *selected = list->details->cell_selected_lighter_background; } -static void -get_cell_style (NautilusList *list, NautilusCListRow *row, - int state, int row_index, int column_index, GtkStyle **style, - GdkGC **fg_gc, GdkGC **bg_gc, guint32 *bg_rgb) +void +nautilus_list_get_cell_style (NautilusList *list, NautilusCListRow *row, + int state, int row_index, int column_index, GtkStyle **style, + GdkGC **fg_gc, GdkGC **bg_gc, guint32 *bg_rgb) { if (style) { *style = GTK_WIDGET (list)->style; @@ -2064,9 +2059,11 @@ get_cell_style (NautilusList *list, NautilusCListRow *row, } } -static int -draw_cell_pixbuf (NautilusCList *clist, GdkWindow *window, GdkRectangle *clip_rectangle, - GdkGC *fg_gc, guint32 bg_rgb, GdkPixbuf *pixbuf, int x, int y) +int +nautilus_list_draw_cell_pixbuf (NautilusList *list, GdkWindow *window, + GdkRectangle *clip_rectangle, + GdkGC *fg_gc, guint32 bg_rgb, + GdkPixbuf *pixbuf, int x, int y) { GdkRectangle image_rectangle; GdkRectangle intersect_rectangle; @@ -2081,7 +2078,7 @@ draw_cell_pixbuf (NautilusCList *clist, GdkWindow *window, GdkRectangle *clip_re return x; } - if (NAUTILUS_IS_LIST (clist) && NAUTILUS_LIST (clist)->details->anti_aliased_mode) { + if (list && nautilus_list_is_anti_aliased (list)) { /* Composite a version of the pixbuf with the background color */ composited = gdk_pixbuf_composite_color_simple (pixbuf, image_rectangle.width, @@ -2217,8 +2214,8 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i return; } - get_cell_style (NAUTILUS_LIST(clist), row, row->state, row_index, - column_index, &style, &fg_gc, &bg_gc, &bg_rgb); + nautilus_list_get_cell_style (NAUTILUS_LIST(clist), row, row->state, row_index, + column_index, &style, &fg_gc, &bg_gc, &bg_rgb); nautilus_list_get_cell_rectangle (NAUTILUS_LIST (clist), row_index, column_index, &cell_rectangle); get_cell_greater_rectangle (&cell_rectangle, &erase_rectangle, column_index == last_column_index (clist)); @@ -2285,30 +2282,30 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i 0.8 * 255, 0.8 * 255); if (dark_pixbuf != NULL) { - draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - dark_pixbuf, offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + dark_pixbuf, offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); gdk_pixbuf_unref (dark_pixbuf); } } } else { - draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - NAUTILUS_CELL_PIXBUF (row->cell[column_index])->pixbuf, - offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXBUF (row->cell[column_index])->pixbuf, + offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); } break; } case NAUTILUS_CELL_PIXTEXT: - offset = draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->pixbuf, - offset, - cell_rectangle.y + row->cell[column_index].vertical+ - (cell_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->pixbuf, + offset, + cell_rectangle.y + row->cell[column_index].vertical+ + (cell_rectangle.height - height) / 2); offset += NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->spacing; /* fall through */ case NAUTILUS_CELL_TEXT: @@ -2375,12 +2372,12 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i height = gdk_pixbuf_get_height (p->data); - offset = draw_cell_pixbuf (clist, clist->clist_window, - &cell_rectangle, - fg_gc, bg_rgb, p->data, - offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, + &cell_rectangle, + fg_gc, bg_rgb, p->data, + offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); offset += PIXBUF_LIST_SPACING; } diff --git a/libnautilus-extensions/nautilus-list.h b/libnautilus-extensions/nautilus-list.h index f2dc3c481..31dc66bab 100644 --- a/libnautilus-extensions/nautilus-list.h +++ b/libnautilus-extensions/nautilus-list.h @@ -187,7 +187,25 @@ void nautilus_list_get_initial_drag_offset (NautilusList *list, void nautilus_list_set_anti_aliased_mode (NautilusList *list, gboolean anti_aliased_mode); - +gboolean nautilus_list_is_anti_aliased (NautilusList *list); + +int nautilus_list_draw_cell_pixbuf (NautilusList *list, + GdkWindow *window, + GdkRectangle *clip_rectangle, + GdkGC *fg_gc, + guint32 bg_rgb, + GdkPixbuf *pixbuf, + int x, + int y); +void nautilus_list_get_cell_style (NautilusList *list, + NautilusCListRow *row, + int state, + int row_index, + int column_index, + GtkStyle **style, + GdkGC **fg_gc, + GdkGC **bg_gc, + guint32 *bg_rgb); #endif /* NAUTILUS_LIST_H */ diff --git a/libnautilus-private/nautilus-ctree.c b/libnautilus-private/nautilus-ctree.c index 353e4aead..4337c8a0a 100644 --- a/libnautilus-private/nautilus-ctree.c +++ b/libnautilus-private/nautilus-ctree.c @@ -121,13 +121,6 @@ static void ctree_attach_styles (NautilusCTree *ctree, static void ctree_detach_styles (NautilusCTree *ctree, NautilusCTreeNode *node, gpointer data); -static void get_cell_style (NautilusCList *clist, - NautilusCListRow *clist_row, - gint state, - gint column, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc); static gint nautilus_ctree_draw_expander (NautilusCTree *ctree, NautilusCTreeRow *ctree_row, GtkStyle *style, @@ -1113,105 +1106,6 @@ nautilus_ctree_set_prelight (NautilusCTree *ctree, } } -static int -draw_cell_pixbuf (GdkWindow *window, GdkRectangle *clip_rectangle, - GdkGC *fg_gc, GdkPixbuf *pixbuf, int x, int y) -{ - GdkRectangle image_rectangle; - GdkRectangle intersect_rectangle; - - if (pixbuf == NULL) { - return x; - } - - image_rectangle.width = gdk_pixbuf_get_width (pixbuf); - image_rectangle.height = gdk_pixbuf_get_height (pixbuf); - image_rectangle.x = x; - image_rectangle.y = y; - - if (!gdk_rectangle_intersect (clip_rectangle, &image_rectangle, &intersect_rectangle)) { - return x; - } - - gdk_pixbuf_render_to_drawable_alpha (pixbuf, window, - intersect_rectangle.x - x, - intersect_rectangle.y - y, - image_rectangle.x, image_rectangle.y, - intersect_rectangle.width, - intersect_rectangle.height, - GDK_PIXBUF_ALPHA_BILEVEL, - NAUTILUS_STANDARD_ALPHA_THRESHHOLD, - GDK_RGB_DITHER_MAX, 0, 0); - - return x + intersect_rectangle.width; -} - -static void -get_cell_style (NautilusCList *clist, - NautilusCListRow *clist_row, - gint state, - gint column, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc) -{ - gint fg_state; - - if ((state == GTK_STATE_NORMAL) && - (GTK_WIDGET (clist)->state == GTK_STATE_INSENSITIVE)) - fg_state = GTK_STATE_INSENSITIVE; - else - fg_state = state; - - if (clist_row->cell[column].style) - { - if (style) - *style = clist_row->cell[column].style; - if (fg_gc) - *fg_gc = clist_row->cell[column].style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = clist_row->cell[column].style->bg_gc[state]; - else - *bg_gc = clist_row->cell[column].style->base_gc[state]; - } - } - else if (clist_row->style) - { - if (style) - *style = clist_row->style; - if (fg_gc) - *fg_gc = clist_row->style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = clist_row->style->bg_gc[state]; - else - *bg_gc = clist_row->style->base_gc[state]; - } - } - else - { - if (style) - *style = GTK_WIDGET (clist)->style; - if (fg_gc) - *fg_gc = GTK_WIDGET (clist)->style->fg_gc[fg_state]; - if (bg_gc) { - if (state == GTK_STATE_SELECTED) - *bg_gc = GTK_WIDGET (clist)->style->bg_gc[state]; - else - *bg_gc = GTK_WIDGET (clist)->style->base_gc[state]; - } - - if (state != GTK_STATE_SELECTED) - { - if (fg_gc && clist_row->fg_set) - *fg_gc = clist->fg_gc; - if (bg_gc && clist_row->bg_set) - *bg_gc = clist->bg_gc; - } - } -} - static gint nautilus_ctree_draw_expander (NautilusCTree *ctree, NautilusCTreeRow *ctree_row, GtkStyle *style, GdkRectangle *clip_rectangle, gint x) @@ -1404,8 +1298,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, if (!area || gdk_rectangle_intersect (area, &tree_rectangle, &tc_rectangle)) { - get_cell_style (clist, &NAUTILUS_CTREE_ROW (node)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (node)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground @@ -1460,8 +1355,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, { if (parent) { - get_cell_style (clist, &NAUTILUS_CTREE_ROW (parent)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (parent)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, @@ -1487,8 +1383,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, tc_rectangle.height); } - get_cell_style (clist, &NAUTILUS_CTREE_ROW (node)->row, - state, column, NULL, NULL, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &NAUTILUS_CTREE_ROW (node)->row, + state, row, column, NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, &NAUTILUS_CTREE_ROW (node)->row.background); @@ -1555,8 +1452,9 @@ nautilus_ctree_draw_lines (NautilusCTree *ctree, xcenter = offset + (justification_factor * ctree->tree_indent / 2); - get_cell_style (clist, &ctree_row->row, state, column, NULL, NULL, - &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), + &ctree_row->row, state, row, column, + NULL, NULL, &bg_gc, NULL); if (bg_gc == clist->bg_gc) gdk_gc_set_foreground (clist->bg_gc, &ctree_row->row.background); @@ -1845,6 +1743,7 @@ draw_row (NautilusCList *clist, GtkStyle *style; GdkGC *fg_gc; GdkGC *bg_gc; + guint bg_rgb; gint width; gint height; @@ -1856,7 +1755,8 @@ draw_row (NautilusCList *clist, if (!clist->column[i].visible) continue; - get_cell_style (clist, clist_row, state, i, &style, &fg_gc, &bg_gc); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), clist_row, state, row, i, + &style, &fg_gc, &bg_gc, &bg_rgb); /* calculate clipping region */ clip_rectangle.x = clist->column[i].area.x + clist->hoffset; @@ -1947,19 +1847,21 @@ draw_row (NautilusCList *clist, switch (clist_row->cell[i].type) { case NAUTILUS_CELL_PIXBUF: - offset = draw_cell_pixbuf (clist->clist_window, &cell_rectangle, fg_gc, - NAUTILUS_CELL_PIXBUF (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXBUF (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); break; case NAUTILUS_CELL_PIXTEXT: - offset = draw_cell_pixbuf (clist->clist_window, &clip_rectangle, fg_gc, - NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); - + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &clip_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); + offset += NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->spacing; case NAUTILUS_CELL_TEXT: row_center_offset = ((clist->row_height - @@ -2016,7 +1918,7 @@ draw_row (NautilusCList *clist, offset += clist_row->cell[i].horizontal; old_offset = offset; - { + if (height > 0) { GdkPixbuf *src_pixbuf, *dark_pixbuf; if (((NautilusCListRow *)ctree->dnd_prelighted_row) == clist_row) { @@ -2029,20 +1931,22 @@ draw_row (NautilusCList *clist, 0.8 * 255, 0.8 * 255); if (dark_pixbuf != NULL) { - offset = draw_cell_pixbuf (clist->clist_window, &cell_rectangle, fg_gc, - dark_pixbuf, offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); - + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + dark_pixbuf, offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); + gdk_pixbuf_unref (dark_pixbuf); } } } else { - offset = draw_cell_pixbuf (clist->clist_window, &clip_rectangle, fg_gc, - NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, - offset, - clip_rectangle.y + clist_row->cell[i].vertical + - (clip_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), + clist->clist_window, &clip_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (clist_row->cell[i])->pixbuf, + offset, + clip_rectangle.y + clist_row->cell[i].vertical + + (clip_rectangle.height - height) / 2); } @@ -2913,7 +2817,9 @@ cell_size_request (NautilusCList *clist, ctree = NAUTILUS_CTREE (clist); - get_cell_style (clist, clist_row, GTK_STATE_NORMAL, column, &style, NULL, NULL); + nautilus_list_get_cell_style (NAUTILUS_LIST (clist), clist_row, + GTK_STATE_NORMAL, 0, column, + &style, NULL, NULL, NULL); switch (clist_row->cell[column].type) { diff --git a/libnautilus-private/nautilus-list.c b/libnautilus-private/nautilus-list.c index 342d7d822..478eccbb8 100644 --- a/libnautilus-private/nautilus-list.c +++ b/libnautilus-private/nautilus-list.c @@ -217,15 +217,6 @@ static int get_cell_horizontal_start_position (NautilusCList *c NautilusCListRow *row, int column_index, int content_width); -static void get_cell_style (NautilusList *clist, - NautilusCListRow *row, - int state, - int row_index, - int column_index, - GtkStyle **style, - GdkGC **fg_gc, - GdkGC **bg_gc, - guint32 *bg_rgb); static void nautilus_list_initialize_class (NautilusListClass *class); static void nautilus_list_initialize (NautilusList *list); static void nautilus_list_destroy (GtkObject *object); @@ -543,6 +534,12 @@ nautilus_list_set_anti_aliased_mode (NautilusList *list, gtk_widget_queue_draw (GTK_WIDGET (list)); } +gboolean +nautilus_list_is_anti_aliased (NautilusList *list) +{ + return list->details->anti_aliased_mode; +} + void nautilus_list_initialize_dnd (NautilusList *list) @@ -1108,7 +1105,7 @@ nautilus_list_button_release (GtkWidget *widget, GdkEventButton *event) /* One final test. Check whether the click was in the * horizontal bounds of the displayed text. */ - get_cell_style (list, row, GTK_STATE_NORMAL, row_index, column_index, &style, NULL, NULL, NULL); + nautilus_list_get_cell_style (list, row, GTK_STATE_NORMAL, row_index, column_index, &style, NULL, NULL, NULL); text_width = gdk_string_width (style->font, NAUTILUS_CELL_TEXT (row->cell[column_index])->text); text_x = get_cell_horizontal_start_position (clist, row, column_index, text_width); if (event->x >= text_x && event->x <= text_x + text_width) { @@ -1728,8 +1725,6 @@ nautilus_list_realize (GtkWidget *widget) g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget))); window = GTK_WINDOW (gtk_widget_get_toplevel (widget)); gtk_window_set_focus (window, widget); - - NAUTILUS_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES); } static void @@ -1996,10 +1991,10 @@ get_column_background (NautilusList *list, GdkGC **selected, GdkGC **plain) *selected = list->details->cell_selected_lighter_background; } -static void -get_cell_style (NautilusList *list, NautilusCListRow *row, - int state, int row_index, int column_index, GtkStyle **style, - GdkGC **fg_gc, GdkGC **bg_gc, guint32 *bg_rgb) +void +nautilus_list_get_cell_style (NautilusList *list, NautilusCListRow *row, + int state, int row_index, int column_index, GtkStyle **style, + GdkGC **fg_gc, GdkGC **bg_gc, guint32 *bg_rgb) { if (style) { *style = GTK_WIDGET (list)->style; @@ -2064,9 +2059,11 @@ get_cell_style (NautilusList *list, NautilusCListRow *row, } } -static int -draw_cell_pixbuf (NautilusCList *clist, GdkWindow *window, GdkRectangle *clip_rectangle, - GdkGC *fg_gc, guint32 bg_rgb, GdkPixbuf *pixbuf, int x, int y) +int +nautilus_list_draw_cell_pixbuf (NautilusList *list, GdkWindow *window, + GdkRectangle *clip_rectangle, + GdkGC *fg_gc, guint32 bg_rgb, + GdkPixbuf *pixbuf, int x, int y) { GdkRectangle image_rectangle; GdkRectangle intersect_rectangle; @@ -2081,7 +2078,7 @@ draw_cell_pixbuf (NautilusCList *clist, GdkWindow *window, GdkRectangle *clip_re return x; } - if (NAUTILUS_IS_LIST (clist) && NAUTILUS_LIST (clist)->details->anti_aliased_mode) { + if (list && nautilus_list_is_anti_aliased (list)) { /* Composite a version of the pixbuf with the background color */ composited = gdk_pixbuf_composite_color_simple (pixbuf, image_rectangle.width, @@ -2217,8 +2214,8 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i return; } - get_cell_style (NAUTILUS_LIST(clist), row, row->state, row_index, - column_index, &style, &fg_gc, &bg_gc, &bg_rgb); + nautilus_list_get_cell_style (NAUTILUS_LIST(clist), row, row->state, row_index, + column_index, &style, &fg_gc, &bg_gc, &bg_rgb); nautilus_list_get_cell_rectangle (NAUTILUS_LIST (clist), row_index, column_index, &cell_rectangle); get_cell_greater_rectangle (&cell_rectangle, &erase_rectangle, column_index == last_column_index (clist)); @@ -2285,30 +2282,30 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i 0.8 * 255, 0.8 * 255); if (dark_pixbuf != NULL) { - draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - dark_pixbuf, offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + dark_pixbuf, offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); gdk_pixbuf_unref (dark_pixbuf); } } } else { - draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - NAUTILUS_CELL_PIXBUF (row->cell[column_index])->pixbuf, - offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXBUF (row->cell[column_index])->pixbuf, + offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); } break; } case NAUTILUS_CELL_PIXTEXT: - offset = draw_cell_pixbuf (clist, clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, - NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->pixbuf, - offset, - cell_rectangle.y + row->cell[column_index].vertical+ - (cell_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, &cell_rectangle, fg_gc, bg_rgb, + NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->pixbuf, + offset, + cell_rectangle.y + row->cell[column_index].vertical+ + (cell_rectangle.height - height) / 2); offset += NAUTILUS_CELL_PIXTEXT (row->cell[column_index])->spacing; /* fall through */ case NAUTILUS_CELL_TEXT: @@ -2375,12 +2372,12 @@ draw_cell (NautilusCList *clist, GdkRectangle *area, int row_index, int column_i height = gdk_pixbuf_get_height (p->data); - offset = draw_cell_pixbuf (clist, clist->clist_window, - &cell_rectangle, - fg_gc, bg_rgb, p->data, - offset, - cell_rectangle.y + row->cell[column_index].vertical + - (cell_rectangle.height - height) / 2); + offset = nautilus_list_draw_cell_pixbuf (NAUTILUS_LIST (clist), clist->clist_window, + &cell_rectangle, + fg_gc, bg_rgb, p->data, + offset, + cell_rectangle.y + row->cell[column_index].vertical + + (cell_rectangle.height - height) / 2); offset += PIXBUF_LIST_SPACING; } diff --git a/libnautilus-private/nautilus-list.h b/libnautilus-private/nautilus-list.h index f2dc3c481..31dc66bab 100644 --- a/libnautilus-private/nautilus-list.h +++ b/libnautilus-private/nautilus-list.h @@ -187,7 +187,25 @@ void nautilus_list_get_initial_drag_offset (NautilusList *list, void nautilus_list_set_anti_aliased_mode (NautilusList *list, gboolean anti_aliased_mode); - +gboolean nautilus_list_is_anti_aliased (NautilusList *list); + +int nautilus_list_draw_cell_pixbuf (NautilusList *list, + GdkWindow *window, + GdkRectangle *clip_rectangle, + GdkGC *fg_gc, + guint32 bg_rgb, + GdkPixbuf *pixbuf, + int x, + int y); +void nautilus_list_get_cell_style (NautilusList *list, + NautilusCListRow *row, + int state, + int row_index, + int column_index, + GtkStyle **style, + GdkGC **fg_gc, + GdkGC **bg_gc, + guint32 *bg_rgb); #endif /* NAUTILUS_LIST_H */ diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 795132f42..e926812d7 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -946,16 +946,20 @@ static void fm_list_view_update_smooth_graphics_mode (FMDirectoryView *directory_view) { NautilusList *list; - gboolean smooth_graphics_mode; + gboolean smooth_graphics_mode, old_smooth_graphics_mode; g_assert (FM_IS_LIST_VIEW (directory_view)); list = get_list (FM_LIST_VIEW (directory_view)); g_assert (list != NULL); + old_smooth_graphics_mode = nautilus_list_is_anti_aliased (list); smooth_graphics_mode = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE); - - nautilus_list_set_anti_aliased_mode (list, smooth_graphics_mode); + + if (old_smooth_graphics_mode != smooth_graphics_mode) { + nautilus_list_set_anti_aliased_mode (list, smooth_graphics_mode); + update_icons (FM_LIST_VIEW (directory_view)); + } } static void @@ -990,6 +994,8 @@ create_list (FMListView *list_view) clist = NAUTILUS_CLIST (list); + NAUTILUS_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES); + for (i = 0; i < number_of_columns; ++i) { get_column_specification (list_view, i, &column); @@ -1922,10 +1928,13 @@ fm_list_view_get_emblem_pixbufs_for_file (FMListView *list_view, GdkPixbuf *emblem_pixbuf; int emblem_size; NautilusStringList *emblems_to_ignore; + gboolean anti_aliased; + + anti_aliased = nautilus_list_is_anti_aliased (get_list (list_view)); emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude (FM_DIRECTORY_VIEW (list_view)); - emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, FALSE, emblems_to_ignore); + emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, anti_aliased, emblems_to_ignore); nautilus_string_list_free (emblems_to_ignore); emblem_pixbufs = NULL; @@ -1936,7 +1945,7 @@ fm_list_view_get_emblem_pixbufs_for_file (FMListView *list_view, (p->data, emblem_size, emblem_size, emblem_size, emblem_size, - NULL, FALSE); + NULL, anti_aliased); if (emblem_pixbuf != NULL) { emblem_pixbufs = g_list_prepend (emblem_pixbufs, emblem_pixbuf); @@ -1975,7 +1984,8 @@ install_row_images (FMListView *list_view, guint row) /* Install the icon for this file. */ icon = (nautilus_icon_factory_get_pixbuf_for_file - (file, NULL, fm_list_view_get_icon_size (list_view), TRUE)); + (file, NULL, fm_list_view_get_icon_size (list_view), + nautilus_list_is_anti_aliased (list))); nautilus_list_set_pixbuf (list, row, LIST_VIEW_COLUMN_ICON, icon); /* Install any emblems for this file. */ |