Commit 5c8338b8 authored by Maciej Stachowiak's avatar Maciej Stachowiak
Browse files

Add VFS_CFLAGS

	* components/tree/Makefile.am: Add VFS_CFLAGS

	* components/tree/main.c (main): Initialize more libraries.

	* components/tree/nautilus-tree-view.h,
	components/tree/nautilus-tree-view.c: Many changes. The upshot is
	that basic tree loading now works, but many details remain to be
	fleshed out (individual bugs were filed on these).

	* libnautilus-extensions/nautilus-directory-async.c:
	(dequeue_pending_idle_callback), (directory_load_done): Try to
	emit done signal exactly once when a monitor load is complete. But
	I think this might be questionable, see below.

	* libnautilus-extensions/nautilus-directory-private.h,
	libnautilus-extensions/nautilus-directory.h,
	libnautilus-extensions/nautilus-directory.c: Add the
	"done_loading" signal for when a load initiated by monitoring is
	done. I just realized this does the wrong thing when more than one
	thing is monitoring at the same time (both get the signal), so
	maybe it should be changed to a callback function passed to
	nautilus_file_monitor_add, but that would be harder to implement.

	(nautilus_directory_emit_done_loading): Function so the async code
	can emit it.
parent 1bee70c4
2000-06-29 Maciej Stachowiak <mjs@eazel.com>
* components/tree/Makefile.am: Add VFS_CFLAGS
* components/tree/main.c (main): Initialize more libraries.
* components/tree/nautilus-tree-view.h,
components/tree/nautilus-tree-view.c: Many changes. The upshot is
that basic tree loading now works, but many details remain to be
fleshed out (individual bugs were filed on these).
* libnautilus-extensions/nautilus-directory-async.c:
(dequeue_pending_idle_callback), (directory_load_done): Try to
emit done signal exactly once when a monitor load is complete. But
I think this might be questionable, see below.
* libnautilus-extensions/nautilus-directory-private.h,
libnautilus-extensions/nautilus-directory.h,
libnautilus-extensions/nautilus-directory.c: Add the
"done_loading" signal for when a load initiated by monitoring is
done. I just realized this does the wrong thing when more than one
thing is monitoring at the same time (both get the signal), so
maybe it should be changed to a callback function passed to
nautilus_file_monitor_add, but that would be harder to implement.
(nautilus_directory_emit_done_loading): Function so the async code
can emit it.
2000-06-29 Ramiro Estrugo <ramiro@eazel.com>
* components/mozilla/Makefile.am:
......
......@@ -27,3 +27,5 @@ SUBDIRS = \
$(RPMVIEW_COMPONENT_SUBDIRS) \
$(MOZILLA_COMPONENT_SUBDIRS) \
$(NULL)
CPPFLAGS = \
-DPREFIX=\"$(prefix)\"
-DPREFIX=\"$(prefix)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DG_LOG_DOMAIN=\"Nautilus-Tree\"
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(VFS_CFLAGS) \
$(GCONF_CFLAGS) \
$(GNOMEUI_CFLAGS) \
$(WERROR)
......
......@@ -28,9 +28,13 @@
#include "nautilus-tree-view.h"
#include <gnome.h>
#include <libnautilus-extensions/nautilus-debug.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-init.h>
#include <liboaf/liboaf.h>
#include <bonobo.h>
#include <libgnomevfs/gnome-vfs.h>
static int object_count = 0;
......@@ -72,10 +76,37 @@ main (int argc, char *argv[])
CORBA_ORB orb;
BonoboGenericFactory *factory;
puts ("XXX: In tree component.");
/* Make criticals and warnings stop in the debugger if NAUTILUS_DEBUG is set.
* Unfortunately, this has to be done explicitly for each domain.
*/
if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
nautilus_make_warnings_and_criticals_stop_in_debugger
(G_LOG_DOMAIN, g_log_domain_glib, "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo", NULL);
}
/* Initialize gettext support */
#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
#endif
/* Initialize the services that we use. */
g_thread_init (NULL);
gnome_init_with_popt_table("nautilus-tree-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
gnome_init_with_popt_table ("nautilus-tree-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
gnome_vfs_init ();
bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
factory = bonobo_generic_factory_new_multi
......
This diff is collapsed.
......@@ -30,6 +30,7 @@
#define NAUTILUS_TREE_VIEW_H
#include <libnautilus/nautilus-view.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkctree.h>
typedef struct NautilusTreeView NautilusTreeView;
......@@ -44,12 +45,12 @@ typedef struct NautilusTreeViewClass NautilusTreeViewClass;
typedef struct NautilusTreeViewDetails NautilusTreeViewDetails;
struct NautilusTreeView {
GtkCTree parent;
GtkScrolledWindow parent;
NautilusTreeViewDetails *details;
};
struct NautilusTreeViewClass {
GtkCTreeClass parent_class;
GtkScrolledWindowClass parent_class;
};
/* GtkObject support */
......
......@@ -654,11 +654,17 @@ dequeue_pending_idle_callback (gpointer callback_data)
pending_file_info = directory->details->pending_file_info;
directory->details->pending_file_info = NULL;
if (pending_file_info == NULL) {
puts ("pending file info is NULL!");
}
#if 0
/* Don't emit a signal if there are no new files. */
if (pending_file_info == NULL) {
nautilus_directory_async_state_changed (directory);
return FALSE;
}
#endif
/* If we are no longer monitoring, then throw away these. */
if (!nautilus_directory_is_file_list_monitored (directory)) {
......@@ -730,6 +736,12 @@ dequeue_pending_idle_callback (gpointer callback_data)
directory->details->files = g_list_concat
(directory->details->files, pending_files);
if (directory->details->directory_loaded &&
!directory->details->directory_loaded_sent_notification) {
nautilus_directory_emit_done_loading (directory);
directory->details->directory_loaded_sent_notification = TRUE;
}
nautilus_directory_async_state_changed (directory);
return FALSE;
}
......@@ -771,6 +783,8 @@ directory_load_done (NautilusDirectory *directory,
{
cancel_directory_load (directory);
directory->details->directory_loaded = TRUE;
directory->details->directory_loaded_sent_notification = FALSE;
/* Call the idle function right away. */
if (directory->details->dequeue_pending_idle_id != 0) {
......
......@@ -66,6 +66,7 @@ struct NautilusDirectoryDetails
gboolean file_list_monitored;
gboolean directory_loaded;
gboolean directory_loaded_sent_notification;
GnomeVFSAsyncHandle *directory_load_in_progress;
GnomeVFSDirectoryListPosition directory_load_list_last_handled;
......@@ -150,6 +151,8 @@ void nautilus_directory_emit_files_added (NautilusDirectory
GList *added_files);
void nautilus_directory_emit_files_changed (NautilusDirectory *directory,
GList *changed_files);
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
/* debugging functions */
int nautilus_directory_number_outstanding (void);
......
......@@ -40,6 +40,7 @@ enum {
FILES_ADDED,
FILES_CHANGED,
METADATA_CHANGED,
DONE_LOADING,
LAST_SIGNAL
};
......@@ -100,6 +101,13 @@ nautilus_directory_initialize_class (gpointer klass)
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, metadata_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[DONE_LOADING] =
gtk_signal_new ("done_loading",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, done_loading),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
......@@ -508,6 +516,14 @@ nautilus_directory_emit_metadata_changed (NautilusDirectory *directory)
directory->details->files);
}
void
nautilus_directory_emit_done_loading (NautilusDirectory *directory)
{
gtk_signal_emit (GTK_OBJECT (directory),
signals[DONE_LOADING]);
}
static char *
uri_get_directory_part (const char *uri)
{
......
......@@ -202,6 +202,16 @@ struct NautilusDirectoryClass
* result in calls to files_changed.
*/
void (* metadata_changed) (NautilusDirectory *directory);
/* The done_loading signal is emitted when a directory load
* request completes. This is needed because, at least in the
* case where the directory is empty, the caller will receive
* no kind of notification at all when a directory load
* initiated by `nautilus_directory_file_monitor_add' completes.
*/
void (* done_loading) (NautilusDirectory *directory);
};
#endif /* NAUTILUS_DIRECTORY_H */
......@@ -654,11 +654,17 @@ dequeue_pending_idle_callback (gpointer callback_data)
pending_file_info = directory->details->pending_file_info;
directory->details->pending_file_info = NULL;
if (pending_file_info == NULL) {
puts ("pending file info is NULL!");
}
#if 0
/* Don't emit a signal if there are no new files. */
if (pending_file_info == NULL) {
nautilus_directory_async_state_changed (directory);
return FALSE;
}
#endif
/* If we are no longer monitoring, then throw away these. */
if (!nautilus_directory_is_file_list_monitored (directory)) {
......@@ -730,6 +736,12 @@ dequeue_pending_idle_callback (gpointer callback_data)
directory->details->files = g_list_concat
(directory->details->files, pending_files);
if (directory->details->directory_loaded &&
!directory->details->directory_loaded_sent_notification) {
nautilus_directory_emit_done_loading (directory);
directory->details->directory_loaded_sent_notification = TRUE;
}
nautilus_directory_async_state_changed (directory);
return FALSE;
}
......@@ -771,6 +783,8 @@ directory_load_done (NautilusDirectory *directory,
{
cancel_directory_load (directory);
directory->details->directory_loaded = TRUE;
directory->details->directory_loaded_sent_notification = FALSE;
/* Call the idle function right away. */
if (directory->details->dequeue_pending_idle_id != 0) {
......
......@@ -66,6 +66,7 @@ struct NautilusDirectoryDetails
gboolean file_list_monitored;
gboolean directory_loaded;
gboolean directory_loaded_sent_notification;
GnomeVFSAsyncHandle *directory_load_in_progress;
GnomeVFSDirectoryListPosition directory_load_list_last_handled;
......@@ -150,6 +151,8 @@ void nautilus_directory_emit_files_added (NautilusDirectory
GList *added_files);
void nautilus_directory_emit_files_changed (NautilusDirectory *directory,
GList *changed_files);
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
/* debugging functions */
int nautilus_directory_number_outstanding (void);
......
......@@ -40,6 +40,7 @@ enum {
FILES_ADDED,
FILES_CHANGED,
METADATA_CHANGED,
DONE_LOADING,
LAST_SIGNAL
};
......@@ -100,6 +101,13 @@ nautilus_directory_initialize_class (gpointer klass)
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, metadata_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[DONE_LOADING] =
gtk_signal_new ("done_loading",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, done_loading),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
......@@ -508,6 +516,14 @@ nautilus_directory_emit_metadata_changed (NautilusDirectory *directory)
directory->details->files);
}
void
nautilus_directory_emit_done_loading (NautilusDirectory *directory)
{
gtk_signal_emit (GTK_OBJECT (directory),
signals[DONE_LOADING]);
}
static char *
uri_get_directory_part (const char *uri)
{
......
......@@ -202,6 +202,16 @@ struct NautilusDirectoryClass
* result in calls to files_changed.
*/
void (* metadata_changed) (NautilusDirectory *directory);
/* The done_loading signal is emitted when a directory load
* request completes. This is needed because, at least in the
* case where the directory is empty, the caller will receive
* no kind of notification at all when a directory load
* initiated by `nautilus_directory_file_monitor_add' completes.
*/
void (* done_loading) (NautilusDirectory *directory);
};
#endif /* NAUTILUS_DIRECTORY_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment