Remove smooth mode and unused font and font size machinery.

* components/tree/nautilus-tree-view.c: (create_tree),
	(nautilus_tree_view_destroy):
	* libnautilus-private/nautilus-directory.c:
	(add_preferences_callbacks):
	* libnautilus-private/nautilus-global-preferences.c:
	* libnautilus-private/nautilus-global-preferences.h:
	* libnautilus-private/nautilus-icon-canvas-item.c:
	(measure_label_text), (nautilus_icon_canvas_item_render),
	(nautilus_icon_canvas_item_set_show_stretch_handles):
	* libnautilus-private/nautilus-icon-container.c:
	(start_rubberbanding), (finalize), (nautilus_icon_container_init),
	(nautilus_icon_container_update_icon),
	(nautilus_icon_container_theme_changed):
	* libnautilus-private/nautilus-icon-container.h:
	* libnautilus-private/nautilus-icon-private.h:
	* src/file-manager/fm-directory-view.c: (fm_directory_view_init),
	(fm_directory_view_finalize):
	* src/file-manager/fm-directory-view.h:
	* src/file-manager/fm-icon-view.c:
	(fm_icon_view_update_icon_container_font_size_table),
	(create_icon_container), (fm_icon_view_class_init):
	Remove smooth mode and unused font and font size machinery.

	* test/.cvsignore: Remove test-nautilus-smooth-graphics.
	* test/Makefile.am: Remove test-nautilus-smooth-graphics.
	* test/test-nautilus-smooth-graphics.c: Remove.

	* src/nautilus-preferences-dialog.c:
	(dialog_delete_event_callback), (dialog_button_response_callback),
	(preferences_dialog_create): Fix bug where we'd lose the
	preferences dialog if you closed it with a delete_event.
This commit is contained in:
Darin Adler 2002-01-29 19:21:59 +00:00
parent 81bceb3e69
commit 0ba9c077fd
16 changed files with 72 additions and 752 deletions

View file

@ -1,3 +1,37 @@
2002-01-29 Darin Adler <darin@bentspoon.com>
* components/tree/nautilus-tree-view.c: (create_tree),
(nautilus_tree_view_destroy):
* libnautilus-private/nautilus-directory.c:
(add_preferences_callbacks):
* libnautilus-private/nautilus-global-preferences.c:
* libnautilus-private/nautilus-global-preferences.h:
* libnautilus-private/nautilus-icon-canvas-item.c:
(measure_label_text), (nautilus_icon_canvas_item_render),
(nautilus_icon_canvas_item_set_show_stretch_handles):
* libnautilus-private/nautilus-icon-container.c:
(start_rubberbanding), (finalize), (nautilus_icon_container_init),
(nautilus_icon_container_update_icon),
(nautilus_icon_container_theme_changed):
* libnautilus-private/nautilus-icon-container.h:
* libnautilus-private/nautilus-icon-private.h:
* src/file-manager/fm-directory-view.c: (fm_directory_view_init),
(fm_directory_view_finalize):
* src/file-manager/fm-directory-view.h:
* src/file-manager/fm-icon-view.c:
(fm_icon_view_update_icon_container_font_size_table),
(create_icon_container), (fm_icon_view_class_init):
Remove smooth mode and unused font and font size machinery.
* test/.cvsignore: Remove test-nautilus-smooth-graphics.
* test/Makefile.am: Remove test-nautilus-smooth-graphics.
* test/test-nautilus-smooth-graphics.c: Remove.
* src/nautilus-preferences-dialog.c:
(dialog_delete_event_callback), (dialog_button_response_callback),
(preferences_dialog_create): Fix bug where we'd lose the
preferences dialog if you closed it with a delete_event.
=== nautilus 1.1.3 ===
2002-01-29 Darin Adler <darin@bentspoon.com>

View file

