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



Author: epiotr
Date: Fri Aug 15 13:52:08 2008
New Revision: 1985
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1985&view=rev

Log:
Convert GnomeCmdFileSelector struct into C++ class, part 3

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc
   branches/gcmd-1-3/src/gnome-cmd-cmdline.cc
   branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc
   branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
   branches/gcmd-1-3/src/gnome-cmd-file-selector.h
   branches/gcmd-1-3/src/gnome-cmd-main-win.cc
   branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc
   branches/gcmd-1-3/src/gnome-cmd-user-actions.cc

Modified: branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc	Fri Aug 15 13:52:08 2008
@@ -601,7 +601,7 @@
     GnomeCmdCon *current_con = fs->get_connection();
 
     if (current_con == bookmark->group->con)
-        gnome_cmd_file_selector_goto_directory (fs, bookmark->path);
+        fs->goto_directory(bookmark->path);
     else
     {
         GnomeCmdCon *con = bookmark->group->con;

Modified: branches/gcmd-1-3/src/gnome-cmd-cmdline.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-cmdline.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-cmdline.cc	Fri Aug 15 13:52:08 2008
@@ -87,18 +87,18 @@
             GnomeVFSURI *test_uri = gnome_cmd_dir_get_child_uri (fs->get_directory(), "-");
 
             if (gnome_vfs_uri_exists (test_uri))
-                gnome_cmd_file_selector_goto_directory (fs, dest_dir);
+                fs->goto_directory(dest_dir);
             else
                 fs->back();
 
             gnome_vfs_uri_unref (test_uri);
         }
         else
-            gnome_cmd_file_selector_goto_directory (fs, dest_dir);
+            fs->goto_directory(dest_dir);
     }
     else
         if (strcmp (cmdline_text, "cd")==0)
-            gnome_cmd_file_selector_goto_directory (fs, "~");
+            fs->goto_directory("~");
         else
             if (fs->is_local())
             {

Modified: branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc	Fri Aug 15 13:52:08 2008
@@ -98,7 +98,7 @@
                 strncpy (chTo, labelText, indicator->priv->slashCharPosition[i]);
                 chTo[indicator->priv->slashCharPosition[i]] = 0x0;
                 gnome_cmd_main_win_switch_fs (main_win, fs);
-                gnome_cmd_file_selector_goto_directory (fs, chTo);
+                fs->goto_directory(chTo);
                 g_free (chTo);
                 return TRUE;
             }
@@ -274,7 +274,7 @@
     g_return_if_fail (GNOME_CMD_IS_DIR_INDICATOR (indicator));
 
     gnome_cmd_main_win_switch_fs (main_win, indicator->priv->fs);
-    gnome_cmd_file_selector_goto_directory (indicator->priv->fs, path);
+    indicator->priv->fs->goto_directory(path);
 }
 
 
@@ -287,7 +287,7 @@
     g_return_if_fail (GNOME_CMD_IS_DIR_INDICATOR (indicator));
 
     gnome_cmd_main_win_switch_fs (main_win, indicator->priv->fs);
-    gnome_cmd_file_selector_goto_directory (indicator->priv->fs, bm->path);
+    indicator->priv->fs->goto_directory(bm->path);
 }
 
 

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 Aug 15 13:52:08 2008
@@ -593,7 +593,7 @@
     if (y < 0) return;
 
     GtkCList *clist = GTK_CLIST (fs->file_list());
-    guint offset = (0-clist->voffset);
+    // guint offset = (0-clist->voffset);
     gint w, h;
 
     gint smin = h/8;
@@ -734,18 +734,18 @@
 }
 
 
