Top left patch, please review
- From: Alexander Larsson <alexl redhat com>
- To: nautilus-list gnome org
- Subject: Top left patch, please review
- Date: Thu, 6 Mar 2003 12:09:28 -0500 (EST)
I just checked in this patch that changes how top-left text is handled.
Can people please review it, since it touches some sensitive parts of
nautilus (NautilusFile ref/unrefing and async stuff).
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5719
diff -u -p -r1.5719 ChangeLog
--- ChangeLog 5 Mar 2003 16:02:52 -0000 1.5719
+++ ChangeLog 6 Mar 2003 17:04:39 -0000
@@ -1,3 +1,74 @@
+2003-03-06 Alexander Larsson <alexl redhat com>
+
+ * libnautilus-private/nautilus-bookmark.c:
+ (nautilus_bookmark_get_pixbuf), (nautilus_bookmark_update_icon):
+ * libnautilus-private/nautilus-emblem-utils.c:
+ (nautilus_emblem_rename_emblem):
+ * src/nautilus-sidebar-title.c: (update_emblems):
+ * src/file-manager/fm-directory-view.c: (ready_to_load):
+ Update according to NautilusIconFactory API changes.
+
+ * libnautilus-private/nautilus-file.h:
+ * libnautilus-private/nautilus-file.c:
+ (nautilus_file_peek_top_left_text),
+ (nautilus_file_get_top_left_text):
+ Add needs_loading out parameter to nautilus_file_peek_top_left_text.
+
+ * libnautilus-private/nautilus-icon-canvas-item.h:
+ * libnautilus-private/nautilus-icon-canvas-item.c:
+ (nautilus_icon_canvas_item_finalize),
+ (nautilus_icon_canvas_item_set_embedded_text_rect),
+ (nautilus_icon_canvas_item_set_embedded_text),
+ (draw_embedded_text), (nautilus_icon_canvas_item_draw):
+ Render embedded text on exposes.
+ (nautilus_icon_canvas_item_get_image):
+ Return a GdkPixmap + mask instead of pixbuf, so that
+ we can do the text rendering on it.
+
+ * libnautilus-private/nautilus-icon-private.h:
+ * libnautilus-private/nautilus-icon-container.h:
+ * libnautilus-private/nautilus-icon-container.c:
+ (nautilus_icon_container_clear), (icon_destroy),
+ (nautilus_icon_container_get_icon_images),
+ (nautilus_icon_container_start_monitor_top_left),
+ (nautilus_icon_container_stop_monitor_top_left),
+ (nautilus_icon_container_update_icon):
+ For icons that have an embedded text rect, request the
+ top-left text, and set the text on the canvas item.
+
+
+ * libnautilus-private/nautilus-icon-dnd.c:
+ (nautilus_icon_dnd_begin_drag):
+ nautilus_icon_canvas_item_get_image now returns a pixmap, handle this
+ change.
+
+ * libnautilus-private/nautilus-icon-factory.h:
+ * libnautilus-private/nautilus-icon-factory.c: (cache_key_destroy),
+ (nautilus_icon_factory_get_required_file_attributes),
+ (get_icon_from_cache), (nautilus_icon_factory_get_pixbuf_for_icon),
+ (cache_key_hash), (cache_key_equal),
+ (nautilus_icon_factory_get_pixbuf_for_file),
+ (nautilus_icon_factory_get_pixbuf_from_name),
+ (nautilus_icon_factory_remove_from_cache):
+ Remove all embedded text handling.
+ (nautilus_icon_factory_get_basic_file_attributes):
+ Remove, not needed anymore.
+ (nautilus_icon_factory_get_icon_for_file):
+ Pass in whether you want icons for text embedding or not.
+
+ * src/file-manager/fm-icon-container.c:
+ (fm_icon_container_get_icon_images),
+ (fm_icon_container_start_monitor_top_left),
+ (fm_icon_container_stop_monitor_top_left),
+ (fm_icon_container_class_init):
+ Update to new APIs. pass TRUE for embedd_text in get_icon_for_file.
+ Implement start/stop top left monitoring.
+
+ * src/file-manager/fm-icon-view.c:
+ (list_covers),(fm_icon_view_clear):
+ Clear the icon container before unreferencing the NautilusFiles.
+ Otherwise the stop_monitor call uses the unref:ed file.
+
2003-03-05 Alexander Larsson <alexl redhat com>
* src/nautilus-zoom-control.[ch]:
Index: libnautilus-private/nautilus-bookmark.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-bookmark.c,v
retrieving revision 1.58
diff -u -p -r1.58 nautilus-bookmark.c
--- libnautilus-private/nautilus-bookmark.c 4 Oct 2002 10:42:02 -0000 1.58
+++ libnautilus-private/nautilus-bookmark.c 6 Mar 2003 17:04:39 -0000
@@ -216,8 +216,9 @@ nautilus_bookmark_get_pixbuf (NautilusBo
}
result = nautilus_icon_factory_get_pixbuf_for_icon
- (icon, NULL, NULL,
- icon_size, NULL, TRUE, NULL);
+ (icon, NULL,
+ icon_size, NULL, NULL,
+ TRUE, NULL);
g_free (icon);
@@ -304,7 +305,7 @@ nautilus_bookmark_update_icon (NautilusB
}
if (nautilus_icon_factory_is_icon_ready_for_file (bookmark->details->file)) {
- new_icon = nautilus_icon_factory_get_icon_for_file (bookmark->details->file);
+ new_icon = nautilus_icon_factory_get_icon_for_file (bookmark->details->file, FALSE);
if (nautilus_bookmark_icon_is_different (bookmark, new_icon)) {
g_free (bookmark->details->icon);
bookmark->details->icon = new_icon;
Index: libnautilus-private/nautilus-emblem-utils.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-emblem-utils.c,v
retrieving revision 1.3
diff -u -p -r1.3 nautilus-emblem-utils.c
--- libnautilus-private/nautilus-emblem-utils.c 21 Oct 2002 16:39:01 -0000 1.3
+++ libnautilus-private/nautilus-emblem-utils.c 6 Mar 2003 17:04:39 -0000
@@ -384,7 +384,7 @@ nautilus_emblem_rename_emblem (const cha
fclose (file);
icon_name = nautilus_emblem_get_icon_name_from_keyword (keyword);
- nautilus_icon_factory_remove_from_cache (icon_name, NULL, NULL,
+ nautilus_icon_factory_remove_from_cache (icon_name, NULL,
NAUTILUS_ICON_SIZE_STANDARD);
g_free (icon_name);
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.310
diff -u -p -r1.310 nautilus-file.c
--- libnautilus-private/nautilus-file.c 10 Feb 2003 19:38:39 -0000 1.310
+++ libnautilus-private/nautilus-file.c 6 Mar 2003 17:04:39 -0000
@@ -4720,22 +4720,30 @@ nautilus_file_is_executable (NautilusFil
*
**/
char *
-nautilus_file_peek_top_left_text (NautilusFile *file)
+nautilus_file_peek_top_left_text (NautilusFile *file, gboolean *needs_loading)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
if (!nautilus_file_should_get_top_left_text (file)) {
+ if (needs_loading) {
+ *needs_loading = FALSE;
+ }
return NULL;
}
+
+ if (needs_loading) {
+ *needs_loading = !file->details->top_left_text_is_up_to_date;
+ }
/* Show " ..." in the file until we read the contents in. */
if (!file->details->got_top_left_text) {
+
if (nautilus_file_contains_text (file)) {
return " ...";
}
return NULL;
}
-
+
/* Show what we read in. */
return file->details->top_left_text;
}
@@ -4752,7 +4760,7 @@ nautilus_file_peek_top_left_text (Nautil
char *
nautilus_file_get_top_left_text (NautilusFile *file)
{
- return g_strdup (nautilus_file_peek_top_left_text (file));
+ return g_strdup (nautilus_file_peek_top_left_text (file, NULL));
}
Index: libnautilus-private/nautilus-file.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.h,v
retrieving revision 1.91
diff -u -p -r1.91 nautilus-file.h
--- libnautilus-private/nautilus-file.h 4 Feb 2003 10:36:03 -0000 1.91
+++ libnautilus-private/nautilus-file.h 6 Mar 2003 17:04:40 -0000
@@ -159,7 +159,8 @@ void nautilus_file_se
GList *keywords);
GList * nautilus_file_get_emblem_names (NautilusFile *file);
char * nautilus_file_get_top_left_text (NautilusFile *file);
-char * nautilus_file_peek_top_left_text (NautilusFile *file);
+char * nautilus_file_peek_top_left_text (NautilusFile *file,
+ gboolean *got_top_left_text);
gboolean nautilus_file_get_directory_item_mime_types (NautilusFile *file,
GList **mime_list);
Index: libnautilus-private/nautilus-icon-canvas-item.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-canvas-item.c,v
retrieving revision 1.165
diff -u -p -r1.165 nautilus-icon-canvas-item.c
--- libnautilus-private/nautilus-icon-canvas-item.c 4 Mar 2003 10:09:52 -0000 1.165
+++ libnautilus-private/nautilus-icon-canvas-item.c 6 Mar 2003 17:04:40 -0000
@@ -99,6 +99,9 @@ struct NautilusIconCanvasItemDetails {
PangoLayout *editable_text_layout;
PangoLayout *additional_text_layout;
+ GdkRectangle embedded_text_rect;
+ PangoLayout *embedded_text_layout;
+
/* Cached rectangle in canvas coordinates */
ArtIRect canvas_rect;
ArtIRect text_rect;
@@ -181,6 +184,10 @@ static gboolean hit_test_stretch_handle
static void clear_rounded_corners (GdkPixbuf *destination_pixbuf,
GdkPixbuf *corner_pixbuf,
int corner_size);
+static void draw_embedded_text (NautilusIconCanvasItem *icon_item,
+ GdkDrawable *drawable,
+ int x,
+ int y);
static NautilusIconCanvasItemClass *parent_class = NULL;
@@ -238,6 +245,11 @@ nautilus_icon_canvas_item_finalize (GObj
if (details->additional_text_layout != NULL) {
g_object_unref (details->additional_text_layout);
}
+
+ if (details->embedded_text_layout != NULL) {
+ g_object_unref (details->embedded_text_layout);
+ }
+
g_free (details);
@@ -391,16 +403,25 @@ nautilus_icon_canvas_item_get_property (
}
}
-GdkPixbuf *
-nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item)
+GdkPixmap *
+nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
+ GdkBitmap **mask)
{
- NautilusIconCanvasItemDetails *details;
-
+ GdkPixmap *pixmap;
+ EelCanvas *canvas;
+
g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), NULL);
- details = item->details;
+ canvas = EEL_CANVAS_ITEM (item)->canvas;
+ gdk_pixbuf_render_pixmap_and_mask_for_colormap (item->details->pixbuf,
+ gtk_widget_get_colormap (GTK_WIDGET (canvas)),
+ &pixmap,
+ mask,
+ 128);
+
+ draw_embedded_text (item, GDK_DRAWABLE (pixmap), 0,0);
- return details->pixbuf;
+ return pixmap;
}
void
@@ -475,6 +496,43 @@ nautilus_icon_canvas_item_set_attach_poi
}
}
+void
+nautilus_icon_canvas_item_set_embedded_text_rect (NautilusIconCanvasItem *item,
+ const GdkRectangle *text_rect)
+{
+ item->details->embedded_text_rect = *text_rect;
+
+ eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
+}
+
+void
+nautilus_icon_canvas_item_set_embedded_text (NautilusIconCanvasItem *item,
+ const char *text)
+{
+ PangoContext *context;
+ PangoFontDescription *desc;
+
+ if (item->details->embedded_text_layout == NULL && text != NULL) {
+ context = gtk_widget_get_pango_context (GTK_WIDGET (EEL_CANVAS_ITEM(item)->canvas));
+ item->details->embedded_text_layout = pango_layout_new (context);
+
+ desc = pango_font_description_from_string ("monospace 6");
+ pango_layout_set_font_description (item->details->embedded_text_layout, desc);
+ pango_font_description_free (desc);
+ }
+
+ if (item->details->embedded_text_layout != NULL) {
+ if (text != NULL) {
+ pango_layout_set_text (item->details->embedded_text_layout, text, -1);
+ } else {
+ pango_layout_set_text (item->details->embedded_text_layout, "", -1);
+ }
+
+ eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
+ }
+}
+
+
/* Recomputes the bounding box of a icon canvas item.
* This is a generic implementation that could be used for any canvas item
* class, it has no assumptions about how the item is used.
@@ -1202,6 +1260,37 @@ map_pixbuf (NautilusIconCanvasItem *icon
return icon_item->details->rendered_pixbuf;
}
+static void
+draw_embedded_text (NautilusIconCanvasItem *icon_item,
+ GdkDrawable *drawable,
+ int x, int y)
+{
+ GdkGC *gc;
+ GdkRectangle clip_rect;
+
+ if (icon_item->details->embedded_text_layout == NULL ||
+ icon_item->details->embedded_text_rect.width == 0 ||
+ icon_item->details->embedded_text_rect.height == 0) {
+ return;
+ }
+
+ gc = gdk_gc_new (drawable);
+
+ clip_rect.x = x + icon_item->details->embedded_text_rect.x;
+ clip_rect.y = y + icon_item->details->embedded_text_rect.y;
+ clip_rect.width = icon_item->details->embedded_text_rect.width;
+ clip_rect.height = icon_item->details->embedded_text_rect.height;
+
+ gdk_gc_set_clip_rectangle (gc, &clip_rect);
+
+ gdk_draw_layout (drawable, gc,
+ x + icon_item->details->embedded_text_rect.x,
+ y + icon_item->details->embedded_text_rect.y,
+ icon_item->details->embedded_text_layout);
+
+ g_object_unref (gc);
+}
+
/* Draw the icon item for non-anti-aliased mode. */
static void
nautilus_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
@@ -1229,6 +1318,8 @@ nautilus_icon_canvas_item_draw (EelCanva
draw_pixbuf (temp_pixbuf, drawable, icon_rect.x0, icon_rect.y0);
g_object_unref (temp_pixbuf);
+ draw_embedded_text (icon_item, drawable, icon_rect.x0, icon_rect.y0);
+
/* Draw the emblem pixbufs. */
emblem_layout_reset (&emblem_layout, icon_item, icon_rect);
while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect)) {
Index: libnautilus-private/nautilus-icon-canvas-item.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-canvas-item.h,v
retrieving revision 1.25
diff -u -p -r1.25 nautilus-icon-canvas-item.h
--- libnautilus-private/nautilus-icon-canvas-item.h 4 Feb 2003 10:36:04 -0000 1.25
+++ libnautilus-private/nautilus-icon-canvas-item.h 6 Mar 2003 17:04:40 -0000
@@ -63,13 +63,18 @@ GType nautilus_icon_canvas_item_ge
/* attributes */
void nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
GdkPixbuf *image);
-GdkPixbuf * nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item);
+GdkPixmap * nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
+ GdkBitmap **mask);
void nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
GList *emblem_pixbufs);
void nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
gboolean show_stretch_handles);
void nautilus_icon_canvas_item_set_attach_points (NautilusIconCanvasItem *item,
NautilusEmblemAttachPoints *attach_points);
+void nautilus_icon_canvas_item_set_embedded_text_rect (NautilusIconCanvasItem *item,
+ const GdkRectangle *text_rect);
+void nautilus_icon_canvas_item_set_embedded_text (NautilusIconCanvasItem *item,
+ const char *text);
double nautilus_icon_canvas_item_get_max_text_width (NautilusIconCanvasItem *item);
const char *nautilus_icon_canvas_item_get_editable_text (NautilusIconCanvasItem *icon_item);
void nautilus_icon_canvas_item_set_renaming (NautilusIconCanvasItem *icon_item,
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.322
diff -u -p -r1.322 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c 4 Mar 2003 13:27:42 -0000 1.322
+++ libnautilus-private/nautilus-icon-container.c 6 Mar 2003 17:04:40 -0000
@@ -111,6 +111,10 @@
#define DEFAULT_LIGHT_INFO_COLOR 0xAAAAFD
#define DEFAULT_DARK_INFO_COLOR 0x33337F
+#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20
+#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20
+
+
enum {
NAUTILUS_TYPESELECT_FLUSH_DELAY = 1000000
/* After this time the current typeselect buffer will be
@@ -131,31 +135,38 @@ typedef struct {
static GType nautilus_icon_container_accessible_get_type (void);
-static void activate_selected_items (NautilusIconContainer *container);
-static void nautilus_icon_container_theme_changed (gpointer user_data);
-static void compute_stretch (StretchState *start,
- StretchState *current);
-static NautilusIcon *get_first_selected_icon (NautilusIconContainer *container);
-static NautilusIcon *get_nth_selected_icon (NautilusIconContainer *container,
- int index);
-static gboolean has_multiple_selection (NautilusIconContainer *container);
-static void icon_destroy (NautilusIconContainer *container,
- NautilusIcon *icon);
-static void end_renaming_mode (NautilusIconContainer *container,
- gboolean commit);
-static NautilusIcon *get_icon_being_renamed (NautilusIconContainer *container);
-static void finish_adding_new_icons (NautilusIconContainer *container);
-static void update_label_color (EelBackground *background,
- NautilusIconContainer *icon_container);
-static void icon_get_bounding_box (NautilusIcon *icon,
- int *x1_return,
- int *y1_return,
- int *x2_return,
- int *y2_return);
-static gboolean is_renaming (NautilusIconContainer *container);
-static gboolean is_renaming_pending (NautilusIconContainer *container);
-static void process_pending_icon_to_rename (NautilusIconContainer *container);
-static void setup_label_gcs (NautilusIconContainer *container);
+static void activate_selected_items (NautilusIconContainer *container);
+static void nautilus_icon_container_theme_changed (gpointer user_data);
+static void compute_stretch (StretchState *start,
+ StretchState *current);
+static NautilusIcon *get_first_selected_icon (NautilusIconContainer *container);
+static NautilusIcon *get_nth_selected_icon (NautilusIconContainer *container,
+ int index);
+static gboolean has_multiple_selection (NautilusIconContainer *container);
+static void icon_destroy (NautilusIconContainer *container,
+ NautilusIcon *icon);
+static void end_renaming_mode (NautilusIconContainer *container,
+ gboolean commit);
+static NautilusIcon *get_icon_being_renamed (NautilusIconContainer *container);
+static void finish_adding_new_icons (NautilusIconContainer *container);
+static void update_label_color (EelBackground *background,
+ NautilusIconContainer *icon_container);
+static void icon_get_bounding_box (NautilusIcon *icon,
+ int *x1_return,
+ int *y1_return,
+ int *x2_return,
+ int *y2_return);
+static gboolean is_renaming (NautilusIconContainer *container);
+static gboolean is_renaming_pending (NautilusIconContainer *container);
+static void process_pending_icon_to_rename (NautilusIconContainer *container);
+static void setup_label_gcs (NautilusIconContainer *container);
+static void nautilus_icon_container_stop_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client);
+static void nautilus_icon_container_start_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client);
+
static int click_policy_auto_value;
@@ -3767,6 +3778,7 @@ void
nautilus_icon_container_clear (NautilusIconContainer *container)
{
NautilusIconContainerDetails *details;
+ NautilusIcon *icon;
GList *p;
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
@@ -3786,6 +3798,12 @@ nautilus_icon_container_clear (NautilusI
details->drop_target = NULL;
for (p = details->icons; p != NULL; p = p->next) {
+ icon = p->data;
+ if (icon->is_monitored) {
+ nautilus_icon_container_stop_monitor_top_left (container,
+ icon->data,
+ icon);
+ }
icon_free (p->data);
}
g_list_free (details->icons);
@@ -3879,6 +3897,11 @@ icon_destroy (NautilusIconContainer *con
set_pending_icon_to_reveal (container, NULL);
}
+ if (icon->is_monitored) {
+ nautilus_icon_container_stop_monitor_top_left (container,
+ icon->data,
+ icon);
+ }
icon_free (icon);
if (was_selected) {
@@ -3925,14 +3948,15 @@ static char *
nautilus_icon_container_get_icon_images (NautilusIconContainer *container,
NautilusIconData *data,
GList **emblem_icons,
- char **embedded_text)
+ char **embedded_text,
+ gboolean *embedded_text_needs_loading)
{
NautilusIconContainerClass *klass;
klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
g_return_val_if_fail (klass->get_icon_images != NULL, NULL);
- return klass->get_icon_images (container, data, emblem_icons, embedded_text);
+ return klass->get_icon_images (container, data, emblem_icons, embedded_text, embedded_text_needs_loading);
}
@@ -3950,6 +3974,33 @@ nautilus_icon_container_get_icon_text (N
klass->get_icon_text (container, data, editable_text, additional_text);
}
+static void
+nautilus_icon_container_start_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client)
+{
+ NautilusIconContainerClass *klass;
+
+ klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
+ g_return_if_fail (klass->start_monitor_top_left != NULL);
+
+ klass->start_monitor_top_left (container, data, client);
+}
+
+static void
+nautilus_icon_container_stop_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client)
+{
+ NautilusIconContainerClass *klass;
+
+ klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
+ g_return_if_fail (klass->stop_monitor_top_left != NULL);
+
+ klass->stop_monitor_top_left (container, data, client);
+}
+
+
void
nautilus_icon_container_update_icon (NautilusIconContainer *container,
NautilusIcon *icon)
@@ -3965,6 +4016,8 @@ nautilus_icon_container_update_icon (Nau
GList *emblem_icon_names, *emblem_pixbufs, *p;
char *editable_text, *additional_text;
char *embedded_text;
+ GdkRectangle embedded_text_rect;
+ gboolean embedded_text_needs_loading;
if (icon == NULL) {
return;
@@ -3978,7 +4031,7 @@ nautilus_icon_container_update_icon (Nau
icon_name = nautilus_icon_container_get_icon_images (
container, icon->data,
&emblem_icon_names,
- &embedded_text);
+ &embedded_text, &embedded_text_needs_loading);
/* compute the maximum size based on the scale factor */
min_image_size = MINIMUM_IMAGE_SIZE * EEL_CANVAS (container)->pixels_per_unit;
@@ -3993,13 +4046,20 @@ nautilus_icon_container_update_icon (Nau
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(icon_name,
(icon == details->drop_target) ? "accept" : NULL,
- embedded_text,
icon_size,
&attach_points,
+ &embedded_text_rect,
TRUE, NULL);
g_free (icon_name);
+ if (embedded_text_rect.width > MINIMUM_EMBEDDED_TEXT_RECT_WIDTH &&
+ embedded_text_rect.height > MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT &&
+ embedded_text_needs_loading) {
+ icon->is_monitored = TRUE;
+ nautilus_icon_container_start_monitor_top_left (container, icon->data, icon);
+ }
+
/* in the rare case an image is too small, scale it up */
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
@@ -4025,9 +4085,9 @@ nautilus_icon_container_update_icon (Nau
emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data,
NULL,
- NULL,
MIN (icon_size, MAXIMUM_EMBLEM_SIZE),
NULL,
+ NULL,
FALSE, NULL);
if (emblem_pixbuf != NULL) {
emblem_pixbufs = g_list_prepend
@@ -4063,6 +4123,8 @@ nautilus_icon_container_update_icon (Nau
nautilus_icon_canvas_item_set_image (icon->item, pixbuf);
nautilus_icon_canvas_item_set_attach_points (icon->item, &attach_points);
nautilus_icon_canvas_item_set_emblems (icon->item, emblem_pixbufs);
+ nautilus_icon_canvas_item_set_embedded_text_rect (icon->item, &embedded_text_rect);
+ nautilus_icon_canvas_item_set_embedded_text (icon->item, embedded_text);
/* Let the pixbufs go. */
g_object_unref (pixbuf);
Index: libnautilus-private/nautilus-icon-container.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.h,v
retrieving revision 1.74
diff -u -p -r1.74 nautilus-icon-container.h
--- libnautilus-private/nautilus-icon-container.h 16 Oct 2002 16:27:20 -0000 1.74
+++ libnautilus-private/nautilus-icon-container.h 6 Mar 2003 17:04:40 -0000
@@ -108,7 +108,8 @@ typedef struct {
char * (* get_icon_images) (NautilusIconContainer *container,
NautilusIconData *data,
GList **emblem_icons,
- char **embedded_text);
+ char **embedded_text,
+ gboolean *embedded_text_needs_loading);
void (* get_icon_text) (NautilusIconContainer *container,
NautilusIconData *data,
char **editable_text,
@@ -119,6 +120,12 @@ typedef struct {
int (* compare_icons_by_name) (NautilusIconContainer *container,
NautilusIconData *icon_a,
NautilusIconData *icon_b);
+ void (* start_monitor_top_left) (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client);
+ void (* stop_monitor_top_left) (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client);
/* Queries on icons for subclass/client.
* These must be implemented => These are signals !
Index: libnautilus-private/nautilus-icon-dnd.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-dnd.c,v
retrieving revision 1.127
diff -u -p -r1.127 nautilus-icon-dnd.c
--- libnautilus-private/nautilus-icon-dnd.c 3 Mar 2003 17:31:31 -0000 1.127
+++ libnautilus-private/nautilus-icon-dnd.c 6 Mar 2003 17:04:40 -0000
@@ -1201,7 +1201,8 @@ nautilus_icon_dnd_begin_drag (NautilusIc
NautilusIconDndInfo *dnd_info;
EelCanvas *canvas;
GdkDragContext *context;
- GdkPixbuf *pixbuf;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
int x_offset, y_offset;
ArtDRect world_rect;
ArtIRect widget_rect;
@@ -1220,7 +1221,7 @@ nautilus_icon_dnd_begin_drag (NautilusIc
dnd_info->drag_info.start_y = event->y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas)));
/* create a pixmap and mask to drag with */
- pixbuf = nautilus_icon_canvas_item_get_image (container->details->drag_icon->item);
+ pixmap = nautilus_icon_canvas_item_get_image (container->details->drag_icon->item, &mask);
/* we want to drag semi-transparent pixbufs, but X is too slow dealing with
stippled masks, so we had to remove the code; this comment is left as a memorial
@@ -1245,7 +1246,10 @@ nautilus_icon_dnd_begin_drag (NautilusIc
if (context) {
/* set the icon for dragging */
- gtk_drag_set_icon_pixbuf (context, pixbuf, x_offset, y_offset);
+ gtk_drag_set_icon_pixmap (context,
+ gtk_widget_get_colormap (GTK_WIDGET (container)),
+ pixmap, mask,
+ x_offset, y_offset);
}
}
Index: libnautilus-private/nautilus-icon-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-factory.c,v
retrieving revision 1.288
diff -u -p -r1.288 nautilus-icon-factory.c
--- libnautilus-private/nautilus-icon-factory.c 8 Feb 2003 20:30:04 -0000 1.288
+++ libnautilus-private/nautilus-icon-factory.c 6 Mar 2003 17:04:41 -0000
@@ -84,16 +84,6 @@
*/
#define ICON_CACHE_SWEEP_TIMEOUT (10 * 1000)
-/* Embedded text font size and text line settings */
-
-/* FIXME; Hard coded font size */
-#define EMBEDDED_TEXT_FONT_SIZE 9
-#define EMBEDDED_TEXT_LINE_SPACING 1
-#define EMBEDDED_TEXT_EMPTY_LINE_HEIGHT 4
-
-#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20
-#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20
-
/* This circular doubly-linked list structure is used to keep a list
* of the most recently used items in the cache.
*/
@@ -107,7 +97,6 @@ struct CircularList {
typedef struct {
char *name; /* Icon name or absolute filename */
char *modifier;
- char *embedded_text;
guint nominal_size;
} CacheKey;
@@ -186,11 +175,7 @@ static CacheIcon *cache_icon_new
GnomeIconData *icon_data);
static CacheIcon *get_icon_from_cache (const char *icon,
const char *modifier,
- const char *embedded_text,
guint nominal_size);
-static GdkPixbuf *embed_text (GdkPixbuf *pixbuf_without_text,
- GnomeIconData *icon_data,
- const char *text);
static void nautilus_icon_factory_clear (void);
GNOME_CLASS_BOILERPLATE (NautilusIconFactory,
@@ -391,7 +376,6 @@ static void
cache_key_destroy (CacheKey *key)
{
g_free (key->name);
- g_free (key->embedded_text);
g_free (key);
}
@@ -739,7 +723,7 @@ should_show_thumbnail (NautilusFile *fil
/* key routine to get the icon for a file */
char *
-nautilus_icon_factory_get_icon_for_file (NautilusFile *file)
+nautilus_icon_factory_get_icon_for_file (NautilusFile *file, gboolean embedd_text)
{
char *custom_uri, *file_uri, *icon_name, *mime_type, *custom_icon;
NautilusIconFactory *factory;
@@ -786,7 +770,7 @@ nautilus_icon_factory_get_icon_for_file
}
lookup_flags = GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES;
- if (nautilus_file_peek_top_left_text (file) != NULL) {
+ if (embedd_text) {
lookup_flags |= GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT;
}
icon_name = gnome_icon_lookup (factory->icon_theme,
@@ -821,25 +805,6 @@ nautilus_icon_factory_get_icon_for_file
}
/**
- * nautilus_icon_factory_get_basic_file_attributes
- *
- * Get the list of file attributes required to obtain a file's basic icon.
- * This includes attributes needed to get a custom icon, but not those needed
- * for text preview.
- * Callers must free this list.
- */
-GList *
-nautilus_icon_factory_get_basic_file_attributes (void)
-{
- GList *attributes;
-
- attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
- attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
- return attributes;
-}
-
-/**
* nautilus_icon_factory_get_required_file_attributes
*
* Get the list of file attributes required to obtain a file's icon.
@@ -850,9 +815,9 @@ nautilus_icon_factory_get_required_file_
{
GList *attributes;
- attributes = nautilus_icon_factory_get_basic_file_attributes ();
+ attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT);
+ NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
return attributes;
}
@@ -879,28 +844,6 @@ nautilus_icon_factory_is_icon_ready_for_
return result;
}
-/**
- * nautilus_icon_factory_is_basic_icon_ready_for_file
- *
- * Check whether a NautilusFile has enough information to report
- * what its basic icon should be. This will account for custom icons
- * but not text preview.
- *
- * @file: The NautilusFile in question.
- */
-gboolean
-nautilus_icon_factory_is_basic_icon_ready_for_file (NautilusFile *file)
-{
- GList *attributes;
- gboolean result;
-
- attributes = nautilus_icon_factory_get_basic_file_attributes ();
- result = nautilus_file_check_if_ready (file, attributes);
- g_list_free (attributes);
-
- return result;
-}
-
char *
nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name)
{
@@ -1153,31 +1096,6 @@ load_icon_file (char *filename,
}
static CacheIcon *
-create_embedded_text_cache_icon (CacheIcon *base_icon,
- const char *embedded_text)
-{
- GdkPixbuf *pixbuf;
- GnomeIconData *icon_data;
-
- pixbuf = embed_text (base_icon->pixbuf,
- base_icon->icon_data,
- embedded_text);
-
- if (pixbuf) {
- icon_data = NULL;
- if (base_icon->icon_data) {
- icon_data = g_new (GnomeIconData, 1);
- *icon_data = *base_icon->icon_data;
- }
- return cache_icon_new (pixbuf, icon_data);
- } else {
- cache_icon_ref (base_icon);
- return base_icon;
- }
-}
-
-
-static CacheIcon *
create_normal_cache_icon (const char *icon,
const char *modifier,
guint nominal_size)
@@ -1260,14 +1178,13 @@ create_normal_cache_icon (const char *ic
static CacheIcon *
get_icon_from_cache (const char *icon,
const char *modifier,
- const char *embedded_text,
guint nominal_size)
{
NautilusIconFactory *factory;
GHashTable *hash_table;
CacheKey lookup_key;
CacheKey *key;
- CacheIcon *cached_icon, *base_cached_icon;
+ CacheIcon *cached_icon;
gpointer key_in_table, value;
struct stat statbuf;
@@ -1282,7 +1199,6 @@ get_icon_from_cache (const char *icon,
/* Check to see if it's already in the table. */
lookup_key.name = (char *)icon;
lookup_key.modifier = (char *)modifier;
- lookup_key.embedded_text = (char *)embedded_text;
lookup_key.nominal_size = nominal_size;
if (g_hash_table_lookup_extended (hash_table, &lookup_key,
@@ -1312,39 +1228,25 @@ get_icon_from_cache (const char *icon,
icon, modifier?modifier:"", embedded_text?"<tl>":"", nominal_size);
*/
- if (embedded_text) {
- base_cached_icon = get_icon_from_cache (icon,
- modifier,
- NULL,
- nominal_size);
- cached_icon = create_embedded_text_cache_icon (base_cached_icon,
- embedded_text);
- cache_icon_unref (base_cached_icon);
-
- } else {
+ cached_icon = create_normal_cache_icon (icon,
+ modifier,
+ nominal_size);
+ /* Try to fallback without modifier */
+ if (cached_icon == NULL && modifier != NULL) {
cached_icon = create_normal_cache_icon (icon,
- modifier,
+ NULL,
nominal_size);
- /* Try to fallback without modifier */
- if (cached_icon == NULL && modifier != NULL) {
- cached_icon = create_normal_cache_icon (icon,
- NULL,
- nominal_size);
- }
-
- if (cached_icon == NULL) {
- cached_icon = factory->fallback_icon;
- cache_icon_ref (cached_icon);
- }
}
-
+ if (cached_icon == NULL) {
+ cached_icon = factory->fallback_icon;
+ cache_icon_ref (cached_icon);
+ }
/* Create the key and icon for the hash table. */
key = g_new (CacheKey, 1);
key->name = g_strdup (icon);
key->modifier = g_strdup (modifier);
- key->embedded_text = g_strdup (embedded_text);
key->nominal_size = nominal_size;
g_hash_table_insert (hash_table, key, cached_icon);
@@ -1365,9 +1267,9 @@ get_icon_from_cache (const char *icon,
GdkPixbuf *
nautilus_icon_factory_get_pixbuf_for_icon (const char *icon,
const char *modifier,
- const char *embedded_text,
guint nominal_size,
NautilusEmblemAttachPoints *attach_points,
+ GdkRectangle *embedded_text_rect,
gboolean wants_default,
char **display_name)
{
@@ -1380,7 +1282,6 @@ nautilus_icon_factory_get_pixbuf_for_ico
factory = get_icon_factory ();
cached_icon = get_icon_from_cache (icon,
modifier,
- embedded_text,
nominal_size);
if (attach_points != NULL) {
@@ -1396,6 +1297,20 @@ nautilus_icon_factory_get_pixbuf_for_ico
attach_points->num_points = 0;
}
}
+ if (embedded_text_rect) {
+ if (cached_icon->icon_data != NULL &&
+ cached_icon->icon_data->has_embedded_rect) {
+ embedded_text_rect->x = cached_icon->icon_data->x0;
+ embedded_text_rect->y = cached_icon->icon_data->y0;
+ embedded_text_rect->width = cached_icon->icon_data->x1 - cached_icon->icon_data->x0;
+ embedded_text_rect->height = cached_icon->icon_data->y1 - cached_icon->icon_data->y0;
+ } else {
+ embedded_text_rect->x = 0;
+ embedded_text_rect->y = 0;
+ embedded_text_rect->width = 0;
+ embedded_text_rect->height = 0;
+ }
+ }
if (display_name != NULL) {
if (cached_icon->icon_data != NULL &&
@@ -1434,10 +1349,6 @@ cache_key_hash (gconstpointer p)
hash ^= g_str_hash (key->modifier);
}
- if (key->embedded_text) {
- hash ^= g_str_hash (key->embedded_text);
- }
-
return hash;
}
@@ -1451,8 +1362,7 @@ cache_key_equal (gconstpointer a, gconst
return eel_strcmp (key_a->name, key_b->name) == 0 &&
key_a->nominal_size == key_b->nominal_size &&
- eel_strcmp (key_a->modifier, key_b->modifier) == 0 &&
- eel_strcmp (key_a->embedded_text, key_b->embedded_text) == 0;
+ eel_strcmp (key_a->modifier, key_b->modifier) == 0;
}
/* Return nominal icon size for given zoom level.
@@ -1493,20 +1403,18 @@ nautilus_icon_factory_get_pixbuf_for_fil
{
char *icon;
GdkPixbuf *pixbuf;
- char *embedded_text;
/* Get the pixbuf for this file. */
- icon = nautilus_icon_factory_get_icon_for_file (file);
+ icon = nautilus_icon_factory_get_icon_for_file (file, FALSE);
if (icon == NULL) {
return NULL;
}
- embedded_text = nautilus_file_peek_top_left_text (file);
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (icon, modifier,
- embedded_text,
size_in_pixels,
- NULL, TRUE, NULL);
+ NULL, NULL,
+ TRUE, NULL);
g_free (icon);
@@ -1521,9 +1429,9 @@ nautilus_icon_factory_get_pixbuf_from_na
char **display_name)
{
return nautilus_icon_factory_get_pixbuf_for_icon (icon_name, modifier,
- NULL,
size_in_pixels,
- NULL, TRUE, display_name);
+ NULL, NULL,
+ TRUE, display_name);
}
GdkPixbuf *
@@ -1535,7 +1443,6 @@ nautilus_icon_factory_get_thumbnail_fram
gboolean
nautilus_icon_factory_remove_from_cache (const char *icon_name,
const char *modifier,
- const char *embedded_text,
guint size)
{
GHashTable *hash_table;
@@ -1548,118 +1455,11 @@ nautilus_icon_factory_remove_from_cache
/* Check to see if it's already in the table. */
lookup_key.name = (char *)icon_name;
lookup_key.modifier = (char *)modifier;
- lookup_key.embedded_text = (char *)embedded_text;
lookup_key.nominal_size = size;
return g_hash_table_remove (hash_table, &lookup_key);
}
-
-static gboolean
-embedded_text_rect_usable (GnomeIconData *icon_data)
-{
- if (icon_data == NULL || !icon_data->has_embedded_rect) {
- return FALSE;
- }
-
- if (icon_data->x1 - icon_data->x0 < MINIMUM_EMBEDDED_TEXT_RECT_WIDTH ||
- icon_data->y1 - icon_data->y0 < MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean embedded_text_preferences_callbacks_added = FALSE;
-static PangoFontDescription *embedded_text_font = NULL;
-
-static void
-embedded_text_font_changed_callback (GtkSettings *settings,
- GParamSpec *pspec,
- gpointer callback_data)
-{
- gboolean clear_cache;
- char *font_name;
-
- clear_cache = GPOINTER_TO_INT (callback_data);
-
- if (embedded_text_font != NULL) {
- pango_font_description_free (embedded_text_font);
- }
-
- font_name = NULL;
- g_object_get (settings,
- "gtk-font-name", &font_name,
- NULL);
-
- if (font_name == NULL) {
- font_name = g_strdup ("Sans");
- }
-
- embedded_text_font = pango_font_description_from_string (font_name);
- g_free (font_name);
-
- pango_font_description_set_size (embedded_text_font,
- EMBEDDED_TEXT_FONT_SIZE * PANGO_SCALE);
-
- if (clear_cache) {
- nautilus_icon_factory_clear ();
- }
-}
-
-static GdkPixbuf *
-embed_text (GdkPixbuf *pixbuf_without_text,
- GnomeIconData *icon_data,
- const char *text)
-{
- GdkPixbuf *pixbuf_with_text;
- PangoLayout *layout;
- static PangoContext *context;
- GtkSettings *settings;
- ArtIRect clip_rect;
-
- g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
-
- /* Quick out for the case where there's no place to embed the
- * text or the place is too small or there's no text.
- */
- if (!embedded_text_rect_usable (icon_data) || eel_strlen (text) == 0) {
- return NULL;
- }
-
- /* Listen for changes in embedded text (icon text preview) font preferences */
- if (!embedded_text_preferences_callbacks_added) {
- embedded_text_preferences_callbacks_added = TRUE;
-
- settings = gtk_settings_get_default ();
- g_signal_connect (settings, "notify::gtk-font-name",
- G_CALLBACK (embedded_text_font_changed_callback), GINT_TO_POINTER (TRUE));
- embedded_text_font_changed_callback (settings, NULL, GINT_TO_POINTER (FALSE));
- }
-
- if (context == NULL) {
- context = eel_pango_ft2_get_context ();
- eel_debug_call_at_shutdown_with_data (g_object_unref, context);
- }
-
- layout = pango_layout_new (context);
- pango_layout_set_font_description (layout, embedded_text_font);
- pango_layout_set_text (layout, text, -1);
-
- pixbuf_with_text = gdk_pixbuf_copy (pixbuf_without_text);
- clip_rect.x0 = icon_data->x0;
- clip_rect.y0 = icon_data->y0;
- clip_rect.x1 = icon_data->x1;
- clip_rect.y1 = icon_data->y1;
-
- eel_gdk_pixbuf_draw_layout_clipped (pixbuf_with_text,
- clip_rect,
- EEL_RGB_COLOR_BLACK, layout);
- g_object_unref (layout);
-
- return pixbuf_with_text;
-}
-
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
void
Index: libnautilus-private/nautilus-icon-factory.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-factory.h,v
retrieving revision 1.45
diff -u -p -r1.45 nautilus-icon-factory.h
--- libnautilus-private/nautilus-icon-factory.h 21 Oct 2002 16:39:01 -0000 1.45
+++ libnautilus-private/nautilus-icon-factory.h 6 Mar 2003 17:04:41 -0000
@@ -107,14 +107,11 @@ GObject * nautilus_icon_fact
guint nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level);
/* Choose the appropriate icon, but don't render it yet. */
-char * nautilus_icon_factory_get_icon_for_file (NautilusFile *file);
+char * nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
+ gboolean embedd_text);
gboolean nautilus_icon_factory_is_icon_ready_for_file (NautilusFile *file);
GList * nautilus_icon_factory_get_required_file_attributes (void);
-/* The calls below do not account for top-left text, allowing it to be loaded progressively. */
-gboolean nautilus_icon_factory_is_basic_icon_ready_for_file (NautilusFile *file);
-GList * nautilus_icon_factory_get_basic_file_attributes (void);
-
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file,
EelStringList *exclude);
char * nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name);
@@ -129,9 +126,9 @@ char * nautilus_icon_fact
*/
GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_icon (const char *icon,
const char *modifier,
- const char *embedded_text,
guint nominal_size,
NautilusEmblemAttachPoints *attach_points,
+ GdkRectangle *embedded_text_rect,
gboolean wants_default,
char **display_name);
@@ -153,7 +150,6 @@ GnomeIconTheme * nautilus_icon_fac
GnomeThumbnailFactory *nautilus_icon_factory_get_thumbnail_factory (void);
gboolean nautilus_icon_factory_remove_from_cache (const char *icon_name,
const char *modifier,
- const char *embedded_text,
guint size);
#endif /* NAUTILUS_ICON_FACTORY_H */
Index: libnautilus-private/nautilus-icon-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-private.h,v
retrieving revision 1.68
diff -u -p -r1.68 nautilus-icon-private.h
--- libnautilus-private/nautilus-icon-private.h 3 Mar 2003 17:19:41 -0000 1.68
+++ libnautilus-private/nautilus-icon-private.h 6 Mar 2003 17:04:41 -0000
@@ -53,6 +53,10 @@ typedef struct {
/* Whether this item was selected before rubberbanding. */
eel_boolean_bit was_selected_before_rubberband : 1;
+
+ /* Whether a monitor was set on this icon. */
+ eel_boolean_bit is_monitored : 1;
+
} NautilusIcon;
Index: src/nautilus-sidebar-title.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-sidebar-title.c,v
retrieving revision 1.142
diff -u -p -r1.142 nautilus-sidebar-title.c
--- src/nautilus-sidebar-title.c 4 Oct 2002 10:42:04 -0000 1.142
+++ src/nautilus-sidebar-title.c 6 Mar 2003 17:04:41 -0000
@@ -575,9 +575,10 @@ update_emblems (NautilusSidebarTitle *si
/* loop through the list of emblems, installing them in the box */
for (p = icons; p != NULL; p = p->next) {
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
- (p->data, NULL, NULL,
+ (p->data, NULL,
NAUTILUS_ICON_SIZE_STANDARD,
- NULL, FALSE, NULL);
+ NULL, NULL,
+ FALSE, NULL);
if (pixbuf != NULL) {
add_emblem (sidebar_title, pixbuf);
g_object_unref (pixbuf);
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.563
diff -u -p -r1.563 fm-directory-view.c
--- src/file-manager/fm-directory-view.c 28 Feb 2003 15:15:04 -0000 1.563
+++ src/file-manager/fm-directory-view.c 6 Mar 2003 17:04:41 -0000
@@ -2046,7 +2046,7 @@ still_should_show_file (FMDirectoryView
static gboolean
ready_to_load (NautilusFile *file)
{
- return nautilus_icon_factory_is_basic_icon_ready_for_file (file);
+ return nautilus_icon_factory_is_icon_ready_for_file (file);
}
/* Go through all the new added and changed files.
Index: src/file-manager/fm-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-container.c,v
retrieving revision 1.6
diff -u -p -r1.6 fm-icon-container.c
--- src/file-manager/fm-icon-container.c 18 Oct 2002 15:47:29 -0000 1.6
+++ src/file-manager/fm-icon-container.c 6 Mar 2003 17:04:41 -0000
@@ -29,6 +29,7 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <eel/eel-string.h>
#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-file-attributes.h>
#include "fm-icon-container.h"
@@ -50,7 +51,8 @@ static char *
fm_icon_container_get_icon_images (NautilusIconContainer *container,
NautilusIconData *data,
GList **emblem_icons,
- char **embedded_text)
+ char **embedded_text,
+ gboolean *embedded_text_needs_loading)
{
FMIconView *icon_view;
EelStringList *emblems_to_ignore;
@@ -63,7 +65,7 @@ fm_icon_container_get_icon_images (Nauti
g_return_val_if_fail (icon_view != NULL, NULL);
if (embedded_text) {
- *embedded_text = nautilus_file_peek_top_left_text (file);
+ *embedded_text = nautilus_file_peek_top_left_text (file, embedded_text_needs_loading);
}
if (emblem_icons != NULL) {
@@ -74,9 +76,45 @@ fm_icon_container_get_icon_images (Nauti
eel_string_list_free (emblems_to_ignore);
}
- return nautilus_icon_factory_get_icon_for_file (file);
+ return nautilus_icon_factory_get_icon_for_file (file, TRUE);
}
+static void
+fm_icon_container_start_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client)
+{
+ NautilusFile *file;
+ GList *attributes;
+
+ file = (NautilusFile *) data;
+
+ g_assert (NAUTILUS_IS_FILE (file));
+
+
+ attributes = NULL;
+ attributes = g_list_prepend (attributes,
+ NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT);
+
+ nautilus_file_monitor_add (file, client, attributes);
+ g_list_free (attributes);
+}
+
+static void
+fm_icon_container_stop_monitor_top_left (NautilusIconContainer *container,
+ NautilusIconData *data,
+ gconstpointer client)
+{
+ NautilusFile *file;
+
+ file = (NautilusFile *) data;
+
+ g_assert (NAUTILUS_IS_FILE (file));
+
+ nautilus_file_monitor_remove (file, client);
+}
+
+
/*
* Get the preference for which caption text should appear
* beneath icons.
@@ -387,6 +425,8 @@ fm_icon_container_class_init (FMIconCont
ic_class->get_icon_text = fm_icon_container_get_icon_text;
ic_class->get_icon_images = fm_icon_container_get_icon_images;
+ ic_class->start_monitor_top_left = fm_icon_container_start_monitor_top_left;
+ ic_class->stop_monitor_top_left = fm_icon_container_stop_monitor_top_left;
ic_class->compare_icons = fm_icon_container_compare_icons;
ic_class->compare_icons_by_name = fm_icon_container_compare_icons_by_name;
Index: src/file-manager/fm-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-view.c,v
retrieving revision 1.273
diff -u -p -r1.273 fm-icon-view.c
--- src/file-manager/fm-icon-view.c 28 Feb 2003 15:15:05 -0000 1.273
+++ src/file-manager/fm-icon-view.c 6 Mar 2003 17:04:42 -0000
@@ -448,6 +448,16 @@ handle_radio_item (FMIconView *view,
}
static void
+list_covers (NautilusIconData *data, gpointer callback_data)
+{
+ GSList **file_list;
+
+ file_list = callback_data;
+
+ *file_list = g_slist_prepend (*file_list, data);
+}
+
+static void
unref_cover (NautilusIconData *data, gpointer callback_data)
{
nautilus_file_unref (NAUTILUS_FILE (data));
@@ -457,6 +467,7 @@ static void
fm_icon_view_clear (FMDirectoryView *view)
{
NautilusIconContainer *icon_container;
+ GSList *file_list;
g_return_if_fail (FM_IS_ICON_VIEW (view));
@@ -465,8 +476,11 @@ fm_icon_view_clear (FMDirectoryView *vie
return;
/* Clear away the existing icons. */
- nautilus_icon_container_for_each (icon_container, unref_cover, NULL);
+ file_list = NULL;
+ nautilus_icon_container_for_each (icon_container, list_covers, &file_list);
nautilus_icon_container_clear (icon_container);
+ g_slist_foreach (file_list, (GFunc)unref_cover, NULL);
+ g_slist_free (file_list);
}
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's an oversexed Jewish astronaut in a wheelchair. She's a warm-hearted punk
fairy princess who hides her beauty behind a pair of thick-framed spectacles.
They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]