Hi, Am Montag, den 11.10.2004, 12:41 +0200 schrieb Alexander Larsson: > [...] > > > * tree sidebar timeout before load-uri when keynav:ing > > > If you navigate the tree sidebar with cursor keys, it will immediately > > > start loading the folders as you move over them. This makes keynav > > > painful. We should have a delay here before we load the folder. > > > > did that, are 300 ms ok ? (attached, fm-tree-view.diff) > > Hmm. Its a bit to short for me when navigating with the keyboard. It > only triggers when i hold down the key. Also, having a delay when > selecting by using the mouse seems wrong to me. The delay should only be > when the keyboard was used. Yeah, attached with changes. Do we want to depend the delay on the keyboard repeat rate ? (seems to be gconf /desktop/gnome/peripherals/keyboard/rate) If so, how is the relation factor ? > > > * context menu poped up by keyboard appear at mouse pointer > > > If you select a file and bring up the context menu (using ctrl-F10) > > > the menu pops up at the current mouse position, not the location of > > > the icon. This is distracting when you're using keyboard navigation, > > > and the mouse cursor could be anywhere. > > > > Yes, but it is hard to fix. I tried it in one of my other apps and what > > I did was basically, > > > > Really ugly. I hesitate to clobber nautilus up with that ;) > > It can't be that hard to do. Just look at the type of the event that > lead to the popup. Ideally, we want clean simple code, but the most > important thing is the user interaction behaviour. If we have to add a > (small, localized, commented) hack to be able to implement it, thats > fine. Well as there seems to be a function to get the selection's coordinates I'd like to try. Cant find the gtk_menu_popup call however. Help ? :) > > > > * .hidden reading follows symlinks/nodes etc > > > When reading .hidden files we should only read it if the file is a > > > regular file. We shouldn't follow symlinks, hang if someone puts a > > > ..hidden pipe there, or whatever unregular. > > > > did that, attached nautilus-directory-async.diff > > + if (!file_info) > + return; > > We use brackets around one-liners too. See docs/style-guide.html. > > + /* FIXME check flags for GNOME_VFS_FILE_FLAGS_SYMLINK too ? */ > Checking for == GNOME_VFS_FILE_TYPE_REGULAR should be ok since we don't > pass GNOME_VFS_FILE_INFO_FOLLOW_LINKS. > > + /* or GNOME_VFS_FILE_FLAGS_LOCAL */ > Non-local .hidden files sound ok to me. > > + file_ok = ( > + (file_info->valid_fields > + & (GNOME_VFS_FILE_INFO_FIELDS_TYPE | > GNOME_VFS_FILE_INFO_FIELDS_SIZE)) > + == (GNOME_VFS_FILE_INFO_FIELDS_TYPE | GNOME_VFS_FILE_INFO_FIELDS_SIZE) > + ) > + && (file_info->type == GNOME_VFS_FILE_TYPE_REGULAR) > + && (file_info->size > 0); Attached with changes. cheers, Danny -- www.keyserver.net key id A334AEA6
Index: fm-tree-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-tree-view.c,v
retrieving revision 1.6
diff -u -p -r1.6 fm-tree-view.c
--- fm-tree-view.c 21 Jun 2004 18:33:43 -0000 1.6
+++ fm-tree-view.c 12 Oct 2004 18:04:13 -0000
@@ -38,6 +38,7 @@
#include <eel/eel-preferences.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
+#include <gtk/gtkmain.h>
#include <gtk/gtkcellrendererpixbuf.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkscrolledwindow.h>
@@ -92,6 +93,8 @@ struct FMTreeViewDetails {
GtkWidget *popup_trash;
GtkWidget *popup_properties;
NautilusFile *popup_file;
+
+ guint selection_changed_timer;
};
typedef struct {
@@ -378,34 +381,64 @@ row_activated_callback (GtkTreeView *tre
}
}
-
-static void
-selection_changed_callback (GtkTreeSelection *selection,
- FMTreeView *view)
+static gboolean
+selection_changed_timer_callback(FMTreeView *view)
{
NautilusFileAttributes attributes;
GtkTreeIter iter;
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->details->tree_widget));
/* no activation if popup menu is open */
if (view->details->popup_file != NULL) {
- return;
+ return FALSE;
}
cancel_activation (view);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
- return;
+ return FALSE;
}
view->details->activation_file = sort_model_iter_to_file (view, &iter);
if (view->details->activation_file == NULL) {
- return;
+ return FALSE;
}
view->details->activation_in_new_window = FALSE;
attributes = NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI;
nautilus_file_call_when_ready (view->details->activation_file, attributes,
got_activation_uri_callback, view);
+ return FALSE; /* remove timeout */
+}
+
+static void
+selection_changed_callback (GtkTreeSelection *selection,
+ FMTreeView *view)
+{
+ GdkEvent *event;
+ gboolean is_keyboard;
+
+ if (view->details->selection_changed_timer) {
+ g_source_remove (view->details->selection_changed_timer);
+ view->details->selection_changed_timer = 0;
+ }
+
+ event = gtk_get_current_event ();
+ if (event) {
+ is_keyboard = (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE);
+ gdk_event_free (event);
+
+ if (is_keyboard) {
+ /* on keyboard event: delay the change */
+ /* TODO: make dependent on keyboard repeat rate as per Markus Bertheau ? */
+ view->details->selection_changed_timer = g_timeout_add (500, (GSourceFunc) selection_changed_timer_callback, view);
+ } else {
+ /* on mouse event: show the change immediately */
+ selection_changed_timer_callback (view);
+ }
+ }
}
static int
@@ -1279,6 +1312,11 @@ fm_tree_view_dispose (GObject *object)
view = FM_TREE_VIEW (object);
+ if (view->details->selection_changed_timer) {
+ g_source_remove (view->details->selection_changed_timer);
+ view->details->selection_changed_timer = 0;
+ }
+
if (view->details->drag_dest) {
g_object_unref (view->details->drag_dest);
view->details->drag_dest = NULL;
Index: nautilus-directory-async.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-async.c,v
retrieving revision 1.210
diff -u -p -r1.210 nautilus-directory-async.c
--- nautilus-directory-async.c 6 Oct 2004 12:12:17 -0000 1.210
+++ nautilus-directory-async.c 12 Oct 2004 18:08:00 -0000
@@ -2018,6 +2018,8 @@ read_dot_hidden_file (NautilusDirectory
GnomeVFSResult result;
int i, file_size;
char *file_contents;
+ GnomeVFSFileInfo *file_info;
+ gboolean file_ok;
/* FIXME: We only support .hidden on file: uri's for the moment.
@@ -2032,6 +2034,34 @@ read_dot_hidden_file (NautilusDirectory
* that works on strings, so we can avoid the VFS parsing step.
*/
dot_hidden_vfs_uri = gnome_vfs_uri_append_file_name (directory->details->vfs_uri, ".hidden");
+
+ file_info = gnome_vfs_file_info_new ();
+ if (!file_info) {
+ return;
+ }
+
+ if (gnome_vfs_get_file_info_uri (
+ dot_hidden_vfs_uri,
+ file_info,
+ GNOME_VFS_FILE_INFO_DEFAULT)
+ != GNOME_VFS_OK) {
+ gnome_vfs_file_info_unref (file_info);
+ return;
+ }
+
+ file_ok = (
+ (file_info->valid_fields
+ & (GNOME_VFS_FILE_INFO_FIELDS_TYPE | GNOME_VFS_FILE_INFO_FIELDS_SIZE))
+ == (GNOME_VFS_FILE_INFO_FIELDS_TYPE | GNOME_VFS_FILE_INFO_FIELDS_SIZE)
+ )
+ && (file_info->type == GNOME_VFS_FILE_TYPE_REGULAR);
+
+ gnome_vfs_file_info_unref (file_info);
+
+ if (!file_ok) {
+ return;
+ }
+
dot_hidden_uri = gnome_vfs_uri_to_string (dot_hidden_vfs_uri, GNOME_VFS_URI_HIDE_NONE);
gnome_vfs_uri_unref (dot_hidden_vfs_uri);
Attachment:
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil