diff options
author | Darin Adler <darin@src.gnome.org> | 2002-02-27 01:17:11 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2002-02-27 01:17:11 +0000 |
commit | f5874fd25f9107031ad14b6e9fb6d1c5e9289e39 (patch) | |
tree | 74e9d8631c6b2414184197e84015d4fd9f71656f /libnautilus-private/nautilus-icon-container.c | |
parent | 8f111d136e7c069165601aee126503d0149bf804 (diff) | |
download | nautilus-f5874fd25f9107031ad14b6e9fb6d1c5e9289e39.tar.gz |
Simplified calls to bonobo_object_ref/unref.
* Many files:
Simplified calls to bonobo_object_ref/unref.
* components/history/nautilus-history-view.c: (update_history):
Fixed so that a history update while one is already in progress
will work properly.
* libnautilus/nautilus-view.c:
(remove_listener): New.
(update_listener): Renamed from nautilus_view_set_frame, made it
handle various cases better. Fixed leak of property bag.
(forget_cached_view_frame): New.
(nautilus_view_set_frame_callback): Use new forget_cached_view_frame
and update_listener.
(nautilus_view_construct_from_bonobo_control): Use
g_signal_connect_object. Not sure if this is better, since they
are part of the same aggregate.
(nautilus_view_finalize): Use new forget_cached_view_frame and
remove_listener.
(nautilus_view_dispose): Use new forget_cached_view_frame and
remove_listener.
(nautilus_view_get_view_frame): Fixed leak of control frame.
(nautilus_view_set_listener_mask): Simplified, and made it work even
if you call it multiple times, by calling new update_listener.
* libnautilus-private/nautilus-icon-canvas-item.c:
(create_label_layout): Handle NULL font_name case just in case.
* libnautilus-private/nautilus-icon-container.c:
(nautilus_icon_container_set_zoom_level): Use
invalidate_label_sizes instead of setting update_icon_font.
(nautilus_icon_container_set_font_name): Do nothing if font name
doesn't change. If it does, use invalidate_label_sizes rather than
setting update_icon_font.
(nautilus_icon_container_set_font_size_table): Only redraw if font
size changes. Also, use invalidate_label_sizes rather than setting
update_icon_font.
* libnautilus-private/nautilus-directory.c:
(add_preferences_callbacks):
* libnautilus-private/nautilus-icon-factory.c: (get_icon_factory):
Initialize global preferences as needed.
* src/file-manager/fm-icon-view.c: (fm_icon_view_finalize):
* src/file-manager/fm-search-list-view.c: (real_destroy):
* src/nautilus-application.c: (nautilus_application_destroy),
(nautilus_application_create_window),
(nautilus_application_class_init):
* src/nautilus-main.c: (main):
* src/nautilus-view-frame.c: (create_corba_objects): Fix property
bag leak.
Diffstat (limited to 'libnautilus-private/nautilus-icon-container.c')
-rw-r--r-- | libnautilus-private/nautilus-icon-container.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index 806a1faab..ffd0fe5b3 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -3710,11 +3710,11 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, /* Get the icons. */ g_signal_emit (container, - signals[GET_ICON_IMAGES], 0, - icon->data, - (icon == details->drop_target) ? "accept" : "", - &emblem_scalable_icons, - &scalable_icon); + signals[GET_ICON_IMAGES], 0, + icon->data, + (icon == details->drop_target) ? "accept" : "", + &emblem_scalable_icons, + &scalable_icon); /* compute the maximum size based on the scale factor */ min_image_size = MINIMUM_IMAGE_SIZE * GNOME_CANVAS (container)->pixels_per_unit; @@ -3733,8 +3733,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, nautilus_scalable_icon_unref (scalable_icon); - /* in the rare case an image is too small, scale it up */ - + /* in the rare case an image is too small, scale it up */ width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); if (width < min_image_size || height < min_image_size) { @@ -3801,10 +3800,6 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, nautilus_icon_canvas_item_set_attach_points (icon->item, &attach_points); nautilus_icon_canvas_item_set_emblems (icon->item, emblem_pixbufs); - if (container->details->update_icon_font == TRUE) { - nautilus_icon_canvas_item_invalidate_label_size (icon->item); - } - /* Let the pixbufs go. */ g_object_unref (pixbuf); eel_gdk_pixbuf_list_free (emblem_pixbufs); @@ -4028,9 +4023,7 @@ nautilus_icon_container_set_zoom_level (NautilusIconContainer *container, int ne / NAUTILUS_ICON_SIZE_STANDARD; gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (container), pixels_per_unit); - /* We need to update the icon font too */ - container->details->update_icon_font = TRUE; - + invalidate_label_sizes (container); nautilus_icon_container_request_update_all (container); } @@ -4044,16 +4037,16 @@ nautilus_icon_container_set_zoom_level (NautilusIconContainer *container, int ne void nautilus_icon_container_request_update_all (NautilusIconContainer *container) { - GList *p; + GList *node; + NautilusIcon *icon; g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); - for (p = container->details->icons; p != NULL; p = p->next) { - nautilus_icon_container_update_icon (container, p->data); + for (node = container->details->icons; node != NULL; node = node->next) { + icon = node->data; + nautilus_icon_container_update_icon (container, icon); } - container->details->update_icon_font = FALSE; - redo_layout (container); } @@ -5081,39 +5074,45 @@ nautilus_icon_container_theme_changed (gpointer user_data) } void -nautilus_icon_container_set_font_name (NautilusIconContainer *container, - const char *font_name) +nautilus_icon_container_set_font_name (NautilusIconContainer *container, + const char *font_name) { g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); - g_free (container->details->font_name); - - g_print ("new font name is: %s\n", font_name); - - if (font_name != NULL) { - container->details->font_name = g_strdup (font_name); - } - else { - container->details->font_name = NULL; + if (eel_strcmp (container->details->font_name, font_name) == 0) { + return; } - container->details->update_icon_font = TRUE; + g_free (container->details->font_name); + container->details->font_name = g_strdup (font_name); + + invalidate_label_sizes (container); + nautilus_icon_container_request_update_all (container); } void nautilus_icon_container_set_font_size_table (NautilusIconContainer *container, const int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1]) { + int old_font_size; int i; g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); g_return_if_fail (font_size_table != NULL); + old_font_size = container->details->font_size_table[container->details->zoom_level]; + for (i = 0; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) { - container->details->font_size_table[i] = font_size_table[i]; + if (container->details->font_size_table[i] != font_size_table[i]) { + container->details->font_size_table[i] = font_size_table[i]; + changed = TRUE; + } } - container->details->update_icon_font = TRUE; + if (old_font_size != container->details->font_size_table[container->details->zoom_level]) { + invalidate_label_sizes (container); + nautilus_icon_container_request_update_all (container); + } } #if ! defined (NAUTILUS_OMIT_SELF_CHECK) |