[gnome-commander] Covert GnomeCmdPath (and its derivatives) from GTK class to pure C++



commit e1a189a95f54a22e87d168fffa04a010197f5fa3
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sat Feb 12 19:09:51 2011 +0100

    Covert GnomeCmdPath (and its derivatives) from GTK class to pure C++

 src/Makefile.am                                  |    2 +-
 src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc |    4 +-
 src/gnome-cmd-con-device.cc                      |   11 +-
 src/gnome-cmd-con-ftp.cc                         |   11 +-
 src/gnome-cmd-con-home.cc                        |    6 +-
 src/gnome-cmd-con-smb.cc                         |    9 +-
 src/gnome-cmd-con.cc                             |    7 +-
 src/gnome-cmd-dir.cc                             |   37 ++---
 src/gnome-cmd-file.cc                            |   18 +--
 src/gnome-cmd-path.cc                            |  129 ---------------
 src/gnome-cmd-path.h                             |   37 +----
 src/gnome-cmd-plain-path.cc                      |  117 +-------------
 src/gnome-cmd-plain-path.h                       |   37 ++---
 src/gnome-cmd-prepare-xfer-dialog.cc             |    2 +-
 src/gnome-cmd-smb-path.cc                        |  188 +++++-----------------
 src/gnome-cmd-smb-path.h                         |   61 +++++---
 src/utils.cc                                     |   11 +-
 17 files changed, 158 insertions(+), 529 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a48ef65..3e281c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,7 @@ gnome_commander_SOURCES = \
 	gnome-cmd-menu-button.h gnome-cmd-menu-button.cc \
 	gnome-cmd-notebook.h gnome-cmd-notebook.cc \
 	gnome-cmd-options-dialog.h gnome-cmd-options-dialog.cc \
-	gnome-cmd-path.h gnome-cmd-path.cc \
+	gnome-cmd-path.h \
 	gnome-cmd-patternsel-dialog.h gnome-cmd-patternsel-dialog.cc \
 	gnome-cmd-pixmap.h gnome-cmd-pixmap.cc \
 	gnome-cmd-plain-path.h gnome-cmd-plain-path.cc \
