[gnome-commander] GnomeCmdFile: more C++ rework



commit 172a6d576f956962a32c854c7fe19274cdf8921e
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Fri Nov 19 21:51:47 2010 +0100

    GnomeCmdFile: more C++ rework

 src/gnome-cmd-file-props-dialog.cc |    2 +-
 src/gnome-cmd-file.cc              |   18 ++++++++--------
 src/gnome-cmd-file.h               |   38 ++++++++++++++++++------------------
 src/gnome-cmd-user-actions.cc      |    4 +-
 4 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/src/gnome-cmd-file-props-dialog.cc b/src/gnome-cmd-file-props-dialog.cc
index ff35291..09efaa7 100644
--- a/src/gnome-cmd-file-props-dialog.cc
+++ b/src/gnome-cmd-file-props-dialog.cc
@@ -396,7 +396,7 @@ inline GtkWidget *create_properties_tab (GnomeCmdFilePropsDialogPrivate *data)
 
     if (data->f->is_local())
     {
-        GnomeCmdDir *dir = gnome_cmd_file_get_parent_dir (data->f);
+        GnomeCmdDir *dir = data->f->get_parent_dir();
         GnomeCmdCon *con = dir ? gnome_cmd_dir_get_connection (dir) : NULL;
         gchar *location = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (dir));
 
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index 7b6e0ed..5423283 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -283,7 +283,7 @@ GnomeVFSResult GnomeCmdFile::chmod(GnomeVFSFilePermissions perm)
 
     if (has_parent_dir (this))
     {
-        GnomeCmdDir *dir = get_parent_dir (this);
+        GnomeCmdDir *dir = ::get_parent_dir (this);
         gchar *uri_str = gnome_cmd_file_get_uri_str (this);
         gnome_cmd_dir_file_changed (dir, uri_str);
         g_free (uri_str);
@@ -307,7 +307,7 @@ GnomeVFSResult GnomeCmdFile::chown(uid_t uid, gid_t gid)
 
     if (has_parent_dir (this))
     {
-        GnomeCmdDir *dir = get_parent_dir (this);
+        GnomeCmdDir *dir = ::get_parent_dir (this);
         gchar *uri_str = gnome_cmd_file_get_uri_str (this);
         gnome_cmd_dir_file_changed (dir, uri_str);
         g_free (uri_str);
@@ -343,7 +343,7 @@ GnomeVFSResult GnomeCmdFile::rename(const gchar *new_name)
         gchar *old_uri_str = gnome_cmd_file_get_uri_str (this);
 
         update_info(new_info);
-        gnome_cmd_dir_file_renamed (get_parent_dir (this), this, old_uri_str);
+        gnome_cmd_dir_file_renamed (::get_parent_dir (this), this, old_uri_str);
         if (GNOME_CMD_IS_DIR (this))
             gnome_cmd_dir_update_path (GNOME_CMD_DIR (this));
     }
@@ -381,7 +381,7 @@ gchar *GnomeCmdFile::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 = 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));
 
@@ -446,7 +446,7 @@ GnomeVFSURI *GnomeCmdFile::get_uri(const gchar *name)
             g_assert ("Non directory file without owning directory");
     }
 
-    return gnome_cmd_dir_get_child_uri (get_parent_dir (this), name ? name : info->name);
+    return gnome_cmd_dir_get_child_uri (::get_parent_dir (this), name ? name : info->name);
 }
 
 
@@ -799,7 +799,7 @@ void GnomeCmdFile::update_info(GnomeVFSFileInfo *info)
 
 gboolean GnomeCmdFile::is_local()
 {
-    return gnome_cmd_dir_is_local (get_parent_dir (this));
+    return gnome_cmd_dir_is_local (::get_parent_dir (this));
 }
 
 
@@ -829,7 +829,7 @@ void GnomeCmdFile::is_deleted()
     if (has_parent_dir (this))
     {
         gchar *uri_str = gnome_cmd_file_get_uri_str (this);
-        gnome_cmd_dir_file_deleted (get_parent_dir (this), uri_str);
+        gnome_cmd_dir_file_deleted (::get_parent_dir (this), uri_str);
         g_free (uri_str);
     }
 }
