[gnome-commander] Move gnome_cmd_file_list_compare_directories() to src/gnome-cmd-user-actions.cc
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Move gnome_cmd_file_list_compare_directories() to src/gnome-cmd-user-actions.cc
- Date: Mon, 1 Aug 2011 18:26:21 +0000 (UTC)
commit 1b7ae29983c389544fa249a26f514189e20923e4
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Mon Aug 1 20:23:55 2011 +0200
Move gnome_cmd_file_list_compare_directories() to src/gnome-cmd-user-actions.cc
src/gnome-cmd-file-list.cc | 56 -----------------------------------------
src/gnome-cmd-file-list.h | 2 -
src/gnome-cmd-user-actions.cc | 52 ++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 60 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index fb7e540..e8a23e8 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2009,62 +2009,6 @@ void GnomeCmdFileList::restore_selection()
}
-static gint compare_filename (GnomeCmdFile *f1, GnomeCmdFile *f2)
-{
- return strcmp (f1->info->name, f2->info->name);
-}
-
-
-void gnome_cmd_file_list_compare_directories (GnomeCmdFileList *fl1, GnomeCmdFileList *fl2)
-{
- g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl1));
- g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl2));
-
- fl1->unselect_all();
- fl2->select_all();
-
- for (GList *i=fl1->get_visible_files(); i; i=i->next)
- {
- GnomeCmdFile *f1 = (GnomeCmdFile *) i->data;
- GnomeCmdFile *f2;
-
- GList *sel2 = fl2->priv->selected_files.get_list();
- GList *gl2 = g_list_find_custom (sel2, f1, (GCompareFunc) compare_filename);
-
- g_list_free (sel2);
-
- if (!gl2)
- {
- fl1->select_file(f1);
- continue;
- }
-
- f2 = (GnomeCmdFile *) gl2->data;
-
- if (f1->info->type==GNOME_VFS_FILE_TYPE_DIRECTORY || f2->info->type==GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- fl2->unselect_file(f2);
- continue;
- }
-
- if (f1->info->mtime > f2->info->mtime)
- {
- fl1->select_file(f1);
- fl2->unselect_file(f2);
- continue;
- }
-
- if (f1->info->mtime == f2->info->mtime)
- {
- if (f1->info->size == f2->info->size)
- fl2->unselect_file(f2);
- else
- fl1->select_file(f1);
- }
- }
-}
-
-
void GnomeCmdFileList::sort()
{
GnomeCmdFile *selfile = get_selected_file();
diff --git a/src/gnome-cmd-file-list.h b/src/gnome-cmd-file-list.h
index 6c1f87e..2714109 100644
--- a/src/gnome-cmd-file-list.h
+++ b/src/gnome-cmd-file-list.h
@@ -215,8 +215,6 @@ inline GnomeCmdFile *GnomeCmdFileList::get_selected_file()
return !f || f->is_dotdot ? NULL : f;
}
-void gnome_cmd_file_list_compare_directories (GnomeCmdFileList *fl1, GnomeCmdFileList *fl2);
-
void gnome_cmd_file_list_show_delete_dialog (GnomeCmdFileList *fl);
void gnome_cmd_file_list_show_properties_dialog (GnomeCmdFileList *fl);
void gnome_cmd_file_list_show_rename_dialog (GnomeCmdFileList *fl);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 9d88052..8d1529e 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1350,12 +1350,60 @@ void mark_restore_selection (GtkMenuItem *menuitem, gpointer not_used)
}
-void mark_compare_directories (GtkMenuItem *menuitem, gpointer not_used)
+static gint compare_filename (GnomeCmdFile *f1, GnomeCmdFile *f2)
{
- gnome_cmd_file_list_compare_directories (get_fl (ACTIVE), get_fl (INACTIVE));
+ return strcmp (f1->info->name, f2->info->name);
}
+void mark_compare_directories (GtkMenuItem *menuitem, gpointer not_used)
+{
+ GnomeCmdFileList *fl1 = get_fl (ACTIVE);
+ GnomeCmdFileList *fl2 = get_fl (INACTIVE);
+
+ fl1->unselect_all();
+ fl2->select_all();
+
+ for (GList *i=fl1->get_visible_files(); i; i=i->next)
+ {
+ GnomeCmdFile *f1 = (GnomeCmdFile *) i->data;
+
+ GList *sel2 = fl2->get_marked_files().get_list();
+ GList *gl2 = g_list_find_custom (sel2, f1, (GCompareFunc) compare_filename);
+
+ g_list_free (sel2);
+
+ if (!gl2)
+ {
+ fl1->select_file(f1);
+ continue;
+ }
+
+ GnomeCmdFile *f2 = (GnomeCmdFile *) gl2->data;
+
+ if (f1->info->type==GNOME_VFS_FILE_TYPE_DIRECTORY || f2->info->type==GNOME_VFS_FILE_TYPE_DIRECTORY)
+ {
+ fl2->unselect_file(f2);
+ continue;
+ }
+
+ if (f1->info->mtime > f2->info->mtime)
+ {
+ fl1->select_file(f1);
+ fl2->unselect_file(f2);
+ continue;
+ }
+
+ if (f1->info->mtime == f2->info->mtime)
+ {
+ if (f1->info->size == f2->info->size)
+ fl2->unselect_file(f2);
+ else
+ fl1->select_file(f1);
+ }
+ }
+}
+
/************** View Menu **************/
void view_conbuttons (GtkMenuItem *menuitem, gpointer not_used)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]