gnome-commander r1535 - in branches/gcmd-1-3: . doc/C src



Author: epiotr
Date: Sun Jan 20 23:06:17 2008
New Revision: 1535
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1535&view=rev

Log:
Fixed problem #345314 (cursor not staying on file while renaming)

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/doc/C/gnome-commander.xml
   branches/gcmd-1-3/src/gnome-cmd-dir.cc
   branches/gcmd-1-3/src/gnome-cmd-dir.h
   branches/gcmd-1-3/src/gnome-cmd-file-list.cc
   branches/gcmd-1-3/src/gnome-cmd-file-list.h
   branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
   branches/gcmd-1-3/src/gnome-cmd-file.cc
   branches/gcmd-1-3/src/gnome-cmd-rename-dialog.cc

Modified: branches/gcmd-1-3/doc/C/gnome-commander.xml
==============================================================================
--- branches/gcmd-1-3/doc/C/gnome-commander.xml	(original)
+++ branches/gcmd-1-3/doc/C/gnome-commander.xml	Sun Jan 20 23:06:17 2008
@@ -5629,7 +5629,10 @@
                 <para>
                     <itemizedlist>
                         <listitem>
-                            <para>Fixed problem #353889 (disappearing files after failed move (F6)))</para>
+                            <para>Fixed problem #345314 (cursor not staying on file while renaming)</para>
+                        </listitem>
+                        <listitem>
+                            <para>Fixed problem #353889 (disappearing files after failed move (F6))</para>
                         </listitem>
                         <listitem>
                             <para>Fixed problems #365227 and #446361 (build issues on Solaris)</para>

Modified: branches/gcmd-1-3/src/gnome-cmd-dir.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir.cc	Sun Jan 20 23:06:17 2008
@@ -45,6 +45,7 @@
     FILE_CREATED,
     FILE_DELETED,
     FILE_CHANGED,
+    FILE_RENAMED,
     LIST_OK,
     LIST_FAILED,
     LAST_SIGNAL
@@ -143,7 +144,7 @@
     parent_class = (GnomeCmdFileClass *) gtk_type_class (gnome_cmd_file_get_type ());
 
     dir_signals[FILE_CREATED] =
-        gtk_signal_new ("file_created",
+        gtk_signal_new ("file-created",
             GTK_RUN_LAST,
             G_OBJECT_CLASS_TYPE (object_class),
             GTK_SIGNAL_OFFSET (GnomeCmdDirClass, file_created),
@@ -152,7 +153,7 @@
             1, GTK_TYPE_POINTER);
 
     dir_signals[FILE_DELETED] =
-        gtk_signal_new ("file_deleted",
+        gtk_signal_new ("file-deleted",
             GTK_RUN_LAST,
             G_OBJECT_CLASS_TYPE (object_class),
             GTK_SIGNAL_OFFSET (GnomeCmdDirClass, file_deleted),
@@ -161,7 +162,7 @@
             1, GTK_TYPE_POINTER);
 
     dir_signals[FILE_CHANGED] =
-        gtk_signal_new ("file_changed",
+        gtk_signal_new ("file-changed",
             GTK_RUN_LAST,
             G_OBJECT_CLASS_TYPE (object_class),
             GTK_SIGNAL_OFFSET (GnomeCmdDirClass, file_changed),
@@ -169,8 +170,17 @@
             GTK_TYPE_NONE,
             1, GTK_TYPE_POINTER);
 
+    dir_signals[FILE_RENAMED] =
+        gtk_signal_new ("file-renamed",
+            GTK_RUN_LAST,
+            G_OBJECT_CLASS_TYPE (object_class),
+            GTK_SIGNAL_OFFSET (GnomeCmdDirClass, file_renamed),
+            gtk_marshal_NONE__POINTER,
+            GTK_TYPE_NONE,
+            1, GTK_TYPE_POINTER);
+
     dir_signals[LIST_OK] =
-        gtk_signal_new ("list_ok",
+        gtk_signal_new ("list-ok",
             GTK_RUN_LAST,
             G_OBJECT_CLASS_TYPE (object_class),
             GTK_SIGNAL_OFFSET (GnomeCmdDirClass, list_ok),
@@ -179,7 +189,7 @@
             1, GTK_TYPE_POINTER);
 
     dir_signals[LIST_FAILED] =
-        gtk_signal_new ("list_failed",
+        gtk_signal_new ("list-failed",
             GTK_RUN_LAST,
             G_OBJECT_CLASS_TYPE (object_class),
             GTK_SIGNAL_OFFSET (GnomeCmdDirClass, list_failed),
@@ -191,6 +201,7 @@
     klass->file_created = NULL;
     klass->file_deleted = NULL;
     klass->file_changed = NULL;
+    klass->file_renamed = NULL;
     klass->list_ok = NULL;
     klass->list_failed = NULL;
 }
@@ -801,12 +812,15 @@
 }
 
 
-void gnome_cmd_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *finfo)
+void gnome_cmd_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *finfo, const gchar *old_uri_str)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
     g_return_if_fail (GNOME_CMD_IS_FILE (finfo));
+    g_return_if_fail (old_uri_str!=NULL);
 
-    gtk_signal_emit (GTK_OBJECT (dir), dir_signals[FILE_CHANGED], finfo);
+    gnome_cmd_file_collection_remove_by_uri (dir->priv->file_collection, old_uri_str);
+    gnome_cmd_file_collection_add (dir->priv->file_collection, finfo);
+    gtk_signal_emit (GTK_OBJECT (dir), dir_signals[FILE_RENAMED], finfo);
 }
 
 

Modified: branches/gcmd-1-3/src/gnome-cmd-dir.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir.h	Sun Jan 20 23:06:17 2008
@@ -77,6 +77,7 @@
     void (* file_created)       (GnomeCmdDir *dir, GnomeCmdFile *file);
     void (* file_deleted)       (GnomeCmdDir *dir, GnomeCmdFile *file);
     void (* file_changed)       (GnomeCmdDir *dir, GnomeCmdFile *file);
+    void (* file_renamed)       (GnomeCmdDir *dir, GnomeCmdFile *file);
     void (* list_ok)            (GnomeCmdDir *dir, GList *files);
     void (* list_failed)        (GnomeCmdDir *dir, GnomeVFSResult result);
 };
