diff options
29 files changed, 494 insertions, 504 deletions
@@ -1,11 +1,100 @@ +2000-06-26 Darin Adler <darin@eazel.com> + + * components/hardware/nautilus-hardware-view.c: + (nautilus_hardware_view_destroy): + * components/loser/content/nautilus-content-loser.c: + (nautilus_content_loser_destroy): + * components/loser/sidebar/nautilus-sidebar-loser.c: + (nautilus_sidebar_loser_destroy): + * components/mozilla/nautilus-mozilla-content-view.c: + (nautilus_mozilla_content_view_destroy): + * components/music/nautilus-music-view.c: + (nautilus_music_view_destroy): + * components/rpmview/nautilus-rpm-view.c: + (nautilus_rpm_view_destroy): + * components/sample/nautilus-sample-content-view.c: + (nautilus_sample_content_view_destroy): + * components/services/time/nautilus-view/trilobite-eazel-time-view.c: + (trilobite_eazel_time_view_destroy): + * components/tree/nautilus-tree-view.c: + (nautilus_tree_view_destroy): + Removed a bunch of incorrect calls to bonobo_object_unref. + An error in the sample can be an insidious thing. + + * components/tree/main.c: (tree_object_destroyed), + (tree_make_object), (main): Removed some stray debugging stuff. + + * libnautilus-extensions/Makefile.am: Got rid of the grid + * libnautilus-extensions/nautilus-icon-private.h: Got rid of the + grid. + * libnautilus-extensions/nautilus-icon-container.c: + (keyboard_icon_reveal_timeout_callback): Took out unneeded use of + thread locking macros. Maybe someday I'll regret this, but we can + add them back then. + (get_all_icon_bounds): Added shared function. + (update_scroll_region): Renamed set_scroll_region and made it use + the shared function. Also got rid of grid code. + (resort): Got rid of grid code. + (lay_down_icons): Got rid of grid code. + (relayout): Made it lay down new icons before doing any layout + work. Also made sure it doesn't do the resort while stretching. + (reload_icon_positions): Got rid of grid code. + (rubberband_select): Got rid of grid code. This was the one place + that it might have made things a little faster but probably not + due to the complexity of what it was doing. + (rubberband_timeout_callback): Took out unneeded use of thread + locking macros. Maybe someday I'll regret this, but we can add + them back then. + (destroy): Got rid of grid code. + (world_width_changed): Got rid of grid code. + (nautilus_icon_container_initialize): Got rid of grid code and + an extra idle cycle that wasn't needed. + (nautilus_icon_container_clear): Got rid of grid code and added + code to update the scroll region on clear. + (icon_destroy): Got rid of grid code. + (assign_icon_position), (finish_adding_icon), + (finish_adding_new_icons), (finish_adding_new_icons_callback), + (nautilus_icon_container_add): Replaced old idle code with + something specific to adding new icons. This does the proper + layout for manual as well as automatic layout cases. + + * libnautilus-extensions/nautilus-background.h: + * libnautilus-extensions/nautilus-background.c: + (nautilus_background_initialize_class): Made two signals instead + of one. One for when the background's settings change and another + for when the appearance changes. + (nautilus_background_set_color): Emit both signals. + (load_image_callback): Emit only the appearance change signal. + (nautilus_background_set_tile_image_uri): Emit both signals. + (nautilus_get_widget_background): Connect to the + appearance_changed signal. + * libnautilus-extensions/nautilus-directory-background.c: + (nautilus_connect_background_to_directory_metadata): + Connect to the settings_changed signal. + * src/file-manager/fm-directory-view.c: + (fm_directory_view_real_merge_menus): Connect to the + settings_changed signal. + * src/nautilus-sidebar.c: (nautilus_sidebar_update_info): Connect + to the appearance_changed signal. + * components/music/nautilus-music-view.c: + (nautilus_music_view_set_up_background): Connect to the + settings_changed signal. + + * HACKING: Gratuitious reformatting. + * RENAMING: Added notes about how we do renaming, at the request + of one of the hackers. + + * nautilus-clean.sh: Added nautilus-tree-view to the things that + are killed, and made gratuitous changes to the script. + Mon Jun 26 15:50:57 2000 George Lebl <jirka@5z.com> * components/hardware/Makefile.am, components/help/Makefile.am, components/history/Makefile.am, components/html/Makefile.am, components/music/Makefile.am, components/notes/Makefile.am, components/rpmview/Makefile.am, src/file-manager/Makefile.am: - Add $(VFS_CFLAGS) to the includes as it is neccessary for - gnome-vfs + Add $(VFS_CFLAGS) to the includes as it is necessary for + gnome-vfs 2000-06-26 Andy Hertzfeld <andy@eazel.com> @@ -39,31 +39,31 @@ Helix Gnome ) also modern version of RedHat come with a new popt, Nautilus currently requires the following modules from GNOME CVS (built in the given order): - module branch configure options Distro - ------ ------ ----------------- ------- - popt: <need 1.5, but not from GNOME CVS, see below>RH6.2 - glib: glib-1-2 H1.2 - gtk+: gtk-1-2 H1.2 - imlib: HEAD H1.2 - gnome-xml: LIB_XML_1_X H1.2 - ORBit: orbit-stable-0-5 - gnome-libs: gnome-libs-1-0 --enable-prefer-db1 H1.2 - gnome-http: HEAD - oaf: HEAD - gconf: HEAD - gdk-pixbuf: HEAD --enable-canvas-pixbuf - gnome-print: HEAD - control-center control-center-1-0 - gnome-vfs: HEAD --enable-oaf=yes - bonobo: HEAD --enable-oaf=yes - gtkhtml: HEAD - eog: HEAD --enable-oaf=yes - xpdf: HEAD - medusa: HEAD - nautilus: HEAD + module branch configure options dist. + ------ ------ ----------------- ----- + popt: <1.5, but not from GNOME CVS, see below> RH6.2 + glib: glib-1-2 HC1.2 + gtk+: gtk-1-2 HC1.2 + imlib: HEAD HC1.2 + gnome-xml: LIB_XML_1_X HC1.2 + ORBit: orbit-stable-0-5 + gnome-libs: gnome-libs-1-0 --enable-prefer-db1 HC1.2 + gnome-http: HEAD + oaf: HEAD + gconf: HEAD + gdk-pixbuf: HEAD --enable-canvas-pixbuf + gnome-print: HEAD + control-center control-center-1-0 + gnome-vfs: HEAD --enable-oaf=yes + bonobo: HEAD --enable-oaf=yes + gtkhtml: HEAD + eog: HEAD --enable-oaf=yes + xpdf: HEAD + medusa: HEAD + nautilus: HEAD RH6.2 == Version from Red Hat 6.2 OK -H1.2 == Version from Helix Gnome 1.2 OK +HC1.2 == Version from Helix Code Gnome 1.2 OK ============================= 3: Distribution Specfic Notes @@ -112,7 +112,6 @@ If you need to get a copy of popt from source: 4: m4 macro and aclocal issues ============================== - m4 macros have issues. Trying to install multiple versions of them on you system can be very tricky. While building these libraries you will place following m4 macros into "your prefix"/share/aclocal directory. Note you will generally get errors with -I @@ -160,7 +159,6 @@ in any module changed. * All patches should go through nautilus-list@lists.eazel.com. - =============================== 6: Using the leak checker =============================== @@ -172,4 +170,3 @@ bourne-compatible shell, like bash, you can run nautilus this way to run with leak checking: LD_PRELOAD=/gnome/libs/libleakcheck.so /gnome/bin/nautilus - @@ -2,6 +2,16 @@ We put plans for renaming in here so we can think about them for a while. Note that when we rename a class, it usually involves renaming some functions and files too. +When we rename files in the repository, we do it by this process: + + 1) copy the file in the repository by logging in and using cp (to retain history) + 2) check out to get the new file + 3) cvs rm to remove the old file on commit + 4) fix all build problems + 5) commit + +This retains the history in both the old and new locations. + --------------- directory names --------------- diff --git a/components/hardware/nautilus-hardware-view.c b/components/hardware/nautilus-hardware-view.c index a66f40182..4875b6137 100644 --- a/components/hardware/nautilus-hardware-view.c +++ b/components/hardware/nautilus-hardware-view.c @@ -134,8 +134,6 @@ nautilus_hardware_view_destroy (GtkObject *object) { NautilusHardwareView *hardware_view = NAUTILUS_HARDWARE_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (hardware_view->details->nautilus_view)); - g_free (hardware_view->details->uri); g_free (hardware_view->details); diff --git a/components/loser/content/nautilus-content-loser.c b/components/loser/content/nautilus-content-loser.c index 88b9b3230..9b6968205 100644 --- a/components/loser/content/nautilus-content-loser.c +++ b/components/loser/content/nautilus-content-loser.c @@ -101,8 +101,6 @@ nautilus_content_loser_destroy (GtkObject *object) view = NAUTILUS_CONTENT_LOSER (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); - g_free (view->details->uri); g_free (view->details); diff --git a/components/loser/sidebar/nautilus-sidebar-loser.c b/components/loser/sidebar/nautilus-sidebar-loser.c index 0372e959c..e50054789 100644 --- a/components/loser/sidebar/nautilus-sidebar-loser.c +++ b/components/loser/sidebar/nautilus-sidebar-loser.c @@ -104,8 +104,6 @@ nautilus_sidebar_loser_destroy (GtkObject *object) view = NAUTILUS_SIDEBAR_LOSER (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); - g_free (view->details->uri); g_free (view->details); diff --git a/components/mozilla/nautilus-mozilla-content-view.c b/components/mozilla/nautilus-mozilla-content-view.c index d4a7a5e22..d000600ff 100644 --- a/components/mozilla/nautilus-mozilla-content-view.c +++ b/components/mozilla/nautilus-mozilla-content-view.c @@ -166,20 +166,17 @@ nautilus_mozilla_content_view_destroy (GtkObject *object) view = NAUTILUS_MOZILLA_CONTENT_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); + g_free (view->details->uri); - if (view->details->uri) { - g_free (view->details->uri); - } - - if (view->details->busy_cursor) { + if (view->details->busy_cursor != NULL) { gdk_cursor_destroy (view->details->busy_cursor); } g_free (view->details); - if (GTK_OBJECT_CLASS (parent_class)->destroy) + if (GTK_OBJECT_CLASS (parent_class)->destroy) { (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + } } /** diff --git a/components/music/nautilus-music-view.c b/components/music/nautilus-music-view.c index 9f7bb2a7d..4301218ca 100644 --- a/components/music/nautilus-music-view.c +++ b/components/music/nautilus-music-view.c @@ -291,8 +291,6 @@ nautilus_music_view_destroy (GtkObject *object) { NautilusMusicView *music_view = NAUTILUS_MUSIC_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (music_view->details->nautilus_view)); - g_free (music_view->details->uri); g_free (music_view->details); @@ -711,12 +709,13 @@ nautilus_music_view_set_up_background (NautilusMusicView *music_view, const char directory = nautilus_directory_get (music_view->details->uri); + /* FIXME: Use nautilus-directory-background calls. */ /* Connect the background changed signal to code that writes the color. */ background = nautilus_get_widget_background (GTK_WIDGET (music_view)); if (music_view->details->background_connection == 0) { music_view->details->background_connection = gtk_signal_connect_object (GTK_OBJECT (background), - "changed", + "settings_changed", nautilus_music_view_background_changed, GTK_OBJECT (music_view)); } diff --git a/components/rpmview/nautilus-rpm-view.c b/components/rpmview/nautilus-rpm-view.c index 7192ab349..f3baa087a 100644 --- a/components/rpmview/nautilus-rpm-view.c +++ b/components/rpmview/nautilus-rpm-view.c @@ -365,8 +365,6 @@ nautilus_rpm_view_destroy (GtkObject *object) { NautilusRPMView *rpm_view = NAUTILUS_RPM_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (rpm_view->details->nautilus_view)); - g_free (rpm_view->details->current_uri); g_free (rpm_view->details); diff --git a/components/sample/nautilus-sample-content-view.c b/components/sample/nautilus-sample-content-view.c index 288e5ead8..8cbe52754 100644 --- a/components/sample/nautilus-sample-content-view.c +++ b/components/sample/nautilus-sample-content-view.c @@ -100,8 +100,6 @@ nautilus_sample_content_view_destroy (GtkObject *object) view = NAUTILUS_SAMPLE_CONTENT_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); - g_free (view->details->uri); g_free (view->details); diff --git a/components/services/time/nautilus-view/trilobite-eazel-time-view.c b/components/services/time/nautilus-view/trilobite-eazel-time-view.c index a6e9c3fe9..caedf237d 100644 --- a/components/services/time/nautilus-view/trilobite-eazel-time-view.c +++ b/components/services/time/nautilus-view/trilobite-eazel-time-view.c @@ -365,8 +365,6 @@ trilobite_eazel_time_view_destroy (GtkObject *object) view = TRILOBITE_EAZEL_TIME_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); - g_free (view->details->server_url); g_free (view->details->max_time_diff); diff --git a/components/tree/main.c b/components/tree/main.c index 6dc76d97a..b6c24a471 100644 --- a/components/tree/main.c +++ b/components/tree/main.c @@ -1,4 +1,5 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + /* * Copyright (C) 2000 Eazel, Inc * @@ -34,7 +35,7 @@ static int object_count = 0; static void -tree_object_destroyed(GtkObject *obj) +tree_object_destroyed (GtkObject *object) { object_count--; if (object_count <= 0) { @@ -50,47 +51,37 @@ tree_make_object (BonoboGenericFactory *factory, NautilusTreeView *view; NautilusView *nautilus_view; - puts ("Checking IID!"); - if (strcmp (iid, "OAFIID:nautilus_tree_view:2d826a6e-1669-4a45-94b8-23d65d22802d")) { return NULL; } - puts ("Trying to make object!"); - view = NAUTILUS_TREE_VIEW (gtk_object_new (NAUTILUS_TYPE_TREE_VIEW, NULL)); object_count++; nautilus_view = nautilus_tree_view_get_nautilus_view (view); - gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", tree_object_destroyed, NULL); + gtk_signal_connect (GTK_OBJECT (view), "destroy", tree_object_destroyed, NULL); return BONOBO_OBJECT (nautilus_view); } -int main(int argc, char *argv[]) +int +main (int argc, char *argv[]) { - BonoboGenericFactory *factory; CORBA_ORB orb; - CORBA_Environment ev; - - CORBA_exception_init(&ev); - - puts ("XXX: In tree component."); - - gnome_init_with_popt_table("nautilus-tree-view", VERSION, - argc, argv, - oaf_popt_options, 0, NULL); + BonoboGenericFactory *factory; + gnome_init_with_popt_table ("nautilus-tree-view", VERSION, + argc, argv, + oaf_popt_options, 0, NULL); orb = oaf_init (argc, argv); - bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); - factory = bonobo_generic_factory_new_multi ("OAFIID:nautilus_tree_view_factory:79f93d13-d404-4ef6-8de2-b8a0045a96ab", tree_make_object, NULL); + factory = bonobo_generic_factory_new_multi + ("OAFIID:nautilus_tree_view_factory:79f93d13-d404-4ef6-8de2-b8a0045a96ab", + tree_make_object, NULL); - puts ("XXX: About to do main tree loop."); - do { bonobo_main (); } while (object_count > 0); diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c index 9fa760029..c3dc9d998 100644 --- a/components/tree/nautilus-tree-view.c +++ b/components/tree/nautilus-tree-view.c @@ -48,13 +48,12 @@ struct NautilusTreeViewDetails { static void nautilus_tree_view_initialize_class (NautilusTreeViewClass *klass); static void nautilus_tree_view_initialize (NautilusTreeView *view); -static void nautilus_tree_view_destroy (GtkObject *object); -static void tree_load_location_callback (NautilusView *nautilus_view, - const char *location, - NautilusTreeView *view); -static void nautilus_tree_view_load_uri (NautilusTreeView *view, - const char *uri); - +static void nautilus_tree_view_destroy (GtkObject *object); +static void tree_load_location_callback (NautilusView *nautilus_view, + const char *location, + NautilusTreeView *view); +static void nautilus_tree_view_load_uri (NautilusTreeView *view, + const char *uri); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusTreeView, nautilus_tree_view, GTK_TYPE_CTREE) @@ -97,7 +96,6 @@ nautilus_tree_view_initialize (NautilusTreeView *view) GTK_SIGNAL_FUNC (tree_load_location_callback), view); - gtk_widget_show (GTK_WIDGET (view)); } @@ -108,15 +106,11 @@ nautilus_tree_view_destroy (GtkObject *object) view = NAUTILUS_TREE_VIEW (object); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); - g_free (view->details); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } - - /** * nautilus_tree_view_get_nautilus_view: * diff --git a/libnautilus-extensions/Makefile.am b/libnautilus-extensions/Makefile.am index 5df0ebf19..142b52262 100644 --- a/libnautilus-extensions/Makefile.am +++ b/libnautilus-extensions/Makefile.am @@ -61,7 +61,6 @@ libnautilus_extensions_la_SOURCES = \ nautilus-icon-container.c \ nautilus-icon-dnd.c \ nautilus-icon-factory.c \ - nautilus-icon-grid.c \ nautilus-icon-text-item.c \ nautilus-keep-last-vertical-box.c \ nautilus-lib-self-check-functions.c \ @@ -136,7 +135,6 @@ noinst_HEADERS = \ nautilus-icon-container.h \ nautilus-icon-dnd.h \ nautilus-icon-factory.h \ - nautilus-icon-grid.h \ nautilus-icon-private.h \ nautilus-icon-text-item.h \ nautilus-keep-last-vertical-box.h \ diff --git a/libnautilus-extensions/nautilus-background.c b/libnautilus-extensions/nautilus-background.c index 76aa1da7d..0bb9aee6b 100644 --- a/libnautilus-extensions/nautilus-background.c +++ b/libnautilus-extensions/nautilus-background.c @@ -59,7 +59,8 @@ static void nautilus_background_draw_flat_box (GtkStyle *style, NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackground, nautilus_background, GTK_TYPE_OBJECT) enum { - CHANGED, + APPEARANCE_CHANGED, + SETTINGS_CHANGED, LAST_SIGNAL }; @@ -67,8 +68,7 @@ enum { static guint signals[LAST_SIGNAL]; -struct NautilusBackgroundDetails -{ +struct NautilusBackgroundDetails { char *color; char *tile_image_uri; GdkPixmap *tile_pixmap; @@ -83,11 +83,21 @@ nautilus_background_initialize_class (gpointer klass) object_class = GTK_OBJECT_CLASS (klass); - signals[CHANGED] = - gtk_signal_new ("changed", + signals[APPEARANCE_CHANGED] = + gtk_signal_new ("appearance_changed", + GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, + object_class->type, + GTK_SIGNAL_OFFSET (NautilusBackgroundClass, + appearance_changed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, + 0); + signals[SETTINGS_CHANGED] = + gtk_signal_new ("settings_changed", GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, object_class->type, - GTK_SIGNAL_OFFSET (NautilusBackgroundClass, changed), + GTK_SIGNAL_OFFSET (NautilusBackgroundClass, + settings_changed), gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); @@ -311,7 +321,10 @@ nautilus_background_set_color (NautilusBackground *background, g_free (background->details->color); background->details->color = g_strdup (color); - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[SETTINGS_CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static void @@ -336,7 +349,8 @@ load_image_callback (GnomeVFSResult error, gdk_pixbuf_ref (pixbuf); background->details->tile_image = pixbuf; - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static void @@ -380,7 +394,10 @@ nautilus_background_set_tile_image_uri (NautilusBackground *background, background->details->tile_image_uri = g_strdup (image_uri); start_loading_tile_image (background); - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[SETTINGS_CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static GtkStyleClass * @@ -612,7 +629,8 @@ nautilus_get_widget_background (GtkWidget *widget) gtk_object_sink (GTK_OBJECT (background)); /* Arrange to get the signal whenever the background changes. */ - gtk_signal_connect_object_while_alive (GTK_OBJECT (background), "changed", + gtk_signal_connect_object_while_alive (GTK_OBJECT (background), + "appearance_changed", nautilus_widget_background_changed, GTK_OBJECT (widget)); nautilus_widget_background_changed (widget, background); diff --git a/libnautilus-extensions/nautilus-background.h b/libnautilus-extensions/nautilus-background.h index 5dccdae2b..d07aa3764 100644 --- a/libnautilus-extensions/nautilus-background.h +++ b/libnautilus-extensions/nautilus-background.h @@ -113,11 +113,16 @@ struct NautilusBackgroundClass { GtkObjectClass parent_class; - /* This signal is emitted when the background image is - finished loading. This allows a window to draw with a - color background if the image takes a lot time to load. - */ - void (* changed) (NautilusBackground *); + /* This signal is emitted whenever the background settings are + * changed. + */ + void (* settings_changed) (NautilusBackground *); + + /* This signal is emitted whenever the appearance of the + * background has changed, like when the background settings are + * altered or when an image is loaded. + */ + void (* appearance_changed) (NautilusBackground *); }; #endif /* NAUTILUS_BACKGROUND_H */ diff --git a/libnautilus-extensions/nautilus-directory-background.c b/libnautilus-extensions/nautilus-directory-background.c index c097203d8..45dec7014 100644 --- a/libnautilus-extensions/nautilus-directory-background.c +++ b/libnautilus-extensions/nautilus-directory-background.c @@ -164,7 +164,7 @@ nautilus_connect_background_to_directory_metadata (GtkWidget *widget, /* Connect new signal handlers. */ if (directory != NULL) { gtk_signal_connect (GTK_OBJECT (background), - "changed", + "settings_changed", GTK_SIGNAL_FUNC (background_changed_callback), directory); gtk_signal_connect (GTK_OBJECT (background), diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c index 01871f939..3c24475b5 100644 --- a/libnautilus-extensions/nautilus-icon-container.c +++ b/libnautilus-extensions/nautilus-icon-container.c @@ -46,7 +46,6 @@ #include "nautilus-font-factory.h" #include "nautilus-lib-self-check-functions.h" -#include "nautilus-icon-grid.h" #include "nautilus-icon-private.h" /* Interval for updating the rubberband selection, in milliseconds. */ @@ -102,14 +101,12 @@ static void end_renaming_mode (NautilusIconConta gboolean commit); static void hide_rename_widget (NautilusIconContainer *container, NautilusIcon *icon); -static void anti_aliased_preferences_changed (gpointer user_data); +static void anti_aliased_preferences_changed (gpointer user_data); static void click_policy_changed_callback (gpointer user_data); - +static void finish_adding_new_icons (NautilusIconContainer *container); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconContainer, nautilus_icon_container, GNOME_TYPE_CANVAS) - - /* The NautilusIconContainer signals. */ enum { ACTIVATE, @@ -270,8 +267,6 @@ icon_get_bounding_box (NautilusIcon *icon, *y2_return = y2; } - - /* Utility functions for NautilusIconContainer. */ static void @@ -323,8 +318,6 @@ keyboard_icon_reveal_timeout_callback (gpointer data) NautilusIconContainer *container; NautilusIcon *icon; - GDK_THREADS_ENTER (); - container = NAUTILUS_ICON_CONTAINER (data); icon = container->details->keyboard_icon_to_reveal; @@ -342,8 +335,6 @@ keyboard_icon_reveal_timeout_callback (gpointer data) } container->details->keyboard_icon_reveal_timer_id = 0; - GDK_THREADS_LEAVE (); - return FALSE; } @@ -408,20 +399,27 @@ set_keyboard_focus (NautilusIconContainer *container, NULL); } - - -/* Idle operation handler. */ +static void +get_all_icon_bounds (NautilusIconContainer *container, + double *x1, double *y1, + double *x2, double *y2) +{ + /* FIXME: Do we have to do something about the rubberband + * here? Any other non-icon items? + */ + gnome_canvas_item_get_bounds + (GNOME_CANVAS (container)->root, + x1, y1, x2, y2); +} static void -set_scroll_region (NautilusIconContainer *container) +update_scroll_region (NautilusIconContainer *container) { double x1, y1, x2, y2; GtkAdjustment *hadj, *vadj; float step_increment; - gnome_canvas_item_get_bounds - (GNOME_CANVAS (container)->root, - &x1, &y1, &x2, &y2); + get_all_icon_bounds (container, &x1, &y1, &x2, &y2); nautilus_gnome_canvas_set_scroll_region_left_justify (GNOME_CANVAS (container), x1 - CONTAINER_PAD_LEFT, @@ -472,24 +470,11 @@ compare_icons (gconstpointer a, gconstpointer b) } static void -resort_and_clear (NautilusIconContainer *container) +resort (NautilusIconContainer *container) { sort_hack_container = container; container->details->icons = g_list_sort (container->details->icons, compare_icons); - - nautilus_icon_grid_clear (container->details->grid); -} - -static void -auto_position_icon (NautilusIconContainer *container, - NautilusIcon *icon) -{ - ArtPoint position; - - nautilus_icon_grid_get_position (container->details->grid, - icon, &position); - icon_set_position (icon, position.x, position.y); } /* Given an icon's bounds, compute the width of the space it should be @@ -611,24 +596,17 @@ lay_down_icons (NautilusIconContainer *container, if (line_start != NULL) { lay_down_one_line (container, line_start, NULL, &y); } - - /* Add all the icons back into the grid. */ - for (p = icons; p != NULL; p = p->next) { - icon = p->data; - - nautilus_icon_grid_add (container->details->grid, icon); - } } static void relayout (NautilusIconContainer *container) { + finish_adding_new_icons (container); + if (!container->details->auto_layout) { return; } - resort_and_clear (container); - /* An icon currently being stretched must be left in place. * That's "drag_icon". This doesn't come up for cases where * we are doing other kinds of drags, but if it did, the @@ -644,6 +622,7 @@ relayout (NautilusIconContainer *container) return; } + resort (container); lay_down_icons (container, container->details->icons, 0); } @@ -659,7 +638,7 @@ reload_icon_positions (NautilusIconContainer *container) g_assert (!container->details->auto_layout); - resort_and_clear (container); + resort (container); no_position_icons = NULL; @@ -676,8 +655,6 @@ reload_icon_positions (NautilusIconContainer *container) &have_stored_position); if (have_stored_position) { icon_set_position (icon, position.x, position.y); - nautilus_icon_grid_add (container->details->grid, icon); - nautilus_gnome_canvas_item_get_world_bounds (GNOME_CANVAS_ITEM (icon->item), &bounds); if (bounds.y1 > bottom) { @@ -695,39 +672,6 @@ reload_icon_positions (NautilusIconContainer *container) g_list_free (no_position_icons); } -static gboolean -idle_handler (gpointer data) -{ - NautilusIconContainer *container; - NautilusIconContainerDetails *details; - - GDK_THREADS_ENTER (); - - container = NAUTILUS_ICON_CONTAINER (data); - details = container->details; - - set_scroll_region (container); - relayout (container); - - details->idle_id = 0; - - GDK_THREADS_LEAVE (); - - return FALSE; -} - -static void -request_idle (NautilusIconContainer *container) -{ - if (container->details->idle_id != 0) { - return; - } - - container->details->idle_id = gtk_idle_add (idle_handler, container); -} - - - /* Container-level icon handling functions. */ static gboolean @@ -814,20 +758,13 @@ rubberband_select (NautilusIconContainer *container, const ArtDRect *previous_rect, const ArtDRect *current_rect) { - ArtDRect both_rects; - GList *icons, *p; - gboolean selection_changed; + GList *p; + gboolean selection_changed, is_in; NautilusIcon *icon; - gboolean is_in; selection_changed = FALSE; - /* As an optimization, ask the grid which icons intersect the rectangles. */ - art_drect_union (&both_rects, previous_rect, current_rect); - icons = nautilus_icon_grid_get_intersecting_icons - (container->details->grid, &both_rects); - - for (p = icons; p != NULL; p = p->next) { + for (p = container->details->icons; p != NULL; p = p->next) { icon = p->data; is_in = nautilus_icon_canvas_item_hit_test_rectangle @@ -840,8 +777,6 @@ rubberband_select (NautilusIconContainer *container, is_in ^ icon->was_selected_before_rubberband); } - g_list_free (icons); - if (selection_changed) { gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]); @@ -860,8 +795,6 @@ rubberband_timeout_callback (gpointer data) int x_scroll, y_scroll; ArtDRect selection_rect; - GDK_THREADS_ENTER (); - widget = GTK_WIDGET (data); container = NAUTILUS_ICON_CONTAINER (data); band_info = &container->details->rubberband_info; @@ -893,7 +826,6 @@ rubberband_timeout_callback (gpointer data) if (y_scroll == 0 && x_scroll == 0 && band_info->prev_x == x && band_info->prev_y == y) { - GDK_THREADS_LEAVE (); return TRUE; } @@ -938,8 +870,6 @@ rubberband_timeout_callback (gpointer data) band_info->prev_rect = selection_rect; - GDK_THREADS_LEAVE (); - return TRUE; } @@ -1033,8 +963,6 @@ stop_rubberbanding (NautilusIconContainer *container, band_info->selection_rectangle = NULL; } - - /* Keyboard navigation. */ typedef gboolean (* IsBetterIconFunction) (NautilusIconContainer *container, @@ -1697,7 +1625,6 @@ destroy (GtkObject *object) nautilus_icon_dnd_fini (container); nautilus_icon_container_clear (container); - nautilus_icon_grid_destroy (container->details->grid); unschedule_keyboard_icon_reveal (container); if (container->details->rubberband_info.timer_id != 0) { @@ -1730,8 +1657,6 @@ destroy (GtkObject *object) NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } - - /* GtkWidget methods. */ static void @@ -1745,19 +1670,8 @@ size_request (GtkWidget *widget, static void world_width_changed (NautilusIconContainer *container, int new_width) { - NautilusIconGrid *grid; - double world_width; - - grid = container->details->grid; - - gnome_canvas_c2w (GNOME_CANVAS (container), - new_width, 0, - &world_width, NULL); - - nautilus_icon_grid_set_visible_width (grid, world_width); - relayout (container); - set_scroll_region (container); + update_scroll_region (container); } static void @@ -2252,7 +2166,6 @@ key_press_event (GtkWidget *widget, return handled; } - /* Initialization. */ static void @@ -2491,8 +2404,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) details = g_new0 (NautilusIconContainerDetails, 1); - details->grid = nautilus_icon_grid_new (); - details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; /* FIXME: Fonts should be supplied by the caller and not @@ -2512,9 +2423,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) /* Set up DnD. */ nautilus_icon_dnd_init (container, stipple); - /* Request update. */ - request_idle (container); - /* Make sure that we find out if the theme changes. */ gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (), @@ -2548,7 +2456,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) container); } - /* NautilusIcon event handling. */ /* Conceptually, pressing button 1 together with CTRL or SHIFT toggles @@ -2686,8 +2593,7 @@ nautilus_icon_container_new (void) return new; } -/* clear all of the icons in the container */ - +/* Clear all of the icons in the container. */ void nautilus_icon_container_clear (NautilusIconContainer *container) { @@ -2698,7 +2604,7 @@ nautilus_icon_container_clear (NautilusIconContainer *container) details = container->details; - end_renaming_mode(container, TRUE); + end_renaming_mode (container, TRUE); clear_keyboard_focus (container); details->stretch_icon = NULL; @@ -2711,7 +2617,7 @@ nautilus_icon_container_clear (NautilusIconContainer *container) g_list_free (details->new_icons); details->new_icons = NULL; - nautilus_icon_grid_clear (details->grid); + update_scroll_region (container); } /* utility routine to remove a single icon from the container */ @@ -2739,8 +2645,6 @@ icon_destroy (NautilusIconContainer *container, details->drop_target = NULL; } - nautilus_icon_grid_remove (details->grid, icon); - icon_free (icon); if (was_selected) { @@ -2749,7 +2653,6 @@ icon_destroy (NautilusIconContainer *container, } } - /* activate any selected items in the container */ static void activate_selected_items (NautilusIconContainer *container) @@ -2761,29 +2664,12 @@ activate_selected_items (NautilusIconContainer *container) selection = nautilus_icon_container_get_selection (container); if (selection != NULL) { gtk_signal_emit (GTK_OBJECT (container), - signals[ACTIVATE], - selection); + signals[ACTIVATE], + selection); } - g_list_free (selection); } -static void -bounds_changed_callback (NautilusIconCanvasItem *item, - NautilusIconContainer *container) -{ - NautilusIcon *icon; - - g_assert (NAUTILUS_IS_ICON_CANVAS_ITEM (item)); - g_assert (NAUTILUS_IS_ICON_CONTAINER (container)); - - icon = item->user_data; - g_assert (icon != NULL); - - nautilus_icon_grid_remove (container->details->grid, icon); - nautilus_icon_grid_add (container->details->grid, icon); -} - void nautilus_icon_container_update_icon (NautilusIconContainer *container, NautilusIcon *icon) @@ -2875,6 +2761,97 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, g_free (additional_text); } +static gboolean +assign_icon_position (NautilusIconContainer *container, + NautilusIcon *icon) +{ + gboolean have_stored_position; + NautilusIconPosition position; + + /* Get the stored position. */ + have_stored_position = FALSE; + position.scale_x = 1.0; + position.scale_y = 1.0; + gtk_signal_emit (GTK_OBJECT (container), + signals[GET_STORED_ICON_POSITION], + icon->data, + &position, + &have_stored_position); + icon->scale_x = position.scale_x; + icon->scale_y = position.scale_y; + if (!container->details->auto_layout) { + if (have_stored_position) { + icon_set_position (icon, position.x, position.y); + } else { + return FALSE; + } + } + return TRUE; +} + +static void +finish_adding_icon (NautilusIconContainer *container, + NautilusIcon *icon) +{ + nautilus_icon_container_update_icon (container, icon); + gnome_canvas_item_show (GNOME_CANVAS_ITEM (icon->item)); + + gtk_signal_connect (GTK_OBJECT (icon->item), "event", + GTK_SIGNAL_FUNC (item_event_callback), container); +} + +static void +finish_adding_new_icons (NautilusIconContainer *container) +{ + GList *p, *new_icons, *no_position_icons; + NautilusIcon *icon; + double bottom; + + new_icons = container->details->new_icons; + if (new_icons == NULL) { + return; + } + container->details->new_icons = NULL; + + /* Position most icons (not unpositioned manual-layout icons). */ + new_icons = g_list_reverse (new_icons); + no_position_icons = NULL; + for (p = new_icons; p != NULL; p = p->next) { + icon = p->data; + if (!assign_icon_position (container, icon)) { + no_position_icons = g_list_prepend (no_position_icons, icon); + } + finish_adding_icon (container, icon); + } + g_list_free (new_icons); + + /* Position the unpositioned manual layout icons. */ + if (no_position_icons != NULL) { + g_assert (!container->details->auto_layout); + + no_position_icons = g_list_reverse (no_position_icons); + get_all_icon_bounds (container, NULL, NULL, NULL, &bottom); + lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM); + g_list_free (no_position_icons); + } + + /* Now the rest of the housekeeping. */ + relayout (container); + update_scroll_region (container); +} + +static gboolean +finish_adding_new_icons_callback (gpointer data) +{ + NautilusIconContainer *container; + + container = NAUTILUS_ICON_CONTAINER (data); + finish_adding_new_icons (container); + container->details->idle_id = 0; + + return FALSE; +} + /** * nautilus_icon_container_add: * @container: A NautilusIconContainer @@ -2890,8 +2867,6 @@ nautilus_icon_container_add (NautilusIconContainer *container, NautilusIconContainerDetails *details; GList *p; NautilusIcon *icon; - gboolean have_stored_position; - NautilusIconPosition position; g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE); g_return_val_if_fail (data != NULL, FALSE); @@ -2908,50 +2883,28 @@ nautilus_icon_container_add (NautilusIconContainer *container, } } - have_stored_position = FALSE; - position.scale_x = 1.0; - position.scale_y = 1.0; - gtk_signal_emit (GTK_OBJECT (container), - signals[GET_STORED_ICON_POSITION], - data, - &position, - &have_stored_position); - + /* Creat the new icon, including the canvas item. */ icon = g_new0 (NautilusIcon, 1); - - icon->scale_x = position.scale_x; - icon->scale_y = position.scale_y; - icon->data = data; - + icon->scale_x = 1.0; + icon->scale_y = 1.0; icon->item = NAUTILUS_ICON_CANVAS_ITEM (gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (container)->root), nautilus_icon_canvas_item_get_type (), NULL)); + gnome_canvas_item_hide (GNOME_CANVAS_ITEM (icon->item)); icon->item->user_data = icon; + /* Put it on both lists. */ details->icons = g_list_prepend (details->icons, icon); details->new_icons = g_list_prepend (details->new_icons, icon); - if (!details->auto_layout && have_stored_position) { - icon_set_position (icon, position.x, position.y); - } else { - auto_position_icon (container, icon); + /* Run an idle function to add the icons. */ + if (container->details->idle_id == 0) { + container->details->idle_id = gtk_idle_add + (finish_adding_new_icons_callback, container); } - nautilus_icon_container_update_icon (container, icon); - gnome_canvas_item_show (GNOME_CANVAS_ITEM (icon->item)); - - /* Must connect the bounds_changed signal after adding the icon to the - * grid, because it will try to remove/add the icon too. - */ - gtk_signal_connect (GTK_OBJECT (icon->item), "event", - GTK_SIGNAL_FUNC (item_event_callback), container); - gtk_signal_connect (GTK_OBJECT (icon->item), "bounds_changed", - GTK_SIGNAL_FUNC (bounds_changed_callback), container); - - request_idle (container); - return TRUE; } @@ -3553,7 +3506,6 @@ nautilus_icon_container_is_auto_layout (NautilusIconContainer *container) * * Returns true if container is in renaming mode **/ - gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container) { diff --git a/libnautilus-extensions/nautilus-icon-private.h b/libnautilus-extensions/nautilus-icon-private.h index 185184483..d5f1112a3 100644 --- a/libnautilus-extensions/nautilus-icon-private.h +++ b/libnautilus-extensions/nautilus-icon-private.h @@ -52,9 +52,6 @@ typedef struct { /* Whether this item was selected before rubberbanding. */ nautilus_boolean_bit was_selected_before_rubberband : 1; - - /* Grid space occupied by this icon. */ - ArtIRect grid_rectangle; } NautilusIcon; @@ -99,16 +96,11 @@ typedef struct { guint64 last_typeselect_time; } TypeSelectState; -typedef struct NautilusIconGrid NautilusIconGrid; - struct NautilusIconContainerDetails { /* List of icons. */ GList *icons; GList *new_icons; - /* The grid. */ - NautilusIconGrid *grid; - /* Current icon for keyboard navigation. */ NautilusIcon *keyboard_focus; diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am index 5df0ebf19..142b52262 100644 --- a/libnautilus-private/Makefile.am +++ b/libnautilus-private/Makefile.am @@ -61,7 +61,6 @@ libnautilus_extensions_la_SOURCES = \ nautilus-icon-container.c \ nautilus-icon-dnd.c \ nautilus-icon-factory.c \ - nautilus-icon-grid.c \ nautilus-icon-text-item.c \ nautilus-keep-last-vertical-box.c \ nautilus-lib-self-check-functions.c \ @@ -136,7 +135,6 @@ noinst_HEADERS = \ nautilus-icon-container.h \ nautilus-icon-dnd.h \ nautilus-icon-factory.h \ - nautilus-icon-grid.h \ nautilus-icon-private.h \ nautilus-icon-text-item.h \ nautilus-keep-last-vertical-box.h \ diff --git a/libnautilus-private/nautilus-background.c b/libnautilus-private/nautilus-background.c index 76aa1da7d..0bb9aee6b 100644 --- a/libnautilus-private/nautilus-background.c +++ b/libnautilus-private/nautilus-background.c @@ -59,7 +59,8 @@ static void nautilus_background_draw_flat_box (GtkStyle *style, NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackground, nautilus_background, GTK_TYPE_OBJECT) enum { - CHANGED, + APPEARANCE_CHANGED, + SETTINGS_CHANGED, LAST_SIGNAL }; @@ -67,8 +68,7 @@ enum { static guint signals[LAST_SIGNAL]; -struct NautilusBackgroundDetails -{ +struct NautilusBackgroundDetails { char *color; char *tile_image_uri; GdkPixmap *tile_pixmap; @@ -83,11 +83,21 @@ nautilus_background_initialize_class (gpointer klass) object_class = GTK_OBJECT_CLASS (klass); - signals[CHANGED] = - gtk_signal_new ("changed", + signals[APPEARANCE_CHANGED] = + gtk_signal_new ("appearance_changed", + GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, + object_class->type, + GTK_SIGNAL_OFFSET (NautilusBackgroundClass, + appearance_changed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, + 0); + signals[SETTINGS_CHANGED] = + gtk_signal_new ("settings_changed", GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, object_class->type, - GTK_SIGNAL_OFFSET (NautilusBackgroundClass, changed), + GTK_SIGNAL_OFFSET (NautilusBackgroundClass, + settings_changed), gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); @@ -311,7 +321,10 @@ nautilus_background_set_color (NautilusBackground *background, g_free (background->details->color); background->details->color = g_strdup (color); - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[SETTINGS_CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static void @@ -336,7 +349,8 @@ load_image_callback (GnomeVFSResult error, gdk_pixbuf_ref (pixbuf); background->details->tile_image = pixbuf; - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static void @@ -380,7 +394,10 @@ nautilus_background_set_tile_image_uri (NautilusBackground *background, background->details->tile_image_uri = g_strdup (image_uri); start_loading_tile_image (background); - gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[SETTINGS_CHANGED]); + gtk_signal_emit (GTK_OBJECT (background), + signals[APPEARANCE_CHANGED]); } static GtkStyleClass * @@ -612,7 +629,8 @@ nautilus_get_widget_background (GtkWidget *widget) gtk_object_sink (GTK_OBJECT (background)); /* Arrange to get the signal whenever the background changes. */ - gtk_signal_connect_object_while_alive (GTK_OBJECT (background), "changed", + gtk_signal_connect_object_while_alive (GTK_OBJECT (background), + "appearance_changed", nautilus_widget_background_changed, GTK_OBJECT (widget)); nautilus_widget_background_changed (widget, background); diff --git a/libnautilus-private/nautilus-background.h b/libnautilus-private/nautilus-background.h index 5dccdae2b..d07aa3764 100644 --- a/libnautilus-private/nautilus-background.h +++ b/libnautilus-private/nautilus-background.h @@ -113,11 +113,16 @@ struct NautilusBackgroundClass { GtkObjectClass parent_class; - /* This signal is emitted when the background image is - finished loading. This allows a window to draw with a - color background if the image takes a lot time to load. - */ - void (* changed) (NautilusBackground *); + /* This signal is emitted whenever the background settings are + * changed. + */ + void (* settings_changed) (NautilusBackground *); + + /* This signal is emitted whenever the appearance of the + * background has changed, like when the background settings are + * altered or when an image is loaded. + */ + void (* appearance_changed) (NautilusBackground *); }; #endif /* NAUTILUS_BACKGROUND_H */ diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index c097203d8..45dec7014 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -164,7 +164,7 @@ nautilus_connect_background_to_directory_metadata (GtkWidget *widget, /* Connect new signal handlers. */ if (directory != NULL) { gtk_signal_connect (GTK_OBJECT (background), - "changed", + "settings_changed", GTK_SIGNAL_FUNC (background_changed_callback), directory); gtk_signal_connect (GTK_OBJECT (background), diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index 01871f939..3c24475b5 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -46,7 +46,6 @@ #include "nautilus-font-factory.h" #include "nautilus-lib-self-check-functions.h" -#include "nautilus-icon-grid.h" #include "nautilus-icon-private.h" /* Interval for updating the rubberband selection, in milliseconds. */ @@ -102,14 +101,12 @@ static void end_renaming_mode (NautilusIconConta gboolean commit); static void hide_rename_widget (NautilusIconContainer *container, NautilusIcon *icon); -static void anti_aliased_preferences_changed (gpointer user_data); +static void anti_aliased_preferences_changed (gpointer user_data); static void click_policy_changed_callback (gpointer user_data); - +static void finish_adding_new_icons (NautilusIconContainer *container); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconContainer, nautilus_icon_container, GNOME_TYPE_CANVAS) - - /* The NautilusIconContainer signals. */ enum { ACTIVATE, @@ -270,8 +267,6 @@ icon_get_bounding_box (NautilusIcon *icon, *y2_return = y2; } - - /* Utility functions for NautilusIconContainer. */ static void @@ -323,8 +318,6 @@ keyboard_icon_reveal_timeout_callback (gpointer data) NautilusIconContainer *container; NautilusIcon *icon; - GDK_THREADS_ENTER (); - container = NAUTILUS_ICON_CONTAINER (data); icon = container->details->keyboard_icon_to_reveal; @@ -342,8 +335,6 @@ keyboard_icon_reveal_timeout_callback (gpointer data) } container->details->keyboard_icon_reveal_timer_id = 0; - GDK_THREADS_LEAVE (); - return FALSE; } @@ -408,20 +399,27 @@ set_keyboard_focus (NautilusIconContainer *container, NULL); } - - -/* Idle operation handler. */ +static void +get_all_icon_bounds (NautilusIconContainer *container, + double *x1, double *y1, + double *x2, double *y2) +{ + /* FIXME: Do we have to do something about the rubberband + * here? Any other non-icon items? + */ + gnome_canvas_item_get_bounds + (GNOME_CANVAS (container)->root, + x1, y1, x2, y2); +} static void -set_scroll_region (NautilusIconContainer *container) +update_scroll_region (NautilusIconContainer *container) { double x1, y1, x2, y2; GtkAdjustment *hadj, *vadj; float step_increment; - gnome_canvas_item_get_bounds - (GNOME_CANVAS (container)->root, - &x1, &y1, &x2, &y2); + get_all_icon_bounds (container, &x1, &y1, &x2, &y2); nautilus_gnome_canvas_set_scroll_region_left_justify (GNOME_CANVAS (container), x1 - CONTAINER_PAD_LEFT, @@ -472,24 +470,11 @@ compare_icons (gconstpointer a, gconstpointer b) } static void -resort_and_clear (NautilusIconContainer *container) +resort (NautilusIconContainer *container) { sort_hack_container = container; container->details->icons = g_list_sort (container->details->icons, compare_icons); - - nautilus_icon_grid_clear (container->details->grid); -} - -static void -auto_position_icon (NautilusIconContainer *container, - NautilusIcon *icon) -{ - ArtPoint position; - - nautilus_icon_grid_get_position (container->details->grid, - icon, &position); - icon_set_position (icon, position.x, position.y); } /* Given an icon's bounds, compute the width of the space it should be @@ -611,24 +596,17 @@ lay_down_icons (NautilusIconContainer *container, if (line_start != NULL) { lay_down_one_line (container, line_start, NULL, &y); } - - /* Add all the icons back into the grid. */ - for (p = icons; p != NULL; p = p->next) { - icon = p->data; - - nautilus_icon_grid_add (container->details->grid, icon); - } } static void relayout (NautilusIconContainer *container) { + finish_adding_new_icons (container); + if (!container->details->auto_layout) { return; } - resort_and_clear (container); - /* An icon currently being stretched must be left in place. * That's "drag_icon". This doesn't come up for cases where * we are doing other kinds of drags, but if it did, the @@ -644,6 +622,7 @@ relayout (NautilusIconContainer *container) return; } + resort (container); lay_down_icons (container, container->details->icons, 0); } @@ -659,7 +638,7 @@ reload_icon_positions (NautilusIconContainer *container) g_assert (!container->details->auto_layout); - resort_and_clear (container); + resort (container); no_position_icons = NULL; @@ -676,8 +655,6 @@ reload_icon_positions (NautilusIconContainer *container) &have_stored_position); if (have_stored_position) { icon_set_position (icon, position.x, position.y); - nautilus_icon_grid_add (container->details->grid, icon); - nautilus_gnome_canvas_item_get_world_bounds (GNOME_CANVAS_ITEM (icon->item), &bounds); if (bounds.y1 > bottom) { @@ -695,39 +672,6 @@ reload_icon_positions (NautilusIconContainer *container) g_list_free (no_position_icons); } -static gboolean -idle_handler (gpointer data) -{ - NautilusIconContainer *container; - NautilusIconContainerDetails *details; - - GDK_THREADS_ENTER (); - - container = NAUTILUS_ICON_CONTAINER (data); - details = container->details; - - set_scroll_region (container); - relayout (container); - - details->idle_id = 0; - - GDK_THREADS_LEAVE (); - - return FALSE; -} - -static void -request_idle (NautilusIconContainer *container) -{ - if (container->details->idle_id != 0) { - return; - } - - container->details->idle_id = gtk_idle_add (idle_handler, container); -} - - - /* Container-level icon handling functions. */ static gboolean @@ -814,20 +758,13 @@ rubberband_select (NautilusIconContainer *container, const ArtDRect *previous_rect, const ArtDRect *current_rect) { - ArtDRect both_rects; - GList *icons, *p; - gboolean selection_changed; + GList *p; + gboolean selection_changed, is_in; NautilusIcon *icon; - gboolean is_in; selection_changed = FALSE; - /* As an optimization, ask the grid which icons intersect the rectangles. */ - art_drect_union (&both_rects, previous_rect, current_rect); - icons = nautilus_icon_grid_get_intersecting_icons - (container->details->grid, &both_rects); - - for (p = icons; p != NULL; p = p->next) { + for (p = container->details->icons; p != NULL; p = p->next) { icon = p->data; is_in = nautilus_icon_canvas_item_hit_test_rectangle @@ -840,8 +777,6 @@ rubberband_select (NautilusIconContainer *container, is_in ^ icon->was_selected_before_rubberband); } - g_list_free (icons); - if (selection_changed) { gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]); @@ -860,8 +795,6 @@ rubberband_timeout_callback (gpointer data) int x_scroll, y_scroll; ArtDRect selection_rect; - GDK_THREADS_ENTER (); - widget = GTK_WIDGET (data); container = NAUTILUS_ICON_CONTAINER (data); band_info = &container->details->rubberband_info; @@ -893,7 +826,6 @@ rubberband_timeout_callback (gpointer data) if (y_scroll == 0 && x_scroll == 0 && band_info->prev_x == x && band_info->prev_y == y) { - GDK_THREADS_LEAVE (); return TRUE; } @@ -938,8 +870,6 @@ rubberband_timeout_callback (gpointer data) band_info->prev_rect = selection_rect; - GDK_THREADS_LEAVE (); - return TRUE; } @@ -1033,8 +963,6 @@ stop_rubberbanding (NautilusIconContainer *container, band_info->selection_rectangle = NULL; } - - /* Keyboard navigation. */ typedef gboolean (* IsBetterIconFunction) (NautilusIconContainer *container, @@ -1697,7 +1625,6 @@ destroy (GtkObject *object) nautilus_icon_dnd_fini (container); nautilus_icon_container_clear (container); - nautilus_icon_grid_destroy (container->details->grid); unschedule_keyboard_icon_reveal (container); if (container->details->rubberband_info.timer_id != 0) { @@ -1730,8 +1657,6 @@ destroy (GtkObject *object) NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } - - /* GtkWidget methods. */ static void @@ -1745,19 +1670,8 @@ size_request (GtkWidget *widget, static void world_width_changed (NautilusIconContainer *container, int new_width) { - NautilusIconGrid *grid; - double world_width; - - grid = container->details->grid; - - gnome_canvas_c2w (GNOME_CANVAS (container), - new_width, 0, - &world_width, NULL); - - nautilus_icon_grid_set_visible_width (grid, world_width); - relayout (container); - set_scroll_region (container); + update_scroll_region (container); } static void @@ -2252,7 +2166,6 @@ key_press_event (GtkWidget *widget, return handled; } - /* Initialization. */ static void @@ -2491,8 +2404,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) details = g_new0 (NautilusIconContainerDetails, 1); - details->grid = nautilus_icon_grid_new (); - details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; /* FIXME: Fonts should be supplied by the caller and not @@ -2512,9 +2423,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) /* Set up DnD. */ nautilus_icon_dnd_init (container, stipple); - /* Request update. */ - request_idle (container); - /* Make sure that we find out if the theme changes. */ gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (), @@ -2548,7 +2456,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) container); } - /* NautilusIcon event handling. */ /* Conceptually, pressing button 1 together with CTRL or SHIFT toggles @@ -2686,8 +2593,7 @@ nautilus_icon_container_new (void) return new; } -/* clear all of the icons in the container */ - +/* Clear all of the icons in the container. */ void nautilus_icon_container_clear (NautilusIconContainer *container) { @@ -2698,7 +2604,7 @@ nautilus_icon_container_clear (NautilusIconContainer *container) details = container->details; - end_renaming_mode(container, TRUE); + end_renaming_mode (container, TRUE); clear_keyboard_focus (container); details->stretch_icon = NULL; @@ -2711,7 +2617,7 @@ nautilus_icon_container_clear (NautilusIconContainer *container) g_list_free (details->new_icons); details->new_icons = NULL; - nautilus_icon_grid_clear (details->grid); + update_scroll_region (container); } /* utility routine to remove a single icon from the container */ @@ -2739,8 +2645,6 @@ icon_destroy (NautilusIconContainer *container, details->drop_target = NULL; } - nautilus_icon_grid_remove (details->grid, icon); - icon_free (icon); if (was_selected) { @@ -2749,7 +2653,6 @@ icon_destroy (NautilusIconContainer *container, } } - /* activate any selected items in the container */ static void activate_selected_items (NautilusIconContainer *container) @@ -2761,29 +2664,12 @@ activate_selected_items (NautilusIconContainer *container) selection = nautilus_icon_container_get_selection (container); if (selection != NULL) { gtk_signal_emit (GTK_OBJECT (container), - signals[ACTIVATE], - selection); + signals[ACTIVATE], + selection); } - g_list_free (selection); } -static void -bounds_changed_callback (NautilusIconCanvasItem *item, - NautilusIconContainer *container) -{ - NautilusIcon *icon; - - g_assert (NAUTILUS_IS_ICON_CANVAS_ITEM (item)); - g_assert (NAUTILUS_IS_ICON_CONTAINER (container)); - - icon = item->user_data; - g_assert (icon != NULL); - - nautilus_icon_grid_remove (container->details->grid, icon); - nautilus_icon_grid_add (container->details->grid, icon); -} - void nautilus_icon_container_update_icon (NautilusIconContainer *container, NautilusIcon *icon) @@ -2875,6 +2761,97 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, g_free (additional_text); } +static gboolean +assign_icon_position (NautilusIconContainer *container, + NautilusIcon *icon) +{ + gboolean have_stored_position; + NautilusIconPosition position; + + /* Get the stored position. */ + have_stored_position = FALSE; + position.scale_x = 1.0; + position.scale_y = 1.0; + gtk_signal_emit (GTK_OBJECT (container), + signals[GET_STORED_ICON_POSITION], + icon->data, + &position, + &have_stored_position); + icon->scale_x = position.scale_x; + icon->scale_y = position.scale_y; + if (!container->details->auto_layout) { + if (have_stored_position) { + icon_set_position (icon, position.x, position.y); + } else { + return FALSE; + } + } + return TRUE; +} + +static void +finish_adding_icon (NautilusIconContainer *container, + NautilusIcon *icon) +{ + nautilus_icon_container_update_icon (container, icon); + gnome_canvas_item_show (GNOME_CANVAS_ITEM (icon->item)); + + gtk_signal_connect (GTK_OBJECT (icon->item), "event", + GTK_SIGNAL_FUNC (item_event_callback), container); +} + +static void +finish_adding_new_icons (NautilusIconContainer *container) +{ + GList *p, *new_icons, *no_position_icons; + NautilusIcon *icon; + double bottom; + + new_icons = container->details->new_icons; + if (new_icons == NULL) { + return; + } + container->details->new_icons = NULL; + + /* Position most icons (not unpositioned manual-layout icons). */ + new_icons = g_list_reverse (new_icons); + no_position_icons = NULL; + for (p = new_icons; p != NULL; p = p->next) { + icon = p->data; + if (!assign_icon_position (container, icon)) { + no_position_icons = g_list_prepend (no_position_icons, icon); + } + finish_adding_icon (container, icon); + } + g_list_free (new_icons); + + /* Position the unpositioned manual layout icons. */ + if (no_position_icons != NULL) { + g_assert (!container->details->auto_layout); + + no_position_icons = g_list_reverse (no_position_icons); + get_all_icon_bounds (container, NULL, NULL, NULL, &bottom); + lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM); + g_list_free (no_position_icons); + } + + /* Now the rest of the housekeeping. */ + relayout (container); + update_scroll_region (container); +} + +static gboolean +finish_adding_new_icons_callback (gpointer data) +{ + NautilusIconContainer *container; + + container = NAUTILUS_ICON_CONTAINER (data); + finish_adding_new_icons (container); + container->details->idle_id = 0; + + return FALSE; +} + /** * nautilus_icon_container_add: * @container: A NautilusIconContainer @@ -2890,8 +2867,6 @@ nautilus_icon_container_add (NautilusIconContainer *container, NautilusIconContainerDetails *details; GList *p; NautilusIcon *icon; - gboolean have_stored_position; - NautilusIconPosition position; g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE); g_return_val_if_fail (data != NULL, FALSE); @@ -2908,50 +2883,28 @@ nautilus_icon_container_add (NautilusIconContainer *container, } } - have_stored_position = FALSE; - position.scale_x = 1.0; - position.scale_y = 1.0; - gtk_signal_emit (GTK_OBJECT (container), - signals[GET_STORED_ICON_POSITION], - data, - &position, - &have_stored_position); - + /* Creat the new icon, including the canvas item. */ icon = g_new0 (NautilusIcon, 1); - - icon->scale_x = position.scale_x; - icon->scale_y = position.scale_y; - icon->data = data; - + icon->scale_x = 1.0; + icon->scale_y = 1.0; icon->item = NAUTILUS_ICON_CANVAS_ITEM (gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (container)->root), nautilus_icon_canvas_item_get_type (), NULL)); + gnome_canvas_item_hide (GNOME_CANVAS_ITEM (icon->item)); icon->item->user_data = icon; + /* Put it on both lists. */ details->icons = g_list_prepend (details->icons, icon); details->new_icons = g_list_prepend (details->new_icons, icon); - if (!details->auto_layout && have_stored_position) { - icon_set_position (icon, position.x, position.y); - } else { - auto_position_icon (container, icon); + /* Run an idle function to add the icons. */ + if (container->details->idle_id == 0) { + container->details->idle_id = gtk_idle_add + (finish_adding_new_icons_callback, container); } - nautilus_icon_container_update_icon (container, icon); - gnome_canvas_item_show (GNOME_CANVAS_ITEM (icon->item)); - - /* Must connect the bounds_changed signal after adding the icon to the - * grid, because it will try to remove/add the icon too. - */ - gtk_signal_connect (GTK_OBJECT (icon->item), "event", - GTK_SIGNAL_FUNC (item_event_callback), container); - gtk_signal_connect (GTK_OBJECT (icon->item), "bounds_changed", - GTK_SIGNAL_FUNC (bounds_changed_callback), container); - - request_idle (container); - return TRUE; } @@ -3553,7 +3506,6 @@ nautilus_icon_container_is_auto_layout (NautilusIconContainer *container) * * Returns true if container is in renaming mode **/ - gboolean nautilus_icon_container_is_renaming (NautilusIconContainer *container) { diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h index 185184483..d5f1112a3 100644 --- a/libnautilus-private/nautilus-icon-private.h +++ b/libnautilus-private/nautilus-icon-private.h @@ -52,9 +52,6 @@ typedef struct { /* Whether this item was selected before rubberbanding. */ nautilus_boolean_bit was_selected_before_rubberband : 1; - - /* Grid space occupied by this icon. */ - ArtIRect grid_rectangle; } NautilusIcon; @@ -99,16 +96,11 @@ typedef struct { guint64 last_typeselect_time; } TypeSelectState; -typedef struct NautilusIconGrid NautilusIconGrid; - struct NautilusIconContainerDetails { /* List of icons. */ GList *icons; GList *new_icons; - /* The grid. */ - NautilusIconGrid *grid; - /* Current icon for keyboard navigation. */ NautilusIcon *keyboard_focus; diff --git a/nautilus-clean.sh b/nautilus-clean.sh index 14a5ec8a2..87acf97fd 100755 --- a/nautilus-clean.sh +++ b/nautilus-clean.sh @@ -35,7 +35,7 @@ then fi -hack_echo () +echo_unless_quiet () { if [ "$quiet" != "yes" ] then @@ -59,6 +59,7 @@ nautilus-rpm-view \ nautilus-sample-content-view \ nautilus-service-startup-view \ nautilus-sidebar-loser \ +nautilus-tree=voew \ ntl-history-view \ ntl-notes \ ntl-web-search \ @@ -73,17 +74,15 @@ fi unset FOUND_ANY for NAME in $AUX_PROGS; do - EGREP_PATTERN=`echo $NAME | sed -e 's/\(.\)\(.*\)/[\1]\2/' | sed -e 's/\[\\\^\]/\[\\^\]/'` - COUNT=`ps auxww | egrep $EGREP_PATTERN | grep -v emacs | wc -l` if [ $COUNT -gt 0 ]; then if [ -z $FOUND_ANY ]; then - hack_echo "Stale Processes Found" + echo_unless_quiet "nautilus-clean: Stale processes found." FOUND_ANY=true fi - hack_echo "$NAME: $COUNT" + echo_unless_quiet "$NAME: $COUNT" if [ "$quiet" != "yes" ] then @@ -96,9 +95,5 @@ done if [ -z $FOUND_ANY ]; then - hack_echo "No Stale Processes Found" - exit 0 + echo_unless_quiet "nautilus-clean: No stale processes found." fi - -exit 0 - diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index b2d723df2..083c7635d 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -2670,7 +2670,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view) (BonoboUIHandlerCallback) remove_custom_icons_callback, view); gtk_signal_connect_object (GTK_OBJECT (fm_directory_view_get_background (view)), - "changed", + "settings_changed", fm_directory_view_update_menus, GTK_OBJECT (view)); diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index 7577d3ecc..187284153 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -1194,7 +1194,7 @@ nautilus_sidebar_update_info (NautilusSidebar *sidebar, if (sidebar->details->background_connection == 0) { sidebar->details->background_connection = gtk_signal_connect_object (GTK_OBJECT (background), - "changed", + "settings_changed", nautilus_sidebar_background_changed, GTK_OBJECT (sidebar)); } diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index 7577d3ecc..187284153 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -1194,7 +1194,7 @@ nautilus_sidebar_update_info (NautilusSidebar *sidebar, if (sidebar->details->background_connection == 0) { sidebar->details->background_connection = gtk_signal_connect_object (GTK_OBJECT (background), - "changed", + "settings_changed", nautilus_sidebar_background_changed, GTK_OBJECT (sidebar)); } |