summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2004-10-22 08:51:41 +0000
committerAlexander Larsson <alexl@src.gnome.org>2004-10-22 08:51:41 +0000
commit15263c609c8f35b84f29347900d367392fe87f31 (patch)
tree8091ac9ed878db5e3079f5f1785d6b1ae4b36c48
parent34742bc8ad3b4d40227d740250bf48c1921308cb (diff)
downloadnautilus-15263c609c8f35b84f29347900d367392fe87f31.tar.gz
Add ugly hack to make renames work on newly created files in the list
2004-10-22 Alexander Larsson <alexl@redhat.com> * src/file-manager/fm-directory-view.c (rename_file): Add ugly hack to make renames work on newly created files in the list view. Don't look, you might go blind.
-rw-r--r--ChangeLog6
-rw-r--r--libnautilus-private/nautilus-file.c1
-rw-r--r--src/file-manager/fm-directory-view.c49
3 files changed, 56 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4efa74d6c..dff0b46f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2004-10-22 Alexander Larsson <alexl@redhat.com>
+ * src/file-manager/fm-directory-view.c (rename_file):
+ Add ugly hack to make renames work on newly created files
+ in the list view. Don't look, you might go blind.
+
+2004-10-22 Alexander Larsson <alexl@redhat.com>
+
* libnautilus-private/nautilus-icon-container.c (icon_set_position):
Fix moving of unpositioned icons, the canvas items start at
<0, 0>, not <-1,-1>
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index a4da3cefe..61dd9f91c 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -5332,6 +5332,7 @@ void
nautilus_file_changed (NautilusFile *file)
{
GList fake_list;
+ g_print ("nautilus_file_changed (%p)\n", file);
g_return_if_fail (NAUTILUS_IS_FILE (file));
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index e0bab5de0..7eb7418c2 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -30,6 +30,7 @@
#include <config.h>
#include <math.h>
#include "fm-directory-view.h"
+#include "fm-list-view.h"
#include "fm-error-reporting.h"
#include "fm-properties-window.h"
@@ -3420,9 +3421,57 @@ start_renaming_file (FMDirectoryView *view, NautilusFile *file)
}
}
+typedef struct {
+ FMDirectoryView *view;
+ NautilusFile *new_file;
+} RenameData;
+
+static gboolean
+delayed_rename_file_hack_callback (RenameData *data)
+{
+ FMDirectoryView *view;
+ NautilusFile *new_file;
+
+ view = data->view;
+ new_file = data->new_file;
+
+ EEL_CALL_METHOD (FM_DIRECTORY_VIEW_CLASS, view, start_renaming_file, (view, new_file));
+ fm_directory_view_reveal_selection (view);
+
+ g_object_unref (data->view);
+ nautilus_file_unref (data->new_file);
+ g_free (data);
+
+ return FALSE;
+}
+
static void
rename_file (FMDirectoryView *view, NautilusFile *new_file)
{
+ RenameData *data;
+
+ /* HACK!!!!
+ This is a work around bug in listview. After the rename is
+ enabled we will get file changes due to info about the new
+ file being read, which will cause the model to change. When
+ the model changes GtkTreeView clears the editing. This hack just
+ delays editing for some time to try to avoid this problem.
+ A major problem is that the selection of the row causes us
+ to load the slow mimetype for the file, which leads to a
+ file_changed. So, before we delay we select the row.
+ */
+ if (FM_IS_LIST_VIEW (view)) {
+ fm_directory_view_select_file (view, new_file);
+
+ data = g_new (RenameData, 1);
+ data->view = g_object_ref (view);
+ data->new_file = nautilus_file_ref (new_file);
+ g_timeout_add (100, (GSourceFunc)delayed_rename_file_hack_callback,
+ data);
+
+ return;
+ }
+
/* no need to select because start_renaming_file selects
* fm_directory_view_select_file (view, new_file);
*/