@ -92,7 +92,6 @@ 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);
EEL_CLASS_BOILERPLATE (NautilusTreeView,
nautilus_tree_view,
@ -823,39 +822,6 @@ filtering_changed_callback (gpointer callback_data)
}
}
static void
update_smooth_graphics_mode (NautilusTreeView *view)
{
gboolean aa_mode, old_aa_mode;
if (view->details->tree != NULL) {
aa_mode = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE);
old_aa_mode = is_anti_aliased (view);
if (old_aa_mode != aa_mode) {
eel_list_set_anti_aliased_mode (EEL_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 eel_list_is_anti_aliased (EEL_LIST (view->details->tree));
}
static gpointer compare_cached_key, compare_cached_value;
static gint
@ -922,8 +888,6 @@ create_tree (NautilusTreeView *view)
eel_clist_set_auto_sort (EEL_CLIST (view->details->tree), TRUE);
eel_clist_set_sort_type (EEL_CLIST (view->details->tree), GTK_SORT_ASCENDING);
update_smooth_graphics_mode (view);
/* FIXME bugzilla.gnome.org 46820:
* Using the NautilusFile comparison function to sort by
* is way too slow when opening large directories (those with
@ -976,10 +940,6 @@ create_tree (NautilusTreeView *view)
filtering_changed_callback,
view);
eel_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);
@ -1115,10 +1075,6 @@ nautilus_tree_view_destroy (BonoboObject *object)
filtering_changed_callback,
view);
eel_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,
NULL);

View file

@ -294,9 +294,6 @@ add_preferences_callbacks (void)
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
async_data_preference_changed_callback,
NULL);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT,
async_data_preference_changed_callback,
NULL);
}
char *

View file

@ -370,10 +370,6 @@ static const PreferenceDefault preference_defaults[] = {
NULL, NULL,
"speed_tradeoff"
},
{ NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_PREVIEW_SOUND,
PREFERENCE_INTEGER,
GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),

View file

@ -77,7 +77,6 @@ G_BEGIN_DECLS
/* Content fonts */
#define NAUTILUS_PREFERENCES_DEFAULT_FONT "preferences/default_font"
#define NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT "preferences/default_smooth_font"
#define NAUTILUS_PREFERENCES_DEFAULT_FONT_SIZE "preferences/default_font_size"
/* Single/Double click preference */
@ -86,9 +85,6 @@ G_BEGIN_DECLS
/* Activating executable text files */
#define NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION "preferences/executable_text_activation"
/* Smooth graphics mode (smoother but slower) */
#define NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE "preferences/smooth_graphics_mode"
/* Which views should be displayed for new windows */
#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR "preferences/start_with_toolbar"
#define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR "preferences/start_with_location_bar"
@ -121,7 +117,6 @@ enum
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE "icon-view/default_zoom_level_font_size"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon-view/default_use_manual_layout"
#define NAUTILUS_PREFERENCES_ICON_VIEW_FONT "icon-view/font"
#define NAUTILUS_PREFERENCES_ICON_VIEW_SMOOTH_FONT "icon-view/smooth_font"
/* The icon view uses 2 variables to store the sort order and
* whether to use manual layout. However, the UI for these

View file

@ -154,10 +154,6 @@ static void draw_or_measure_label_text (NautilusIconCanvasItem
GdkDrawable *drawable,
int icon_left,
int icon_bottom);
static void draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
GdkPixbuf *destination_pixbuf,
int icon_left,
int icon_bottom);
static void draw_label_text (NautilusIconCanvasItem *item,
GdkDrawable *drawable,
int icon_left,
@ -188,8 +184,6 @@ static void draw_label_layout (NautilusIconCanvasItem
static gboolean hit_test_stretch_handle (NautilusIconCanvasItem *item,
ArtIRect canvas_rect);
static gboolean icon_canvas_item_is_smooth (const NautilusIconCanvasItem *icon_item);
static void update_label_layouts (NautilusIconCanvasItem *item);
static void clear_rounded_corners (GdkPixbuf *destination_pixbuf,
GdkPixbuf *corner_pixbuf,
@ -774,11 +768,7 @@ measure_label_text (NautilusIconCanvasItem *item)
return;
}
if (icon_canvas_item_is_smooth (item)) {
draw_or_measure_label_text_aa (item, NULL, 0, 0);
} else {
draw_or_measure_label_text (item, NULL, 0, 0);
}
draw_or_measure_label_text (item, NULL, 0, 0);
}
static void
@ -831,101 +821,6 @@ draw_stretch_handles (NautilusIconCanvasItem *item, GdkDrawable *drawable,
gdk_gc_unref (gc);
}
/* utility routine that uses libart to draw an outlined rectangle */
static void
draw_outline_rectangle_aa (GnomeCanvasBuf *buf, int x0, int y0, int x1, int y1, guint outline_color)
{
ArtVpath vpath[12];
ArtSVP *path;
int halfwidth;
halfwidth = 1.0;
vpath[0].code = ART_MOVETO;
vpath[0].x = x0 - halfwidth;
vpath[0].y = y0 - halfwidth;
vpath[1].code = ART_LINETO;
vpath[1].x = x0 - halfwidth;
vpath[1].y = y1 + halfwidth;
vpath[2].code = ART_LINETO;
vpath[2].x = x1 + halfwidth;
vpath[2].y = y1 + halfwidth;
vpath[3].code = ART_LINETO;
vpath[3].x = x1 + halfwidth;
vpath[3].y = y0 - halfwidth;
vpath[4].code = ART_LINETO;
vpath[4].x = x0 - halfwidth;
vpath[4].y = y0 - halfwidth;
vpath[5].code = ART_MOVETO;
vpath[5].x = x0 + halfwidth;
vpath[5].y = y0 + halfwidth;
vpath[6].code = ART_LINETO;
vpath[6].x = x1 - halfwidth;
vpath[6].y = y0 + halfwidth;
vpath[7].code = ART_LINETO;
vpath[7].x = x1 - halfwidth;
vpath[7].y = y1 - halfwidth;
vpath[8].code = ART_LINETO;
vpath[8].x = x0 + halfwidth;
vpath[8].y = y1 - halfwidth;
vpath[9].code = ART_LINETO;
vpath[9].x = x0 + halfwidth;
vpath[9].y = y0 + halfwidth;
vpath[10].code = ART_END;
vpath[10].x = 0;
vpath[10].y = 0;
path = art_svp_from_vpath(vpath);
gnome_canvas_render_svp(buf, path, outline_color);
art_svp_free(path);
}
/* draw the stretch handles in the anti-aliased canvas */
static void
draw_stretch_handles_aa (NautilusIconCanvasItem *item, GnomeCanvasBuf *buf,
const ArtIRect *rect)
{
int knob_width, knob_height;
GnomeCanvasItem *canvas_item;
char *knob_filename;
GdkPixbuf *knob_pixbuf;
if (!item->details->show_stretch_handles) {
return;
}
canvas_item = GNOME_CANVAS_ITEM (item);
knob_filename = nautilus_theme_get_image_path ("knob.png");
knob_pixbuf = gdk_pixbuf_new_from_file (knob_filename, NULL);
knob_width = gdk_pixbuf_get_width (knob_pixbuf);
knob_height = gdk_pixbuf_get_height (knob_pixbuf);
/* draw a box to connect the dots */
draw_outline_rectangle_aa (buf, rect->x0 + 1, rect->y0 + 1,
rect->x1 - 1, rect->y1 - 1,
EEL_RGBA_COLOR_PACK (153, 153, 153, 127));
/* now draw the stretch handles themselves */
eel_gnome_canvas_draw_pixbuf (buf, knob_pixbuf, rect->x0, rect->y0);
eel_gnome_canvas_draw_pixbuf (buf, knob_pixbuf, rect->x0, rect->y1 - knob_height);
eel_gnome_canvas_draw_pixbuf (buf, knob_pixbuf, rect->x1 - knob_width, rect->y0);
eel_gnome_canvas_draw_pixbuf (buf, knob_pixbuf, rect->x1 - knob_width, rect->y1 - knob_height);
g_free (knob_filename);
g_object_unref (knob_pixbuf);
}
static void
emblem_layout_reset (EmblemLayout *layout, NautilusIconCanvasItem *icon_item, ArtIRect icon_rect)
{
@ -1310,162 +1205,6 @@ draw_label_layout (NautilusIconCanvasItem *item,
}
}
static void
draw_label_layout_aa (NautilusIconCanvasItem *item,
GdkPixbuf *pixbuf,
PangoLayout *layout,
gboolean highlight,
int y,
guint32 color)
{
int x;
if (pixbuf == NULL) {
return;
}
if (item->details->is_renaming) {
return;
}
x = (item->details->text_width - pango_layout_get_width (layout) / PANGO_SCALE) / 2;
if (!highlight) {
eel_gdk_pixbuf_draw_layout (pixbuf, x, y, color, layout);
} else {
/* draw a shadow in black */
eel_gdk_pixbuf_draw_layout (pixbuf, x + 2, y + 1,
EEL_RGB_COLOR_BLACK, layout);
/* draw smeared-wide text to "embolden" */
eel_gdk_pixbuf_draw_layout (pixbuf, x, y, color, layout);
eel_gdk_pixbuf_draw_layout (pixbuf, x + 1, y, color, layout);
}
}
static void
draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
GdkPixbuf *destination_pixbuf,
int icon_left,
int icon_bottom)
{
NautilusIconCanvasItemDetails *details;
int width_so_far, height_so_far;
GnomeCanvasItem *canvas_item;
PangoLayout *layout;
int layout_width, layout_height;
gboolean have_editable, have_additional, needs_highlight;
guint32 label_color;
details = item->details;
needs_highlight = details->is_highlighted_for_selection || details->is_highlighted_for_drop;
have_editable = details->editable_text != NULL && details->editable_text[0] != '\0';
have_additional = details->additional_text != NULL && details->additional_text[0] != '\0';
/* No font or no text, then do no work. */
if (!have_editable && !have_additional) {
details->text_height = 0;
details->text_width = 0;
return;
}
#if (defined PERFORMANCE_TEST_MEASURE_DISABLE && defined PERFORMANCE_TEST_DRAW_DISABLE)
/* don't do any drawing and fake out the width */
details->text_width = 80;
details->text_height = 20;
return;
#endif
#ifdef PERFORMANCE_TEST_MEASURE_DISABLE
if (destination_pixbuf == NULL) {
/* fake out the width */
details->text_width = 80;
details->text_height = 20;
return;
}
#endif
#ifdef PERFORMANCE_TEST_DRAW_DISABLE
if (destination_pixbuf != NULL) {
return;
}
#endif
canvas_item = GNOME_CANVAS_ITEM (item);
if (destination_pixbuf == NULL) {
details->text_width = floor (nautilus_icon_canvas_item_get_max_text_width (item));
}
if (needs_highlight) {
icon_bottom += 1; /* leave some space for selection frame */
}
width_so_far = 0;
height_so_far = 0;
if (have_editable) {
layout = get_label_layout (&details->editable_text_layout, item, details->editable_text);
if (needs_highlight) {
label_color = highlight_text_color;
} else {
label_color = nautilus_icon_container_get_label_color (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), TRUE);
}
draw_label_layout_aa (item, destination_pixbuf,
layout, needs_highlight,
icon_bottom + height_so_far, label_color);
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
width_so_far = MAX (width_so_far, layout_width);
height_so_far += layout_height + LABEL_LINE_SPACING;
g_object_unref (layout);
}
if (have_additional) {
layout = get_label_layout (&details->additional_text_layout, item, details->additional_text);
if (needs_highlight) {
label_color = highlight_text_info_color;
} else {
label_color = nautilus_icon_container_get_label_color (NAUTILUS_ICON_CONTAINER (canvas_item->canvas), FALSE);
}
draw_label_layout_aa (item, destination_pixbuf,
layout, needs_highlight,
icon_bottom + height_so_far, label_color);
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
width_so_far = MAX (width_so_far, layout_width);
height_so_far += layout_height + LABEL_LINE_SPACING;
g_object_unref (layout);
}
/* add some extra space for highlighting even when we don't highlight so things won't move */
height_so_far += 2; /* extra slop for nicer highlighting */
width_so_far += 8; /* account for emboldening, plus extra to make it look nicer */
if (destination_pixbuf != NULL) {
/* Current calculations should match what we measured before drawing.
* This assumes that we will always make a separate call to measure
* before the call to draw. We might later decide to use this function
* differently and change these asserts.
*/
#if (defined PERFORMANCE_TEST_MEASURE_DISABLE || defined PERFORMANCE_TEST_DRAW_DISABLE)
g_assert (height_so_far == details->text_height);
g_assert (width_so_far == details->text_width);
#endif
} else {
/* If measuring, remember the width & height. */
details->text_width = width_so_far;
details->text_height = height_so_far;
}
}
/* clear the corners of the selection pixbuf by copying the corners of the passed-in pixbuf */
static void
clear_rounded_corners (GdkPixbuf *destination_pixbuf, GdkPixbuf *corner_pixbuf, int corner_size)
@ -1507,119 +1246,10 @@ clear_rounded_corners (GdkPixbuf *destination_pixbuf, GdkPixbuf *corner_pixbuf,
dest_width - corner_size, dest_height - corner_size);
}
static void
draw_label_text_aa (NautilusIconCanvasItem *icon_item, GnomeCanvasBuf *buf, int x, int y, int x_delta)
{
GdkPixbuf *text_pixbuf;
NautilusIconContainer *container;
gboolean needs_highlight;
gboolean have_editable;
gboolean have_additional;
/* make sure this is really necessary */
have_editable = icon_item->details->editable_text != NULL
&& icon_item->details->editable_text[0] != '\0';
have_additional = icon_item->details->additional_text != NULL
&& icon_item->details->additional_text[0] != '\0';
/* No font or no text, then do no work. */
if (!have_editable && !have_additional) {
icon_item->details->text_height = 0;
icon_item->details->text_width = 0;
return;
}
if (icon_item->details->is_renaming) {
/* Exit if we are renaming. We don't need to set the text
* width and height to 0 because there is text, it just is not
* drawn to the canvas while the renaming widget is displayed.
*/
return;
}
/* Set up the background. */
needs_highlight = icon_item->details->is_highlighted_for_selection
|| icon_item->details->is_highlighted_for_drop;
/* Optimizing out the allocation of this pixbuf on every call is a
* measureable speed improvement, but only by around 5%.
* draw_or_measure_label_text_aa accounts for about 90% of the time.
*/
text_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE,
8,
icon_item->details->text_width,
icon_item->details->text_height);
if (needs_highlight) {
container = NAUTILUS_ICON_CONTAINER (GNOME_CANVAS_ITEM (icon_item)->canvas);
eel_gdk_pixbuf_fill_rectangle_with_color (text_pixbuf,
eel_gdk_pixbuf_whole_pixbuf,
container->details->highlight_color);
clear_rounded_corners (text_pixbuf, container->details->highlight_frame, 5);
} else {
eel_gdk_pixbuf_fill_rectangle_with_color (text_pixbuf,
eel_gdk_pixbuf_whole_pixbuf,
EEL_RGBA_COLOR_PACK (0, 0, 0, 0));
}
draw_or_measure_label_text_aa (icon_item, text_pixbuf, x_delta, 0);
/* Draw the pixbuf containing the label. */
eel_gnome_canvas_draw_pixbuf (buf, text_pixbuf, x - x_delta, y + LABEL_OFFSET);
g_object_unref (text_pixbuf);
/* draw the keyboard selection focus indicator if necessary */
if (icon_item->details->is_highlighted_as_keyboard_focus) {
draw_outline_rectangle_aa (buf, x - x_delta + 1, y + 1,
x - x_delta + icon_item->details->text_width,
y + icon_item->details->text_height,
EEL_RGBA_COLOR_PACK (153, 153, 153, 127));
}
}
/* draw the item for anti-aliased mode */
static void
nautilus_icon_canvas_item_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
{
ArtIRect icon_rect, emblem_rect;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf, *temp_pixbuf;
NautilusIconCanvasItem *icon_item;
int x_delta;
icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
/* map the pixbuf for selection or other effects */
temp_pixbuf = map_pixbuf (icon_item);
icon_rect = icon_item->details->canvas_rect;
if (buf->is_bg) {
gnome_canvas_buf_ensure_buf (buf);
buf->is_bg = FALSE;
}
/* draw the icon */
eel_gnome_canvas_draw_pixbuf (buf, temp_pixbuf, icon_rect.x0, icon_rect.y0);
g_object_unref (temp_pixbuf);
/* draw the emblems */
emblem_layout_reset (&emblem_layout, icon_item, icon_rect);
while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect)) {
eel_gnome_canvas_draw_pixbuf (buf, emblem_pixbuf, emblem_rect.x0, emblem_rect.y0);
}
/* draw the stretch handles */
draw_stretch_handles_aa (icon_item, buf, &icon_rect);
/* draw the text */
x_delta = (icon_item->details->text_width - (icon_rect.x1 - icon_rect.x0)) / 2;
draw_label_text_aa (icon_item, buf, icon_rect.x0, icon_rect.y1, x_delta);
g_warning ("NautilusIconCanvasItem does not support the anti-aliased canvas");
}
@ -1929,19 +1559,6 @@ nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item));
}
/* Check whether the item is in smooth mode */
static gboolean
icon_canvas_item_is_smooth (const NautilusIconCanvasItem *icon_item)
{
GnomeCanvas *parent_canvas;
g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (icon_item), FALSE);
parent_canvas = GNOME_CANVAS (GNOME_CANVAS_ITEM (icon_item)->canvas);
return parent_canvas->aa;
}
/* Check if one of the stretch handles was hit. */
static gboolean
hit_test_stretch_handle (NautilusIconCanvasItem *item,

View file

@ -1526,7 +1526,6 @@ start_rubberbanding (NautilusIconContainer *container,
NautilusIconRubberbandInfo *band_info;
uint fill_color, outline_color;
char *fill_color_str;
char *endp;
GList *p;
details = container->details;
@ -1550,59 +1549,29 @@ start_rubberbanding (NautilusIconContainer *container,
/* FIXME: The code to extract colors from the theme should be in FMDirectoryView, not here.
* The NautilusIconContainer class should simply provide calls to set the colors.
*/
if (GNOME_CANVAS(container)->aa) {
/* FIXME: Should use some standard format, not just a 32-bit integer. */
fill_color_str = nautilus_theme_get_theme_data ("directory", "selection_box_color_rgba");
if (fill_color_str == NULL) {
fill_color = 0x77BBDD40;
} else {
fill_color = strtoul (fill_color_str, &endp, 0);
if (endp == fill_color_str) {
fill_color = 0x77BBDD40;
}
g_free (fill_color_str);
}
outline_color = fill_color | 255;
band_info->selection_rectangle = gnome_canvas_item_new
(gnome_canvas_root
(GNOME_CANVAS (container)),
GNOME_TYPE_CANVAS_RECT,
"x1", band_info->start_x,
"y1", band_info->start_y,
"x2", band_info->start_x,
"y2", band_info->start_y,
"fill_color_rgba", fill_color,
"outline_color_rgba", outline_color,
"width_pixels", 1,
NULL);
fill_color_str = nautilus_theme_get_theme_data ("directory", "selection_box_color_rgba");
if (fill_color_str == NULL) {
fill_color = 0x77BBDD40;
} else {
fill_color_str = nautilus_theme_get_theme_data ("directory", "selection_box_color_rgba");
if (fill_color_str == NULL) {
fill_color = 0x77BBDD40;
} else {
fill_color = strtoul (fill_color_str, NULL, 0);
/* FIXME: Need error handling here. */
g_free (fill_color_str);
}
outline_color = fill_color | 255;
band_info->selection_rectangle = gnome_canvas_item_new
(gnome_canvas_root
(GNOME_CANVAS (container)),
EEL_TYPE_CANVAS_RECT,
"x1", band_info->start_x,
"y1", band_info->start_y,
"x2", band_info->start_x,
"y2", band_info->start_y,
"fill_color_rgba", fill_color,
"outline_color_rgba", outline_color,
"width_pixels", 1,
NULL);
fill_color = strtoul (fill_color_str, NULL, 0);
/* FIXME: Need error handling here. */
g_free (fill_color_str);
}
outline_color = fill_color | 255;
band_info->selection_rectangle = gnome_canvas_item_new
(gnome_canvas_root
(GNOME_CANVAS (container)),
EEL_TYPE_CANVAS_RECT,
"x1", band_info->start_x,
"y1", band_info->start_y,
"x2", band_info->start_x,
"y2", band_info->start_y,
"fill_color_rgba", fill_color,
"outline_color_rgba", outline_color,
"width_pixels", 1,
NULL);
band_info->prev_x = event->x;
band_info->prev_y = event->y;
@ -2328,7 +2297,6 @@ static void
finalize (GObject *object)
{
NautilusIconContainerDetails *details;
guint i;
details = NAUTILUS_ICON_CONTAINER (object)->details;
@ -2340,11 +2308,6 @@ finalize (GObject *object)
nautilus_icon_container_theme_changed,
object);
for (i = 0; i < G_N_ELEMENTS (details->label_font); i++) {
if (details->label_font[i] != NULL)
gdk_font_unref (details->label_font[i]);
}
if (details->highlight_frame != NULL) {
g_object_unref (details->highlight_frame);
}
@ -3364,31 +3327,6 @@ nautilus_icon_container_init (NautilusIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
/* font table - this isn't exactly proportional, but it looks better than computed */
/* FIXME bugzilla.gnome.org 45093: Font name is hard-coded here. */
/* FIXME bugzilla.gnome.org 45101: Font size is hard-coded here. */
#if GNOME2_CONVERSION_COMPLETE
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_by_family ("helvetica", 8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = nautilus_font_factory_get_font_by_family ("helvetica", 10);
details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = nautilus_font_factory_get_font_by_family ("helvetica", 12);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = nautilus_font_factory_get_font_by_family ("helvetica", 14);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_by_family ("helvetica", 18);
#endif
/* These are the default font sizes. The font sizes are configurable via
* nautilus_icon_container_set_font_size_table()
*/
details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = 8;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = 8;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 10;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 12;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 14;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 18;
details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 18;
container->details = details;
/* Set up DnD. */
@ -3859,9 +3797,6 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
gnome_canvas_item_set (GNOME_CANVAS_ITEM (icon->item),
"editable_text", editable_text,
"additional_text", additional_text,
#if GNOME2_CONVERSION_COMPLETE
"font", details->label_font[details->zoom_level],
#endif
"highlighted_for_drop", icon == details->drop_target,
NULL);
@ -4134,41 +4069,6 @@ nautilus_icon_container_reveal (NautilusIconContainer *container, NautilusIconDa
}
}
/**
* nautilus_icon_container_get_anti_aliased_mode:
* get the state of the anti_aliased boolean
*
**/
gboolean
nautilus_icon_container_get_anti_aliased_mode (NautilusIconContainer *container)
{
GnomeCanvas *canvas;
canvas = GNOME_CANVAS (container);
return canvas->aa;
}
/**
* nautilus_icon_container_set_anti_aliased_mode:
* Change the anti-aliased mode and redraw everything
*
**/
void
nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *container, gboolean anti_aliased_mode)
{
GnomeCanvas *canvas;
canvas = GNOME_CANVAS (container);
if (canvas->aa != anti_aliased_mode) {
canvas->aa = anti_aliased_mode;
invalidate_label_sizes (container);
nautilus_icon_container_request_update_all (container);
}
}
/**
* nautilus_icon_container_get_selection:
* @container: An icon container.
@ -5011,25 +4911,6 @@ nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *contai
return FALSE;
}
void
nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
int zoom_level,
GdkFont *font)
{
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
g_return_if_fail (font != NULL);
g_return_if_fail (zoom_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST);
g_return_if_fail (zoom_level <= NAUTILUS_ZOOM_LEVEL_LARGEST);
gdk_font_ref (font);
if (container->details->label_font[zoom_level] != NULL) {
gdk_font_unref (container->details->label_font[zoom_level]);
}
container->details->label_font[zoom_level] = font;
}
void
nautilus_icon_container_set_single_click_mode (NautilusIconContainer *container,
gboolean single_click_mode)
@ -5166,20 +5047,6 @@ nautilus_icon_container_theme_changed (gpointer user_data)
}
}
void
nautilus_icon_container_set_font_size_table (NautilusIconContainer *container,
const int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1])
{
int i;
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
g_return_if_fail (font_size_table != NULL);
for (i = 0; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
container->details->font_size_table[i] = font_size_table[i];
}
}
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char *

View file

@ -208,18 +208,10 @@ void nautilus_icon_container_set_single_click_mode (Nautilu
gboolean single_click_mode);
void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
gboolean enable);
gboolean nautilus_icon_container_get_anti_aliased_mode (NautilusIconContainer *view);
void nautilus_icon_container_set_anti_aliased_mode (NautilusIconContainer *view,
gboolean anti_aliased_mode);
void nautilus_icon_container_set_label_font_for_zoom_level (NautilusIconContainer *container,
int zoom_level,
GdkFont *font);
gboolean nautilus_icon_container_get_is_fixed_size (NautilusIconContainer *container);
void nautilus_icon_container_set_is_fixed_size (NautilusIconContainer *container,
gboolean is_fixed_size);
void nautilus_icon_container_reset_scroll_region (NautilusIconContainer *container);
void nautilus_icon_container_set_font_size_table (NautilusIconContainer *container,
const int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1]);
void nautilus_icon_container_set_margins (NautilusIconContainer *container,
int left_margin,
int right_margin,

View file

@ -167,10 +167,6 @@ struct NautilusIconContainerDetails {
/* zoom level */
int zoom_level;
/* fonts used to draw labels in regular mode */
GdkFont *label_font[NAUTILUS_ZOOM_LEVEL_LARGEST + 1];
int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1]; /* unused? */
/* pixbuf and color for label highlighting */
GdkPixbuf *highlight_frame;
guint32 highlight_color;

View file

@ -1041,18 +1041,6 @@ click_policy_changed_callback (gpointer callback_data)
click_policy_changed, (view));
}
static void
smooth_graphics_mode_changed_callback (gpointer callback_data)
{
FMDirectoryView *view;
view = FM_DIRECTORY_VIEW (callback_data);
EEL_CALL_METHOD
(FM_DIRECTORY_VIEW_CLASS, view,
smooth_graphics_mode_changed, (view));
}
gboolean
fm_directory_view_should_sort_directories_first (FMDirectoryView *view)
{
@ -1277,9 +1265,6 @@ fm_directory_view_init (FMDirectoryView *view)
eel_preferences_add_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
click_policy_changed_callback,
view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
sort_directories_first_changed_callback,
view);
@ -1358,9 +1343,6 @@ fm_directory_view_finalize (GObject *object)
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
click_policy_changed_callback,
view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
sort_directories_first_changed_callback,
view);

