[gnome-commander] GnomeCmdCon: removed superfluous code for cwd handling



commit c15bce07022028a61754bd0e87c439147a5bb0c8
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Thu Jul 23 18:32:47 2009 +0200

    GnomeCmdCon: removed superfluous code for cwd handling

 src/gnome-cmd-con-device.cc    |    1 -
 src/gnome-cmd-con-ftp.cc       |    1 -
 src/gnome-cmd-con-home.cc      |    1 -
 src/gnome-cmd-con.cc           |   41 ----------------------------------------
 src/gnome-cmd-con.h            |    5 ----
 src/gnome-cmd-file-selector.cc |    8 +++---
 6 files changed, 4 insertions(+), 53 deletions(-)
---
diff --git a/src/gnome-cmd-con-device.cc b/src/gnome-cmd-con-device.cc
index 67303a6..fb8560e 100644
--- a/src/gnome-cmd-con-device.cc
+++ b/src/gnome-cmd-con-device.cc
@@ -231,7 +231,6 @@ static gboolean dev_close (GnomeCmdCon *con)
     GnomeCmdConDevice *dev_con = GNOME_CMD_CON_DEVICE (con);
 
     gnome_cmd_con_set_default_dir (con, NULL);
-    gnome_cmd_con_set_cwd (con, NULL);
 
     chdir (g_get_home_dir ());
 
