GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 3c7ded1f authored by Rebecca Schulman's avatar Rebecca Schulman Committed by Rebecca Schulman

This change is the first part of the fix for bug 3920. The fix will allow

2000-11-15  Rebecca Schulman  <rebecka@eazel.com>
	This change is the first part of the fix for bug 3920.
	The fix will allow nautilus to tell a user that the
	search they have requested is newer than their index.
	This involved communicating errors that occurred while
	opening and reading the directory outside of the
	directory model to a view, which can react in a useful
	way.

	Reviewed by: John Sullivan <sullivan@eazel.com>

	* libnautilus-extensions/nautilus-directory-async.c:
	(directory_load_done):
	If the directory load did not complete successfully,
	emit an error signal

	* libnautilus-extensions/nautilus-directory-private.h:
	* libnautilus-extensions/nautilus-directory.h:
	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_initialize_class),
	(nautilus_directory_emit_load_error):
	Add the load error signal, and a cover function to
	emit the signal

	* src/file-manager/fm-directory-view.h:
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_initialize_class), (load_error_callback),
	(finish_loading_uri), (disconnect_model_handlers):
	Also add a load_error signal to the fm directory view class,
	so that subclasses can get information about errors particular
	to a type of directory, (in this case the search list view)
	and react correctly.

	* src/file-manager/fm-search-list-view.c: (load_error_callback),
	(fm_search_list_view_initialize):
	Handle the load error SERVICE_OBSOLETE, by displaying a dialog
	that tells the user that their index is too old for their
	search to work correctly, and gives them an option to reindex

	* src/file-manager/nautilus-indexing-info.c:
	(nautilus_indexing_info_request_reindex):
	* src/file-manager/nautilus-indexing-info.h:
	Add a cover function to medusa's request reindex function
	that the search list view calls.
