[gnome-commander] GnomeCmdFileList: connecting file list to dir signals



commit 57aa6f984b0ed47e88c8f1a5ca9fa7efa2e8f5a9
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Wed Jul 15 22:05:08 2009 +0200

    GnomeCmdFileList: connecting file list to dir signals
    
    This is an initial framework for redirecting dir signals to GnomeCmdFileList.
    Every change resulting in file list redraw, sends 'files-changed' signal to GnomeCmdFileSelector.
    Currently signal handlers are not connected yet.

 src/gnome-cmd-file-list.cc |   46 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 487a988..f6dbaa5 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1284,6 +1284,52 @@ static void on_realize (GnomeCmdFileList *fl, gpointer user_data)
 }
 
 
+static void on_dir_file_created (GnomeCmdDir *dir, GnomeCmdFile *f, GnomeCmdFileList *fl)
+{
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+
+    if (fl->insert_file(f))
+        g_signal_emit (fl, signals[FILES_CHANGED], 0);
+}
+
+
+static void on_dir_file_deleted (GnomeCmdDir *dir, GnomeCmdFile *f, GnomeCmdFileList *fl)
+{
+    if (fl->cwd == dir)
+        if (fl->remove_file(f))
+            g_signal_emit (fl, signals[FILES_CHANGED], 0);
+}
+
+
+static void on_dir_file_changed (GnomeCmdDir *dir, GnomeCmdFile *f, GnomeCmdFileList *fl)
+{
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+
+    if (fl->has_file(f))
+    {
+        fl->update_file(f);
+        g_signal_emit (fl, signals[FILES_CHANGED], 0);
+    }
+}
+
+
+static void on_dir_file_renamed (GnomeCmdDir *dir, GnomeCmdFile *f, GnomeCmdFileList *fl)
+{
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+
+    if (fl->has_file(f))
+    {
+        // gnome_cmd_file_invalidate_metadata (f, TAG_FILE);    // FIXME: should be handled in GnomeCmdDir, not here
+        fl->update_file(f);
+
+        GnomeCmdFileList::ColumnID sort_col = fl->get_sort_column();
+
+        if (sort_col==GnomeCmdFileList::COLUMN_NAME || sort_col==GnomeCmdFileList::COLUMN_EXT)
+            fl->sort();
+    }
+}
+
+
 /*******************************
  * Gtk class implementation
  *******************************/



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