diff options
46 files changed, 681 insertions, 460 deletions
@@ -1,3 +1,74 @@ +2000-10-25 Darin Adler <darin@eazel.com> + + * libnautilus-extensions/nautilus-directory-private.h: + * libnautilus-extensions/nautilus-directory.h: + * libnautilus-extensions/nautilus-file-private.h: + * libnautilus-extensions/nautilus-directory-async.c: (istr_equal), + (istr_hash), (istr_set_new), (istr_set_insert), (add_istr_to_list), + (istr_set_get_as_list), (istr_set_destroy): New set of functions + for manipulating a set of case-insensitive strings (private for + now). + (mime_list_cancel): Change to use the istr_set. + (get_filter_options_for_directory_count): Moved up so it can be + used by the directory load code. + (load_directory_done): Common function to use when a load is + completed or cancelled. + (dequeue_pending_idle_callback): Update file count and MIME list + as well as just loading the files. + (should_get_directory_count): New cover that takes into account + the fact that a directory load is already getting the count. + (should_get_mime_list): New cover that takes into account + the fact that a directory load is already getting the MIME list. + (start_monitoring_file_list): Set up more stuff since a load + does a lot more now. + (directory_count_start): Don't start a directory count if we are + already loading the directory's file list. + (mime_list_one), (mime_list_callback), (mime_list_load): Change to + use the istr_set. Also removed some code that set variables that + were never used. + (mime_list_start): Don't start a MIME list if we are already + loading the directory's file list. + + * components/adapter/Makefile.am: + * components/hardware/Makefile.am: + * components/html/Makefile.am: + * components/loser/content/Makefile.am: + * components/loser/sidebar/Makefile.am: + * components/mozilla/Makefile.am: + * components/music/Makefile.am: + * components/rpmview/Makefile.am: + * components/sample/Makefile.am: + * components/services/install/command-line/Makefile.am: + * components/services/install/lib/Makefile.am: + * components/services/install/nautilus-view/Makefile.am: + * components/services/install/server/Makefile.am: + * components/services/inventory/lib/Makefile.am: + * components/services/inventory/nautilus-view/Makefile.am: + * components/services/login/nautilus-view/Makefile.am: + * components/services/nautilus-dependent-shared/Makefile.am: + * components/services/summary/lib/Makefile.am: + * components/services/summary/nautilus-view/Makefile.am: + * components/services/time/command-line/Makefile.am: + * components/services/time/nautilus-view/Makefile.am: + * components/services/time/service/Makefile.am: + * components/services/trilobite/libtrilobite/Makefile.am: + * components/services/trilobite/sample/command-line/Makefile.am: + * components/services/trilobite/sample/lib/Makefile.am: + * components/services/trilobite/sample/nautilus-view/Makefile.am: + * components/services/trilobite/sample/service/Makefile.am: + * components/services/vault/command-line/Makefile.am: + * components/tree/Makefile.am: + * helper-utilities/authenticate/Makefile.am: + * nautilus-installer/src/Makefile.am: + Changed all use of CPPFLAGS to use INCLUDES instead as it says in + the automake documentation. + + * libnautilus-extensions/nautilus-glib-extensions.h: Reformatting. + * libnautilus-extensions/nautilus-glib-extensions.c: + (nautilus_g_hash_table_remove_deep_custom), + (nautilus_g_hash_table_remove_deep), (destroy_deep_helper), + (nautilus_g_hash_table_destroy_deep_custom): Reformatting. + 2000-10-25 Michael Engber <engber@eazel.com> * libnautilus-extensions/nautilus-file-operations.c: diff --git a/components/adapter/Makefile.am b/components/adapter/Makefile.am index 92b467d2d..927ccfc60 100644 --- a/components/adapter/Makefile.am +++ b/components/adapter/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-Adapter\" \ - -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Adapter\" \ + -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \ -I$(top_srcdir) -I$(top_builddir) -I. \ $(GNOMEUI_CFLAGS) \ $(BONOBOX_CFLAGS) \ diff --git a/components/hardware/Makefile.am b/components/hardware/Makefile.am index 01e38c531..d0cb959e0 100644 --- a/components/hardware/Makefile.am +++ b/components/hardware/Makefile.am @@ -1,10 +1,8 @@ SUBDIRS=icons -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" - -DG_LOG_DOMAIN=\"Nautilus-Hardware\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Hardware\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(GCONF_CFLAGS) \ diff --git a/components/html/Makefile.am b/components/html/Makefile.am index 27a12c592..0db403671 100644 --- a/components/html/Makefile.am +++ b/components/html/Makefile.am @@ -1,11 +1,9 @@ # FIXME bugzilla.eazel.com 714: I (Elliot) want the HTML component to be a # shared library component, not an exe one. -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" - -DG_LOG_DOMAIN=\"Nautilus-HTML\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-HTML\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ diff --git a/components/loser/content/Makefile.am b/components/loser/content/Makefile.am index 3ae753a2b..d46e4ee3c 100644 --- a/components/loser/content/Makefile.am +++ b/components/loser/content/Makefile.am @@ -1,12 +1,10 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"Nautilus-Test\" \ -DDATADIR=\"$(datadir)\" \ - -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" - -INCLUDES = \ + -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(OAF_CFLAGS) \ diff --git a/components/loser/sidebar/Makefile.am b/components/loser/sidebar/Makefile.am index 7c0355865..63fda1106 100644 --- a/components/loser/sidebar/Makefile.am +++ b/components/loser/sidebar/Makefile.am @@ -1,12 +1,10 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"Nautilus-Test\" \ -DDATADIR=\"$(datadir)\" \ - -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" - -INCLUDES = \ + -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(GCONF_CFLAGS) \ diff --git a/components/mozilla/Makefile.am b/components/mozilla/Makefile.am index 44bfe6368..d480f9b11 100644 --- a/components/mozilla/Makefile.am +++ b/components/mozilla/Makefile.am @@ -1,13 +1,10 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"Nautilus-Mozilla\" \ -DDATADIR=\"$(datadir)\" \ $(MOZILLA_COMPONENT_DEBUG_FLAGS) \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ $(BONOBO_CFLAGS) \ diff --git a/components/music/Makefile.am b/components/music/Makefile.am index f459b72d7..0c7283668 100644 --- a/components/music/Makefile.am +++ b/components/music/Makefile.am @@ -1,8 +1,6 @@ -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" - -DG_LOG_DOMAIN=\"Nautilus-Music\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Music\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(GCONF_CFLAGS) \ diff --git a/components/rpmview/Makefile.am b/components/rpmview/Makefile.am index 8d65dd9bd..8a67e7a9b 100644 --- a/components/rpmview/Makefile.am +++ b/components/rpmview/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-RPM\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-RPM\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/install/lib \ -I$(top_srcdir)/components/services/trilobite \ @@ -19,7 +17,6 @@ INCLUDES = \ $(NULL) oafdir = $(datadir)/oaf - oaf_DATA = nautilus-rpm-view.oafinfo bin_PROGRAMS = nautilus-rpm-view diff --git a/components/sample/Makefile.am b/components/sample/Makefile.am index f0e8fbc7d..b30f16e86 100644 --- a/components/sample/Makefile.am +++ b/components/sample/Makefile.am @@ -1,12 +1,10 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"Nautilus-Sample\" \ -DDATADIR=\"$(datadir)\" \ - -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" - -INCLUDES = \ + -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(GNOMEUI_CFLAGS) \ diff --git a/components/services/install-view/Makefile.am b/components/services/install-view/Makefile.am index 3588865fc..59b02f042 100644 --- a/components/services/install-view/Makefile.am +++ b/components/services/install-view/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-service-install\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-service-install\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/install/lib \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/install/command-line/Makefile.am b/components/services/install/command-line/Makefile.am index c16e17ef1..c9f8e6ebb 100644 --- a/components/services/install/command-line/Makefile.am +++ b/components/services/install/command-line/Makefile.am @@ -1,10 +1,8 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-Services\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Services\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I/usr/include/rpm \ diff --git a/components/services/install/lib/Makefile.am b/components/services/install/lib/Makefile.am index a88a3b2f3..451f32f31 100644 --- a/components/services/install/lib/Makefile.am +++ b/components/services/install/lib/Makefile.am @@ -1,11 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-install-service\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-install-service\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I/usr/include/rpm \ diff --git a/components/services/install/nautilus-view/Makefile.am b/components/services/install/nautilus-view/Makefile.am index 3588865fc..59b02f042 100644 --- a/components/services/install/nautilus-view/Makefile.am +++ b/components/services/install/nautilus-view/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-service-install\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-service-install\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/install/lib \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/install/server/Makefile.am b/components/services/install/server/Makefile.am index f5cbe77d9..00d59ecdc 100644 --- a/components/services/install/server/Makefile.am +++ b/components/services/install/server/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-eazel-install-service\" \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/install/lib \ diff --git a/components/services/inventory/lib/Makefile.am b/components/services/inventory/lib/Makefile.am index a774a2912..10169c7c9 100644 --- a/components/services/inventory/lib/Makefile.am +++ b/components/services/inventory/lib/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-eazel-inventory\" \ -DSTANDALONE \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/inventory/nautilus-view/Makefile.am b/components/services/inventory/nautilus-view/Makefile.am index c56ccbb29..f6fbe2394 100644 --- a/components/services/inventory/nautilus-view/Makefile.am +++ b/components/services/inventory/nautilus-view/Makefile.am @@ -1,11 +1,8 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-eazel-inventory\" \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ -I$(top_srcdir)/components/services/inventory/lib \ diff --git a/components/services/login/nautilus-view/Makefile.am b/components/services/login/nautilus-view/Makefile.am index ff56f97b2..3ad08f169 100644 --- a/components/services/login/nautilus-view/Makefile.am +++ b/components/services/login/nautilus-view/Makefile.am @@ -1,11 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-change-password\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-change-password\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/nautilus-dependent-shared \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ diff --git a/components/services/nautilus-dependent-shared/Makefile.am b/components/services/nautilus-dependent-shared/Makefile.am index cf2155491..5205d9811 100644 --- a/components/services/nautilus-dependent-shared/Makefile.am +++ b/components/services/nautilus-dependent-shared/Makefile.am @@ -2,12 +2,9 @@ include $(top_srcdir)/Makefile.shared SUBDIRS = icons -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"eazel-service\" \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/nautilus-dependent-shared \ diff --git a/components/services/summary/lib/Makefile.am b/components/services/summary/lib/Makefile.am index b75621ede..e518e26eb 100644 --- a/components/services/summary/lib/Makefile.am +++ b/components/services/summary/lib/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-eazel-summary\" \ -DSTANDALONE \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/summary/nautilus-view/Makefile.am b/components/services/summary/nautilus-view/Makefile.am index cc5cb6b01..476cd6e1a 100644 --- a/components/services/summary/nautilus-view/Makefile.am +++ b/components/services/summary/nautilus-view/Makefile.am @@ -1,14 +1,11 @@ include $(top_srcdir)/Makefile.shared -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-summary\" \ - -DDATADIR=\"$(datadir)\" \ - $(NULL) - SUBDIRS = icons INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-summary\" \ + -DDATADIR=\"$(datadir)\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/nautilus-dependent-shared \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/time/command-line/Makefile.am b/components/services/time/command-line/Makefile.am index 89c45e954..e7133e571 100644 --- a/components/services/time/command-line/Makefile.am +++ b/components/services/time/command-line/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" - -DG_LOG_DOMAIN=\"trilobite-eazel-time-service-cli\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-time-service-cli\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ diff --git a/components/services/time/nautilus-view/Makefile.am b/components/services/time/nautilus-view/Makefile.am index 7ae7d9170..5d7aac5cf 100644 --- a/components/services/time/nautilus-view/Makefile.am +++ b/components/services/time/nautilus-view/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-time-service\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - ${NULL} - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-time-service\" \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ diff --git a/components/services/time/service/Makefile.am b/components/services/time/service/Makefile.am index 2e80d9d55..4f1ca616a 100644 --- a/components/services/time/service/Makefile.am +++ b/components/services/time/service/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ +INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-eazel-time-service\" \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ diff --git a/components/services/trilobite/libtrilobite/Makefile.am b/components/services/trilobite/libtrilobite/Makefile.am index 69501d3ed..a3e733036 100644 --- a/components/services/trilobite/libtrilobite/Makefile.am +++ b/components/services/trilobite/libtrilobite/Makefile.am @@ -2,14 +2,11 @@ NULL = lib_LTLIBRARIES = libtrilobite.la libtrilobite-service.la -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"libtrilobite\" \ - -DSTANDALONE \ - -DTRILOBITE_VERSION=\"0.1.0\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"libtrilobite\" \ + -DSTANDALONE \ + -DTRILOBITE_VERSION=\"0.1.0\" \ -I$(srcdir) \ -I$(top_srcdir) \ -I$(top_builddir) \ diff --git a/components/services/trilobite/sample/command-line/Makefile.am b/components/services/trilobite/sample/command-line/Makefile.am index cf9dbba8e..acea4bccf 100644 --- a/components/services/trilobite/sample/command-line/Makefile.am +++ b/components/services/trilobite/sample/command-line/Makefile.am @@ -1,11 +1,8 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-sample-client\" \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/trilobite/sample/lib/Makefile.am b/components/services/trilobite/sample/lib/Makefile.am index 0f6686bca..d31a77aaa 100644 --- a/components/services/trilobite/sample/lib/Makefile.am +++ b/components/services/trilobite/sample/lib/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DG_LOG_DOMAIN=\"trilobite-sample-service\" \ -DSTANDALONE \ - $(NULL) - -INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/trilobite/sample/nautilus-view/Makefile.am b/components/services/trilobite/sample/nautilus-view/Makefile.am index 5f707d1ee..34c153d69 100644 --- a/components/services/trilobite/sample/nautilus-view/Makefile.am +++ b/components/services/trilobite/sample/nautilus-view/Makefile.am @@ -2,12 +2,9 @@ NULL = SUBDIRS = icons -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-sample-service\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-sample-service\" \ -I$(top_srcdir) \ -I$(top_srcdir)/components/services/trilobite/libtrilobite \ -I$(top_srcdir)/components/services/trilobite/sample/lib \ diff --git a/components/services/trilobite/sample/service/Makefile.am b/components/services/trilobite/sample/service/Makefile.am index fe2e5a196..e21826898 100644 --- a/components/services/trilobite/sample/service/Makefile.am +++ b/components/services/trilobite/sample/service/Makefile.am @@ -1,12 +1,9 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-sample-service\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(NULL) - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-sample-service\" \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/services/vault/command-line/Makefile.am b/components/services/vault/command-line/Makefile.am index f3231d982..12ffa4804 100644 --- a/components/services/vault/command-line/Makefile.am +++ b/components/services/vault/command-line/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" - -DG_LOG_DOMAIN=\"trilobite-eazel-vault-service\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"trilobite-eazel-vault-service\" \ -I$(top_srcdir) \ -I$(top_builddir) \ -I$(top_srcdir)/components/services/trilobite \ diff --git a/components/tree/Makefile.am b/components/tree/Makefile.am index 60804a41d..02fa9c120 100644 --- a/components/tree/Makefile.am +++ b/components/tree/Makefile.am @@ -1,11 +1,9 @@ NULL = -CPPFLAGS = \ +INCLUDES = \ -DPREFIX=\"$(prefix)\" \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"Nautilus-Tree\" - -INCLUDES = \ + -DG_LOG_DOMAIN=\"Nautilus-Tree\" \ -I$(top_srcdir) \ -I$(top_builddir) \ $(VFS_CFLAGS) \ diff --git a/helper-utilities/authenticate/Makefile.am b/helper-utilities/authenticate/Makefile.am index 153419d81..f9c2851d8 100644 --- a/helper-utilities/authenticate/Makefile.am +++ b/helper-utilities/authenticate/Makefile.am @@ -1,10 +1,8 @@ NULL = -CPPFLAGS = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"Nautilus-Authenticate\" - INCLUDES = \ + -DPREFIX=\"$(prefix)\" \ + -DG_LOG_DOMAIN=\"Nautilus-Authenticate\" \ -I$(top_srcdir) \ $(GNOMEUI_CFLAGS) \ $(NULL) diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c index df114f959..7ebb3b8e6 100644 --- a/libnautilus-extensions/nautilus-directory-async.c +++ b/libnautilus-extensions/nautilus-directory-async.c @@ -34,6 +34,7 @@ #include "nautilus-link.h" #include "nautilus-search-uri.h" #include "nautilus-string.h" +#include <ctype.h> #include <gnome-xml/parser.h> #include <gnome-xml/xmlmemory.h> #include <gtk/gtkmain.h> @@ -127,6 +128,72 @@ static gboolean request_is_satisfied (NautilusDirectory *directory, NautilusFile *file, Request *request); +/* Some helpers for case-insensitive strings. + * Move to nautilus-glib-extensions? + */ + +static gboolean +istr_equal (gconstpointer v, gconstpointer v2) +{ + return g_strcasecmp (v, v2) == 0; +} + +static guint +istr_hash (gconstpointer key) +{ + const char *p; + guint h; + + h = 0; + for (p = key; *p != '\0'; p++) { + h = (h << 5) - h + tolower ((guchar) *p); + } + + return h; +} + +static GHashTable * +istr_set_new (void) +{ + return g_hash_table_new (istr_hash, istr_equal); +} + +static void +istr_set_insert (GHashTable *table, const char *istr) +{ + char *key; + + if (g_hash_table_lookup (table, istr) == NULL) { + key = g_strdup (istr); + g_hash_table_insert (table, key, key); + } +} + +static void +add_istr_to_list (gpointer key, gpointer value, gpointer callback_data) +{ + GList **list; + + list = callback_data; + *list = g_list_prepend (*list, g_strdup (key)); +} + +static GList * +istr_set_get_as_list (GHashTable *table) +{ + GList *list; + + list = NULL; + g_hash_table_foreach (table, add_istr_to_list, &list); + return list; +} + +static void +istr_set_destroy (GHashTable *table) +{ + nautilus_g_hash_table_destroy_deep (table); +} + /* Start a job. This is really just a way of limiting the number of * async. requests that we issue at any given time. Without this, the * number of requests is unbounded. @@ -296,11 +363,11 @@ mime_list_cancel (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (directory->details->mime_list_file)); gnome_vfs_async_cancel (directory->details->mime_list_in_progress); + istr_set_destroy (directory->details->mime_list_hash); directory->details->mime_list_file = NULL; directory->details->mime_list_in_progress = NULL; - g_free (directory->details->mime_list_uri); - directory->details->mime_list_uri = NULL; + directory->details->mime_list_hash = NULL; async_job_end (directory, "MIME list"); } @@ -1059,32 +1126,14 @@ nautilus_compare_file_with_name (gconstpointer a, gconstpointer b) (const char *) b); } -static gboolean -update_file_info_in_list_if_needed (GList *list, - GnomeVFSFileInfo *file_info) -{ - GList *list_entry; - - list_entry = g_list_find_custom (list, - (gpointer) file_info->name, - nautilus_compare_file_with_name); - if (list_entry == NULL) { - /* the file is not in the list yet */ - return FALSE; - } - - /* the file is in the list already update the file info if needed */ - nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info); - - return TRUE; -} - static void set_file_unconfirmed (NautilusFile *file, gboolean unconfirmed) { NautilusDirectory *directory; g_assert (NAUTILUS_IS_FILE (file)); + g_assert (unconfirmed == FALSE || unconfirmed == TRUE); + if (file->details->unconfirmed == unconfirmed) { return; } @@ -1093,12 +1142,49 @@ set_file_unconfirmed (NautilusFile *file, gboolean unconfirmed) directory = file->details->directory; if (unconfirmed) { directory->details->confirmed_file_count--; - } - else { + } else { directory->details->confirmed_file_count++; } } +static GnomeVFSDirectoryFilterOptions +get_filter_options_for_directory_count (void) +{ + GnomeVFSDirectoryFilterOptions filter_options; + + filter_options = GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR + | GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR; + + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE)) { + filter_options |= GNOME_VFS_DIRECTORY_FILTER_NODOTFILES; + } + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE)) { + filter_options |= GNOME_VFS_DIRECTORY_FILTER_NOBACKUPFILES; + } + + return filter_options; +} + +static void +load_directory_done (NautilusDirectory *directory) +{ + istr_set_destroy (directory->details->load_mime_list_hash); + directory->details->load_mime_list_hash = NULL; + + directory->details->load_directory_file->details->loading_directory = FALSE; + + if (directory->details->load_directory_file->details->directory != directory) { + nautilus_directory_async_state_changed (directory->details->load_directory_file->details->directory); + } + + nautilus_file_unref (directory->details->load_directory_file); + directory->details->load_directory_file = NULL; + + gnome_vfs_directory_filter_destroy (directory->details->load_file_count_filter); + directory->details->load_file_count_filter = NULL; + + nautilus_directory_async_state_changed (directory); +} static gboolean dequeue_pending_idle_callback (gpointer callback_data) @@ -1120,8 +1206,7 @@ dequeue_pending_idle_callback (gpointer callback_data) /* If we are no longer monitoring, then throw away these. */ if (!nautilus_directory_is_file_list_monitored (directory)) { gnome_vfs_file_info_list_free (pending_file_info); - - nautilus_directory_async_state_changed (directory); + load_directory_done (directory); return FALSE; } @@ -1133,6 +1218,16 @@ dequeue_pending_idle_callback (gpointer callback_data) for (node = pending_file_info; node != NULL; node = node->next) { file_info = node->data; + /* Update the file count. */ + if (gnome_vfs_directory_filter_apply (directory->details->load_file_count_filter, + file_info)) { + directory->details->load_file_count += 1; + } + + /* Add the MIME type to the set. */ + istr_set_insert (directory->details->load_mime_list_hash, + file_info->mime_type); + /* check if the file already exists */ file = nautilus_directory_find_file (directory, file_info->name); if (file != NULL) { @@ -1145,7 +1240,7 @@ dequeue_pending_idle_callback (gpointer callback_data) } nautilus_file_ref (file); saw_again_files = g_list_prepend (saw_again_files, file); - } else if (!update_file_info_in_list_if_needed (pending_files, file_info)) { + } else { /* new file, create a nautilus file object and add it to the list */ file = nautilus_file_new_from_info (directory, file_info); pending_files = g_list_prepend (pending_files, file); @@ -1157,8 +1252,9 @@ dequeue_pending_idle_callback (gpointer callback_data) * files are gone. */ if (directory->details->directory_loaded) { - for (node = directory->details->file_list; node != NULL; node = next) { - file = node->data; + for (node = directory->details->file_list; + node != NULL; node = next) { + file = NAUTILUS_FILE (node->data); next = node->next; if (file->details->unconfirmed) { @@ -1187,10 +1283,20 @@ dequeue_pending_idle_callback (gpointer callback_data) nautilus_directory_emit_files_added (directory, added_files); nautilus_file_list_free (added_files); - /* Send the done_loading signal. */ if (directory->details->directory_loaded && !directory->details->directory_loaded_sent_notification) { + /* Send the done_loading signal. */ nautilus_directory_emit_done_loading (directory); + + directory->details->load_directory_file->details->got_directory_count = TRUE; + directory->details->load_directory_file->details->directory_count = directory->details->load_file_count; + + directory->details->load_directory_file->details->got_mime_list = TRUE; + directory->details->load_directory_file->details->mime_list = istr_set_get_as_list + (directory->details->load_mime_list_hash); + + load_directory_done (directory); + directory->details->directory_loaded_sent_notification = TRUE; } @@ -1215,6 +1321,8 @@ directory_load_one (NautilusDirectory *directory, if (info == NULL) { return; } + + /* Arrange for the "loading" part of the work. */ gnome_vfs_file_info_ref (info); directory->details->pending_file_info = g_list_prepend (directory->details->pending_file_info, info); @@ -1248,7 +1356,8 @@ directory_load_done (NautilusDirectory *directory, * they won't be marked "gone" later -- we don't know enough * about them to know whether they are really gone. */ - for (node = directory->details->file_list; node != NULL; node = node->next) { + for (node = directory->details->file_list; + node != NULL; node = node->next) { set_file_unconfirmed (NAUTILUS_FILE (node->data), FALSE); } } @@ -1527,8 +1636,8 @@ directory_count_callback (GnomeVFSAsyncHandle *handle, if (result != GNOME_VFS_ERROR_EOF) { count_file->details->directory_count_failed = TRUE; } else { - count_file->details->directory_count = entries_read; count_file->details->got_directory_count = TRUE; + count_file->details->directory_count = entries_read; } directory->details->count_file = NULL; directory->details->count_in_progress = NULL; @@ -1670,6 +1779,13 @@ lacks_directory_count (NautilusFile *file) } static gboolean +should_get_directory_count (NautilusFile *file) +{ + return lacks_directory_count (file) + && !file->details->loading_directory; +} + +static gboolean wants_directory_count (const Request *request) { return request->directory_count; @@ -1720,7 +1836,15 @@ static gboolean lacks_mime_list (NautilusFile *file) { return nautilus_file_is_directory (file) - && file->details->got_mime_list == FALSE; + && !file->details->got_mime_list + && !file->details->mime_list_failed; +} + +static gboolean +should_get_mime_list (NautilusFile *file) +{ + return lacks_mime_list (file) + && !file->details->loading_directory; } static gboolean @@ -1819,7 +1943,8 @@ call_ready_callbacks (NautilusDirectory *directory) called_any = FALSE; while (1) { /* Check if any callbacks are satisifed and call them if they are. */ - for (node = directory->details->call_when_ready_list; node != NULL; node = next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = next) { next = node->next; callback = node->data; @@ -1849,14 +1974,16 @@ nautilus_directory_is_anyone_monitoring_file_list (NautilusDirectory *directory) ReadyCallback *callback; Monitor *monitor; - for (node = directory->details->call_when_ready_list; node != NULL; node = node->next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = node->next) { callback = node->data; if (callback->request.file_list) { return TRUE; } } - for (node = directory->details->monitor_list; node != NULL; node = node->next) { + for (node = directory->details->monitor_list; + node != NULL; node = node->next) { monitor = node->data; if (monitor->request.file_list) { return TRUE; @@ -1909,7 +2036,17 @@ start_monitoring_file_list (NautilusDirectory *directory) g_assert (directory->details->uri != NULL); directory->details->directory_load_list_last_handled = GNOME_VFS_DIRECTORY_LIST_POSITION_NONE; -#ifdef DEBUG_LOAD_DIRECTORY + directory->details->load_file_count = 0; + directory->details->load_directory_file = + nautilus_directory_get_corresponding_file (directory); + directory->details->load_directory_file->details->loading_directory = TRUE; + directory->details->load_file_count = 0; + directory->details->load_file_count_filter = gnome_vfs_directory_filter_new + (GNOME_VFS_DIRECTORY_FILTER_NONE, + get_filter_options_for_directory_count (), + NULL); + directory->details->load_mime_list_hash = istr_set_new (); +#ifdef DEBUG_LOAD_DIRECTORY g_message ("load_directory called to monitor file list of %s", directory->details->uri); #endif gnome_vfs_async_load_directory @@ -1979,13 +2116,10 @@ nautilus_directory_invalidate_counts (NautilusDirectory *directory) file->details->got_mime_list = FALSE; file->details->mime_list_failed = FALSE; - if (parent_directory != directory) { - nautilus_directory_async_state_changed (parent_directory); - } - nautilus_file_unref (file); + + nautilus_directory_async_state_changed (parent_directory); } - nautilus_directory_async_state_changed (directory); } void @@ -2001,7 +2135,6 @@ nautilus_directory_force_reload (NautilusDirectory *directory) nautilus_directory_async_state_changed (directory); } - static gboolean is_needy (NautilusFile *file, FileCheck check_missing, @@ -2059,14 +2192,16 @@ select_needy_file (NautilusDirectory *directory, NautilusFile *file; /* Quick out if no one is interested. */ - for (node = directory->details->call_when_ready_list; node != NULL; node = node->next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = node->next) { callback = node->data; if ((* check_wanted) (&callback->request)) { break; } } if (node == NULL) { - for (node = directory->details->monitor_list; node != NULL; node = node->next) { + for (node = directory->details->monitor_list; + node != NULL; node = node->next) { monitor = node->data; if ((* check_wanted) (&monitor->request)) { break; @@ -2078,10 +2213,12 @@ select_needy_file (NautilusDirectory *directory, } /* Search for a file that has an unfulfilled request. */ - for (node = directory->details->file_list; node != NULL; node = node->next) { + for (node = directory->details->file_list; + node != NULL; node = node->next) { file = node->data; if ((* check_missing) (file)) { - for (node_2 = directory->details->call_when_ready_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->call_when_ready_list; + node_2 != NULL; node_2 = node_2->next) { callback = node_2->data; if ((callback->file == NULL || callback->file == file) && (* check_wanted) (&callback->request)) { @@ -2091,7 +2228,8 @@ select_needy_file (NautilusDirectory *directory, if (node_2 != NULL) { return file; } - for (node_2 = directory->details->monitor_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->monitor_list; + node_2 != NULL; node_2 = node_2->next) { monitor = node_2->data; if ((monitor->file == NULL || monitor->file == file) && (* check_wanted) (&monitor->request)) { @@ -2108,7 +2246,8 @@ select_needy_file (NautilusDirectory *directory, file = directory->details->as_file; if (file != NULL) { if ((* check_missing) (file)) { - for (node_2 = directory->details->call_when_ready_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->call_when_ready_list; + node_2 != NULL; node_2 = node_2->next) { callback = node_2->data; if (callback->file == file && (* check_wanted) (&callback->request)) { @@ -2118,7 +2257,8 @@ select_needy_file (NautilusDirectory *directory, if (node_2 != NULL) { return file; } - for (node_2 = directory->details->monitor_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->monitor_list; + node_2 != NULL; node_2 = node_2->next) { monitor = node_2->data; if (monitor->file == file && (* check_wanted) (&monitor->request)) { @@ -2134,28 +2274,6 @@ select_needy_file (NautilusDirectory *directory, return NULL; } - - -static GnomeVFSDirectoryFilterOptions -get_filter_options_for_directory_count (NautilusFile *file) -{ - GnomeVFSDirectoryFilterOptions filter_options; - - filter_options = GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR | - GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR; - - if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE)) { - filter_options |= GNOME_VFS_DIRECTORY_FILTER_NODOTFILES; - } - if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE)) { - filter_options |= GNOME_VFS_DIRECTORY_FILTER_NOBACKUPFILES; - } - - return filter_options; -} - - - static void directory_count_start (NautilusDirectory *directory) { @@ -2171,7 +2289,7 @@ directory_count_start (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (file)); g_assert (file->details->directory == directory); if (is_needy (file, - lacks_directory_count, + should_get_directory_count, wants_directory_count)) { return; } @@ -2183,7 +2301,7 @@ directory_count_start (NautilusDirectory *directory) /* Figure out which file to get a count for. */ file = select_needy_file (directory, - lacks_directory_count, + should_get_directory_count, wants_directory_count); if (file == NULL) { return; @@ -2206,7 +2324,7 @@ directory_count_start (NautilusDirectory *directory) NULL, FALSE, GNOME_VFS_DIRECTORY_FILTER_NONE, - get_filter_options_for_directory_count (file), + get_filter_options_for_directory_count (), NULL, G_MAXINT, directory_count_callback, @@ -2387,13 +2505,7 @@ static void mime_list_one (NautilusDirectory *directory, GnomeVFSFileInfo *info) { - NautilusFile *file; - - file = directory->details->mime_list_file; - - if (g_list_find_custom (file->details->mime_list, info->mime_type, (GCompareFunc) g_strcasecmp) == NULL) { - file->details->mime_list = g_list_prepend (file->details->mime_list, g_strdup (info->mime_type)); - } + istr_set_insert (directory->details->mime_list_hash, info->mime_type); } static void @@ -2431,20 +2543,20 @@ mime_list_callback (GnomeVFSAsyncHandle *handle, } /* Record either a failure or success. */ + nautilus_g_list_free_deep (file->details->mime_list); if (result != GNOME_VFS_ERROR_EOF) { file->details->mime_list_failed = TRUE; - nautilus_g_list_free_deep (file->details->mime_list); file->details->mime_list = NULL; - file->details->mime_list_status = NAUTILUS_REQUEST_NOT_STARTED; } else { file->details->got_mime_list = TRUE; - file->details->mime_list_status = NAUTILUS_REQUEST_DONE; + file->details->mime_list = istr_set_get_as_list + (directory->details->mime_list_hash); } + istr_set_destroy (directory->details->mime_list_hash); - g_free (directory->details->mime_list_uri); - directory->details->mime_list_uri = NULL; directory->details->mime_list_in_progress = NULL; directory->details->mime_list_file = NULL; + directory->details->mime_list_hash = NULL; /* Send file-changed even if getting the item type list * failed, so interested parties can distinguish between @@ -2460,10 +2572,9 @@ mime_list_callback (GnomeVFSAsyncHandle *handle, static void mime_list_load (NautilusDirectory *directory, const char *uri) { - g_assert (directory->details->mime_list_uri == NULL); - directory->details->mime_list_uri = g_strdup (uri); directory->details->mime_list_last_handled = GNOME_VFS_DIRECTORY_LIST_POSITION_NONE; + directory->details->mime_list_hash = istr_set_new (); #ifdef DEBUG_LOAD_DIRECTORY g_message ("load_directory called to get MIME list of %s", uri); #endif @@ -2477,7 +2588,7 @@ mime_list_load (NautilusDirectory *directory, const char *uri) (GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR | GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR), NULL, - G_MAXINT, + DIRECTORY_LOAD_ITEMS_PER_CALLBACK, mime_list_callback, directory); } @@ -2497,7 +2608,7 @@ mime_list_start (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (file)); g_assert (file->details->directory == directory); if (is_needy (file, - lacks_mime_list, + should_get_mime_list, wants_mime_list)) { return; } @@ -2509,7 +2620,7 @@ mime_list_start (NautilusDirectory *directory) /* Figure out which file to get a mime list for. */ file = select_needy_file (directory, - lacks_mime_list, + should_get_mime_list, wants_mime_list); if (file == NULL) { return; @@ -2519,10 +2630,6 @@ mime_list_start (NautilusDirectory *directory) return; } - /* Start counting. */ - file->details->mime_list_status = NAUTILUS_REQUEST_IN_PROGRESS; - - /* FIXME: clear out mime_list_whatever */ directory->details->mime_list_file = file; uri = nautilus_file_get_uri (file); mime_list_load (directory, uri); diff --git a/libnautilus-extensions/nautilus-directory-private.h b/libnautilus-extensions/nautilus-directory-private.h index c7b42cd1c..4b685b781 100644 --- a/libnautilus-extensions/nautilus-directory-private.h +++ b/libnautilus-extensions/nautilus-directory-private.h @@ -77,10 +77,15 @@ struct NautilusDirectoryDetails int confirmed_file_count; guint dequeue_pending_idle_id; + NautilusFile *load_directory_file; + int load_file_count; + GnomeVFSDirectoryFilter *load_file_count_filter; + GHashTable *load_mime_list_hash; + GList *get_file_infos_in_progress; /* list of GnomeVFSAsyncHandle * */ - GnomeVFSAsyncHandle *count_in_progress; NautilusFile *count_file; + GnomeVFSAsyncHandle *count_in_progress; NautilusFile *deep_count_file; GnomeVFSAsyncHandle *deep_count_in_progress; @@ -90,11 +95,11 @@ struct NautilusDirectoryDetails NautilusFile *mime_list_file; GnomeVFSAsyncHandle *mime_list_in_progress; - char *mime_list_uri; GnomeVFSDirectoryListPosition mime_list_last_handled; + GHashTable *mime_list_hash; - GnomeVFSAsyncHandle *get_info_in_progress; NautilusFile *get_info_file; + GnomeVFSAsyncHandle *get_info_in_progress; TopLeftTextReadState *top_left_read_state; ActivationURIReadState *activation_uri_read_state; diff --git a/libnautilus-extensions/nautilus-directory.h b/libnautilus-extensions/nautilus-directory.h index ef58b32e0..02b537a38 100644 --- a/libnautilus-extensions/nautilus-directory.h +++ b/libnautilus-extensions/nautilus-directory.h @@ -123,31 +123,31 @@ typedef struct } NautilusDirectoryClass; /* Basic GtkObject requirements. */ -GtkType nautilus_directory_get_type (void); +GtkType nautilus_directory_get_type (void); /* Get a directory given a uri. * Creates the appropriate subclass given the uri mappings. * Returns a referenced object, not a floating one. Unref when finished. * If two windows are viewing the same uri, the directory object is shared. */ -NautilusDirectory *nautilus_directory_get (const char *uri); +NautilusDirectory *nautilus_directory_get (const char *uri); /* Covers for gtk_object_ref and gtk_object_unref that provide two conveniences: * 1) You don't have to cast to GtkObject *, so using these is type safe. * 2) You are allowed to call these with NULL, */ -void nautilus_directory_ref (NautilusDirectory *directory); -void nautilus_directory_unref (NautilusDirectory *directory); +void nautilus_directory_ref (NautilusDirectory *directory); +void nautilus_directory_unref (NautilusDirectory *directory); /* Access to a URI. */ -char * nautilus_directory_get_uri (NautilusDirectory *directory); +char * nautilus_directory_get_uri (NautilusDirectory *directory); /* Is this file still alive and in this directory? */ -gboolean nautilus_directory_contains_file (NautilusDirectory *directory, - NautilusFile *file); +gboolean nautilus_directory_contains_file (NautilusDirectory *directory, + NautilusFile *file); /* Get (and ref) a NautilusFile object for this directory. */ -NautilusFile *nautilus_directory_get_corresponding_file (NautilusDirectory *directory); +NautilusFile * nautilus_directory_get_corresponding_file (NautilusDirectory *directory); /* Waiting for data that's read asynchronously. @@ -155,36 +155,35 @@ NautilusFile *nautilus_directory_get_corresponding_file (NautilusDirectory * If any file attributes or metadata keys are passed, it won't call * until all the files are seen. */ -void nautilus_directory_call_when_ready (NautilusDirectory *directory, - GList *file_attributes, - NautilusDirectoryCallback callback, - gpointer callback_data); -void nautilus_directory_cancel_callback (NautilusDirectory *directory, - NautilusDirectoryCallback callback, - gpointer callback_data); +void nautilus_directory_call_when_ready (NautilusDirectory *directory, + GList *file_attributes, + NautilusDirectoryCallback callback, + gpointer callback_data); +void nautilus_directory_cancel_callback (NautilusDirectory *directory, + NautilusDirectoryCallback callback, + gpointer callback_data); /* Monitor the files in a directory. */ -void nautilus_directory_file_monitor_add (NautilusDirectory *directory, - gconstpointer client, - GList *monitor_attributes, - gboolean force_reload); -void nautilus_directory_file_monitor_remove (NautilusDirectory *directory, - gconstpointer client); +void nautilus_directory_file_monitor_add (NautilusDirectory *directory, + gconstpointer client, + GList *monitor_attributes, + gboolean force_reload); +void nautilus_directory_file_monitor_remove (NautilusDirectory *directory, + gconstpointer client); /* Return true if the directory has information about all the files. * This will be false until the directory has been read at least once. */ -gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory); +gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory); /* Return true if the directory is local. */ -gboolean nautilus_directory_is_local (NautilusDirectory *directory); +gboolean nautilus_directory_is_local (NautilusDirectory *directory); /* Return false if directory contains anything besides a Nautilus metafile. * Only valid if directory is monitored. Used by the Trash monitor. */ -gboolean nautilus_directory_is_not_empty (NautilusDirectory *directory); +gboolean nautilus_directory_is_not_empty (NautilusDirectory *directory); +gboolean nautilus_directory_file_list_length_reached (NautilusDirectory *directory); - -gboolean nautilus_directory_file_list_length_reached (NautilusDirectory *directory); #endif /* NAUTILUS_DIRECTORY_H */ diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h index e4a083d6c..2f68e193b 100644 --- a/libnautilus-extensions/nautilus-file-private.h +++ b/libnautilus-extensions/nautilus-file-private.h @@ -32,6 +32,11 @@ struct NautilusFileDetails gboolean is_gone; char *name; + + /* Set by the NautilusDirectory while it's loading the file + * list so the file knows not to do redundant I/O. + */ + gboolean loading_directory; GnomeVFSFileInfo *info; gboolean get_info_failed; @@ -47,8 +52,7 @@ struct NautilusFileDetails guint deep_unreadable_count; GnomeVFSFileSize deep_size; - /* if this is a directory, the list of mime-types in it */ - NautilusRequestStatus mime_list_status; + /* If this is a directory, the list of MIME types in it. */ GList *mime_list; gboolean got_mime_list; gboolean mime_list_failed; diff --git a/libnautilus-extensions/nautilus-glib-extensions.c b/libnautilus-extensions/nautilus-glib-extensions.c index 2c499ddf4..5f2f39e08 100644 --- a/libnautilus-extensions/nautilus-glib-extensions.c +++ b/libnautilus-extensions/nautilus-glib-extensions.c @@ -877,7 +877,6 @@ nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, g_list_free (flattened.values); } - gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer key, GFunc key_free_func, gpointer key_free_data, @@ -888,14 +887,15 @@ nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer /* It would sure be nice if we could do this with a single lookup. */ - if (g_hash_table_lookup_extended (hash_table, key, &key_in_table, &value)) { + if (g_hash_table_lookup_extended (hash_table, key, + &key_in_table, &value)) { g_hash_table_remove (hash_table, key); if (key_free_func != NULL) { - key_free_func (key_in_table, key_free_data); + (* key_free_func) (key_in_table, key_free_data); } /* handle key == value, don't double free */ if (value_free_func != NULL && value != key_in_table) { - value_free_func (value, value_free_data); + (* value_free_func) (value, value_free_data); } return TRUE; } else { @@ -906,7 +906,8 @@ nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, gconstpointer key) { - return nautilus_g_hash_table_remove_deep_custom (hash_table, key, (GFunc) g_free, NULL, (GFunc) g_free, NULL); + return nautilus_g_hash_table_remove_deep_custom + (hash_table, key, (GFunc) g_free, NULL, (GFunc) g_free, NULL); } typedef struct { @@ -917,17 +918,18 @@ typedef struct { } HashTableFreeFuncs; static gboolean -nautilus_g_hash_table_destroy_deep_helper (gpointer key, gpointer value, gpointer data) +destroy_deep_helper (gpointer key, gpointer value, gpointer data) { HashTableFreeFuncs *free_funcs; + free_funcs = (HashTableFreeFuncs *) data; if (free_funcs->key_free_func != NULL) { - free_funcs->key_free_func (key, free_funcs->key_free_data); + (* free_funcs->key_free_func) (key, free_funcs->key_free_data); } /* handle key == value, don't double free */ if (free_funcs->value_free_func != NULL && value != key) { - free_funcs->value_free_func (value, free_funcs->value_free_data); + (* free_funcs->value_free_func) (value, free_funcs->value_free_data); } return TRUE; } @@ -946,7 +948,7 @@ nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, free_funcs.value_free_func = value_free_func; free_funcs.value_free_data = value_free_data; - g_hash_table_foreach_remove (hash_table, nautilus_g_hash_table_destroy_deep_helper, &free_funcs); + g_hash_table_foreach_remove (hash_table, destroy_deep_helper, &free_funcs); g_hash_table_destroy (hash_table); } diff --git a/libnautilus-extensions/nautilus-glib-extensions.h b/libnautilus-extensions/nautilus-glib-extensions.h index 9357e8879..eedc97762 100644 --- a/libnautilus-extensions/nautilus-glib-extensions.h +++ b/libnautilus-extensions/nautilus-glib-extensions.h @@ -102,27 +102,26 @@ void nautilus_g_string_append_len (GString int length); /* GHashTable functions */ -GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function, - GCompareFunc key_compare_function, - const char *display_name); -void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, - GHFunc callback, - gpointer callback_data); -gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, - gconstpointer key, - GFunc key_free_func, - gpointer key_free_data, - GFunc value_free_func, - gpointer value_free_data); -gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, - gconstpointer key); -void nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, - GFunc key_free_func, - gpointer key_free_data, - GFunc value_free_func, - gpointer value_free_data); -void nautilus_g_hash_table_destroy_deep (GHashTable *hash_table); - +GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function, + GCompareFunc key_compare_function, + const char *display_name); +void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, + GHFunc callback, + gpointer callback_data); +gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, + gconstpointer key, + GFunc key_free_func, + gpointer key_free_data, + GFunc value_free_func, + gpointer value_free_data); +gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, + gconstpointer key); +void nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, + GFunc key_free_func, + gpointer key_free_data, + GFunc value_free_func, + gpointer value_free_data); +void nautilus_g_hash_table_destroy_deep (GHashTable *hash_table); /* GPtrArray functions */ GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list); diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index df114f959..7ebb3b8e6 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -34,6 +34,7 @@ #include "nautilus-link.h" #include "nautilus-search-uri.h" #include "nautilus-string.h" +#include <ctype.h> #include <gnome-xml/parser.h> #include <gnome-xml/xmlmemory.h> #include <gtk/gtkmain.h> @@ -127,6 +128,72 @@ static gboolean request_is_satisfied (NautilusDirectory *directory, NautilusFile *file, Request *request); +/* Some helpers for case-insensitive strings. + * Move to nautilus-glib-extensions? + */ + +static gboolean +istr_equal (gconstpointer v, gconstpointer v2) +{ + return g_strcasecmp (v, v2) == 0; +} + +static guint +istr_hash (gconstpointer key) +{ + const char *p; + guint h; + + h = 0; + for (p = key; *p != '\0'; p++) { + h = (h << 5) - h + tolower ((guchar) *p); + } + + return h; +} + +static GHashTable * +istr_set_new (void) +{ + return g_hash_table_new (istr_hash, istr_equal); +} + +static void +istr_set_insert (GHashTable *table, const char *istr) +{ + char *key; + + if (g_hash_table_lookup (table, istr) == NULL) { + key = g_strdup (istr); + g_hash_table_insert (table, key, key); + } +} + +static void +add_istr_to_list (gpointer key, gpointer value, gpointer callback_data) +{ + GList **list; + + list = callback_data; + *list = g_list_prepend (*list, g_strdup (key)); +} + +static GList * +istr_set_get_as_list (GHashTable *table) +{ + GList *list; + + list = NULL; + g_hash_table_foreach (table, add_istr_to_list, &list); + return list; +} + +static void +istr_set_destroy (GHashTable *table) +{ + nautilus_g_hash_table_destroy_deep (table); +} + /* Start a job. This is really just a way of limiting the number of * async. requests that we issue at any given time. Without this, the * number of requests is unbounded. @@ -296,11 +363,11 @@ mime_list_cancel (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (directory->details->mime_list_file)); gnome_vfs_async_cancel (directory->details->mime_list_in_progress); + istr_set_destroy (directory->details->mime_list_hash); directory->details->mime_list_file = NULL; directory->details->mime_list_in_progress = NULL; - g_free (directory->details->mime_list_uri); - directory->details->mime_list_uri = NULL; + directory->details->mime_list_hash = NULL; async_job_end (directory, "MIME list"); } @@ -1059,32 +1126,14 @@ nautilus_compare_file_with_name (gconstpointer a, gconstpointer b) (const char *) b); } -static gboolean -update_file_info_in_list_if_needed (GList *list, - GnomeVFSFileInfo *file_info) -{ - GList *list_entry; - - list_entry = g_list_find_custom (list, - (gpointer) file_info->name, - nautilus_compare_file_with_name); - if (list_entry == NULL) { - /* the file is not in the list yet */ - return FALSE; - } - - /* the file is in the list already update the file info if needed */ - nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info); - - return TRUE; -} - static void set_file_unconfirmed (NautilusFile *file, gboolean unconfirmed) { NautilusDirectory *directory; g_assert (NAUTILUS_IS_FILE (file)); + g_assert (unconfirmed == FALSE || unconfirmed == TRUE); + if (file->details->unconfirmed == unconfirmed) { return; } @@ -1093,12 +1142,49 @@ set_file_unconfirmed (NautilusFile *file, gboolean unconfirmed) directory = file->details->directory; if (unconfirmed) { directory->details->confirmed_file_count--; - } - else { + } else { directory->details->confirmed_file_count++; } } +static GnomeVFSDirectoryFilterOptions +get_filter_options_for_directory_count (void) +{ + GnomeVFSDirectoryFilterOptions filter_options; + + filter_options = GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR + | GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR; + + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE)) { + filter_options |= GNOME_VFS_DIRECTORY_FILTER_NODOTFILES; + } + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE)) { + filter_options |= GNOME_VFS_DIRECTORY_FILTER_NOBACKUPFILES; + } + + return filter_options; +} + +static void +load_directory_done (NautilusDirectory *directory) +{ + istr_set_destroy (directory->details->load_mime_list_hash); + directory->details->load_mime_list_hash = NULL; + + directory->details->load_directory_file->details->loading_directory = FALSE; + + if (directory->details->load_directory_file->details->directory != directory) { + nautilus_directory_async_state_changed (directory->details->load_directory_file->details->directory); + } + + nautilus_file_unref (directory->details->load_directory_file); + directory->details->load_directory_file = NULL; + + gnome_vfs_directory_filter_destroy (directory->details->load_file_count_filter); + directory->details->load_file_count_filter = NULL; + + nautilus_directory_async_state_changed (directory); +} static gboolean dequeue_pending_idle_callback (gpointer callback_data) @@ -1120,8 +1206,7 @@ dequeue_pending_idle_callback (gpointer callback_data) /* If we are no longer monitoring, then throw away these. */ if (!nautilus_directory_is_file_list_monitored (directory)) { gnome_vfs_file_info_list_free (pending_file_info); - - nautilus_directory_async_state_changed (directory); + load_directory_done (directory); return FALSE; } @@ -1133,6 +1218,16 @@ dequeue_pending_idle_callback (gpointer callback_data) for (node = pending_file_info; node != NULL; node = node->next) { file_info = node->data; + /* Update the file count. */ + if (gnome_vfs_directory_filter_apply (directory->details->load_file_count_filter, + file_info)) { + directory->details->load_file_count += 1; + } + + /* Add the MIME type to the set. */ + istr_set_insert (directory->details->load_mime_list_hash, + file_info->mime_type); + /* check if the file already exists */ file = nautilus_directory_find_file (directory, file_info->name); if (file != NULL) { @@ -1145,7 +1240,7 @@ dequeue_pending_idle_callback (gpointer callback_data) } nautilus_file_ref (file); saw_again_files = g_list_prepend (saw_again_files, file); - } else if (!update_file_info_in_list_if_needed (pending_files, file_info)) { + } else { /* new file, create a nautilus file object and add it to the list */ file = nautilus_file_new_from_info (directory, file_info); pending_files = g_list_prepend (pending_files, file); @@ -1157,8 +1252,9 @@ dequeue_pending_idle_callback (gpointer callback_data) * files are gone. */ if (directory->details->directory_loaded) { - for (node = directory->details->file_list; node != NULL; node = next) { - file = node->data; + for (node = directory->details->file_list; + node != NULL; node = next) { + file = NAUTILUS_FILE (node->data); next = node->next; if (file->details->unconfirmed) { @@ -1187,10 +1283,20 @@ dequeue_pending_idle_callback (gpointer callback_data) nautilus_directory_emit_files_added (directory, added_files); nautilus_file_list_free (added_files); - /* Send the done_loading signal. */ if (directory->details->directory_loaded && !directory->details->directory_loaded_sent_notification) { + /* Send the done_loading signal. */ nautilus_directory_emit_done_loading (directory); + + directory->details->load_directory_file->details->got_directory_count = TRUE; + directory->details->load_directory_file->details->directory_count = directory->details->load_file_count; + + directory->details->load_directory_file->details->got_mime_list = TRUE; + directory->details->load_directory_file->details->mime_list = istr_set_get_as_list + (directory->details->load_mime_list_hash); + + load_directory_done (directory); + directory->details->directory_loaded_sent_notification = TRUE; } @@ -1215,6 +1321,8 @@ directory_load_one (NautilusDirectory *directory, if (info == NULL) { return; } + + /* Arrange for the "loading" part of the work. */ gnome_vfs_file_info_ref (info); directory->details->pending_file_info = g_list_prepend (directory->details->pending_file_info, info); @@ -1248,7 +1356,8 @@ directory_load_done (NautilusDirectory *directory, * they won't be marked "gone" later -- we don't know enough * about them to know whether they are really gone. */ - for (node = directory->details->file_list; node != NULL; node = node->next) { + for (node = directory->details->file_list; + node != NULL; node = node->next) { set_file_unconfirmed (NAUTILUS_FILE (node->data), FALSE); } } @@ -1527,8 +1636,8 @@ directory_count_callback (GnomeVFSAsyncHandle *handle, if (result != GNOME_VFS_ERROR_EOF) { count_file->details->directory_count_failed = TRUE; } else { - count_file->details->directory_count = entries_read; count_file->details->got_directory_count = TRUE; + count_file->details->directory_count = entries_read; } directory->details->count_file = NULL; directory->details->count_in_progress = NULL; @@ -1670,6 +1779,13 @@ lacks_directory_count (NautilusFile *file) } static gboolean +should_get_directory_count (NautilusFile *file) +{ + return lacks_directory_count (file) + && !file->details->loading_directory; +} + +static gboolean wants_directory_count (const Request *request) { return request->directory_count; @@ -1720,7 +1836,15 @@ static gboolean lacks_mime_list (NautilusFile *file) { return nautilus_file_is_directory (file) - && file->details->got_mime_list == FALSE; + && !file->details->got_mime_list + && !file->details->mime_list_failed; +} + +static gboolean +should_get_mime_list (NautilusFile *file) +{ + return lacks_mime_list (file) + && !file->details->loading_directory; } static gboolean @@ -1819,7 +1943,8 @@ call_ready_callbacks (NautilusDirectory *directory) called_any = FALSE; while (1) { /* Check if any callbacks are satisifed and call them if they are. */ - for (node = directory->details->call_when_ready_list; node != NULL; node = next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = next) { next = node->next; callback = node->data; @@ -1849,14 +1974,16 @@ nautilus_directory_is_anyone_monitoring_file_list (NautilusDirectory *directory) ReadyCallback *callback; Monitor *monitor; - for (node = directory->details->call_when_ready_list; node != NULL; node = node->next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = node->next) { callback = node->data; if (callback->request.file_list) { return TRUE; } } - for (node = directory->details->monitor_list; node != NULL; node = node->next) { + for (node = directory->details->monitor_list; + node != NULL; node = node->next) { monitor = node->data; if (monitor->request.file_list) { return TRUE; @@ -1909,7 +2036,17 @@ start_monitoring_file_list (NautilusDirectory *directory) g_assert (directory->details->uri != NULL); directory->details->directory_load_list_last_handled = GNOME_VFS_DIRECTORY_LIST_POSITION_NONE; -#ifdef DEBUG_LOAD_DIRECTORY + directory->details->load_file_count = 0; + directory->details->load_directory_file = + nautilus_directory_get_corresponding_file (directory); + directory->details->load_directory_file->details->loading_directory = TRUE; + directory->details->load_file_count = 0; + directory->details->load_file_count_filter = gnome_vfs_directory_filter_new + (GNOME_VFS_DIRECTORY_FILTER_NONE, + get_filter_options_for_directory_count (), + NULL); + directory->details->load_mime_list_hash = istr_set_new (); +#ifdef DEBUG_LOAD_DIRECTORY g_message ("load_directory called to monitor file list of %s", directory->details->uri); #endif gnome_vfs_async_load_directory @@ -1979,13 +2116,10 @@ nautilus_directory_invalidate_counts (NautilusDirectory *directory) file->details->got_mime_list = FALSE; file->details->mime_list_failed = FALSE; - if (parent_directory != directory) { - nautilus_directory_async_state_changed (parent_directory); - } - nautilus_file_unref (file); + + nautilus_directory_async_state_changed (parent_directory); } - nautilus_directory_async_state_changed (directory); } void @@ -2001,7 +2135,6 @@ nautilus_directory_force_reload (NautilusDirectory *directory) nautilus_directory_async_state_changed (directory); } - static gboolean is_needy (NautilusFile *file, FileCheck check_missing, @@ -2059,14 +2192,16 @@ select_needy_file (NautilusDirectory *directory, NautilusFile *file; /* Quick out if no one is interested. */ - for (node = directory->details->call_when_ready_list; node != NULL; node = node->next) { + for (node = directory->details->call_when_ready_list; + node != NULL; node = node->next) { callback = node->data; if ((* check_wanted) (&callback->request)) { break; } } if (node == NULL) { - for (node = directory->details->monitor_list; node != NULL; node = node->next) { + for (node = directory->details->monitor_list; + node != NULL; node = node->next) { monitor = node->data; if ((* check_wanted) (&monitor->request)) { break; @@ -2078,10 +2213,12 @@ select_needy_file (NautilusDirectory *directory, } /* Search for a file that has an unfulfilled request. */ - for (node = directory->details->file_list; node != NULL; node = node->next) { + for (node = directory->details->file_list; + node != NULL; node = node->next) { file = node->data; if ((* check_missing) (file)) { - for (node_2 = directory->details->call_when_ready_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->call_when_ready_list; + node_2 != NULL; node_2 = node_2->next) { callback = node_2->data; if ((callback->file == NULL || callback->file == file) && (* check_wanted) (&callback->request)) { @@ -2091,7 +2228,8 @@ select_needy_file (NautilusDirectory *directory, if (node_2 != NULL) { return file; } - for (node_2 = directory->details->monitor_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->monitor_list; + node_2 != NULL; node_2 = node_2->next) { monitor = node_2->data; if ((monitor->file == NULL || monitor->file == file) && (* check_wanted) (&monitor->request)) { @@ -2108,7 +2246,8 @@ select_needy_file (NautilusDirectory *directory, file = directory->details->as_file; if (file != NULL) { if ((* check_missing) (file)) { - for (node_2 = directory->details->call_when_ready_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->call_when_ready_list; + node_2 != NULL; node_2 = node_2->next) { callback = node_2->data; if (callback->file == file && (* check_wanted) (&callback->request)) { @@ -2118,7 +2257,8 @@ select_needy_file (NautilusDirectory *directory, if (node_2 != NULL) { return file; } - for (node_2 = directory->details->monitor_list; node_2 != NULL; node_2 = node_2->next) { + for (node_2 = directory->details->monitor_list; + node_2 != NULL; node_2 = node_2->next) { monitor = node_2->data; if (monitor->file == file && (* check_wanted) (&monitor->request)) { @@ -2134,28 +2274,6 @@ select_needy_file (NautilusDirectory *directory, return NULL; } - - -static GnomeVFSDirectoryFilterOptions -get_filter_options_for_directory_count (NautilusFile *file) -{ - GnomeVFSDirectoryFilterOptions filter_options; - - filter_options = GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR | - GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR; - - if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE)) { - filter_options |= GNOME_VFS_DIRECTORY_FILTER_NODOTFILES; - } - if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE)) { - filter_options |= GNOME_VFS_DIRECTORY_FILTER_NOBACKUPFILES; - } - - return filter_options; -} - - - static void directory_count_start (NautilusDirectory *directory) { @@ -2171,7 +2289,7 @@ directory_count_start (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (file)); g_assert (file->details->directory == directory); if (is_needy (file, - lacks_directory_count, + should_get_directory_count, wants_directory_count)) { return; } @@ -2183,7 +2301,7 @@ directory_count_start (NautilusDirectory *directory) /* Figure out which file to get a count for. */ file = select_needy_file (directory, - lacks_directory_count, + should_get_directory_count, wants_directory_count); if (file == NULL) { return; @@ -2206,7 +2324,7 @@ directory_count_start (NautilusDirectory *directory) NULL, FALSE, GNOME_VFS_DIRECTORY_FILTER_NONE, - get_filter_options_for_directory_count (file), + get_filter_options_for_directory_count (), NULL, G_MAXINT, directory_count_callback, @@ -2387,13 +2505,7 @@ static void mime_list_one (NautilusDirectory *directory, GnomeVFSFileInfo *info) { - NautilusFile *file; - - file = directory->details->mime_list_file; - - if (g_list_find_custom (file->details->mime_list, info->mime_type, (GCompareFunc) g_strcasecmp) == NULL) { - file->details->mime_list = g_list_prepend (file->details->mime_list, g_strdup (info->mime_type)); - } + istr_set_insert (directory->details->mime_list_hash, info->mime_type); } static void @@ -2431,20 +2543,20 @@ mime_list_callback (GnomeVFSAsyncHandle *handle, } /* Record either a failure or success. */ + nautilus_g_list_free_deep (file->details->mime_list); if (result != GNOME_VFS_ERROR_EOF) { file->details->mime_list_failed = TRUE; - nautilus_g_list_free_deep (file->details->mime_list); file->details->mime_list = NULL; - file->details->mime_list_status = NAUTILUS_REQUEST_NOT_STARTED; } else { file->details->got_mime_list = TRUE; - file->details->mime_list_status = NAUTILUS_REQUEST_DONE; + file->details->mime_list = istr_set_get_as_list + (directory->details->mime_list_hash); } + istr_set_destroy (directory->details->mime_list_hash); - g_free (directory->details->mime_list_uri); - directory->details->mime_list_uri = NULL; directory->details->mime_list_in_progress = NULL; directory->details->mime_list_file = NULL; + directory->details->mime_list_hash = NULL; /* Send file-changed even if getting the item type list * failed, so interested parties can distinguish between @@ -2460,10 +2572,9 @@ mime_list_callback (GnomeVFSAsyncHandle *handle, static void mime_list_load (NautilusDirectory *directory, const char *uri) { - g_assert (directory->details->mime_list_uri == NULL); - directory->details->mime_list_uri = g_strdup (uri); directory->details->mime_list_last_handled = GNOME_VFS_DIRECTORY_LIST_POSITION_NONE; + directory->details->mime_list_hash = istr_set_new (); #ifdef DEBUG_LOAD_DIRECTORY g_message ("load_directory called to get MIME list of %s", uri); #endif @@ -2477,7 +2588,7 @@ mime_list_load (NautilusDirectory *directory, const char *uri) (GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR | GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR), NULL, - G_MAXINT, + DIRECTORY_LOAD_ITEMS_PER_CALLBACK, mime_list_callback, directory); } @@ -2497,7 +2608,7 @@ mime_list_start (NautilusDirectory *directory) g_assert (NAUTILUS_IS_FILE (file)); g_assert (file->details->directory == directory); if (is_needy (file, - lacks_mime_list, + should_get_mime_list, wants_mime_list)) { return; } @@ -2509,7 +2620,7 @@ mime_list_start (NautilusDirectory *directory) /* Figure out which file to get a mime list for. */ file = select_needy_file (directory, - lacks_mime_list, + should_get_mime_list, wants_mime_list); if (file == NULL) { return; @@ -2519,10 +2630,6 @@ mime_list_start (NautilusDirectory *directory) return; } - /* Start counting. */ - file->details->mime_list_status = NAUTILUS_REQUEST_IN_PROGRESS; - - /* FIXME: clear out mime_list_whatever */ directory->details->mime_list_file = file; uri = nautilus_file_get_uri (file); mime_list_load (directory, uri); diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h index c7b42cd1c..4b685b781 100644 --- a/libnautilus-private/nautilus-directory-private.h +++ b/libnautilus-private/nautilus-directory-private.h @@ -77,10 +77,15 @@ struct NautilusDirectoryDetails int confirmed_file_count; guint dequeue_pending_idle_id; + NautilusFile *load_directory_file; + int load_file_count; + GnomeVFSDirectoryFilter *load_file_count_filter; + GHashTable *load_mime_list_hash; + GList *get_file_infos_in_progress; /* list of GnomeVFSAsyncHandle * */ - GnomeVFSAsyncHandle *count_in_progress; NautilusFile *count_file; + GnomeVFSAsyncHandle *count_in_progress; NautilusFile *deep_count_file; GnomeVFSAsyncHandle *deep_count_in_progress; @@ -90,11 +95,11 @@ struct NautilusDirectoryDetails NautilusFile *mime_list_file; GnomeVFSAsyncHandle *mime_list_in_progress; - char *mime_list_uri; GnomeVFSDirectoryListPosition mime_list_last_handled; + GHashTable *mime_list_hash; - GnomeVFSAsyncHandle *get_info_in_progress; NautilusFile *get_info_file; + GnomeVFSAsyncHandle *get_info_in_progress; TopLeftTextReadState *top_left_read_state; ActivationURIReadState *activation_uri_read_state; diff --git a/libnautilus-private/nautilus-directory.h b/libnautilus-private/nautilus-directory.h index ef58b32e0..02b537a38 100644 --- a/libnautilus-private/nautilus-directory.h +++ b/libnautilus-private/nautilus-directory.h @@ -123,31 +123,31 @@ typedef struct } NautilusDirectoryClass; /* Basic GtkObject requirements. */ -GtkType nautilus_directory_get_type (void); +GtkType nautilus_directory_get_type (void); /* Get a directory given a uri. * Creates the appropriate subclass given the uri mappings. * Returns a referenced object, not a floating one. Unref when finished. * If two windows are viewing the same uri, the directory object is shared. */ -NautilusDirectory *nautilus_directory_get (const char *uri); +NautilusDirectory *nautilus_directory_get (const char *uri); /* Covers for gtk_object_ref and gtk_object_unref that provide two conveniences: * 1) You don't have to cast to GtkObject *, so using these is type safe. * 2) You are allowed to call these with NULL, */ -void nautilus_directory_ref (NautilusDirectory *directory); -void nautilus_directory_unref (NautilusDirectory *directory); +void nautilus_directory_ref (NautilusDirectory *directory); +void nautilus_directory_unref (NautilusDirectory *directory); /* Access to a URI. */ -char * nautilus_directory_get_uri (NautilusDirectory *directory); +char * nautilus_directory_get_uri (NautilusDirectory *directory); /* Is this file still alive and in this directory? */ -gboolean nautilus_directory_contains_file (NautilusDirectory *directory, - NautilusFile *file); +gboolean nautilus_directory_contains_file (NautilusDirectory *directory, + NautilusFile *file); /* Get (and ref) a NautilusFile object for this directory. */ -NautilusFile *nautilus_directory_get_corresponding_file (NautilusDirectory *directory); +NautilusFile * nautilus_directory_get_corresponding_file (NautilusDirectory *directory); /* Waiting for data that's read asynchronously. @@ -155,36 +155,35 @@ NautilusFile *nautilus_directory_get_corresponding_file (NautilusDirectory * If any file attributes or metadata keys are passed, it won't call * until all the files are seen. */ -void nautilus_directory_call_when_ready (NautilusDirectory *directory, - GList *file_attributes, - NautilusDirectoryCallback callback, - gpointer callback_data); -void nautilus_directory_cancel_callback (NautilusDirectory *directory, - NautilusDirectoryCallback callback, - gpointer callback_data); +void nautilus_directory_call_when_ready (NautilusDirectory *directory, + GList *file_attributes, + NautilusDirectoryCallback callback, + gpointer callback_data); +void nautilus_directory_cancel_callback (NautilusDirectory *directory, + NautilusDirectoryCallback callback, + gpointer callback_data); /* Monitor the files in a directory. */ -void nautilus_directory_file_monitor_add (NautilusDirectory *directory, - gconstpointer client, - GList *monitor_attributes, - gboolean force_reload); -void nautilus_directory_file_monitor_remove (NautilusDirectory *directory, - gconstpointer client); +void nautilus_directory_file_monitor_add (NautilusDirectory *directory, + gconstpointer client, + GList *monitor_attributes, + gboolean force_reload); +void nautilus_directory_file_monitor_remove (NautilusDirectory *directory, + gconstpointer client); /* Return true if the directory has information about all the files. * This will be false until the directory has been read at least once. */ -gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory); +gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory); /* Return true if the directory is local. */ -gboolean nautilus_directory_is_local (NautilusDirectory *directory); +gboolean nautilus_directory_is_local (NautilusDirectory *directory); /* Return false if directory contains anything besides a Nautilus metafile. * Only valid if directory is monitored. Used by the Trash monitor. */ -gboolean nautilus_directory_is_not_empty (NautilusDirectory *directory); +gboolean nautilus_directory_is_not_empty (NautilusDirectory *directory); +gboolean nautilus_directory_file_list_length_reached (NautilusDirectory *directory); - -gboolean nautilus_directory_file_list_length_reached (NautilusDirectory *directory); #endif /* NAUTILUS_DIRECTORY_H */ diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h index e4a083d6c..2f68e193b 100644 --- a/libnautilus-private/nautilus-file-private.h +++ b/libnautilus-private/nautilus-file-private.h @@ -32,6 +32,11 @@ struct NautilusFileDetails gboolean is_gone; char *name; + + /* Set by the NautilusDirectory while it's loading the file + * list so the file knows not to do redundant I/O. + */ + gboolean loading_directory; GnomeVFSFileInfo *info; gboolean get_info_failed; @@ -47,8 +52,7 @@ struct NautilusFileDetails guint deep_unreadable_count; GnomeVFSFileSize deep_size; - /* if this is a directory, the list of mime-types in it */ - NautilusRequestStatus mime_list_status; + /* If this is a directory, the list of MIME types in it. */ GList *mime_list; gboolean got_mime_list; gboolean mime_list_failed; diff --git a/libnautilus-private/nautilus-glib-extensions.c b/libnautilus-private/nautilus-glib-extensions.c index 2c499ddf4..5f2f39e08 100644 --- a/libnautilus-private/nautilus-glib-extensions.c +++ b/libnautilus-private/nautilus-glib-extensions.c @@ -877,7 +877,6 @@ nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, g_list_free (flattened.values); } - gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer key, GFunc key_free_func, gpointer key_free_data, @@ -888,14 +887,15 @@ nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer /* It would sure be nice if we could do this with a single lookup. */ - if (g_hash_table_lookup_extended (hash_table, key, &key_in_table, &value)) { + if (g_hash_table_lookup_extended (hash_table, key, + &key_in_table, &value)) { g_hash_table_remove (hash_table, key); if (key_free_func != NULL) { - key_free_func (key_in_table, key_free_data); + (* key_free_func) (key_in_table, key_free_data); } /* handle key == value, don't double free */ if (value_free_func != NULL && value != key_in_table) { - value_free_func (value, value_free_data); + (* value_free_func) (value, value_free_data); } return TRUE; } else { @@ -906,7 +906,8 @@ nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, gconstpointer key) { - return nautilus_g_hash_table_remove_deep_custom (hash_table, key, (GFunc) g_free, NULL, (GFunc) g_free, NULL); + return nautilus_g_hash_table_remove_deep_custom + (hash_table, key, (GFunc) g_free, NULL, (GFunc) g_free, NULL); } typedef struct { @@ -917,17 +918,18 @@ typedef struct { } HashTableFreeFuncs; static gboolean -nautilus_g_hash_table_destroy_deep_helper (gpointer key, gpointer value, gpointer data) +destroy_deep_helper (gpointer key, gpointer value, gpointer data) { HashTableFreeFuncs *free_funcs; + free_funcs = (HashTableFreeFuncs *) data; if (free_funcs->key_free_func != NULL) { - free_funcs->key_free_func (key, free_funcs->key_free_data); + (* free_funcs->key_free_func) (key, free_funcs->key_free_data); } /* handle key == value, don't double free */ if (free_funcs->value_free_func != NULL && value != key) { - free_funcs->value_free_func (value, free_funcs->value_free_data); + (* free_funcs->value_free_func) (value, free_funcs->value_free_data); } return TRUE; } @@ -946,7 +948,7 @@ nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, free_funcs.value_free_func = value_free_func; free_funcs.value_free_data = value_free_data; - g_hash_table_foreach_remove (hash_table, nautilus_g_hash_table_destroy_deep_helper, &free_funcs); + g_hash_table_foreach_remove (hash_table, destroy_deep_helper, &free_funcs); g_hash_table_destroy (hash_table); } diff --git a/libnautilus-private/nautilus-glib-extensions.h b/libnautilus-private/nautilus-glib-extensions.h index 9357e8879..eedc97762 100644 --- a/libnautilus-private/nautilus-glib-extensions.h +++ b/libnautilus-private/nautilus-glib-extensions.h @@ -102,27 +102,26 @@ void nautilus_g_string_append_len (GString int length); /* GHashTable functions */ -GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function, - GCompareFunc key_compare_function, - const char *display_name); -void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, - GHFunc callback, - gpointer callback_data); -gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, - gconstpointer key, - GFunc key_free_func, - gpointer key_free_data, - GFunc value_free_func, - gpointer value_free_data); -gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, - gconstpointer key); -void nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, - GFunc key_free_func, - gpointer key_free_data, - GFunc value_free_func, - gpointer value_free_data); -void nautilus_g_hash_table_destroy_deep (GHashTable *hash_table); - +GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function, + GCompareFunc key_compare_function, + const char *display_name); +void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, + GHFunc callback, + gpointer callback_data); +gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, + gconstpointer key, + GFunc key_free_func, + gpointer key_free_data, + GFunc value_free_func, + gpointer value_free_data); +gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table, + gconstpointer key); +void nautilus_g_hash_table_destroy_deep_custom (GHashTable *hash_table, + GFunc key_free_func, + gpointer key_free_data, + GFunc value_free_func, + gpointer value_free_data); +void nautilus_g_hash_table_destroy_deep (GHashTable *hash_table); /* GPtrArray functions */ GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list); diff --git a/nautilus-installer/src/Makefile.am b/nautilus-installer/src/Makefile.am index 7e4b907a3..fc256239d 100644 --- a/nautilus-installer/src/Makefile.am +++ b/nautilus-installer/src/Makefile.am @@ -13,13 +13,11 @@ INCLUDES = \ $(GNOME_INCLUDEDIR) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DG_LOG_DOMAIN=\"Nautilus-Installer\" \ + -DEAZEL_INSTALL_NO_CORBA \ + -DEAZEL_INSTALL_SLIM \ + -DNO_TEXT_BOX \ $(NULL) -CPPFLAGS = -DEAZEL_INSTALL_NO_CORBA -DEAZEL_INSTALL_SLIM -DNO_TEXT_BOX - -CFLAGS = -g -##LDFLAGS = -static - bin_PROGRAMS = eazel-installer eazel_installer_SOURCES = \ diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 4617c348d..c84cba819 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -4324,7 +4324,7 @@ filtering_changed_callback (gpointer callback_data) directory_view->details->show_backup_files = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE); - + /* Reload the current uri so that the filtering changes take place. */ if (directory_view->details->model != NULL) { load_directory (directory_view, |