diff --git a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
index 1050bb7..39883ea 100644
--- a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
+++ b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
@@ -511,11 +511,9 @@ void gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark)
         }
         else
         {
-            if (con->base_path)
-                g_object_unref (con->base_path);
+            delete con->base_path;
 
             con->base_path = gnome_cmd_con_create_path (con, bookmark->path);
-            g_object_ref (con->base_path);
             if (fs->file_list()->locked)
                 fs->new_tab(gnome_cmd_con_get_default_dir (con));
             else
diff --git a/src/gnome-cmd-con-device.cc b/src/gnome-cmd-con-device.cc
index 3caba0f..b0d4bdf 100644
--- a/src/gnome-cmd-con-device.cc
+++ b/src/gnome-cmd-con-device.cc
@@ -179,10 +179,7 @@ static void dev_open (GnomeCmdCon *con)
     DEBUG ('m', "Mounting device\n");
 
     if (!con->base_path)
-    {
-        con->base_path = gnome_cmd_plain_path_new (G_DIR_SEPARATOR_S);
-        g_object_ref (con->base_path);
-    }
+        con->base_path = new GnomeCmdPlainPath(G_DIR_SEPARATOR_S);
 
     con->state = GnomeCmdCon::STATE_OPENING;
     con->open_result = GnomeCmdCon::OPEN_IN_PROGRESS;
@@ -279,11 +276,11 @@ static gboolean dev_open_is_needed (GnomeCmdCon *con)
 static GnomeVFSURI *dev_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 {
     g_return_val_if_fail (GNOME_CMD_IS_CON_DEVICE (con), NULL);
-    g_return_val_if_fail (GNOME_CMD_IS_PATH (path), NULL);
+    g_return_val_if_fail (path!=NULL, NULL);
 
     GnomeCmdConDevice *dev_con = GNOME_CMD_CON_DEVICE (con);
 
-    const gchar *path_str = gnome_cmd_path_get_path (path);
+    const gchar *path_str = path->get_path();
     gchar *p = g_build_filename (dev_con->priv->mountp, path_str, NULL);
     GnomeVFSURI *u1 = gnome_vfs_uri_new ("file:");
     GnomeVFSURI *u2 = gnome_vfs_uri_append_path (u1, p);
@@ -298,7 +295,7 @@ static GnomeCmdPath *dev_create_path (GnomeCmdCon *con, const gchar *path_str)
     g_return_val_if_fail (GNOME_CMD_IS_CON_DEVICE (con), NULL);
     g_return_val_if_fail (path_str != NULL, NULL);
 
-    return gnome_cmd_plain_path_new (path_str);
+    return new GnomeCmdPlainPath(path_str);
 }
 
 
diff --git a/src/gnome-cmd-con-ftp.cc b/src/gnome-cmd-con-ftp.cc
index 66bfb86..7bf98b5 100644
--- a/src/gnome-cmd-con-ftp.cc
+++ b/src/gnome-cmd-con-ftp.cc
@@ -82,10 +82,7 @@ static void ftp_open (GnomeCmdCon *con)
     DEBUG('m', "Opening remote connection\n");
 
     if (!con->base_path)
-    {
-        con->base_path = gnome_cmd_plain_path_new (G_DIR_SEPARATOR_S);
-        g_object_ref (con->base_path);
-    }
+        con->base_path = new GnomeCmdPlainPath(G_DIR_SEPARATOR_S);
 
     con->state = GnomeCmdCon::STATE_OPENING;
     con->open_result = GnomeCmdCon::OPEN_IN_PROGRESS;
@@ -97,7 +94,7 @@ static void ftp_open (GnomeCmdCon *con)
 static gboolean ftp_close (GnomeCmdCon *con)
 {
     gnome_cmd_con_set_default_dir (con, NULL);
-    g_object_unref (con->base_path);
+    delete con->base_path;
     con->base_path = NULL;
     con->state = GnomeCmdCon::STATE_CLOSED;
     con->open_result = GnomeCmdCon::OPEN_NOT_STARTED;
@@ -124,7 +121,7 @@ static GnomeVFSURI *ftp_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
     g_return_val_if_fail (con->uri != NULL, NULL);
 
     GnomeVFSURI *u0 = gnome_vfs_uri_new (con->uri);
-    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (u0, gnome_cmd_path_get_path (path));
+    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (u0, path->get_path());
 
     gnome_vfs_uri_unref (u0);
 
@@ -134,7 +131,7 @@ static GnomeVFSURI *ftp_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 
 static GnomeCmdPath *ftp_create_path (GnomeCmdCon *con, const gchar *path_str)
 {
-    return gnome_cmd_plain_path_new (path_str);
+    return new GnomeCmdPlainPath(path_str);
 }
 
 
diff --git a/src/gnome-cmd-con-home.cc b/src/gnome-cmd-con-home.cc
index 6be697c..1bf7c8c 100644
--- a/src/gnome-cmd-con-home.cc
+++ b/src/gnome-cmd-con-home.cc
@@ -58,7 +58,7 @@ static gboolean home_open_is_needed (GnomeCmdCon *con)
 static GnomeVFSURI *home_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 {
     GnomeVFSURI *u1 = gnome_vfs_uri_new ("file:");
-    GnomeVFSURI *u2 = gnome_vfs_uri_append_path (u1, gnome_cmd_path_get_path (path));
+    GnomeVFSURI *u2 = gnome_vfs_uri_append_path (u1, path->get_path());
     gnome_vfs_uri_unref (u1);
 
     return u2;
@@ -67,7 +67,7 @@ static GnomeVFSURI *home_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 
 static GnomeCmdPath *home_create_path (GnomeCmdCon *con, const gchar *path_str)
 {
-    return gnome_cmd_plain_path_new (path_str);
+    return new GnomeCmdPlainPath(path_str);
 }
 
 
@@ -122,7 +122,7 @@ static void init (GnomeCmdConHome *home_con)
     con->open_pixmap = gnome_cmd_pixmap_new_from_icon ("gnome-fs-home", dev_icon_size);
     con->close_pixmap = gnome_cmd_pixmap_new_from_icon ("gnome-fs-home", dev_icon_size);
 
-    GnomeCmdPath *path = gnome_cmd_plain_path_new (g_get_home_dir ());
+    GnomeCmdPath *path = new GnomeCmdPlainPath(g_get_home_dir ());
     GnomeCmdDir *dir = gnome_cmd_dir_new (con, path);
 
     gnome_cmd_con_set_default_dir (con, dir);
diff --git a/src/gnome-cmd-con-smb.cc b/src/gnome-cmd-con-smb.cc
index 062bbc7..d1249b3 100644
--- a/src/gnome-cmd-con-smb.cc
+++ b/src/gnome-cmd-con-smb.cc
@@ -78,10 +78,7 @@ get_file_info_callback (GnomeVFSAsyncHandle *handle,
 static void smb_open (GnomeCmdCon *con)
 {
     if (!con->base_path)
-    {
-        con->base_path = gnome_cmd_smb_path_new (NULL, NULL, NULL);
-        g_object_ref (con->base_path);
-    }
+        con->base_path = new GnomeCmdSmbPath(NULL, NULL, NULL);
 
     GnomeVFSURI *uri = gnome_cmd_con_create_uri (con, con->base_path);
     if (!uri)
@@ -139,7 +136,7 @@ static GnomeVFSURI *smb_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
     u1 = gnome_vfs_uri_new ("smb:");
     if (!u1) return NULL;
 
-    u2 = gnome_vfs_uri_append_path (u1, gnome_cmd_path_get_path (path));
+    u2 = gnome_vfs_uri_append_path (u1, path->get_path());
     gnome_vfs_uri_unref (u1);
     if (!u2) return NULL;
 
@@ -155,7 +152,7 @@ static GnomeVFSURI *smb_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 
 static GnomeCmdPath *smb_create_path (GnomeCmdCon *con, const gchar *path_str)
 {
-    return gnome_cmd_smb_path_new_from_str (path_str);
+    return new GnomeCmdSmbPath(path_str);
 }
 
 
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 7d165a1..fdf36e5 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -87,8 +87,7 @@ static void destroy (GtkObject *object)
     g_free (con->alias);
     g_free (con->uri);
 
-    if (con->base_path)
-        g_object_unref (con->base_path);
+    delete con->base_path;
     g_free (con->open_text);
     g_free (con->open_tooltip);
     gnome_cmd_pixmap_free (con->open_pixmap);
@@ -440,7 +439,7 @@ GnomeVFSResult gnome_cmd_con_get_path_target_type (GnomeCmdCon *con, const gchar
         *type = info->type;
 
     gnome_vfs_uri_unref (uri);
-    gtk_object_destroy (GTK_OBJECT (path));
+    delete path;
     gnome_vfs_file_info_unref (info);
 
     return res;
@@ -464,7 +463,7 @@ GnomeVFSResult gnome_cmd_con_mkdir (GnomeCmdCon *con, const gchar *path_str)
         GNOME_VFS_PERM_OTHER_READ|GNOME_VFS_PERM_OTHER_EXEC);
 
     gnome_vfs_uri_unref (uri);
-    gtk_object_destroy (GTK_OBJECT (path));
+    delete path;
 
     return result;
 }
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index f6e2eee..a6d9d24 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -131,14 +131,12 @@ static void gnome_cmd_dir_finalize (GObject *object)
 {
     GnomeCmdDir *dir = GNOME_CMD_DIR (object);
 
-    DEBUG ('d', "dir destroying 0x%p %s\n", dir, gnome_cmd_path_get_path (dir->priv->path));
+    DEBUG ('d', "dir destroying 0x%p %s\n", dir, dir->priv->path->get_path());
 
     gnome_cmd_con_remove_from_cache (dir->priv->con, dir);
 
     delete dir->priv->file_collection;
-
-    if (dir->priv->path)
-        g_object_unref (dir->priv->path);
+    delete dir->priv->path;
 
     dir->priv->handle->ref = NULL;
     handle_unref (dir->priv->handle);
@@ -239,7 +237,7 @@ GnomeCmdDir *gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *p
     g_return_val_if_fail (GNOME_CMD_IS_DIR (parent), NULL);
 
     GnomeCmdCon *con = gnome_cmd_dir_get_connection (parent);
-    GnomeCmdPath *path = gnome_cmd_path_get_child (gnome_cmd_dir_get_path (parent), info->name);
+    GnomeCmdPath *path =  gnome_cmd_dir_get_path (parent)->get_child(info->name);
 
     GnomeVFSURI *uri = gnome_cmd_con_create_uri (con, path);
     gchar *uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
@@ -250,7 +248,7 @@ GnomeCmdDir *gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *p
 
     if (dir)
     {
-        gtk_object_destroy (GTK_OBJECT (path));
+        delete path;
         GNOME_CMD_FILE (dir)->update_info(info);
         return dir;
     }
@@ -260,7 +258,6 @@ GnomeCmdDir *gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *p
 
     dir->priv->con = con;
     gnome_cmd_dir_set_path (dir, path);
-    gtk_object_ref (GTK_OBJECT (path));
     dir->priv->needs_mtime_update = FALSE;
 
     gnome_cmd_con_add_to_cache (gnome_cmd_dir_get_connection (parent), dir);
@@ -290,8 +287,7 @@ GnomeCmdDir *gnome_cmd_dir_new_with_con (GnomeCmdCon *con)
     gnome_cmd_file_setup (GNOME_CMD_FILE (dir), con->base_info, NULL);
 
     dir->priv->con = con;
-    gnome_cmd_dir_set_path (dir, con->base_path);
-    g_object_ref (con->base_path);
+    gnome_cmd_dir_set_path (dir, con->base_path->clone());
     dir->priv->needs_mtime_update = FALSE;
 
     gnome_cmd_con_add_to_cache (con, dir);
@@ -303,7 +299,7 @@ GnomeCmdDir *gnome_cmd_dir_new_with_con (GnomeCmdCon *con)
 GnomeCmdDir *gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path)
 {
     g_return_val_if_fail (GNOME_CMD_IS_CON (con), NULL);
-    g_return_val_if_fail (GNOME_CMD_IS_PATH (path), NULL);
+    g_return_val_if_fail (path!=NULL, NULL);
 
     GnomeVFSFileInfo *info;
     GnomeVFSResult res;
@@ -332,14 +328,13 @@ GnomeCmdDir *gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path)
 
         dir->priv->con = con;
         gnome_cmd_dir_set_path (dir, path);
-        g_object_ref (path);
         dir->priv->needs_mtime_update = FALSE;
 
         gnome_cmd_con_add_to_cache (con, dir);
     }
     else
     {
-        gnome_cmd_show_message (*main_win, gnome_cmd_path_get_display_path (path), gnome_vfs_result_to_string (res));
+        gnome_cmd_show_message (*main_win, path->get_display_path(), gnome_vfs_result_to_string (res));
         gnome_vfs_file_info_unref (info);
     }
 
@@ -354,7 +349,7 @@ GnomeCmdDir *gnome_cmd_dir_get_parent (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
-    GnomeCmdPath *path = gnome_cmd_path_get_parent (dir->priv->path);
+    GnomeCmdPath *path = dir->priv->path->get_parent();
 
     return path ? gnome_cmd_dir_new (dir->priv->con, path) : NULL;
 }
@@ -364,7 +359,7 @@ GnomeCmdDir *gnome_cmd_dir_get_child (GnomeCmdDir *dir, const gchar *child)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
-    GnomeCmdPath *path = gnome_cmd_path_get_child (dir->priv->path, child);
+    GnomeCmdPath *path = dir->priv->path->get_child(child);
 
     return path ? gnome_cmd_dir_new (dir->priv->con, path) : NULL;
 }
@@ -576,11 +571,9 @@ void gnome_cmd_dir_set_path (GnomeCmdDir *dir, GnomeCmdPath *path)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
-    if (dir->priv->path)
-        gtk_object_destroy (GTK_OBJECT (dir->priv->path));
+    delete dir->priv->path;
 
     dir->priv->path = path;
-    g_object_ref (path);
 }
 
 
@@ -592,7 +585,7 @@ void gnome_cmd_dir_update_path (GnomeCmdDir *dir)
     if (!parent)
         return;
 
-    GnomeCmdPath *path = gnome_cmd_path_get_child (gnome_cmd_dir_get_path (parent), GNOME_CMD_FILE (dir)->get_name());
+    GnomeCmdPath *path = gnome_cmd_dir_get_path (parent)->get_child(GNOME_CMD_FILE (dir)->get_name());
     if (path)
         gnome_cmd_dir_set_path (dir, path);
 }
