diff options
author | Darin Adler <darin@src.gnome.org> | 2001-04-03 00:47:20 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-04-03 00:47:20 +0000 |
commit | 58b097eca0e8a3109ef15af3f9c186f13d546240 (patch) | |
tree | f78be7efe7ce6bbadec1ad99f514dd046b4f0829 /components/image-viewer/nautilus-image-view.c | |
parent | 59362affbb81e118d56c46707f7474c9df8ca0f0 (diff) | |
download | nautilus-58b097eca0e8a3109ef15af3f9c186f13d546240.tar.gz |
Make file operations progress dialog always stay up for at least 1
second total so it doesn't just appear and disappear.
Preparing for a fix to the nautilus-adapter process leaking when
Nautilus is terminated by Ctrl-C, I cleaned up some of the code
inside the adapter.
Improved the warning you get when neither /etc/mnttab nor
/proc/mounts can be opened.
Fix bug 6888 (when I view a large image, it appears first at 100%,
then zoomed to fit).
Re-added part of the code to make components go away when the main
program that is hosting them goes away. The X-window-based
solution is not working as well as I had hoped, so I'm re-adding
the 20-second-timeout-based solution.
* components/adapter/nautilus-adapter-embed-strategy.c:
(nautilus_adapter_embed_strategy_initialize_class),
(nautilus_adapter_embed_strategy_get),
(nautilus_adapter_embed_strategy_emit_open_location): Change the
strategy new functions to use more-normal reference rules. The
caller no longer expects them to "use up" a reference.
* components/adapter/nautilus-adapter-control-embed-strategy.c:
(nautilus_adapter_control_embed_strategy_destroy),
(nautilus_adapter_control_embed_strategy_new): Don't keep a
reference to the BonoboControl around after creating the frame.
* components/adapter/nautilus-adapter-embeddable-embed-strategy.c:
(nautilus_adapter_embeddable_embed_strategy_destroy),
(nautilus_adapter_embeddable_embed_strategy_new): Don't keep a
reference to the BonoboEmeddable around after creating the frame.
* components/image-viewer/nautilus-image-view.c: (redraw_control),
(scrolled_window_size_allocate_callback),
(control_factory_common), (init_bonobo_image_generic_factory):
Some name changes, and a fix so that we don't show the image first
at 100%, and then shrink to fit. The downside is that this might
be too hard-coded to the current behavior of Nautilus, but it's
better than flashing every time you open an image.
* components/services/trilobite/utils/.cvsignore: Ignore some
files in this new directory.
* libnautilus-extensions/nautilus-file-operations-progress.h:
* libnautilus-extensions/nautilus-file-operations-progress.c:
(nautilus_file_operations_progress_update), (close_callback),
(nautilus_file_operations_progress_destroy), (map_callback),
(delete_event_callback),
(nautilus_file_operations_progress_initialize),
(nautilus_file_operations_progress_initialize_class),
(nautilus_file_operations_progress_new),
(nautilus_file_operations_progress_set_total),
(nautilus_file_operations_progress_set_operation_string),
(nautilus_file_operations_progress_new_file),
(nautilus_file_operations_progress_clear),
(nautilus_file_operations_progress_update_sizes),
(delayed_close_callback), (nautilus_file_operations_progress_done):
Did a lot of code cleanups throughout the file, and added a new
call nautilus_file_operations_progress_done. Use this instead of
gtk_object_destroy so that the window can linger long enough for
the user to see it, if a copy was really fast.
* libnautilus-extensions/nautilus-file-operations.c:
(transfer_info_destroy), (parent_for_error_dialog),
(create_transfer_dialog), (handle_transfer_ok),
(handle_transfer_vfs_error): Change to use the new
nautilus_file_operations_progress_done call instead of
gtk_object_destroy when done with the progress dialog.
* libnautilus-extensions/nautilus-icon-container.c:
(nautilus_icon_container_update_scroll_region): Fix indentation.
* libnautilus-extensions/nautilus-volume-monitor.c:
(get_current_mount_list): Replace cryptic g_return_if_fail message
with better-worded g_warning.
* libnautilus/nautilus-view.c: (set_frame_callback),
(widget_destroyed_callback),
(nautilus_view_construct_from_bonobo_control): Re-added code to
monitor the lifetime of the frame and self-destruct when the frame
goes away. The X-window-based solution wasn't working 100%, and
this solution does.
* src/nautilus-sidebar.c: (toggle_sidebar_panel),
(sidebar_for_each_sidebar_panel): Change object data key to use a
prefix that includes the word "nautilus". Tweak code that builds
the menu so that it always includes any panel that's displayed,
even if the user level says it shouldn't be there.
Diffstat (limited to 'components/image-viewer/nautilus-image-view.c')
-rw-r--r-- | components/image-viewer/nautilus-image-view.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/components/image-viewer/nautilus-image-view.c b/components/image-viewer/nautilus-image-view.c index e102e73c4..d3352d603 100644 --- a/components/image-viewer/nautilus-image-view.c +++ b/components/image-viewer/nautilus-image-view.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + /* * Generic image loading embeddable using gdk-pixbuf. * @@ -57,8 +59,8 @@ typedef struct { GtkWidget *scrolled_window; GdkPixbuf *scaled; gboolean size_allocated; - gboolean initial_flag; - gboolean resize_flag; + gboolean got_initial_size; + gboolean got_penultimate_allocation; GdkPixbuf *zoomed; float zoom_level; @@ -210,7 +212,7 @@ redraw_control (bonobo_object_data_t *bod, GdkRectangle *rect) * so we don't screw up the size allocation process by drawing * an unscaled image too early. */ - if (bod->size_allocated) { + if (bod->got_initial_size) { render_pixbuf (buf, bod->drawing_area, rect); } } @@ -580,7 +582,6 @@ control_size_allocate_callback (GtkWidget *drawing_area, GtkAllocation *allocati control_update (bod); } - /* * This callback will be invoked when the container assigns us a size. */ @@ -615,23 +616,28 @@ image_fits_in_container (bonobo_object_data_t *bod) */ static void scrolled_window_size_allocate_callback (GtkWidget *drawing_area, - GtkAllocation *allocation, - bonobo_object_data_t *bod) + GtkAllocation *allocation, + bonobo_object_data_t *bod) { - /* implement initial shrink-to-fit if necessary. It's hard to tell when resizing - * is complete, inspiring this hackish solution determining when; it should - * be replaced with a cleaner approach when the framework is improved. + /* Implement initial shrink-to-fit if necessary. It's hard to + * tell when resizing is complete, inspiring this hackish + * solution determining when; it should be replaced with a + * cleaner approach when the framework is improved. */ - if (bod->resize_flag && bod->initial_flag && allocation->width > 1 && allocation->height > 1) - { - bod->initial_flag = FALSE; + if (bod->got_penultimate_allocation + && !bod->got_initial_size + && allocation->width > 1 + && allocation->height > 1) { + bod->got_initial_size = TRUE; if (!image_fits_in_container (bod)) { zoomable_zoom_to_fit_callback (bod->zoomable, bod); } - } - else if (!bod->resize_flag && allocation->width == 1 && allocation->height == 1) { - bod->resize_flag = TRUE; + gtk_widget_queue_draw (bod->drawing_area); + } else if (!bod->got_penultimate_allocation + && allocation->width == 1 + && allocation->height == 1) { + bod->got_penultimate_allocation = TRUE; } } @@ -652,17 +658,10 @@ control_factory_common (GtkWidget *scrolled_window) bonobo_object_data_t *bod; bod = g_new0 (bonobo_object_data_t, 1); - bod->scaled = NULL; - bod->zoomed = NULL; bod->zoom_level = 1.0; bod->drawing_area = gtk_drawing_area_new (); - bod->size_allocated = FALSE; bod->scrolled_window = scrolled_window; - /* set flags that control initial shrink-to-fit */ - bod->initial_flag = TRUE; - bod->resize_flag = FALSE; - gtk_signal_connect (GTK_OBJECT (bod->drawing_area), "expose_event", GTK_SIGNAL_FUNC (drawing_area_exposed), bod); @@ -671,8 +670,10 @@ control_factory_common (GtkWidget *scrolled_window) bod->root = scrolled_window; gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (bod->root), bod->drawing_area); - } else + } else { bod->root = bod->drawing_area; + bod->got_initial_size = TRUE; + } gtk_widget_show_all (bod->root); bod->control = bonobo_control_new (bod->root); @@ -802,7 +803,8 @@ init_bonobo_image_generic_factory (void) { char *registration_id; - registration_id = oaf_make_registration_id ("OAFIID:nautilus_image_view_factory:61ea9ab1-e4b4-4da8-8f54-61cf6f33c4f6", g_getenv ("DISPLAY")); + registration_id = oaf_make_registration_id ("OAFIID:nautilus_image_view_factory:61ea9ab1-e4b4-4da8-8f54-61cf6f33c4f6", + g_getenv ("DISPLAY")); image_factory = bonobo_generic_factory_new_multi (registration_id, |