-static void goto_directory (GnomeCmdFileSelector *fs, const gchar *in_dir)
+void GnomeCmdFileSelector::goto_directory(const gchar *in_dir)
 {
-    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
     g_return_if_fail (in_dir != NULL);
 
-    GnomeCmdDir *cur_dir, *new_dir = NULL;
-    const gchar *focus_dir = NULL;
-    gchar *dir;
+    GnomeCmdDir *cur_dir = get_directory();
 
-    cur_dir = fs->get_directory();
     g_return_if_fail (GNOME_CMD_IS_DIR (cur_dir));
 
+    GnomeCmdDir *new_dir = NULL;
+    const gchar *focus_dir = NULL;
+    gchar *dir;
+
     if (g_str_has_prefix (in_dir, "~"))
         dir = gnome_vfs_expand_initial_tilde (in_dir);
     else
@@ -766,7 +766,7 @@
     {
         // check if it's an absolute address or not
         if (dir[0] == '/')
-            new_dir = gnome_cmd_dir_new (fs->priv->con, gnome_cmd_con_create_path (fs->priv->con, dir));
+            new_dir = gnome_cmd_dir_new (priv->con, gnome_cmd_con_create_path (priv->con, dir));
         else
             if (g_str_has_prefix (dir, "\\\\") )
             {
@@ -779,11 +779,11 @@
     }
 
     if (new_dir)
-        fs->set_directory(new_dir);
+        set_directory(new_dir);
 
     // focus the current dir when going back to the parent dir
     if (focus_dir)
-        gnome_cmd_file_list_focus_file (fs->file_list(), focus_dir, FALSE);
+        gnome_cmd_file_list_focus_file (file_list(), focus_dir, FALSE);
 
     g_free (dir);
 }
@@ -800,9 +800,9 @@
         gnome_cmd_file_list_invalidate_tree_size (fs->file_list());
 
         if (strcmp (f->info->name, "..") == 0)
-            goto_directory (fs, "..");
+            fs->goto_directory("..");
         else
-            fs->set_directory (GNOME_CMD_DIR (f));
+            fs->set_directory(GNOME_CMD_DIR (f));
     }
 }
 
@@ -1045,8 +1045,9 @@
     {
         if (event->button == 1 || event->button == 3)
             gnome_cmd_main_win_switch_fs (main_win, fs);
-        else if (event->button == 2)
-            goto_directory (fs, "..");
+        else
+            if (event->button == 2)
+                fs->goto_directory("..");
     }
 }
 
@@ -1231,7 +1232,7 @@
 static void on_root_btn_clicked (GtkButton *button, GnomeCmdFileSelector *fs)
 {
     gnome_cmd_main_win_switch_fs (main_win, fs);
-    goto_directory (fs, G_DIR_SEPARATOR_S);
+    fs->goto_directory(G_DIR_SEPARATOR_S);
 }
 
 
@@ -1493,7 +1494,7 @@
         return;
 
     priv->dir_history->lock();
-    goto_directory (this, priv->dir_history->first());
+    goto_directory(priv->dir_history->first());
     priv->dir_history->unlock();
 }
 
@@ -1504,7 +1505,7 @@
         return;
 
     priv->dir_history->lock();
-    goto_directory (this, priv->dir_history->back());
+    goto_directory(priv->dir_history->back());
     priv->dir_history->unlock();
 }
 
@@ -1515,7 +1516,7 @@
         return;
 
     priv->dir_history->lock();
-    goto_directory (this, priv->dir_history->forward());
+    goto_directory(priv->dir_history->forward());
     priv->dir_history->unlock();
 }
 
@@ -1526,7 +1527,7 @@
         return;
 
     priv->dir_history->lock();
-    goto_directory (this, priv->dir_history->last());
+    goto_directory(priv->dir_history->last());
     priv->dir_history->unlock();
 }
 
@@ -1580,12 +1581,6 @@
 }
 
 