@@ -117,7 +118,7 @@
 void gnome_cmd_dir_file_created (GnomeCmdDir *dir, const gchar *uri_str);
 void gnome_cmd_dir_file_deleted (GnomeCmdDir *dir, const gchar *uri_str);
 void gnome_cmd_dir_file_changed (GnomeCmdDir *dir, const gchar *uri_str);
-void gnome_cmd_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *finfo);
+void gnome_cmd_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *finfo, const gchar *old_uri_str);
 gboolean gnome_cmd_dir_uses_fam (GnomeCmdDir *dir);
 
 void gnome_cmd_dir_start_monitoring (GnomeCmdDir *dir);

Modified: branches/gcmd-1-3/src/gnome-cmd-file-list.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-list.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-list.cc	Sun Jan 20 23:06:17 2008
@@ -1305,6 +1305,14 @@
 }
 
 
+GnomeCmdFileListColumnID gnome_cmd_file_list_get_sort_column (GnomeCmdFileList *fl)
+{
+    g_return_val_if_fail (GNOME_CMD_IS_FILE_LIST (fl), FILE_LIST_COLUMN_ICON);
+
+    return (GnomeCmdFileListColumnID) fl->priv->current_col;
+}
+
+
 void gnome_cmd_file_list_update_style (GnomeCmdFileList *fl)
 {
     gtk_clist_set_row_height (GTK_CLIST (fl), gnome_cmd_data_get_list_row_height ());

Modified: branches/gcmd-1-3/src/gnome-cmd-file-list.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-list.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-list.h	Sun Jan 20 23:06:17 2008
@@ -110,6 +110,7 @@
 GtkWidget *gnome_cmd_file_list_new (void);
 
 void gnome_cmd_file_list_show_column (GnomeCmdFileList *fl, GnomeCmdFileListColumnID col, gboolean value);
+GnomeCmdFileListColumnID gnome_cmd_file_list_get_sort_column (GnomeCmdFileList *fl);
 
 void gnome_cmd_file_list_update_style (GnomeCmdFileList *fl);
 

Modified: branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-selector.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-selector.cc	Sun Jan 20 23:06:17 2008
@@ -887,6 +887,24 @@
 }
 
 
