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



Author: epiotr
Date: Fri Sep 26 23:17:24 2008
New Revision: 2128
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2128&view=rev

Log:
Move get_file_at_row() and get_row_from_file() to GnomeCmdFileList

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-file-selector.cc
   branches/gcmd-1-3/src/gnome-cmd-quicksearch-popup.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	Fri Sep 26 23:17:24 2008
@@ -253,23 +253,6 @@
 }
 
 
-inline GnomeCmdFile *get_file_at_row (GnomeCmdFileList *fl, gint row)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_FILE_LIST (fl), NULL);
-
-    return (GnomeCmdFile *) gtk_clist_get_row_data (*fl, row);
-}
-
-
-inline gint get_row_from_file (GnomeCmdFileList *fl, GnomeCmdFile *finfo)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_FILE_LIST (fl), -1);
-    g_return_val_if_fail (finfo != NULL, -1);
-
-    return gtk_clist_find_row_from_data (*fl, finfo);
-}
-
-
 static void on_selpat_hide (GtkWidget *dialog, GnomeCmdFileList *fl)
 {
     fl->priv->selpat_dialog = NULL;
@@ -340,7 +323,7 @@
     if (strcmp (finfo->info->name, "..") == 0)
         return;
 
-    gint row = get_row_from_file (fl, finfo);
+    gint row = fl->get_row_from_file(finfo);
     if (row == -1)
         return;
 
@@ -372,7 +355,7 @@
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
     g_return_if_fail (finfo != NULL);
 
-    gint row = get_row_from_file (fl, finfo);
+    gint row = fl->get_row_from_file(finfo);
     if (row == -1)
         return;
 
@@ -404,7 +387,7 @@
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
     g_return_if_fail (finfo != NULL);
 
-    gint row = get_row_from_file (fl, finfo);
+    gint row = fl->get_row_from_file(finfo);
 
     if (row == -1)
         return;
@@ -423,7 +406,7 @@
 
     fl->priv->cur_file = row;
 
-    GnomeCmdFile *finfo = get_file_at_row (fl, row);
+    GnomeCmdFile *finfo = fl->get_file_at_row(row);
 
     if (finfo)
         select_file (fl, finfo);
@@ -452,7 +435,7 @@
 
     fl->priv->cur_file = row;
 
-    GnomeCmdFile *finfo = get_file_at_row (fl, row);
+    GnomeCmdFile *finfo = fl->get_file_at_row(row);
 
     if (finfo)
         toggle_file (fl, finfo);
@@ -1077,7 +1060,7 @@
         return FALSE;
     }
 
-    GnomeCmdFile *finfo = get_file_at_row (fl, row);
+    GnomeCmdFile *finfo = fl->get_file_at_row(row);
 
     gtk_signal_emit (*fl, file_list_signals[FILE_CLICKED], finfo, event);
 
