Process the result of refreshing the folder during explicit completion

(start_explicit_completion): Process the result from
	refresh...().  Here we present the actual feedback about only
	being able to display local folders for local_only=TRUE.

Signed-off-by: Federico Mena Quintero <federico@novell.com>

svn path=/trunk/; revision=22178
This commit is contained in:
Federico Mena Quintero
2009-01-23 00:53:38 +00:00
committed by Federico Mena Quintero
parent 2dd7cf4926
commit 65cd4f8df4
2 changed files with 64 additions and 28 deletions

View File

@ -26,6 +26,9 @@
We filter out incomplete hostnames here (typing We filter out incomplete hostnames here (typing
"sftp://incompl[tab]" will error out), as well as completely "sftp://incompl[tab]" will error out), as well as completely
unparsable input. unparsable input.
(start_explicit_completion): Process the result from
refresh...(). Here we present the actual feedback about only
being able to display local folders for local_only=TRUE.
2009-01-22 Matthew Barnes <mbarnes@redhat.com> 2009-01-22 Matthew Barnes <mbarnes@redhat.com>

View File

@ -1111,29 +1111,18 @@ explicitly_complete (GtkFileChooserEntry *chooser_entry)
static void static void
start_explicit_completion (GtkFileChooserEntry *chooser_entry) start_explicit_completion (GtkFileChooserEntry *chooser_entry)
{ {
/* FMQ: get result from the function below */ RefreshStatus status;
refresh_current_folder_and_file_part (chooser_entry, REFRESH_UP_TO_CURSOR_POSITION); gboolean is_error;
char *feedback_msg;
if (!chooser_entry->current_folder_file) status = refresh_current_folder_and_file_part (chooser_entry, REFRESH_UP_TO_CURSOR_POSITION);
is_error = FALSE;
switch (status)
{ {
/* Here, no folder path means we couldn't parse what the user typed. */ case REFRESH_OK:
g_assert (chooser_entry->current_folder_file != NULL);
beep (chooser_entry);
pop_up_completion_feedback (chooser_entry, _("Invalid path"));
chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
return;
}
if (chooser_entry->local_only
&& !g_file_is_native (chooser_entry->current_folder_file))
{
beep (chooser_entry);
pop_up_completion_feedback (chooser_entry, _("Only local files can be selected"));
chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
return;
}
if (chooser_entry->current_folder if (chooser_entry->current_folder
&& _gtk_folder_is_finished_loading (chooser_entry->current_folder)) && _gtk_folder_is_finished_loading (chooser_entry->current_folder))
@ -1149,6 +1138,50 @@ start_explicit_completion (GtkFileChooserEntry *chooser_entry)
*/ */
pop_up_completion_feedback (chooser_entry, _("Completing...")); pop_up_completion_feedback (chooser_entry, _("Completing..."));
} }
break;
case REFRESH_INVALID_INPUT:
is_error = TRUE;
feedback_msg = _("Invalid path");
break;
case REFRESH_INCOMPLETE_HOSTNAME:
is_error = TRUE;
if (chooser_entry->local_only)
feedback_msg = _("Only local files may be selected"); /* hostnames in a local_only file chooser? user error */
else
{
/* Another option is to complete the hostname based on the remote volumes that are mounted */
feedback_msg = _("Incomplete hostname; end it with '/'");
}
break;
case REFRESH_NONEXISTENT:
is_error = TRUE;
feedback_msg = _("Path does not exist");
break;
case REFRESH_NOT_LOCAL:
is_error = TRUE;
feedback_msg = _("Only local files may be selected");
break;
default:
g_assert_not_reached ();
return;
}
if (is_error)
{
g_assert (chooser_entry->current_folder_file == NULL);
beep (chooser_entry);
pop_up_completion_feedback (chooser_entry, feedback_msg);
chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
}
} }
static gboolean static gboolean