@@ -602,7 +595,7 @@ gchar *gnome_cmd_dir_get_display_path (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
-    return g_strdup (gnome_cmd_path_get_display_path (dir->priv->path));
+    return g_strdup (dir->priv->path->get_display_path());
 }
 
 
@@ -630,9 +623,9 @@ GnomeVFSURI *gnome_cmd_dir_get_child_uri (GnomeCmdDir *dir, const gchar *filenam
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
-    GnomeCmdPath *path = gnome_cmd_path_get_child (dir->priv->path, filename);
+    GnomeCmdPath *path = dir->priv->path->get_child(filename);
     GnomeVFSURI *uri = gnome_cmd_con_create_uri (dir->priv->con, path);
-    gtk_object_destroy (GTK_OBJECT (path));
+    delete path;
 
     return uri;
 }
@@ -682,7 +675,7 @@ GnomeVFSURI *gnome_cmd_dir_get_absolute_path_uri (GnomeCmdDir *dir, string absol
     GnomeCmdPath *path = gnome_cmd_con_create_path (dir->priv->con, absolute_filename.c_str());
     GnomeVFSURI *uri = gnome_cmd_con_create_uri (dir->priv->con, path);
 
-    gtk_object_destroy (GTK_OBJECT (path));
+    delete path;
 
     return uri;
 }
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index b7bd568..0253d70 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -159,11 +159,10 @@ GnomeCmdFile *gnome_cmd_file_new_from_uri (GnomeVFSURI *uri)
     }
 
     GnomeVFSURI *parent = gnome_vfs_uri_get_parent (uri);