@@ -1115,7 +1098,7 @@
         if (event->type == GDK_BUTTON_PRESS && (event->button == 1 || event->button == 3))
         {
             gint prev_row = fl->priv->cur_file;
-            gint row = get_row_from_file (fl, finfo);
+            gint row = fl->get_row_from_file(finfo);
 
             fl->select_row(row);
             gtk_widget_grab_focus (GTK_WIDGET (fl));
@@ -1130,7 +1113,7 @@
                         if (!fl->priv->selected_files)
                         {
                             if (prev_row!=row)
-                                select_file (fl, get_file_at_row (fl, prev_row));
+                                select_file (fl, fl->get_file_at_row(prev_row));
                             select_file_at_row (fl, row);
                         }
                         else
@@ -1181,7 +1164,7 @@
 
         if (row != -1)
         {
-            GnomeCmdFile *finfo = gnome_cmd_file_list_get_file_at_row (fl, row+1);
+            GnomeCmdFile *finfo = fl->get_file_at_row(row+1);
             if (finfo)
             {
                 fl->select_row(row+1);
@@ -1212,7 +1195,7 @@
     {
         if (event->button == 1 && state_is_blank (event->state))
         {
-            GnomeCmdFile *finfo = get_file_at_row (fl, row);
+            GnomeCmdFile *finfo = fl->get_file_at_row(row);
             if (finfo && g_list_index (fl->priv->selected_files, finfo) == -1)
                 fl->unselect_all();
             return TRUE;
@@ -1441,7 +1424,7 @@
 
     for (gint i=0; i<num_files; i++)
     {
-        GnomeCmdFile *f2 = get_file_at_row (this, i);
+        GnomeCmdFile *f2 = get_file_at_row(i);
         if (priv->sort_func (f2, f, this) == 1)
         {
             priv->visible_files.add(f);
@@ -1501,7 +1484,7 @@
     if (!gnome_cmd_file_needs_update (f))
         return;
 
-    gint row = get_row_from_file (this, f);
+    gint row = get_row_from_file(f);
     if (row == -1)
         return;
 
@@ -1516,7 +1499,7 @@
 {
     g_return_if_fail (GNOME_CMD_IS_FILE (f));
 
-    gint row = get_row_from_file (this, f);
+    gint row = get_row_from_file(f);
     if (row == -1)
         return;
 
@@ -1531,7 +1514,7 @@
 {
     g_return_if_fail (f != NULL);
 
-    gint row = get_row_from_file (this, f);
+    gint row = get_row_from_file(f);
 
     if (row >= 0)
     {
@@ -1596,7 +1579,7 @@
 
 GnomeCmdFile *GnomeCmdFileList::get_focused_file()
 {
-    return priv->cur_file < 0 ? NULL : get_file_at_row (this, priv->cur_file);
+    return priv->cur_file < 0 ? NULL : get_file_at_row(priv->cur_file);
 }
 
 
@@ -1626,7 +1609,7 @@
 
 void GnomeCmdFileList::toggle()
 {
-    GnomeCmdFile *f = get_file_at_row (this, priv->cur_file);
+    GnomeCmdFile *f = get_file_at_row(priv->cur_file);
 
     if (f)
         toggle_file (this, f);
@@ -1636,7 +1619,7 @@
 void GnomeCmdFileList::toggle_and_step()
 {
 
-    GnomeCmdFile *f = get_file_at_row (this, priv->cur_file);
+    GnomeCmdFile *f = get_file_at_row(priv->cur_file);
 
     if (f)
         toggle_file (this, f);
@@ -1654,7 +1637,7 @@
         g_return_if_fail (f != NULL);
         g_return_if_fail (f->info != NULL);
 
-        gint row = get_row_from_file (this, f);
+        gint row = get_row_from_file (f);
         if (row == -1)
             return;
 
@@ -1796,7 +1779,7 @@
     // refocus the previously selected file if this file list has the focus
     if (selfile && GTK_WIDGET_HAS_FOCUS (this))
     {
-        gint selrow = get_row_from_file (this, selfile);
+        gint selrow = get_row_from_file(selfile);
         select_row(selrow);
         gtk_clist_moveto (GTK_CLIST (this), selrow, -1, 1, 0);
     }
@@ -1809,18 +1792,6 @@
 }
 
 
-GnomeCmdFile *gnome_cmd_file_list_get_file_at_row (GnomeCmdFileList *fl, gint row)
-{
-    return get_file_at_row (fl, row);
-}
-
-
-gint gnome_cmd_file_list_get_row_from_file (GnomeCmdFileList *fl, GnomeCmdFile *finfo)
-{
-    return get_row_from_file (fl, finfo);
-}
-
-
 void gnome_cmd_file_list_show_rename_dialog (GnomeCmdFileList *fl)
 {
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));

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	Fri Sep 26 23:17:24 2008
@@ -99,6 +99,8 @@
     void restore_selection();
 
     void select_row(gint row);
+    GnomeCmdFile *get_file_at_row(gint row)            {  return (GnomeCmdFile *) gtk_clist_get_row_data (*this, row);  }
+    gint get_row_from_file(GnomeCmdFile *f)            {  return gtk_clist_find_row_from_data (*this, f);               }
     void focus_file(const gchar *focus_file, gboolean scroll_to_file=TRUE);
 
     void toggle();
@@ -183,9 +185,6 @@
 
 void gnome_cmd_file_list_compare_directories (GnomeCmdFileList *fl1, GnomeCmdFileList *fl2);
 
-GnomeCmdFile *gnome_cmd_file_list_get_file_at_row (GnomeCmdFileList *fl, gint row);
-gint gnome_cmd_file_list_get_row_from_file (GnomeCmdFileList *fl, GnomeCmdFile *finfo);
-
 void gnome_cmd_file_list_show_advrename_dialog (GnomeCmdFileList *fl);
 void gnome_cmd_file_list_show_chmod_dialog (GnomeCmdFileList *fl);
 void gnome_cmd_file_list_show_chown_dialog (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	Fri Sep 26 23:17:24 2008
@@ -415,7 +415,7 @@
         to_fn = gnome_vfs_unescape_string (gnome_vfs_uri_extract_short_name (uri), 0);
     }
 
-    f = gnome_cmd_file_list_get_file_at_row (fs->file_list(), row);
+    f = fs->file_list()->get_file_at_row(row);
     cwd = fs->get_directory();
 
     if (f && f->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
@@ -572,7 +572,7 @@
 
     if (row > -1)
     {
-        GnomeCmdFile *f = gnome_cmd_file_list_get_file_at_row (fs->file_list(), row);
+        GnomeCmdFile *f = fs->file_list()->get_file_at_row(row);
 
         if (f->info->type != GNOME_VFS_FILE_TYPE_DIRECTORY)
             row = -1;

Modified: branches/gcmd-1-3/src/gnome-cmd-quicksearch-popup.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-quicksearch-popup.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-quicksearch-popup.cc	Fri Sep 26 23:17:24 2008
@@ -47,7 +47,7 @@
         return;
 
     popup->priv->last_focused_file = finfo;
-    gint row = gnome_cmd_file_list_get_row_from_file (popup->priv->fl, finfo);
+    gint row = popup->priv->fl->get_row_from_file(finfo);
     gtk_clist_moveto (GTK_CLIST (popup->priv->fl), row, 0, 1, 0);
     gtk_clist_freeze (GTK_CLIST (popup->priv->fl));
     GNOME_CMD_CLIST (popup->priv->fl)->drag_motion_row = row;



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