+static void on_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *finfo, GnomeCmdFileSelector *fs)
+{
+    g_return_if_fail (GNOME_CMD_IS_DIR (dir));
+    g_return_if_fail (GNOME_CMD_IS_FILE (finfo));
+    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
+
+    if (file_is_in_list (fs, finfo))
+    {
+        gnome_cmd_file_list_update_file (GNOME_CMD_FILE_LIST (fs->list), finfo);
+
+        GnomeCmdFileListColumnID sort_col = gnome_cmd_file_list_get_sort_column (GNOME_CMD_FILE_LIST (fs->list));
+
+        if (sort_col==FILE_LIST_COLUMN_NAME || sort_col==FILE_LIST_COLUMN_EXT)
+            gnome_cmd_file_list_sort (GNOME_CMD_FILE_LIST (fs->list));
+    }
+}
+
+
 static void on_con_combo_item_selected (GnomeCmdCombo *con_combo, GnomeCmdCon *con, GnomeCmdFileSelector *fs)
 {
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
@@ -1059,11 +1077,14 @@
                                            GTK_SIGNAL_FUNC (on_dir_file_deleted), fs);
             gtk_signal_disconnect_by_func (GTK_OBJECT (fs->priv->connected_dir),
                                            GTK_SIGNAL_FUNC (on_dir_file_changed), fs);
+            gtk_signal_disconnect_by_func (GTK_OBJECT (fs->priv->connected_dir),
+                                           GTK_SIGNAL_FUNC (on_dir_file_renamed), fs);
         }
 
         gtk_signal_connect (GTK_OBJECT (dir), "file-created", GTK_SIGNAL_FUNC (on_dir_file_created), fs);
         gtk_signal_connect (GTK_OBJECT (dir), "file-deleted", GTK_SIGNAL_FUNC (on_dir_file_deleted), fs);
         gtk_signal_connect (GTK_OBJECT (dir), "file-changed", GTK_SIGNAL_FUNC (on_dir_file_changed), fs);
+        gtk_signal_connect (GTK_OBJECT (dir), "file-renamed", GTK_SIGNAL_FUNC (on_dir_file_renamed), fs);
         fs->priv->connected_dir = dir;
     }
 

Modified: branches/gcmd-1-3/src/gnome-cmd-file.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file.cc	Sun Jan 20 23:06:17 2008
@@ -271,6 +271,8 @@
     g_return_val_if_fail (finfo, GNOME_VFS_ERROR_CORRUPTED_DATA);
     g_return_val_if_fail (finfo->info, GNOME_VFS_ERROR_CORRUPTED_DATA);
 
+    gchar *old_uri_str = gnome_cmd_file_get_uri_str (finfo);
+
     GnomeVFSFileInfo *new_info = gnome_vfs_file_info_dup (finfo->info);
     g_return_val_if_fail (new_info, GNOME_VFS_ERROR_CORRUPTED_DATA);
 
@@ -284,7 +286,7 @@
     if (result == GNOME_VFS_OK && has_parent_dir (finfo))
     {
         gnome_cmd_file_update_info (finfo, new_info);
-        gnome_cmd_dir_file_renamed (get_parent_dir (finfo), finfo);
+        gnome_cmd_dir_file_renamed (get_parent_dir (finfo), finfo, old_uri_str);
         if (GNOME_CMD_IS_DIR (finfo))
             gnome_cmd_dir_update_path (GNOME_CMD_DIR (finfo));
     }

Modified: branches/gcmd-1-3/src/gnome-cmd-rename-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-rename-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-rename-dialog.cc	Sun Jan 20 23:06:17 2008
@@ -54,7 +54,8 @@
         case GDK_KP_Enter:
             {
                 const gchar *new_fname = gtk_entry_get_text (dialog->priv->textbox);
-                GnomeVFSResult ret = gnome_cmd_file_rename (dialog->priv->finfo, new_fname);
+                GnomeVFSResult result = gnome_cmd_file_rename (dialog->priv->finfo, new_fname);
+                gnome_cmd_file_list_focus_file (gnome_cmd_main_win_get_fs (main_win, ACTIVE)->list, new_fname, TRUE);
 
                 gnome_cmd_file_unref (dialog->priv->finfo);
                 gtk_widget_destroy (widget);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]