Commit 206c22d2 authored by John Sullivan's avatar John Sullivan

Did part of the work for bug 1753 (search view should start out

	sorted by search criteria). We're still not sure if this is a
	good UI, but I'll make it possible for us to try it out if it
	isn't too much more work.

	* src/file-manager/fm-directory-view.c: Added a FIXME comment

	* src/file-manager/fm-list-view.h: Added get_default_sort_attribute
	function pointer.
	* src/file-manager/fm-list-view.c:
	(fm_list_view_initialize_class): Wired up default_sort_attribute
	function pointer.
	(fm_list_view_begin_loading): use get_default_sort_attribute ()
	instead of string constant.
	(get_default_sort_attribute): Dispatch to possibly overridden
	function pointer.
	(real_get_default_sort_attribute): return "name" (dupe, actually)

	* src/file-manager/fm-search-list-view.c:
	(fm_search_list_view_initialize_class): Wired up
	get_default_sort_attribute function pointer
	(real_get_default_sort_attribute): return "name" (dupe, actually).
	This gives us the place to decide which attribute to start out
	sorted by. To choose the attribute, we need to define a mapping
	between the search URI and one of the column attributes. I'm
	waiting on this part until mathieu gets farther along with the
	search-URI-to-human-readable-string code, which I hope to
	leverage.
parent 571bc00d
2000-08-08 John Sullivan <sullivan@eazel.com>
Did part of the work for bug 1753 (search view should start out
sorted by search criteria). We're still not sure if this is a
good UI, but I'll make it possible for us to try it out if it
isn't too much more work.
* src/file-manager/fm-directory-view.c: Added a FIXME comment
* src/file-manager/fm-list-view.h: Added get_default_sort_attribute
function pointer.
* src/file-manager/fm-list-view.c:
(fm_list_view_initialize_class): Wired up default_sort_attribute
function pointer.
(fm_list_view_begin_loading): use get_default_sort_attribute ()
instead of string constant.
(get_default_sort_attribute): Dispatch to possibly overridden
function pointer.
(real_get_default_sort_attribute): return "name" (dupe, actually)
* src/file-manager/fm-search-list-view.c:
(fm_search_list_view_initialize_class): Wired up
get_default_sort_attribute function pointer
(real_get_default_sort_attribute): return "name" (dupe, actually).
This gives us the place to decide which attribute to start out
sorted by. To choose the attribute, we need to define a mapping
between the search URI and one of the column attributes. I'm
waiting on this part until mathieu gets farther along with the
search-URI-to-human-readable-string code, which I hope to
leverage.
2000-08-08 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-sidebar-tabs.c: (nautilus_sidebar_tabs_initialize),
......
......@@ -3209,6 +3209,7 @@ fm_directory_view_activate_files (FMDirectoryView *view,
* @uri: A string representing the uri to switch to.
*
**/
/* FIXME: Why is this function public? Left over from pre-Bonobo days? */
void
fm_directory_view_load_uri (FMDirectoryView *view,
const char *uri)
......
......@@ -135,6 +135,7 @@ static NautilusList * get_list (FMListVie
static void update_icons (FMListView *list_view);
static int get_number_of_columns (FMListView *list_view);
static int get_link_column (FMListView *list_view);
static char * get_default_sort_attribute (FMListView *list_view);
static void get_column_specification (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
......@@ -145,6 +146,7 @@ static NautilusFileSortType get_column_sort_criterion (FMListVie
int column_number);
static int real_get_number_of_columns (FMListView *list_view);
static int real_get_link_column (FMListView *list_view);
static char * real_get_default_sort_attribute (FMListView *list_view);
static void real_get_column_specification (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
......@@ -191,6 +193,7 @@ fm_list_view_initialize_class (gpointer klass)
fm_list_view_class->get_number_of_columns = real_get_number_of_columns;
fm_list_view_class->get_link_column = real_get_link_column;
fm_list_view_class->get_column_specification = real_get_column_specification;
fm_list_view_class->get_default_sort_attribute = real_get_default_sort_attribute;
}
static void
......@@ -977,6 +980,7 @@ fm_list_view_begin_loading (FMDirectoryView *view)
{
NautilusDirectory *directory;
FMListView *list_view;
char *default_sort_attribute;
g_return_if_fail (FM_IS_LIST_VIEW (view));
......@@ -995,16 +999,18 @@ fm_list_view_begin_loading (FMDirectoryView *view)
list_view->details->default_zoom_level),
TRUE);
default_sort_attribute = get_default_sort_attribute (list_view);
fm_list_view_sort_items (
list_view,
get_sort_column_from_attribute (list_view,
nautilus_directory_get_metadata (directory,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN,
LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE)),
default_sort_attribute)),
nautilus_directory_get_boolean_metadata (
directory,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED,
FALSE));
g_free (default_sort_attribute);
}
static void
......@@ -1457,6 +1463,16 @@ get_link_column (FMListView *list_view)
->get_link_column) (list_view);
}
static char *
get_default_sort_attribute (FMListView *list_view)
{
/* For now, we just use the function pointer.
* It might be better to use a signal later.
*/
return (* FM_LIST_VIEW_CLASS (GTK_OBJECT (list_view)->klass)
->get_default_sort_attribute) (list_view);
}
static void
get_column_specification (FMListView *list_view,
int column_number,
......@@ -1546,6 +1562,12 @@ fm_list_view_column_set (FMListViewColumn *column,
column->right_justified = right_justified;
}
static char *
real_get_default_sort_attribute (FMListView *view)
{
return g_strdup (LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE);
}
static int
real_get_number_of_columns (FMListView *view)
{
......
......@@ -49,11 +49,12 @@ typedef struct {
typedef struct {
FMDirectoryViewClass parent_slot;
int (* get_number_of_columns) (FMListView *list_view);
int (* get_link_column) (FMListView *list_view);
void (* get_column_specification) (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
int (* get_number_of_columns) (FMListView *list_view);
int (* get_link_column) (FMListView *list_view);
void (* get_column_specification) (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
char * (* get_default_sort_attribute) (FMListView *list_view);
} FMListViewClass;
/* GtkObject support */
......
......@@ -41,6 +41,7 @@ static void fm_search_list_view_initialize (gpointer object,
static void fm_search_list_view_initialize_class (gpointer klass);
static int real_get_number_of_columns (FMListView *list_view);
static int real_get_link_column (FMListView *list_view);
static char * real_get_default_sort_attribute (FMListView *view);
static void real_get_column_specification (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
......@@ -83,6 +84,7 @@ fm_search_list_view_initialize_class (gpointer klass)
fm_list_view_class->get_number_of_columns = real_get_number_of_columns;
fm_list_view_class->get_link_column = real_get_link_column;
fm_list_view_class->get_column_specification = real_get_column_specification;
fm_list_view_class->get_default_sort_attribute = real_get_default_sort_attribute;
}
static void
......@@ -110,6 +112,16 @@ real_get_number_of_columns (FMListView *view)
return 7;
}
static char *
real_get_default_sort_attribute (FMListView *view)
{
/* FIXME bugzilla.eazel.com 1753:
* Maybe we should start out sorted by the attribute that
* most closely matches what was searched for.
*/
return g_strdup ("name");
}
static int
real_get_link_column (FMListView *view)
{
......
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