gnome-commander r2095 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Mon Sep 22 18:25:51 2008
New Revision: 2095
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2095&view=rev

Log:
GnomeCmdFileList: more C++ rework

Modified:
   branches/gcmd-1-3/ChangeLog
   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-patternsel-dialog.cc
   branches/gcmd-1-3/src/gnome-cmd-user-actions.cc

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	Mon Sep 22 18:25:51 2008
@@ -1688,34 +1688,32 @@
 }
 
 
-void gnome_cmd_file_list_select_pattern (GnomeCmdFileList *fl, const gchar *pattern, gboolean case_sens)
+void GnomeCmdFileList::select_pattern(const gchar *pattern, gboolean case_sens)
 {
-    toggle_with_pattern (fl, pattern, case_sens, TRUE);
+    toggle_with_pattern (this, pattern, case_sens, TRUE);
 }
 
 
-void gnome_cmd_file_list_unselect_pattern (GnomeCmdFileList *fl, const gchar *pattern, gboolean case_sens)
+void GnomeCmdFileList::unselect_pattern(const gchar *pattern, gboolean case_sens)
 {
-    toggle_with_pattern (fl, pattern, case_sens, FALSE);
+    toggle_with_pattern (this, pattern, case_sens, FALSE);
 }
 
 
-void gnome_cmd_file_list_invert_selection (GnomeCmdFileList *fl)
+void GnomeCmdFileList::invert_selection()
 {
-    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
-
-    GList *sel = g_list_copy (fl->priv->selected_files);
+    GList *sel = g_list_copy (priv->selected_files);
 
-    for (GList *tmp=fl->get_visible_files(); tmp; tmp = tmp->next)
+    for (GList *tmp=get_visible_files(); tmp; tmp = tmp->next)
     {
         GnomeCmdFile *finfo = (GnomeCmdFile *) tmp->data;
 
         if (finfo && finfo->info)
         {
             if (g_list_index (sel, finfo) == -1)
-                select_file (fl, finfo);
+                select_file (this, finfo);
             else
-                unselect_file (fl, finfo);
+                unselect_file (this, finfo);
         }
     }
 
@@ -1723,19 +1721,19 @@
 }
 
 
-void gnome_cmd_file_list_select_all_with_same_extension (GnomeCmdFileList *fl)
+void GnomeCmdFileList::select_all_with_same_extension()
 {
-    toggle_files_with_same_extension (fl, TRUE);
+    toggle_files_with_same_extension (this, TRUE);
 }
 
 
-void gnome_cmd_file_list_unselect_all_with_same_extension (GnomeCmdFileList *fl)
+void GnomeCmdFileList::unselect_all_with_same_extension()
 {
-    toggle_files_with_same_extension (fl, FALSE);
+    toggle_files_with_same_extension (this, FALSE);
 }
 
 
-void gnome_cmd_file_list_restore_selection (GnomeCmdFileList *fl)
+void GnomeCmdFileList::restore_selection()
 {
 }
 
@@ -2160,11 +2158,11 @@
                 return TRUE;
 
             case GDK_KP_Multiply:
-                gnome_cmd_file_list_invert_selection (this);
+                invert_selection();
                 return TRUE;
 
             case GDK_KP_Divide:
-                gnome_cmd_file_list_restore_selection (this);
+                restore_selection();
                 return TRUE;
 
             case GDK_Insert:

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	Mon Sep 22 18:25:51 2008
@@ -88,6 +88,13 @@
     void select_all();
     void unselect_all();
 
+    void select_pattern(const gchar *pattern, gboolean case_sens);
+    void unselect_pattern(const gchar *pattern, gboolean case_sens);
+    void select_all_with_same_extension();
+    void unselect_all_with_same_extension();
+    void invert_selection();
+    void restore_selection();
+
     void select_row(gint row);
 
     void toggle();
@@ -168,13 +175,6 @@
 
 void gnome_cmd_file_list_focus_file (GnomeCmdFileList *fl, const gchar *focus_file, gboolean scroll_to_file);
 
-void gnome_cmd_file_list_select_pattern (GnomeCmdFileList *fl, const gchar *pattern, gboolean case_sens);
-void gnome_cmd_file_list_unselect_pattern (GnomeCmdFileList *fl, const gchar *pattern, gboolean case_sens);
-void gnome_cmd_file_list_invert_selection (GnomeCmdFileList *fl);
-void gnome_cmd_file_list_select_all_with_same_extension (GnomeCmdFileList *fl);
-void gnome_cmd_file_list_unselect_all_with_same_extension (GnomeCmdFileList *fl);
-void gnome_cmd_file_list_restore_selection (GnomeCmdFileList *fl);
-
 void gnome_cmd_file_list_compare_directories (GnomeCmdFileList *fl1, GnomeCmdFileList *fl2);
 
 GnomeCmdFile *gnome_cmd_file_list_get_file_at_row (GnomeCmdFileList *fl, gint row);

Modified: branches/gcmd-1-3/src/gnome-cmd-patternsel-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-patternsel-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-patternsel-dialog.cc	Mon Sep 22 18:25:51 2008
@@ -52,9 +52,9 @@
     gboolean case_sens = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->case_check));
 
     if (dialog->priv->mode)
-        gnome_cmd_file_list_select_pattern (dialog->priv->fl, s, case_sens);
+        dialog->priv->fl->select_pattern(s, case_sens);
     else
-        gnome_cmd_file_list_unselect_pattern (dialog->priv->fl, s, case_sens);
+        dialog->priv->fl->unselect_pattern(s, case_sens);
 
     defaults->name_patterns = string_history_add (defaults->name_patterns, s, PATTERN_HISTORY_SIZE);
 

Modified: branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	Mon Sep 22 18:25:51 2008
@@ -1147,25 +1147,25 @@
 
 void mark_invert_selection (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_list_invert_selection (get_fl (ACTIVE));
+    get_fl (ACTIVE)->invert_selection();
 }
 
 
 void mark_select_all_with_same_extension (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_list_select_all_with_same_extension (get_fl (ACTIVE));
+    get_fl (ACTIVE)->select_all_with_same_extension();
 }
 
 
 void mark_unselect_all_with_same_extension (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_list_unselect_all_with_same_extension (get_fl (ACTIVE));
+    get_fl (ACTIVE)->unselect_all_with_same_extension();
 }
 
 
 void mark_restore_selection (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_list_restore_selection (get_fl (ACTIVE));
+    get_fl (ACTIVE)->restore_selection();
 }
 
 



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