-void gnome_cmd_file_selector_goto_directory (GnomeCmdFileSelector *fs, const gchar *dir)
-{
-    goto_directory (fs, dir);
-}
-
-
 void GnomeCmdFileSelector::set_active(gboolean value)
 {
     priv->active = value;
@@ -2017,7 +2012,7 @@
                 return TRUE;
 
             case GDK_Page_Up:
-                goto_directory (fs, "..");
+                fs->goto_directory("..");
                 return TRUE;
 
             case GDK_Page_Down:
@@ -2048,7 +2043,7 @@
             case GDK_Left:
             case GDK_KP_Left:
             case GDK_BackSpace:
-                goto_directory (fs, "..");
+                fs->goto_directory("..");
                 return TRUE;
 
             case GDK_Right:

Modified: branches/gcmd-1-3/src/gnome-cmd-file-selector.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-selector.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-selector.h	Fri Aug 15 13:52:08 2008
@@ -72,6 +72,7 @@
     
     GnomeCmdDir *get_directory();
     void set_directory(GnomeCmdDir *dir);
+    void goto_directory(const gchar *dir);
 
     void reload();
 
@@ -105,8 +106,6 @@
 
 void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID);
 
-void gnome_cmd_file_selector_goto_directory (GnomeCmdFileSelector *fs, const gchar *dir);
-
 void gnome_cmd_file_selector_start_editor (GnomeCmdFileSelector *fs);
 
 void gnome_cmd_file_selector_update_connections (GnomeCmdFileSelector *fs);

Modified: branches/gcmd-1-3/src/gnome-cmd-main-win.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-main-win.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-main-win.cc	Fri Aug 15 13:52:08 2008
@@ -837,10 +837,8 @@
     gnome_cmd_main_win_get_fs (mw, LEFT)->set_connection(get_home_con ());
     gnome_cmd_main_win_get_fs (mw, RIGHT)->set_connection(get_home_con ());
 
-    gnome_cmd_file_selector_goto_directory (gnome_cmd_main_win_get_fs (mw, LEFT),
-                                            start_dir_left ? start_dir_left : gnome_cmd_data_get_start_dir (LEFT));
-    gnome_cmd_file_selector_goto_directory (gnome_cmd_main_win_get_fs (mw, RIGHT),
-                                            start_dir_right ? start_dir_right : gnome_cmd_data_get_start_dir (RIGHT));
+    gnome_cmd_main_win_get_fs (mw, LEFT)->goto_directory(start_dir_left ? start_dir_left : gnome_cmd_data_get_start_dir (LEFT));
+    gnome_cmd_main_win_get_fs (mw, RIGHT)->goto_directory(start_dir_right ? start_dir_right : gnome_cmd_data_get_start_dir (RIGHT));
 
     gtk_window_add_accel_group (GTK_WINDOW (main_win), mw->priv->accel_group);
     gnome_cmd_main_win_focus_file_lists (main_win);

Modified: branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc	Fri Aug 15 13:52:08 2008
@@ -640,7 +640,7 @@
     gchar *dpath = g_path_get_dirname (fpath);
 
     GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
-    gnome_cmd_file_selector_goto_directory (fs, dpath);
+    fs->goto_directory(dpath);
     gnome_cmd_file_list_focus_file (fs->file_list(), gnome_cmd_file_get_name (finfo), TRUE);
 
     g_free (fpath);

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	Fri Aug 15 13:52:08 2008
@@ -1234,7 +1234,7 @@
 
 void view_up (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_goto_directory (get_fs (ACTIVE), "..");
+    get_fs (ACTIVE)->goto_directory("..");
 }
 
 
@@ -1301,13 +1301,13 @@
 void view_home (GtkMenuItem *menuitem, gpointer not_used)
 {
     get_fs (ACTIVE)->set_connection(get_home_con ());
-    gnome_cmd_file_selector_goto_directory (get_fs (ACTIVE), "~");
+    get_fs (ACTIVE)->goto_directory("~");
 }
 
 
 void view_root (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_goto_directory (get_fs (ACTIVE), "/");
+    get_fs (ACTIVE)->goto_directory("/");
 }
 
 



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