View file

@ -275,7 +275,6 @@ struct FMDirectoryViewClass {
void (* embedded_text_policy_changed) (FMDirectoryView *view);
void (* image_display_policy_changed) (FMDirectoryView *view);
void (* click_policy_changed) (FMDirectoryView *view);
void (* smooth_graphics_mode_changed) (FMDirectoryView *view);
void (* sort_directories_first_changed) (FMDirectoryView *view);
};

View file

@ -130,7 +130,6 @@ gboolean fm_icon_view_supports_auto_layout (
static void fm_icon_view_update_icon_container_fonts (FMIconView *icon_view);
static void fm_icon_view_update_icon_container_font_size_table (FMIconView *icon_view);
static void fm_icon_view_update_click_mode (FMIconView *icon_view);
static void fm_icon_view_update_smooth_graphics_mode (FMIconView *icon_view);
static gboolean fm_icon_view_using_tighter_layout (FMIconView *icon_view);
static gboolean fm_icon_view_get_directory_tighter_layout (FMIconView *icon_view,
NautilusFile *file);
@ -2160,14 +2159,6 @@ fm_icon_view_click_policy_changed (FMDirectoryView *directory_view)
fm_icon_view_update_click_mode (FM_ICON_VIEW (directory_view));
}
static void
fm_icon_view_smooth_graphics_mode_changed (FMDirectoryView *directory_view)
{
g_assert (FM_IS_ICON_VIEW (directory_view));
fm_icon_view_update_smooth_graphics_mode (FM_ICON_VIEW (directory_view));
}
static void
default_sort_order_changed_callback (gpointer callback_data)
{
@ -2408,12 +2399,6 @@ fm_icon_view_update_icon_container_font_size_table (FMIconView *icon_view)
}
for (i = 0; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
g_assert (font_size_table[i] >= min_font_size);
g_assert (font_size_table[i] <= max_font_size);
}
nautilus_icon_container_set_font_size_table (icon_container, font_size_table);
nautilus_icon_container_request_update_all (icon_container);
}
@ -2433,20 +2418,6 @@ fm_icon_view_update_click_mode (FMIconView *icon_view)
click_mode == NAUTILUS_CLICK_POLICY_SINGLE);
}
static void
fm_icon_view_update_smooth_graphics_mode (FMIconView *icon_view)
{
NautilusIconContainer *icon_container;
gboolean smooth_graphics_mode;
icon_container = get_icon_container (icon_view);
g_assert (icon_container != NULL);
smooth_graphics_mode = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE);
nautilus_icon_container_set_anti_aliased_mode (icon_container, smooth_graphics_mode);
}
static void
create_icon_container (FMIconView *icon_view)
{
@ -2557,7 +2528,6 @@ create_icon_container (FMIconView *icon_view)
fm_icon_view_update_icon_container_fonts (icon_view);
fm_icon_view_update_icon_container_font_size_table (icon_view);
fm_icon_view_update_click_mode (icon_view);
fm_icon_view_update_smooth_graphics_mode (icon_view);
gtk_widget_show (GTK_WIDGET (icon_container));
}
@ -2753,7 +2723,6 @@ fm_icon_view_class_init (FMIconViewClass *klass)
fm_directory_view_class->embedded_text_policy_changed = fm_icon_view_embedded_text_policy_changed;
fm_directory_view_class->image_display_policy_changed = fm_icon_view_image_display_policy_changed;
fm_directory_view_class->merge_menus = fm_icon_view_merge_menus;
fm_directory_view_class->smooth_graphics_mode_changed = fm_icon_view_smooth_graphics_mode_changed;
fm_directory_view_class->sort_directories_first_changed = fm_icon_view_sort_directories_first_changed;
fm_directory_view_class->start_renaming_item = fm_icon_view_start_renaming_item;
fm_directory_view_class->text_attribute_names_changed = fm_icon_view_text_attribute_names_changed;

