Fix bugzilla.eazel.com bug 7934, to remove the ability to make an index

2001-04-26  Rebecca Schulman  <rebecka@eazel.com>
	Fix bugzilla.eazel.com bug 7934, to remove the ability
	to make an index using Nautilus.

	reviewed by: Darin Adler <darin@eazle.com>

	* src/file-manager/fm-list-view.c: (get_cell_text):
	* src/file-manager/fm-search-list-view.c: (real_load_error),
	(display_indexed_search_problems_dialog), (real_get_link_column),
	(real_get_emblems_column):
	Simplify the dialog that allows a Nautilus user to request a new
	index.  Tell the user instead how to create an index if the user
	has root access in this dialog instead.
	* src/file-manager/nautilus-indexing-info.c:
	(show_last_index_time_dialog), (last_index_time_dialog_new),
	(index_progress_dialog_new), (show_indexing_info_dialog):
	* src/file-manager/nautilus-indexing-info.h:
	Remove the request reindex function.  Remove option to create a new
	index.  Keep dialogs to show either the time of the last index creation,
	or the progress of the current indexing task, depending on whether
	an index is in progress or not.
This commit is contained in:
Rebecca Schulman 2001-04-27 00:55:17 +00:00 committed by Rebecca Schulman
parent 1aa7e5de53
commit 377cd43e9a
5 changed files with 86 additions and 199 deletions

View file

@ -1,3 +1,25 @@
2001-04-26 Rebecca Schulman <rebecka@eazel.com>
Fix bugzilla.eazel.com bug 7934, to remove the ability
to make an index using Nautilus.
reviewed by: Darin Adler <darin@eazle.com>
* src/file-manager/fm-list-view.c: (get_cell_text):
* src/file-manager/fm-search-list-view.c: (real_load_error),
(display_indexed_search_problems_dialog), (real_get_link_column),
(real_get_emblems_column):
Simplify the dialog that allows a Nautilus user to request a new
index. Tell the user instead how to create an index if the user
has root access in this dialog instead.
* src/file-manager/nautilus-indexing-info.c:
(show_last_index_time_dialog), (last_index_time_dialog_new),
(index_progress_dialog_new), (show_indexing_info_dialog):
* src/file-manager/nautilus-indexing-info.h:
Remove the request reindex function. Remove option to create a new
index. Keep dialogs to show either the time of the last index creation,
or the progress of the current indexing task, depending on whether
an index is in progress or not.
2001-04-26 Dan Mueth <dan@eazel.com>
Committing first draft of the screenshot guidelines for Nautilus

View file