parent 9bab1fad
2000-11-15 John Sullivan <sullivan@eazel.com>
2000-11-15 Rebecca Schulman <rebecka@eazel.com>
This change is the first part of the fix for bug 3920.
The fix will allow nautilus to tell a user that the
search they have requested is newer than their index.
This involved communicating errors that occurred while
opening and reading the directory outside of the
directory model to a view, which can react in a useful
way.
Reviewed by: John Sullivan <sullivan@eazel.com>
* libnautilus-extensions/nautilus-directory-async.c:
(directory_load_done):
If the directory load did not complete successfully,
emit an error signal
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory.h:
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_initialize_class),
(nautilus_directory_emit_load_error):
Add the load error signal, and a cover function to
emit the signal
* src/file-manager/fm-directory-view.h:
* src/file-manager/fm-directory-view.c:
(fm_directory_view_pop_up_selection_context_menu),
(fm_directory_view_pop_up_background_context_menu):
Enabled Bonobo context menus again, because Darin has
now checked in the fixes to Bonobo that make them work
properly. Let me know about any (new) context-menu bugs
you might run into.
(fm_directory_view_initialize_class), (load_error_callback),
(finish_loading_uri), (disconnect_model_handlers):
Also add a load_error signal to the fm directory view class,
so that subclasses can get information about errors particular
to a type of directory, (in this case the search list view)
and react correctly.
* src/file-manager/fm-search-list-view.c: (load_error_callback),
(fm_search_list_view_initialize):
Handle the load error SERVICE_OBSOLETE, by displaying a dialog
that tells the user that their index is too old for their
search to work correctly, and gives them an option to reindex
* src/file-manager/nautilus-indexing-info.c:
(nautilus_indexing_info_request_reindex):
* src/file-manager/nautilus-indexing-info.h:
Add a cover function to medusa's request reindex function
that the search list view calls.
2000-11-15 John Sullivan <sullivan@eazel.com>
......
......@@ -1366,6 +1366,9 @@ directory_load_done (NautilusDirectory *directory,
node != NULL; node = node->next) {
set_file_unconfirmed (NAUTILUS_FILE (node->data), FALSE);
}
nautilus_directory_emit_load_error (directory,
result);
}
/* Call the idle function right away. */
......
......@@ -158,6 +158,8 @@ void nautilus_directory_emit_files_changed (NautilusD
void nautilus_directory_emit_change_signals_deep (NautilusDirectory *directory,
GList *changed_files);
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
void nautilus_directory_emit_load_error (NautilusDirectory *directory,
GnomeVFSResult error_result);
NautilusDirectory *nautilus_directory_get_internal (const char *uri,
gboolean create);
char * nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory);
......
......@@ -45,6 +45,7 @@ enum {
FILES_ADDED,
FILES_CHANGED,
DONE_LOADING,
LOAD_ERROR,
LAST_SIGNAL
};
......@@ -106,7 +107,14 @@ nautilus_directory_initialize_class (NautilusDirectoryClass *klass)
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, done_loading),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[LOAD_ERROR] =
gtk_signal_new ("load_error",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, load_error),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
klass->get_name_for_self_as_new_file = real_get_name_for_self_as_new_file;
......@@ -593,7 +601,6 @@ nautilus_directory_file_list_length_reached (NautilusDirectory *directory)
return directory->details->confirmed_file_count >= NAUTILUS_DIRECTORY_FILE_LIST_HARD_LIMIT;
}
GList *
nautilus_directory_begin_file_name_change (NautilusDirectory *directory,
NautilusFile *file)
......@@ -696,6 +703,16 @@ nautilus_directory_emit_done_loading (NautilusDirectory *directory)
signals[DONE_LOADING]);
}
void
nautilus_directory_emit_load_error (NautilusDirectory *directory,
GnomeVFSResult error_result)
{
gtk_signal_emit (GTK_OBJECT (directory),
signals[LOAD_ERROR],
error_result);
}
static char *
uri_get_directory_part (const char *uri)
{
......
......@@ -26,6 +26,7 @@
#define NAUTILUS_DIRECTORY_H
#include <gtk/gtkobject.h>
#include <libgnomevfs/gnome-vfs-types.h>
/* NautilusDirectory is a class that manages the model for a directory,
real or virtual, for Nautilus, mainly the file-manager component. The directory is
......@@ -101,6 +102,8 @@ typedef struct
*/
void (* done_loading) (NautilusDirectory *directory);
void (* load_error) (NautilusDirectory *directory);
/*** Virtual functions for subclasses to override. ***/
gboolean (* contains_file) (NautilusDirectory *directory,
NautilusFile *file);
......
......@@ -1366,6 +1366,9 @@ directory_load_done (NautilusDirectory *directory,
node != NULL; node = node->next) {
set_file_unconfirmed (NAUTILUS_FILE (node->data), FALSE);
}
nautilus_directory_emit_load_error (directory,
result);
}
/* Call the idle function right away. */
......
......@@ -158,6 +158,8 @@ void nautilus_directory_emit_files_changed (NautilusD
void nautilus_directory_emit_change_signals_deep (NautilusDirectory *directory,
GList *changed_files);
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
void nautilus_directory_emit_load_error (NautilusDirectory *directory,
GnomeVFSResult error_result);
NautilusDirectory *nautilus_directory_get_internal (const char *uri,
gboolean create);
char * nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory);
......
......@@ -45,6 +45,7 @@ enum {
FILES_ADDED,
FILES_CHANGED,
DONE_LOADING,
LOAD_ERROR,
LAST_SIGNAL
};
......@@ -106,7 +107,14 @@ nautilus_directory_initialize_class (NautilusDirectoryClass *klass)
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, done_loading),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[LOAD_ERROR] =
gtk_signal_new ("load_error",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusDirectoryClass, load_error),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
klass->get_name_for_self_as_new_file = real_get_name_for_self_as_new_file;
......@@ -593,7 +601,6 @@ nautilus_directory_file_list_length_reached (NautilusDirectory *directory)
return directory->details->confirmed_file_count >= NAUTILUS_DIRECTORY_FILE_LIST_HARD_LIMIT;
}
GList *
nautilus_directory_begin_file_name_change (NautilusDirectory *directory,
NautilusFile *file)
......@@ -696,6 +703,16 @@ nautilus_directory_emit_done_loading (NautilusDirectory *directory)
signals[DONE_LOADING]);
}
void
nautilus_directory_emit_load_error (NautilusDirectory *directory,
GnomeVFSResult error_result)
{
gtk_signal_emit (GTK_OBJECT (directory),
signals[LOAD_ERROR],
error_result);
}
static char *
uri_get_directory_part (const char *uri)
{
......
......@@ -26,6 +26,7 @@
#define NAUTILUS_DIRECTORY_H
#include <gtk/gtkobject.h>
#include <libgnomevfs/gnome-vfs-types.h>
/* NautilusDirectory is a class that manages the model for a directory,
real or virtual, for Nautilus, mainly the file-manager component. The directory is
......@@ -101,6 +102,8 @@ typedef struct
*/
void (* done_loading) (NautilusDirectory *directory);
void (* load_error) (NautilusDirectory *directory);
/*** Virtual functions for subclasses to override. ***/
gboolean (* contains_file) (NautilusDirectory *directory,
NautilusFile *file);
......
......@@ -108,6 +108,7 @@ enum {
CREATE_SELECTION_CONTEXT_MENU_ITEMS,
BEGIN_ADDING_FILES,
BEGIN_LOADING,
LOAD_ERROR,
CLEAR,
DONE_ADDING_FILES,
FILE_CHANGED,
......@@ -134,6 +135,7 @@ struct FMDirectoryViewDetails
guint files_added_handler_id;
guint files_changed_handler_id;
guint load_error_handler_id;
GList *pending_files_added;
GList *pending_files_changed;
......@@ -299,6 +301,13 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass)
GTK_SIGNAL_OFFSET (FMDirectoryViewClass, begin_loading),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[LOAD_ERROR] =
gtk_signal_new ("load_error",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (FMDirectoryViewClass, load_error),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
signals[CREATE_SELECTION_CONTEXT_MENU_ITEMS] =
gtk_signal_new ("create_selection_context_menu_items",
GTK_RUN_LAST,
......@@ -1946,6 +1955,22 @@ files_changed_callback (NautilusDirectory *directory,
schedule_update_menus (view);
}
static void
load_error_callback (NautilusDirectory *directory,
GnomeVFSResult load_error_code,
gpointer callback_data)
{
FMDirectoryView *view;
view = FM_DIRECTORY_VIEW (callback_data);
fm_directory_view_stop (view);
/* Emit a signal to tell subclasses that a load
error has occurred, so they can handle it in the
UI */
gtk_signal_emit (GTK_OBJECT (view), signals[LOAD_ERROR], load_error_code);
}
/**
* fm_directory_queue_notice_file_change
*
......@@ -4061,6 +4086,11 @@ finish_loading_uri (FMDirectoryView *view)
"files_changed",
files_changed_callback,
view);
view->details->load_error_handler_id = gtk_signal_connect
(GTK_OBJECT (view->details->model),
"load_error",
load_error_callback,
view);
/* Monitor the things needed to get the right
* icon. Also monitor a directory's item count because
......@@ -4150,6 +4180,7 @@ disconnect_model_handlers (FMDirectoryView *view)
{
disconnect_handler (view, &view->details->files_added_handler_id);
disconnect_handler (view, &view->details->files_changed_handler_id);
disconnect_handler (view, &view->details->load_error_handler_id);
if (view->details->model != NULL) {
nautilus_directory_file_monitor_remove (view->details->model, view);
nautilus_file_cancel_call_when_ready (view->details->directory_as_file,
......
......@@ -116,6 +116,14 @@ struct FMDirectoryViewClass {
*/
void (* begin_loading) (FMDirectoryView *view);
/* The 'load_error' signal is emitted when the directory model
reports an error in the process of monitoring the directory's
contents. The load error indicates that the process of
load the contents has ended, but the directory is still
being monitored*/
void (* load_error) (FMDirectoryView *view,
GnomeVFSResult result);
/* The 'create_selection_context_menu_items' signal is emitted
* when creating a context menu for the selected items. @files is
* the list of selected files; it isn't destroyed until the menu
......
......@@ -32,13 +32,17 @@
#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomevfs/gnome-vfs-result.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-search-uri.h>
#include <libnautilus-extensions/nautilus-stock-dialogs.h>
#include <libnautilus-extensions/nautilus-string.h>
/* FIXME bugzilla.eazel.com 2815: This code uses part of the
......@@ -110,6 +114,47 @@ load_location_callback (NautilusView *nautilus_view, char *location)
}
/* FIXME: GnomeVFSResults may not be the
best way to communicate an error code to
a view */
static void
load_error_callback (FMDirectoryView *nautilus_view,
GnomeVFSResult result,
gpointer callback_data)
{
GnomeDialog *load_error_dialog;
char *generic_error_string;
if (result == GNOME_VFS_ERROR_SERVICE_OBSOLETE) {
/* FIXME: Shoudl be two messages, one for each of whether
"slow complete search" turned on or not */
load_error_dialog = nautilus_yes_no_dialog (_("The search you have selected "
"is newer than the index on your "
"system. The search will return no "
"results right now. Would you like "
"to create a new index now?"),
_("Search for items that are too new"),
_("Create a new index"),
_("Don't create index"),
NULL);
gtk_signal_connect (GTK_OBJECT (nautilus_gnome_dialog_get_button_by_index
(load_error_dialog, GNOME_OK)),
"clicked",
nautilus_indexing_info_request_reindex,
NULL);
}
else {
generic_error_string = g_strdup_printf (_("An error occurred while loading "
"this search's contents: "
"%s"),
gnome_vfs_result_to_string (result));
load_error_dialog = nautilus_error_dialog (generic_error_string,
"Error during directory load",
NULL);
}
}
static void
fm_search_list_view_initialize_class (gpointer klass)
{
......@@ -163,11 +208,14 @@ fm_search_list_view_initialize (gpointer object,
nautilus_view = fm_directory_view_get_nautilus_view (directory_view);
gtk_signal_connect (GTK_OBJECT(nautilus_view),
gtk_signal_connect (GTK_OBJECT (nautilus_view),
"load_location",
GTK_SIGNAL_FUNC (load_location_callback),
NULL);
gtk_signal_connect (GTK_OBJECT (directory_view),
"load_error",
GTK_SIGNAL_FUNC (load_error_callback),
NULL);
}
static void
......
......@@ -249,6 +249,12 @@ show_index_progress_bar (GnomeDialog *gnome_dialog)
g_free);
}
void
nautilus_indexing_info_request_reindex (void)
{
medusa_index_service_request_reindex ();
}
/**
* nautilus_indexing_info_show_dialog:
*
......
......@@ -31,6 +31,7 @@ BEGIN_GNOME_DECLS
/* Show the indexing info dialog, If one is already running
* just raise that one */
void nautilus_indexing_info_show_dialog (void);
void nautilus_indexing_info_request_reindex (void);
END_GNOME_DECLS
......
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