Re: [Nautilus-list] patch for directory view as list
- From: Matt Bissiri <bissiri eecs umich edu>
- To: John Sullivan <sullivan eazel com>
- Cc: nautilus-list lists eazel com
- Subject: Re: [Nautilus-list] patch for directory view as list
- Date: Mon, 16 Oct 2000 15:07:14 -0400
Hi John,
John Sullivan wrote:
> Hi Matt,
>
> Thanks for catching this problem and writing a patch. Your patch fixes the
> problem (which, surprisingly, hadn't yet been reported in
> bugzilla.eazel.com, I don't think). However, rather than just take your
> patch and forget about the issue for now, I'd prefer that the related code
> be cleaned up a little more. It's been in a funny state since the creation
> of nautilus-clist. Specifically, there is no need to have both
> nautilus_list_get_first_selected_row and
> nautilus_clist_get_first_selected_row (and the same for _get_last_). The
> _clist_ flavor is a private function used only once, in a place where the
> public _list_ version would work just fine (there's already a local variable
> holding the NautilusList). So we should remove the _clist_ flavor of these
> two functions and leave just the _list_ flavor.
>
> Also, since we don't use nautilus_gtk_clist_get_first/last_selected_row any
> more, we should just delete those functions entirely. They will just take up
> a little space and bit-rot away uselessly otherwise.
>
nautilus_gtk_clist_get_first_selected_row is used in
libnautilus-extensions/nautilus-program-chooser.c line 729.
That's why I did not remove the
`nautilus_gtk_clist_get_(first|last)_selected_row'
functions in my previous patch.
[snip]
>
> Matt, please let me know if you would like me to finish up this
> first/last_selected_row issue, or whether you would like to do so. I'm happy
> to take your patch and make the other changes I mentioned. And I'm equally
> happy to let you do it. Since you found the problem, I'll let you make the
> call.
>
I've attached an updated patch, following your suggestions above,
except for removing `nautilus_gtk_clist_get_(first|last)_selected_row' from
libnautilus-extensions/nautilus-gtk-extensions.[ch]
Matt
? idl/Makefile.in
? idl/Makefile
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.2369
diff -u -r1.2369 ChangeLog
--- ChangeLog 2000/10/16 06:08:34 1.2369
+++ ChangeLog 2000/10/16 18:30:37
@@ -1,3 +1,22 @@
+2000-10-16 Matt Bissiri <bissiri eecs umich edu>
+
+ * libnautilus-extensions/nautilus-list.h:
+ Add prototype for `nautilus_list_get_last_selected_row'.
+ * libnautilus-extensions/nautilus-list.c:
+ (nautilus_clist_get_first_selected_row),
+ (nautilus_clist_get_last_selected_row): Removed.
+ (nautilus_list_keyboard_navigation_key_press):
+ Use `nautilus_list_get_(first|last)_selected_row' instead of
+ `nautilus_clist_get_(first|last)_selected_row'.
+ (nautilus_list_get_last_selected_row): New function.
+
+ Now that NautilusList derives from NautilusCList instead of GtkCList,
+ NautilusList should not use `nautilus_gtk_clist_get_first_selected_row'
+ or `nautilus_gtk_clist_get_last_selected_row'.
+ Instead use implementation with NautilusCList instead of GtkCList.
+ This fixes a bug where up/down/pgup/pgdown keys did not work properly
+ when viewing directory as list.
+
2000-10-15 Andy Hertzfeld <andy eazel com>
* components/music/nautilus-music-view.c:
Index: libnautilus-extensions/nautilus-list.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-extensions/nautilus-list.c,v
retrieving revision 1.80
diff -u -r1.80 nautilus-list.c
--- libnautilus-extensions/nautilus-list.c 2000/10/13 06:21:12 1.80
+++ libnautilus-extensions/nautilus-list.c 2000/10/16 18:30:38
@@ -1201,18 +1201,6 @@
}
}
-static int
-nautilus_clist_get_first_selected_row (NautilusCList *list)
-{
- return nautilus_gtk_clist_get_first_selected_row ((GtkCList *)list);
-}
-
-static int
-nautilus_clist_get_last_selected_row (NautilusCList *list)
-{
- return nautilus_gtk_clist_get_last_selected_row ((GtkCList *)list);
-}
-
static void
nautilus_list_keyboard_navigation_key_press (NautilusList *list, GdkEventKey *event,
GtkScrollType scroll_type, gboolean jump_to_end)
@@ -1241,8 +1229,8 @@
} else {
start_row = (scroll_type == GTK_SCROLL_STEP_FORWARD
|| scroll_type == GTK_SCROLL_PAGE_FORWARD ?
- nautilus_clist_get_last_selected_row (clist) :
- nautilus_clist_get_first_selected_row (clist));
+ nautilus_list_get_last_selected_row (list) :
+ nautilus_list_get_first_selected_row (list));
}
/* If there's no row to start with, select the row farthest toward the end.
@@ -3343,6 +3331,12 @@
}
}
+/**
+ * nautilus_list_get_first_selected_row:
+ *
+ * Get the index of the first selected row, or -1 if no rows are selected.
+ * @list: Any NautilusList
+ **/
int
nautilus_list_get_first_selected_row (NautilusList *list)
{
@@ -3355,6 +3349,32 @@
for (p = NAUTILUS_CLIST (list)->row_list, row_index = 0;
p != NULL;
p = p->next, ++row_index) {
+ row = p->data;
+ if (row->state == GTK_STATE_SELECTED)
+ return row_index;
+ }
+
+ return -1;
+}
+
+/**
+ * nautilus_list_get_last_selected_row:
+ *
+ * Get the index of the last selected row, or -1 if no rows are selected.
+ * @list: Any NautilusList
+ **/
+int
+nautilus_list_get_last_selected_row (NautilusList *list)
+{
+ NautilusCListRow *row;
+ GList *p;
+ int row_index;
+
+ g_return_val_if_fail (NAUTILUS_IS_LIST (list), -1);
+
+ for (p = NAUTILUS_CLIST (list)->row_list_end, row_index = NAUTILUS_CLIST (list)->rows - 1;
+ p != NULL;
+ p = p->prev, --row_index) {
row = p->data;
if (row->state == GTK_STATE_SELECTED)
return row_index;
Index: libnautilus-extensions/nautilus-list.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-extensions/nautilus-list.h,v
retrieving revision 1.20
diff -u -r1.20 nautilus-list.h
--- libnautilus-extensions/nautilus-list.h 2000/10/03 23:08:11 1.20
+++ libnautilus-extensions/nautilus-list.h 2000/10/16 18:30:38
@@ -150,6 +150,7 @@
NautilusCListRow *nautilus_list_row_at (NautilusList *list,
int y);
int nautilus_list_get_first_selected_row (NautilusList *list);
+int nautilus_list_get_last_selected_row (NautilusList *list);
void nautilus_list_each_selected_row (NautilusList *list,
NautilusEachRowFunction function,
gpointer data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]