@ -1118,10 +1118,10 @@ get_cell_text (GtkWidget *widget, int column_index, int cell_width,
if (strcmp (specification.attribute, "date_modified") == 0) {
/* special handling of dates */
return nautilus_file_fit_modified_date_as_string (
NAUTILUS_FILE (row->data),
cell_width,
measure_width_callback, truncate_middle_callback,
font);
NAUTILUS_FILE (row->data),
cell_width,
measure_width_callback, truncate_middle_callback,
font);
}
switch ((EelCellType)row->cell[column_index].type) {

View file

@ -38,7 +38,7 @@
#ifdef HAVE_MEDUSA
#include <libmedusa/medusa-indexed-search.h>
#include <libmedusa/medusa-unindexed-search.h>
#include <libmedusa/medusa-index-service.h>
#include <libmedusa/medusa-index-progress.h>
#endif
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
@ -186,31 +186,32 @@ real_load_error (FMDirectoryView *nautilus_view,
switch (result) {
case GNOME_VFS_ERROR_SERVICE_OBSOLETE:
load_error_dialog = eel_show_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 (eel_gnome_dialog_get_button_by_index
(load_error_dialog, GNOME_OK)),
"clicked",
nautilus_indexing_info_request_reindex,
NULL);
load_error_dialog = eel_show_info_dialog (_("The search you have selected "
"is newer than the index on your "
"system. The search will return "
"no results right now. You can create a new "
" index by running \"medusa-indexd\" as root "
"on the command line."),
_("Search for items that are too new"),
NULL);
break;
case GNOME_VFS_ERROR_TOO_BIG:
eel_show_error_dialog (_("Every indexed file on your computer "
"matches the criteria you selected. "
"You can check the spelling on your selections "
"or add more criteria to narrow your results."),
_("Error during search"),
NULL);
"matches the criteria you selected. "
"You can check the spelling on your selections "
"or add more criteria to narrow your results."),
_("Error during search"),
NULL);
break;
case GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE:
/* We've handled this case in load_location_callback */
/* FIXME: This dialog does not get shown because a slow search
will be performed and will not return an error. */
eel_show_error_dialog (_("Find cannot open your file system index. "
"Your index may be missing or corrupt. You can "
"create a new index by running \"medusa-indexd\" as root "
"on the command line."),
_("Error reading file index"),
NULL);
break;
case GNOME_VFS_ERROR_CANCELLED:
break;
@ -232,11 +233,7 @@ real_load_error (FMDirectoryView *nautilus_view,
static void
display_indexed_search_problems_dialog (gboolean backup_search_is_available)
{
GnomeDialog *index_problem_dialog;
const char *error_string, *title_string;
MedusaIndexingRequestResult index_service_availability;
GtkButton *create_index_button;
if (medusa_indexed_search_system_index_files_look_available ()) {
/* There is an index on the system, but there is no
@ -255,61 +252,23 @@ display_indexed_search_problems_dialog (gboolean backup_search_is_available)
? N_("Fast searches are not available")
: N_("Content searches are not available");
eel_show_error_dialog_with_details (error_string,
title_string,
_("Your index files are available "
"but the Medusa search daemon, which handles "
"index requests, isn't running. "
"To start this program, log in as root and "
"enter this command at the command line:\n"
"medusa-searchd"),
NULL);
title_string,
_("Your index files are available "
"but the Medusa search daemon, which handles "
"index requests, isn't running. "
"To start this program, log in as root and "
"enter this command at the command line:\n\n"
"medusa-searchd"),
NULL);
}
else {
/* There is currently no index available, so we need to explain
whether a new index needs to be made, and if nautilus can direct it
to be made correctly.
There are three possibilities here:
1. There is no index on this system, and one is not currently being made.
2. There is no index on this system, but one is currently being made.
3. We can't contact the indexing service. */
index_service_availability = medusa_index_service_is_available ();
switch (index_service_availability) {
case MEDUSA_INDEXER_READY_TO_INDEX:
error_string = backup_search_is_available
? N_("To do a fast search, Find requires an index "
"of the files on your system. "
"Your computer does not have an index "
"right now. Because Find cannot use an "
"index, this search may take several "
"minutes. "
"Would you like to create an index? "
"Creating an index will be done while "
"you are not actively using your computer.")
: N_("To do a content search, Find requires an index "
"of the content on your system. "
"Your computer does not have an index "
"right now. Would you like to create an index? "
"Creating an index will be done while you are not "
"actively using your computer.");
title_string = backup_search_is_available
? N_("Indexed searches are not available")
: N_("Content searches are not available");
index_problem_dialog = eel_show_yes_no_dialog (error_string,
title_string,
_("Create an Index"),
_("Don't Create an Index Now"),
NULL);
create_index_button = eel_gnome_dialog_get_button_by_index (index_problem_dialog,
GNOME_OK);
gtk_signal_connect (GTK_OBJECT (create_index_button),
"clicked",
nautilus_indexing_info_request_reindex,
NULL);
break;
case MEDUSA_INDEXER_ALREADY_INDEXING:
whether a new index needs to be made, or whether one is currently
being made. */
if (medusa_indexing_is_currently_in_progress ()) {
error_string = backup_search_is_available
? N_("To do a fast search, Find requires an index "
"of the files on your system. "
"of the files on your system. "
"Your computer is currently creating that "
"index. Because Find cannot use an index, "
"this search may take several "
@ -323,10 +282,10 @@ display_indexed_search_problems_dialog (gboolean backup_search_is_available)
? N_("Indexed searches are not available")
: N_("Content searches are not available");
eel_show_error_dialog (error_string,
title_string,
NULL);
break;
default:
title_string,
NULL);
}
else {
error_string = backup_search_is_available
? N_("To do a fast search, Find requires an index "
"of the files on your system. No index "
@ -348,7 +307,6 @@ display_indexed_search_problems_dialog (gboolean backup_search_is_available)
eel_show_error_dialog (error_string,
title_string,
NULL);
break;
}
}
@ -506,18 +464,18 @@ real_get_emblem_names_to_exclude (FMDirectoryView *view)
return NULL;
}
static int
real_get_emblems_column (FMListView *view)
{
return 2;
}
static int
real_get_link_column (FMListView *view)
{
return 1;
}
static int
real_get_emblems_column (FMListView *view)
{
return 2;
}
static void
real_get_column_specification (FMListView *view,
int column_number,

View file

@ -57,14 +57,13 @@ typedef struct {
typedef struct {
GnomeDialog *last_index_time_dialog;
MedusaIndexingStatus indexing_service_status;
GnomeDialog *index_in_progress_dialog;
gboolean show_last_index_time;
gboolean indexing_is_in_progress;
} IndexingInfoDialogs;
static IndexingInfoDialogs *dialogs = NULL;
static GnomeDialog * last_index_time_and_reindex_button_dialog_new (void);
static GnomeDialog * last_index_time_dialog_new (void);
static int
get_index_percentage_complete (void)
@ -135,7 +134,7 @@ show_index_progress_dialog (void)
static void
show_reindex_request_dialog (void)
show_last_index_time_dialog (void)
{
int callback_id;
@ -143,98 +142,26 @@ show_reindex_request_dialog (void)
gtk_widget_show_all (GTK_WIDGET (dialogs->last_index_time_dialog));
callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
dialogs->last_index_time_dialog);
#if 0
gtk_signal_connect_object (GTK_OBJECT (dialogs->last_index_time_dialog),
"destroy",
medusa_remove_state_changed_function,
GINT_TO_POINTER (callback_id));
#endif
}
static void
recreate_and_show_reindex_request_dialog (void)
{
gnome_dialog_close (dialogs->last_index_time_dialog);
gtk_widget_destroy (GTK_WIDGET (dialogs->last_index_time_dialog));
dialogs->last_index_time_dialog = last_index_time_and_reindex_button_dialog_new ();
gtk_widget_show_all (GTK_WIDGET (dialogs->last_index_time_dialog));
}
static void
update_file_index_callback (GtkWidget *widget, gpointer data)
{
MedusaIndexingRequestResult result;
const char *error;
result = medusa_index_service_request_reindex ();
switch (result) {
case MEDUSA_INDEXER_REQUEST_OK:
error = NULL;
dialogs->show_last_index_time = FALSE;
show_index_progress_dialog ();
break;
case MEDUSA_INDEXER_ERROR_BUSY:
error = _("The indexer is currently busy.");
break;
case MEDUSA_INDEXER_ERROR_NO_RESPONSE:
dialogs->indexing_service_status = MEDUSA_INDEXER_NOT_AVAILABLE;
recreate_and_show_reindex_request_dialog ();
error = _("An indexer is not running, or is not responding to requests to reindex your computer.");
break;
case MEDUSA_INDEXER_ERROR_INVALID_RESPONSE:
dialogs->indexing_service_status = MEDUSA_INDEXER_NOT_AVAILABLE;
recreate_and_show_reindex_request_dialog ();
error = _("An attempt to reindex, caused an Internal Indexer Error. Tell rebecka@eazel.com");
break;
default:
g_assert_not_reached ();
error = NULL;
}
if (error) {
/* FIXME: Maybe we should include details here? */
eel_show_error_dialog (error,
_("Reindexing Failed"),
NULL);
}
}
static GnomeDialog *
last_index_time_and_reindex_button_dialog_new (void)
last_index_time_dialog_new (void)
{
char *time_str;
char *label_str;
GtkWidget *label;
GtkWidget *button;
GtkWidget *hbox;
GnomeDialog *dialog;
dialogs->indexing_service_status = medusa_index_service_is_available ();
switch (dialogs->indexing_service_status) {
case MEDUSA_INDEXER_ALREADY_INDEXING:
/* Fall through, we won't be showing this in the above case, anyways. */
case MEDUSA_INDEXER_READY_TO_INDEX:
dialog = eel_create_info_dialog (_("Once a day your files and text content are indexed so "
"your searches are fast. If you need to update your index "
"now, click on the \"Update Now\" button."),
_("Indexing Status"),
NULL);
break;
case MEDUSA_INDEXER_NOT_AVAILABLE:
/* FIXME: Do we want to talk about the index not being available? */
dialog = eel_create_info_dialog (_("Once a day your files and text content are indexed so "
"your searches are fast. "),
_("Indexing Status"),
NULL);
break;
default:
g_assert_not_reached ();
dialog = NULL;
}
dialog = eel_create_info_dialog (_("Once a day your files and text content are indexed so "
"your searches are fast. "),
_("Indexing Status"),
NULL);
set_close_hides_for_dialog (dialog);
time_str = nautilus_indexing_info_get_last_index_time ();
label_str = g_strdup_printf (_("Your files were last indexed at %s"),
time_str);
@ -247,17 +174,6 @@ last_index_time_and_reindex_button_dialog_new (void)
gtk_box_pack_start (GTK_BOX (dialog->vbox), label,
FALSE, FALSE, 0);
if (dialogs->indexing_service_status == MEDUSA_INDEXER_READY_TO_INDEX) {
hbox = gtk_hbox_new (FALSE, 0);
button = gtk_button_new_with_label (_("Update Now"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
update_file_index_callback, NULL);
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox,
FALSE, FALSE, 0);
}
return dialog;
}
@ -280,8 +196,8 @@ index_progress_dialog_new (void)
guint timeout_id;
dialog = eel_create_info_dialog (_("Once a day your files and text content are indexed so "
"your searches are fast. Your files are currently being indexed."),
_("Indexing Status"), NULL);
"your searches are fast. Your files are currently being indexed."),
_("Indexing Status"), NULL);
set_close_hides_for_dialog (dialog);
percentage_complete = get_index_percentage_complete ();
indexing_progress_bar = gtk_progress_bar_new ();
@ -363,16 +279,16 @@ show_indexing_info_dialog (void)
dialogs = g_new0 (IndexingInfoDialogs, 1);
g_atexit (destroy_indexing_info_dialogs_on_exit);
dialogs->last_index_time_dialog = last_index_time_and_reindex_button_dialog_new ();
dialogs->last_index_time_dialog = last_index_time_dialog_new ();
dialogs->index_in_progress_dialog = index_progress_dialog_new ();
}
dialogs->show_last_index_time = !medusa_index_is_currently_running ();
dialogs->indexing_is_in_progress = medusa_indexing_is_currently_in_progress ();
if (dialogs->show_last_index_time) {
show_reindex_request_dialog ();
} else {
if (dialogs->indexing_is_in_progress) {
show_index_progress_dialog ();
} else {
show_last_index_time_dialog ();
}
}
@ -390,14 +306,6 @@ show_search_service_not_available_dialog (void)
#endif
void
nautilus_indexing_info_request_reindex (void)
{
#ifdef HAVE_MEDUSA
medusa_index_service_request_reindex ();
#endif
}
char *
nautilus_indexing_info_get_last_index_time (void)
{

View file

@ -30,7 +30,6 @@
* just raise that one.
*/
void nautilus_indexing_info_show_dialog (void);
void nautilus_indexing_info_request_reindex (void);
char *nautilus_indexing_info_get_last_index_time (void);
#endif /* NAUTILUS_INDEXING_INFO_H */