-    GnomeCmdPath *path = gnome_cmd_plain_path_new (gnome_vfs_uri_get_path (parent));
-    GnomeCmdDir *dir = gnome_cmd_dir_new (get_home_con(), path);
+    GnomeCmdPlainPath path(gnome_vfs_uri_get_path (parent));
+    GnomeCmdDir *dir = gnome_cmd_dir_new (get_home_con(), &path);
 
     gnome_vfs_uri_unref (parent);
-    g_object_unref (path);
 
     return gnome_cmd_file_new (info, dir);
 }
@@ -342,14 +341,14 @@ gchar *GnomeCmdFile::get_path()
         if (GNOME_CMD_IS_DIR (this))
         {
             path = gnome_cmd_dir_get_path (GNOME_CMD_DIR (this));
-            return g_strdup (gnome_cmd_path_get_path (path));
+            return g_strdup (path->get_path());
         }
         g_assert ("Non directory file without owning directory");
     }
 
-    path = gnome_cmd_path_get_child (gnome_cmd_dir_get_path (::get_parent_dir (this)), info->name);
-    path_str = g_strdup (gnome_cmd_path_get_path (path));
-    gtk_object_destroy (GTK_OBJECT (path));
+    path = gnome_cmd_dir_get_path (::get_parent_dir (this))->get_child(info->name);
+    path_str = g_strdup (path->get_path());
+    delete path;
 
     return path_str;
 }
@@ -685,12 +684,11 @@ void gnome_cmd_file_view (GnomeCmdFile *f, gint internal_viewer)
     gchar *path_str = get_temp_download_filepath (f->get_name());
     if (!path_str)  return;
 
-    GnomeCmdPath *path = gnome_cmd_plain_path_new (path_str);
+    GnomeCmdPlainPath path(path_str);
     GnomeVFSURI *src_uri = f->get_uri();
-    GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (get_home_con (), path);
+    GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (get_home_con (), &path);
 
     g_printerr ("Copying to: %s\n", path_str);
-    gtk_object_destroy (GTK_OBJECT (path));
     g_free (path_str);
 
     gnome_cmd_xfer_tmp_download (src_uri,
diff --git a/src/gnome-cmd-path.h b/src/gnome-cmd-path.h
index f842b2a..9806ef3 100644
--- a/src/gnome-cmd-path.h
+++ b/src/gnome-cmd-path.h
@@ -20,39 +20,20 @@
 #ifndef __GNOME_CMD_PATH_H__
 #define __GNOME_CMD_PATH_H__
 
-#define GNOME_CMD_TYPE_PATH              (gnome_cmd_path_get_type ())
-#define GNOME_CMD_PATH(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_CMD_TYPE_PATH, GnomeCmdPath))
-#define GNOME_CMD_PATH_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_CMD_TYPE_PATH, GnomeCmdPathClass))
-#define GNOME_CMD_IS_PATH(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_CMD_TYPE_PATH))
-#define GNOME_CMD_IS_PATH_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_CMD_TYPE_PATH))
-#define GNOME_CMD_PATH_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_CMD_TYPE_PATH, GnomeCmdPathClass))
-
-
 struct GnomeCmdPath
 {
-    GtkObject parent;
-};
-
-struct GnomeCmdPathClass
-{
-    GtkObjectClass parent_class;
+  protected:
 
-    // virtual functions
-    const gchar *(* get_path)          (GnomeCmdPath *path);
-    const gchar *(* get_display_path)  (GnomeCmdPath *path);
-    GnomeCmdPath *(* get_parent)       (GnomeCmdPath *path);
-    GnomeCmdPath *(* get_child)        (GnomeCmdPath *path, const gchar *child);
-};
-
-
-GtkType gnome_cmd_path_get_type ();
+    virtual GnomeCmdPath *do_clone() const = 0;
 
-const gchar *gnome_cmd_path_get_path (GnomeCmdPath *path);
+  public:
 
-const gchar *gnome_cmd_path_get_display_path (GnomeCmdPath *path);
+    GnomeCmdPath *clone() const                                 {  return do_clone();  }
 
-GnomeCmdPath *gnome_cmd_path_get_parent (GnomeCmdPath *path);
-
-GnomeCmdPath *gnome_cmd_path_get_child (GnomeCmdPath *path, const gchar *child);
+    virtual const gchar *get_path() = 0;
+    virtual const gchar *get_display_path() = 0;
+    virtual GnomeCmdPath *get_parent() = 0;
+    virtual GnomeCmdPath *get_child(const gchar *child) = 0;
+};
 
 #endif // __GNOME_CMD_PATH_H__
diff --git a/src/gnome-cmd-plain-path.cc b/src/gnome-cmd-plain-path.cc
index 871e835..8eb7533 100644
--- a/src/gnome-cmd-plain-path.cc
+++ b/src/gnome-cmd-plain-path.cc
@@ -26,37 +26,10 @@
 using namespace std;
 
 
-struct GnomeCmdPlainPathPrivate
+inline GnomeCmdPath *GnomeCmdPlainPath::get_parent()
 {
-    gchar *path;
-};
-
-
-static GnomeCmdPathClass *parent_class = NULL;
-
-
-inline const gchar *plain_path_get_path (GnomeCmdPath *path)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_PLAIN_PATH (path), NULL);
-
-    return GNOME_CMD_PLAIN_PATH (path)->priv->path;
-}
-
-
-inline const gchar *plain_path_get_display_path (GnomeCmdPath *path)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_PLAIN_PATH (path), NULL);
-
-    return GNOME_CMD_PLAIN_PATH (path)->priv->path;
-}
-
-
-inline GnomeCmdPath *plain_path_get_parent (GnomeCmdPath *path)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_PLAIN_PATH (path), NULL);
-
     GnomeVFSURI *t = gnome_vfs_uri_new (G_DIR_SEPARATOR_S);