diff --git a/src/gnome-cmd-con-ftp.cc b/src/gnome-cmd-con-ftp.cc
index 40c5c6b..ef522c6 100644
--- a/src/gnome-cmd-con-ftp.cc
+++ b/src/gnome-cmd-con-ftp.cc
@@ -97,7 +97,6 @@ static void ftp_open (GnomeCmdCon *con)
 static gboolean ftp_close (GnomeCmdCon *con)
 {
     gnome_cmd_con_set_default_dir (con, NULL);
-    gnome_cmd_con_set_cwd (con, NULL);
     g_object_unref (con->base_path);
     con->base_path = NULL;
     con->state = CON_STATE_CLOSED;
diff --git a/src/gnome-cmd-con-home.cc b/src/gnome-cmd-con-home.cc
index 0eec4af..e5867c7 100644
--- a/src/gnome-cmd-con-home.cc
+++ b/src/gnome-cmd-con-home.cc
@@ -128,7 +128,6 @@ static void init (GnomeCmdConHome *home_con)
     GnomeCmdDir *dir = gnome_cmd_dir_new (con, path);
 
     gnome_cmd_con_set_default_dir (con, dir);
-    gnome_cmd_con_set_cwd (con, dir);
 }
 
 
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 51b3d95..a1bd6c2 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -31,7 +31,6 @@ using namespace std;
 
 struct GnomeCmdConPrivate
 {
-    GnomeCmdDir    *cwd;           // current working directory
     GnomeCmdDir    *root_dir;      // the root dir of this connection
     GnomeCmdDir    *default_dir;   // the start dir of this connection
     History        *dir_history;
@@ -97,8 +96,6 @@ static void destroy (GtkObject *object)
     g_free (con->close_tooltip);
     gnome_cmd_pixmap_free (con->close_pixmap);
 
-    if (con->priv->cwd)
-        gnome_cmd_dir_unref (con->priv->cwd);
     if (con->priv->default_dir)
         gnome_cmd_dir_unref (con->priv->default_dir);
     if (con->priv->root_dir)
@@ -203,7 +200,6 @@ static void init (GnomeCmdCon *con)
     con->open_failed_msg = NULL;
 
     con->priv = g_new0 (GnomeCmdConPrivate, 1);
-    con->priv->cwd = NULL;
     con->priv->default_dir = NULL;
     con->priv->dir_history = new History(20);
     con->priv->bookmarks = g_new0 (GnomeCmdBookmarkGroup, 1);
@@ -256,7 +252,6 @@ static gboolean check_con_open_progress (GnomeCmdCon *con)
         GnomeCmdDir *dir = gnome_cmd_dir_new_with_con (con->base_info, con->base_path, con);
 
         gnome_cmd_con_set_default_dir (con, dir);
-        gnome_cmd_con_set_cwd (con, dir);
 
         DEBUG ('m', "Emitting open_done signal\n");
         gtk_signal_emit (GTK_OBJECT (con), signals[OPEN_DONE]);
@@ -332,42 +327,6 @@ GnomeCmdPath *gnome_cmd_con_create_path (GnomeCmdCon *con, const gchar *path_str
 }
 
 
-void gnome_cmd_con_set_cwd (GnomeCmdCon *con, GnomeCmdDir *dir)
-{
-    g_return_if_fail (GNOME_CMD_IS_CON (con));
-
-    if (GNOME_CMD_IS_DIR (dir) && gnome_cmd_dir_get_connection (dir) != con)
-        return;
-
-    if (dir == con->priv->cwd)
-        return;
-
-    if (dir)
-        gnome_cmd_dir_ref (dir);
-    if (con->priv->cwd)
-        gnome_cmd_dir_unref (con->priv->cwd);
-
-    con->priv->cwd = dir;
-}
-
-
-GnomeCmdDir *gnome_cmd_con_get_cwd (GnomeCmdCon *con)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_CON (con), NULL);
-
-    /*
-    if (!con->priv->cwd)
-    {
-        GnomeCmdDir *dir = gnome_cmd_dir_new (con, con->base_path);
-        if (dir)
-            gnome_cmd_con_set_cwd (con, dir);
-    }
-    */
-
-    return con->priv->cwd;
-}
-
-
 void gnome_cmd_con_set_default_dir (GnomeCmdCon *con, GnomeCmdDir *dir)
 {
     g_return_if_fail (GNOME_CMD_IS_CON (con));
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 4129137..fe1310f 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -207,12 +207,7 @@ inline void gnome_cmd_con_set_host_name (GnomeCmdCon *con, const std::string &ho
     gnome_cmd_con_set_host_name (con, host.empty() ? NULL : host.c_str());
 }
 
-void gnome_cmd_con_set_cwd (GnomeCmdCon *con, GnomeCmdDir *dir);
-
-GnomeCmdDir *gnome_cmd_con_get_cwd (GnomeCmdCon *con);
-
 GnomeCmdDir *gnome_cmd_con_get_default_dir (GnomeCmdCon *con);
-
 void gnome_cmd_con_set_default_dir (GnomeCmdCon *con, GnomeCmdDir *dir);
 
 GnomeCmdDir *gnome_cmd_con_get_root_dir (GnomeCmdCon *con);
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index d188a7a..0892959 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -252,8 +252,7 @@ inline void set_connection (GnomeCmdFileSelector *fs, GnomeCmdCon *con, GnomeCmd
     }
 
     if (!dir)
-        dir = gnome_cmd_con_should_remember_dir (con) ? gnome_cmd_con_get_cwd (con) :
-                                                        gnome_cmd_con_get_default_dir (con);
+        dir = gnome_cmd_con_get_default_dir (con);
 
     fs->set_directory(dir);
 
@@ -1023,8 +1022,6 @@ static void on_dir_list_ok (GnomeCmdDir *dir, GList *files, GnomeCmdFileSelector
         fs->file_list()->connected_dir = dir;
     }
 
-    gnome_cmd_con_set_cwd (fs->get_connection(), dir);
-
     if (fs->priv->dir_history && !fs->priv->dir_history->is_locked)
     {
         gchar *fpath = gnome_cmd_file_get_path (GNOME_CMD_FILE (dir));
@@ -1619,6 +1616,9 @@ void GnomeCmdFileSelector::set_connection (GnomeCmdCon *con, GnomeCmdDir *start_
     {
         if (!gnome_cmd_con_should_remember_dir (con))
             set_directory (gnome_cmd_con_get_default_dir (con));
+        else
+            if (start_dir)
+                set_directory (start_dir);
         return;
     }
 



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