View file

@ -51,19 +51,9 @@ static void preferences_dialog_populate_themes_group (EelPreferencesGroup
static GtkWidget *preferences_dialog;
static EelPreferencesItemDescription appearance_items[] = {
{ N_("Smoother Graphics"),
NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
N_("Use smoother (but slower) graphics"),
EEL_PREFERENCE_ITEM_BOOLEAN
},
{ N_("Fonts"),
NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT,
N_("Default smooth font:"),
EEL_PREFERENCE_ITEM_SMOOTH_FONT,
},
{ N_("Fonts"),
NAUTILUS_PREFERENCES_DEFAULT_FONT,
N_("Default non-smooth font:"),
N_("Default font:"),
EEL_PREFERENCE_ITEM_FONT,
},
{ N_("Nautilus Themes"),
@ -206,16 +196,7 @@ static EelPreferencesItemDescription view_preferences_items[] = {
{ N_("Icon View Defaults"),
NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
N_("Font:"),
EEL_PREFERENCE_ITEM_FONT,
NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
EEL_PREFERENCE_ITEM_HIDE
},
{ N_("Icon View Defaults"),
NAUTILUS_PREFERENCES_ICON_VIEW_SMOOTH_FONT,
N_("Font:"),
EEL_PREFERENCE_ITEM_SMOOTH_FONT,
NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
EEL_PREFERENCE_ITEM_SHOW
EEL_PREFERENCE_ITEM_FONT
},
{ N_("Icon View Defaults"),
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
@ -423,9 +404,17 @@ static EelPreferencesPaneDescription panes[] = {
{ NULL }
};
static void
dialog_delete_event_callback (GtkWidget *widget,
GdkEventAny *event,
gpointer user_data)
{
gtk_widget_hide (widget);
}
static void
dialog_button_response_callback (GtkDialog *dialog,
gint response_id,
int response_id,
gpointer callback_data)
{
gtk_widget_hide (GTK_WIDGET (dialog));
@ -441,6 +430,10 @@ preferences_dialog_create (void)
gtk_window_set_wmclass (GTK_WINDOW (dialog), "nautilus_preferences", "Nautilus");
g_signal_connect (dialog,
"delete_event",
G_CALLBACK (dialog_delete_event_callback),
dialog);
g_signal_connect (dialog,
"response",
G_CALLBACK (dialog_button_response_callback),

View file

@ -1,5 +1,3 @@
*.la
*.lo
.deps
.libs
Makefile
@ -9,5 +7,4 @@ test-nautilus-mime-actions
test-nautilus-mime-actions-set
test-nautilus-preferences-change
test-nautilus-preferences-display
test-nautilus-smooth-graphics
test-nautilus-wrap-table

View file

@ -20,7 +20,6 @@ noinst_PROGRAMS =\
test-nautilus-mime-actions-set \
test-nautilus-preferences-change \
test-nautilus-preferences-display \
test-nautilus-smooth-graphics \
test-nautilus-wrap-table \
$(NULL)
@ -29,7 +28,6 @@ test_nautilus_mime_actions_SOURCES = test-nautilus-mime-actions.c test.c
test_nautilus_mime_actions_set_SOURCES = test-nautilus-mime-actions-set.c test.c
test_nautilus_preferences_change_SOURCES = test-nautilus-preferences-change.c test.c
test_nautilus_preferences_display_SOURCES = test-nautilus-preferences-display.c test.c
test_nautilus_smooth_graphics_SOURCES = test-nautilus-smooth-graphics.c test.c
test_nautilus_wrap_table_SOURCES = test-nautilus-wrap-table.c test.c
EXTRA_DIST = \

View file

@ -1,68 +0,0 @@
#include <config.h>
#include <gtk/gtk.h>
#include <libgnomeui/libgnomeui.h>
#include <libnautilus-private/nautilus-global-preferences.h>
static void
button_toggled (GtkWidget *button,
gpointer callback_data)
{
eel_preferences_set_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
GTK_TOGGLE_BUTTON (button)->active);
}
static void
smooth_graphics_mode_changed_callback (gpointer callback_data)
{
gboolean is_smooth;
is_smooth = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (callback_data),
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE));
}
static void
delete_event (GtkWidget *widget, GdkEvent *event, gpointer callback_data)
{
gtk_main_quit ();
}
int
main (int argc, char * argv[])
{
GtkWidget *window;
GtkWidget *button;
gnome_program_init ("test-nautilus-smooth-graphics", "1.0",
LIBGNOMEUI_MODULE, argc, argv, NULL);
nautilus_global_preferences_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete_event", G_CALLBACK (delete_event), NULL);
button = gtk_toggle_button_new_with_label ("Smooth Graphics");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE));
gtk_container_add (GTK_CONTAINER (window), button);
g_signal_connect (button,
"toggled",
G_CALLBACK (button_toggled),
NULL);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}