-    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, GNOME_CMD_PLAIN_PATH (path)->priv->path);
+    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, path);
     gnome_vfs_uri_unref (t);
 
     GnomeVFSURI *u2 = gnome_vfs_uri_get_parent (u1);
@@ -67,19 +40,17 @@ inline GnomeCmdPath *plain_path_get_parent (GnomeCmdPath *path)
     gchar *s = gnome_vfs_uri_to_string (u2, GNOME_VFS_URI_HIDE_NONE);
     gnome_vfs_uri_unref (u2);
 
-    GnomeCmdPath *parent_path = gnome_cmd_plain_path_new (gnome_vfs_get_local_path_from_uri (s));
+    GnomeCmdPath *parent_path = new GnomeCmdPlainPath (gnome_vfs_get_local_path_from_uri (s));
     g_free (s);
 
     return parent_path;
 }
 
 
-inline GnomeCmdPath *plain_path_get_child (GnomeCmdPath *path, const gchar *child)
+inline GnomeCmdPath *GnomeCmdPlainPath::get_child(const gchar *child)
 {
-    g_return_val_if_fail (GNOME_CMD_IS_PLAIN_PATH (path), NULL);
-
     GnomeVFSURI *t = gnome_vfs_uri_new (G_DIR_SEPARATOR_S);
-    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, GNOME_CMD_PLAIN_PATH (path)->priv->path);
+    GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, path);
     gnome_vfs_uri_unref (t);
 
     GnomeVFSURI *u2 = strchr (child, '/')==NULL ?
@@ -92,84 +63,8 @@ inline GnomeCmdPath *plain_path_get_child (GnomeCmdPath *path, const gchar *chil
     gchar *path_str = gnome_vfs_unescape_string (gnome_vfs_uri_get_path (u2), 0);
     gnome_vfs_uri_unref (u2);
 
-    GnomeCmdPath *child_path = gnome_cmd_plain_path_new (path_str);
+    GnomeCmdPath *child_path = new GnomeCmdPlainPath(path_str);
     g_free (path_str);
 
     return child_path;
 }