@@ -935,9 +935,9 @@ void gnome_cmd_file_list_unref (GList *files)
 }
 
 
-GnomeCmdDir *gnome_cmd_file_get_parent_dir (GnomeCmdFile *f)
+GnomeCmdDir *GnomeCmdFile::get_parent_dir()
 {
-    return get_parent_dir (f);
+    return ::get_parent_dir (this);
 }
 
 
diff --git a/src/gnome-cmd-file.h b/src/gnome-cmd-file.h
index 9e7ff64..4b98fa8 100644
--- a/src/gnome-cmd-file.h
+++ b/src/gnome-cmd-file.h
@@ -31,6 +31,9 @@
 
 class GnomeCmdFileMetadata;
 
+struct GnomeCmdDir;
+
+
 struct GnomeCmdFile
 {
     GnomeCmdFileInfo parent;
@@ -53,20 +56,6 @@ struct GnomeCmdFile
 
     char *get_collation_fname() const    {  return collate_key ? collate_key : info->name;  }
 
-    const gchar *get_type_string();
-    const gchar *get_type_desc();
-    gboolean get_type_pixmap_and_mask(GdkPixmap **pixmap, GdkBitmap **mask);
-
-    GnomeVFSResult chmod(GnomeVFSFilePermissions perm);
-    GnomeVFSResult chown(uid_t uid, gid_t gid);
-    GnomeVFSResult rename(const gchar *new_name);
-
-    void update_info(GnomeVFSFileInfo *info);
-    gboolean is_local();
-    gboolean is_executable();
-    void is_deleted();
-    void execute();
-
     const gchar *get_extension();
     const gchar *get_owner();
     const gchar *get_group();
@@ -82,6 +71,22 @@ struct GnomeCmdFile
     gboolean has_mime_type(const gchar *mime_type);
     gboolean mime_begins_with(const gchar *mime_type_start);
 
+    GnomeCmdDir *get_parent_dir();
+
+    const gchar *get_type_string();
+    const gchar *get_type_desc();
+    gboolean get_type_pixmap_and_mask(GdkPixmap **pixmap, GdkBitmap **mask);
+
+    GnomeVFSResult chmod(GnomeVFSFilePermissions perm);
+    GnomeVFSResult chown(uid_t uid, gid_t gid);
+    GnomeVFSResult rename(const gchar *new_name);
+
+    void update_info(GnomeVFSFileInfo *info);
+    gboolean is_local();
+    gboolean is_executable();
+    void is_deleted();
+    void execute();
+
     gboolean needs_update();
 
     void invalidate_tree_size();
@@ -96,9 +101,6 @@ struct GnomeCmdFileClass
 };
 
 
-struct GnomeCmdDir;
-
-
 GtkType gnome_cmd_file_get_type ();
 
 GnomeCmdFile *gnome_cmd_file_new_from_uri (const gchar *local_full_path);
@@ -136,8 +138,6 @@ void gnome_cmd_file_list_free (GList *files);
 void gnome_cmd_file_list_ref (GList *files);
 void gnome_cmd_file_list_unref (GList *files);
 
-GnomeCmdDir *gnome_cmd_file_get_parent_dir (GnomeCmdFile *f);
-
 inline const gchar *GnomeCmdFile::get_mime_type()
 {
     g_return_val_if_fail (info != NULL, NULL);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 1a7d308..397fc15 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1067,11 +1067,11 @@ void command_execute (GtkMenuItem *menuitem, gpointer command)
 
     if (i)
     {
-        dir = gnome_cmd_file_get_parent_dir (GNOME_CMD_FILE (i->data));
+        dir = GNOME_CMD_FILE (i->data)->get_parent_dir();
         i = i->next;
     }
 
-    for (; i && gnome_cmd_file_get_parent_dir (GNOME_CMD_FILE (i->data))==dir; i=i->next);
+    for (; i && GNOME_CMD_FILE (i->data)->get_parent_dir()==dir; i=i->next);
 
     if (i)
         dir = NULL;



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