-
-
-/*******************************
- * Gtk class implementation
- *******************************/
-
-static void destroy (GtkObject *object)
-{
-    GnomeCmdPlainPath *path = GNOME_CMD_PLAIN_PATH (object);
-
-    g_free (path->priv->path);
-    g_free (path->priv);
-
-    if (GTK_OBJECT_CLASS (parent_class)->destroy)
-        (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void class_init (GnomeCmdPlainPathClass *klass)
-{
-    GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-    GnomeCmdPathClass *path_class = GNOME_CMD_PATH_CLASS (klass);
-
-    parent_class = (GnomeCmdPathClass *) gtk_type_class (GNOME_CMD_TYPE_PATH);
-
-    object_class->destroy = destroy;
-
-    path_class->get_path = plain_path_get_path;
-    path_class->get_display_path = plain_path_get_display_path;
-    path_class->get_parent = plain_path_get_parent;
-    path_class->get_child = plain_path_get_child;
-}
-
-
-static void init (GnomeCmdPlainPath *path)
-{
-    path->priv = g_new0 (GnomeCmdPlainPathPrivate, 1);
-}
-
-
-
-/***********************************
- * Public functions
- ***********************************/
-
-GtkType gnome_cmd_plain_path_get_type ()
-{
-    static GtkType type = 0;
-
-    if (type == 0)
-    {
-        GtkTypeInfo info =
-        {
-            "GnomeCmdPlainPath",
-            sizeof (GnomeCmdPlainPath),
-            sizeof (GnomeCmdPlainPathClass),
-            (GtkClassInitFunc) class_init,
-            (GtkObjectInitFunc) init,
-            /* reserved_1 */ NULL,
-            /* reserved_2 */ NULL,
-            (GtkClassInitFunc) NULL
-        };
-
-        type = gtk_type_unique (GNOME_CMD_TYPE_PATH, &info);
-    }
-    return type;
-}
-
-
-GnomeCmdPath *gnome_cmd_plain_path_new (const gchar *path)
-{
-    GnomeCmdPlainPath *plain_path = (GnomeCmdPlainPath *) g_object_new (GNOME_CMD_TYPE_PLAIN_PATH, NULL);
-    plain_path->priv->path = g_strdup (path);
-
-    return GNOME_CMD_PATH (plain_path);
-}
diff --git a/src/gnome-cmd-plain-path.h b/src/gnome-cmd-plain-path.h
index edfaa5e..c1ee7ae 100644
--- a/src/gnome-cmd-plain-path.h
+++ b/src/gnome-cmd-plain-path.h
@@ -22,34 +22,33 @@
 
 #include "gnome-cmd-path.h"
 
-#define GNOME_CMD_TYPE_PLAIN_PATH              (gnome_cmd_plain_path_get_type ())
-#define GNOME_CMD_PLAIN_PATH(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_CMD_TYPE_PLAIN_PATH, GnomeCmdPlainPath))
-#define GNOME_CMD_PLAIN_PATH_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_CMD_TYPE_PLAIN_PATH, GnomeCmdPlainPathClass))
-#define GNOME_CMD_IS_PLAIN_PATH(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_CMD_TYPE_PLAIN_PATH))
-#define GNOME_CMD_IS_PLAIN_PATH_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_CMD_TYPE_PLAIN_PATH))
-#define GNOME_CMD_PLAIN_PATH_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_CMD_TYPE_PLAIN_PATH, GnomeCmdPlainPathClass))
-
-
 struct GnomeCmdPlainPathPrivate;
 
 
-struct GnomeCmdPlainPath
+class GnomeCmdPlainPath: public GnomeCmdPath
 {
-    GnomeCmdPath parent;
 
-    GnomeCmdPlainPathPrivate *priv;
-};
+    gchar *path;
 
-struct GnomeCmdPlainPathClass
-{
-    GnomeCmdPathClass parent_class;
+  protected:
 
-    void (* update_text) (GtkEditable *editable, gint start_pos, gint end_pos);
-};
+    virtual GnomeCmdPlainPath *do_clone() const {  return new GnomeCmdPlainPath(*this);  }
+
+  public:
 
+    GnomeCmdPlainPath(const GnomeCmdPlainPath &thePath);
+    GnomeCmdPlainPath(const gchar *path)        {  this->path = g_strdup (path);  }
+    virtual ~GnomeCmdPlainPath()                {  g_free (path);                 }
 
-GtkType gnome_cmd_plain_path_get_type ();
+    virtual const gchar *get_path()             {  return path;                   }
+    virtual const gchar *get_display_path()     {  return path;                   }
+    virtual GnomeCmdPath *get_parent();
+    virtual GnomeCmdPath *get_child(const gchar *child);
+};
 
-GnomeCmdPath *gnome_cmd_plain_path_new (const gchar *path);
+inline GnomeCmdPlainPath::GnomeCmdPlainPath(const GnomeCmdPlainPath &thePath)
+{
+    path = g_strdup (thePath.path);
+}
 
 #endif // __GNOME_CMD_PLAIN_PATH_H__
diff --git a/src/gnome-cmd-prepare-xfer-dialog.cc b/src/gnome-cmd-prepare-xfer-dialog.cc
index 9b171da..ee2a65a 100644
--- a/src/gnome-cmd-prepare-xfer-dialog.cc
+++ b/src/gnome-cmd-prepare-xfer-dialog.cc
@@ -84,7 +84,7 @@ static void on_ok (GtkButton *button, GnomeCmdPrepareXferDialog *dialog)
     {
         if (!gnome_cmd_dir_is_local (dialog->default_dest_dir))
         {
-            const gchar *t = gnome_cmd_path_get_path (gnome_cmd_dir_get_path (dialog->default_dest_dir));
+            const gchar *t = gnome_cmd_dir_get_path (dialog->default_dest_dir)->get_path();
             dest_path = g_build_filename (t, user_path, NULL);
         }
         else
diff --git a/src/gnome-cmd-smb-path.cc b/src/gnome-cmd-smb-path.cc
index 1adef04..642cb14 100644
--- a/src/gnome-cmd-smb-path.cc
+++ b/src/gnome-cmd-smb-path.cc
@@ -28,53 +28,43 @@
 using namespace std;
 
 
-struct GnomeCmdSmbPathPrivate
+inline void GnomeCmdSmbPath::set_resources(const gchar *workgroup, const gchar *resource, const gchar *path)
 {
-    gchar *workgroup;
-    gchar *resource;
-    gchar *resource_path;
-    gchar *path;
-    gchar *display_path;
-};
+    this->workgroup = g_strdup (workgroup);
 
-static GnomeCmdPathClass *parent_class = NULL;
-
-
-inline const gchar *smb_path_get_path (GnomeCmdPath *path)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_SMB_PATH (path), NULL);
-
-    return GNOME_CMD_SMB_PATH (path)->priv->path;
-}
-
-
-inline const gchar *smb_path_get_display_path (GnomeCmdPath *path)
-{
-    g_return_val_if_fail (GNOME_CMD_IS_SMB_PATH (path), NULL);
+    if (workgroup)
+    {
+        if (resource)
+        {
+            this->resource = g_strdup (resource);
+            this->resource_path = g_strdup (resource_path);
+            path = g_strconcat (G_DIR_SEPARATOR_S, resource, resource_path, NULL);
+        }
+        else
+            path = g_strconcat (G_DIR_SEPARATOR_S, workgroup, NULL);
+    }
+    else
+        path = g_strdup (G_DIR_SEPARATOR_S);
 
-    return GNOME_CMD_SMB_PATH (path)->priv->display_path;
+    display_path = unix_to_unc (path);
 }
 
 
-inline GnomeCmdPath *smb_path_get_parent (GnomeCmdPath *path)
+GnomeCmdPath *GnomeCmdSmbPath::get_parent()
 {
-    g_return_val_if_fail (GNOME_CMD_IS_SMB_PATH (path), NULL);
-
-    GnomeCmdSmbPath *smb_path = GNOME_CMD_SMB_PATH (path);
-
-    if (!smb_path->priv->workgroup)
+    if (!workgroup)
         return NULL;
 
     gchar *a = NULL,
           *b = NULL,
           *c = NULL;
 
-    if (smb_path->priv->resource)
+    if (resource)
     {
-        if (smb_path->priv->resource_path)
+        if (resource_path)
         {
             GnomeVFSURI *t = gnome_vfs_uri_new (G_DIR_SEPARATOR_S);
-            GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, smb_path->priv->resource_path);
+            GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, resource_path);
             gnome_vfs_uri_unref (t);
 
             if (u1 && gnome_vfs_uri_has_parent (u1))
@@ -89,20 +79,19 @@ inline GnomeCmdPath *smb_path_get_parent (GnomeCmdPath *path)
                 g_free (s);
             }
 
-            b = smb_path->priv->resource;
+            b = resource;
             gnome_vfs_uri_unref (u1);
         }
 
-        a = smb_path->priv->workgroup;
+        a = workgroup;
     }
 
-    return gnome_cmd_smb_path_new (a, b, c);
+    return new GnomeCmdSmbPath(a, b, c);
 }
 
 
-inline GnomeCmdPath *smb_path_get_child (GnomeCmdPath *path, const gchar *child)
+ GnomeCmdPath *GnomeCmdSmbPath::get_child(const gchar *child)
 {
-    g_return_val_if_fail (GNOME_CMD_IS_SMB_PATH (path), NULL);
     g_return_val_if_fail (child != NULL, NULL);
     g_return_val_if_fail (child[0] != '/', NULL);
 
@@ -110,18 +99,16 @@ inline GnomeCmdPath *smb_path_get_child (GnomeCmdPath *path, const gchar *child)
           *b = NULL,
           *c = NULL;
 
-    GnomeCmdSmbPath *smb_path = GNOME_CMD_SMB_PATH (path);
-
-    if (smb_path->priv->workgroup)
+    if (workgroup)
     {
-        if (smb_path->priv->resource)
+        if (resource)
         {
-            if (smb_path->priv->resource_path)
+            if (resource_path)
             {
                 GnomeVFSURI *u1, *u2;
 
                 GnomeVFSURI *t = gnome_vfs_uri_new (G_DIR_SEPARATOR_S);
-                u1 = gnome_vfs_uri_append_path (t, smb_path->priv->resource_path);
+                u1 = gnome_vfs_uri_append_path (t, resource_path);
                 gnome_vfs_uri_unref (t);
                 if (!strchr (child, '/'))
                     u2 = gnome_vfs_uri_append_file_name (u1, child);
@@ -136,17 +123,17 @@ inline GnomeCmdPath *smb_path_get_child (GnomeCmdPath *path, const gchar *child)
             else
                 c = g_strdup_printf ("/%s", child);
 
-            b = g_strdup (smb_path->priv->resource);
+            b = g_strdup (resource);
         }
         else
             b = g_strdup (child);
 
-        a = g_strdup (smb_path->priv->workgroup);
+        a = g_strdup (workgroup);
     }
     else
         a = g_strdup (child);
 
-    GnomeCmdPath *out = gnome_cmd_smb_path_new (a, b, c);
+    GnomeCmdPath *out = new GnomeCmdSmbPath(a, b, c);
     g_free (a);
     g_free (b);
     g_free (c);
@@ -155,111 +142,20 @@ inline GnomeCmdPath *smb_path_get_child (GnomeCmdPath *path, const gchar *child)
 }
 
 
-/*******************************
- * Gtk class implementation
- *******************************/
-
-static void destroy (GtkObject *object)
-{
-    GnomeCmdSmbPath *path = GNOME_CMD_SMB_PATH (object);
-
-    g_free (path->priv->workgroup);
-    g_free (path->priv->resource);
-    g_free (path->priv->resource_path);
-    g_free (path->priv->path);
-    g_free (path->priv->display_path);
-    g_free (path->priv);
-
-    if (GTK_OBJECT_CLASS (parent_class)->destroy)
-        (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void class_init (GnomeCmdSmbPathClass *klass)
+GnomeCmdSmbPath::GnomeCmdSmbPath(const gchar *workgroup, const gchar *resource, const gchar *resource_path)
 {
-    GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-    GnomeCmdPathClass *path_class = GNOME_CMD_PATH_CLASS (klass);
-
-    parent_class = (GnomeCmdPathClass *) gtk_type_class (GNOME_CMD_TYPE_PATH);
-
-    object_class->destroy = destroy;
-
-    path_class->get_path = smb_path_get_path;
-    path_class->get_display_path = smb_path_get_display_path;
-    path_class->get_parent = smb_path_get_parent;
-    path_class->get_child = smb_path_get_child;
+    set_resources(workgroup,resource,resource_path);
 }
 
 
-static void init (GnomeCmdSmbPath *path)
+GnomeCmdSmbPath::GnomeCmdSmbPath(const gchar *path_str)
 {
-    path->priv = g_new0 (GnomeCmdSmbPathPrivate, 1);
-}
-
-
-/***********************************
- * Public functions
- ***********************************/
-
-GtkType gnome_cmd_smb_path_get_type ()
-{
-    static GtkType type = 0;
-
-    if (type == 0)
-    {
-        GtkTypeInfo info =
-        {
-            "GnomeCmdSmbPath",
-            sizeof (GnomeCmdSmbPath),
-            sizeof (GnomeCmdSmbPathClass),
-            (GtkClassInitFunc) class_init,
-            (GtkObjectInitFunc) init,
-            /* reserved_1 */ NULL,
-            /* reserved_2 */ NULL,
-            (GtkClassInitFunc) NULL
-        };
-
-        type = gtk_type_unique (GNOME_CMD_TYPE_PATH, &info);
-    }
-    return type;
-}
-
-
-GnomeCmdPath *gnome_cmd_smb_path_new (const gchar *workgroup, const gchar *resource, const gchar *resource_path)
-{
-    GnomeCmdSmbPath *smb_path = (GnomeCmdSmbPath *) g_object_new (GNOME_CMD_TYPE_SMB_PATH, NULL);
-
-    smb_path->priv->workgroup = g_strdup (workgroup);
-
-    if (workgroup)
-    {
-        if (resource)
-        {
-            smb_path->priv->resource = g_strdup (resource);
-            smb_path->priv->resource_path = g_strdup (resource_path);
-            smb_path->priv->path = g_strconcat (G_DIR_SEPARATOR_S, resource, resource_path, NULL);
-        }
-        else
-            smb_path->priv->path = g_strconcat (G_DIR_SEPARATOR_S, workgroup, NULL);
-    }
-    else
-        smb_path->priv->path = g_strdup (G_DIR_SEPARATOR_S);
-
-    smb_path->priv->display_path = unix_to_unc (smb_path->priv->path);
-
-    return GNOME_CMD_PATH (smb_path);
-}
-
-
-GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
-{
-    g_return_val_if_fail (path_str != NULL, NULL);
+    g_return_if_fail (path_str != NULL);
 
     gchar *s, *t;
     gchar *a = NULL,
           *b = NULL,
           *c = NULL;
-    GnomeCmdPath *out = NULL;
 
     DEBUG('s', "Creating smb-path for %s\n", path_str);
 
@@ -274,7 +170,7 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
     if (!*s)
     {
         g_free (t);
-        return NULL;
+        return;
     }
 
     gchar **v = g_strsplit (s, G_DIR_SEPARATOR_S, 0);
@@ -305,21 +201,19 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
         if (ent)
         {
             if (ent->type == SMB_WORKGROUP)
-                out = gnome_cmd_smb_path_new (a, b, c);
+                set_resources(a, b, c);
             else
             {
                 if (!b)
                     b = "/";
                 b = c ? g_strconcat (G_DIR_SEPARATOR_S, b, c, NULL) : g_strdup (b);
                 g_free (c);
-                out = gnome_cmd_smb_path_new (ent->workgroup_name, a, b);
+                set_resources(ent->workgroup_name, a, b);
             }
         }
         else
-            create_error_dialog (_("Can't find a host or workgroup named %s\n"), a);
+            g_warning ("Can't find a host or workgroup named %s", a);
     }
     else
-        out = gnome_cmd_smb_path_new (NULL, NULL, NULL);
-
-    return out;
+        set_resources(NULL, NULL, NULL);
 }
diff --git a/src/gnome-cmd-smb-path.h b/src/gnome-cmd-smb-path.h
index a9768f3..c84d488 100644
--- a/src/gnome-cmd-smb-path.h
+++ b/src/gnome-cmd-smb-path.h
@@ -23,37 +23,50 @@
 
 #include "gnome-cmd-path.h"
 
-#define GNOME_CMD_TYPE_SMB_PATH              (gnome_cmd_smb_path_get_type ())
-#define GNOME_CMD_SMB_PATH(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_CMD_TYPE_SMB_PATH, GnomeCmdSmbPath))
-#define GNOME_CMD_SMB_PATH_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_CMD_TYPE_SMB_PATH, GnomeCmdSmbPathClass))
-#define GNOME_CMD_IS_SMB_PATH(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_CMD_TYPE_SMB_PATH))
-#define GNOME_CMD_IS_SMB_PATH_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_CMD_TYPE_SMB_PATH))
-#define GNOME_CMD_SMB_PATH_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_CMD_TYPE_SMB_PATH, GnomeCmdSmbPathClass))
+class GnomeCmdSmbPath: public GnomeCmdPath
+{
+    gchar *workgroup;
+    gchar *resource;
+    gchar *resource_path;
+    gchar *path;
+    gchar *display_path;
 
+    void set_resources(const gchar *workgroup, const gchar *resource, const gchar *path);
 
-struct GnomeCmdSmbPathPrivate;
+  protected:
 
+    virtual GnomeCmdSmbPath *do_clone() const       {  return new GnomeCmdSmbPath(*this);  }
 
-struct GnomeCmdSmbPath
-{
-    GnomeCmdPath parent;
+  public:
 
-    GnomeCmdSmbPathPrivate *priv;
-};
-
-struct GnomeCmdSmbPathClass
-{
-    GnomeCmdPathClass parent_class;
+    GnomeCmdSmbPath(const GnomeCmdSmbPath &thePath);
+    GnomeCmdSmbPath(const gchar *workgroup, const gchar *resource, const gchar *path);
+    GnomeCmdSmbPath(const gchar *path_str);
+    virtual ~GnomeCmdSmbPath();
 
-    void (* update_text)  (GtkEditable    *editable,
-                           gint            start_pos,
-                           gint            end_pos);
+    virtual const gchar *get_path()                 {  return path;                   }
+    virtual const gchar *get_display_path()         {  return display_path;           }
+    virtual GnomeCmdPath *get_parent();
+    virtual GnomeCmdPath *get_child(const gchar *child);
 };
 
-
-GtkType gnome_cmd_smb_path_get_type ();
-
-GnomeCmdPath *gnome_cmd_smb_path_new (const gchar *workgroup, const gchar *resource, const gchar *path);
-GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str);
+inline GnomeCmdSmbPath::GnomeCmdSmbPath(const GnomeCmdSmbPath &thePath)
+{
+    path = g_strdup (thePath.path);
+    workgroup = g_strdup (thePath.workgroup);
+    resource = g_strdup (thePath.resource);
+    resource_path = g_strdup (thePath.resource_path);
+    path = g_strdup (thePath.path);
+    display_path = g_strdup (thePath.display_path);
+}
+
+inline GnomeCmdSmbPath::~GnomeCmdSmbPath()
+{
+    g_free (workgroup);
+    g_free (resource);
+    g_free (resource_path);
+    g_free (path);
+    g_free (display_path);
+}
 
 #endif // __GNOME_CMD_SMB_PATH_H__
diff --git a/src/utils.cc b/src/utils.cc
index bda13ad..9ab09c3 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -460,10 +460,8 @@ static void on_tmp_download_response (GtkWidget *w, gint id, TmpDlData *dldata)
         dldata->args[1] = (gpointer) path_str;
 
         GnomeVFSURI *src_uri = gnome_vfs_uri_dup (dldata->f->get_uri());
-        GnomeCmdPath *path = gnome_cmd_plain_path_new (path_str);
-        GnomeCmdCon *con = get_home_con ();
-        GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (con, path);
-        gtk_object_destroy (GTK_OBJECT (path));
+        GnomeCmdPlainPath path(path_str);
+        GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (get_home_con (), &path);
 
         gnome_cmd_xfer_tmp_download (src_uri,
                                      dest_uri,
@@ -671,9 +669,8 @@ void mime_exec_multiple (GList *files, GnomeCmdApp *app)
                     if (!path_str) return;
 
                     GnomeVFSURI *src_uri = gnome_vfs_uri_dup (f->get_uri());
-                    GnomeCmdPath *path = gnome_cmd_plain_path_new (path_str);
-                    GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (get_home_con (), path);
-                    gtk_object_destroy (GTK_OBJECT (path));
+                    GnomeCmdPlainPath path(path_str);
+                    GnomeVFSURI *dest_uri = gnome_cmd_con_create_uri (get_home_con (), &path);
 
                     src_uri_list = g_list_append (src_uri_list, src_uri);
                     dest_uri_list = g_list_append (dest_uri_list, dest_uri);



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