gnome-commander r1587 - branches/gcmd-1-3/src



Author: epiotr
Date: Mon Feb 25 16:37:41 2008
New Revision: 1587
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1587&view=rev

Log:
Code cleanup

Modified:
   branches/gcmd-1-3/src/gnome-cmd-dir.cc
   branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc

Modified: branches/gcmd-1-3/src/gnome-cmd-dir.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir.cc	Mon Feb 25 16:37:41 2008
@@ -258,24 +258,19 @@
 
 GnomeCmdDir *gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *parent)
 {
-    GnomeCmdDir *dir;
-    GnomeCmdCon *con;
-    GnomeCmdPath *path;
-    GnomeVFSURI *uri;
-    gchar *uri_str;
-
     g_return_val_if_fail (info != NULL, NULL);
     g_return_val_if_fail (GNOME_CMD_IS_DIR (parent), NULL);
 
-    con = gnome_cmd_dir_get_connection (parent);
-    path = gnome_cmd_path_get_child (gnome_cmd_dir_get_path (parent), info->name);
+    GnomeCmdCon *con = gnome_cmd_dir_get_connection (parent);
+    GnomeCmdPath *path = gnome_cmd_path_get_child (gnome_cmd_dir_get_path (parent), info->name);
 
-    uri = gnome_cmd_con_create_uri (con, path);
-    uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+    GnomeVFSURI *uri = gnome_cmd_con_create_uri (con, path);
+    gchar *uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
 
-    dir = gnome_cmd_con_cache_lookup (gnome_cmd_dir_get_connection (parent), uri_str);
+    GnomeCmdDir *dir = gnome_cmd_con_cache_lookup (gnome_cmd_dir_get_connection (parent), uri_str);
     g_free (uri_str);
     gnome_vfs_uri_unref (uri);
+
     if (dir)
     {
         gtk_object_destroy (GTK_OBJECT (path));

Modified: branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc	Mon Feb 25 16:37:41 2008
@@ -37,8 +37,6 @@
 
 static void on_ok (GtkButton *button, GnomeCmdPrepareXferDialog *dialog)
 {
-    GnomeVFSResult res;
-    GnomeVFSFileType type;
     GnomeCmdDir *dest_dir;
     gchar *dest_fn = NULL;
     gchar *dest_path;
@@ -69,7 +67,8 @@
     }
 
     // Check if something exists at the given path and find out what it is
-    res = gnome_cmd_con_get_path_target_type (con, dest_path, &type);
+    GnomeVFSFileType type;
+    GnomeVFSResult   res = gnome_cmd_con_get_path_target_type (con, dest_path, &type);
 
     if (res != GNOME_VFS_OK && res != GNOME_VFS_ERROR_NOT_FOUND)
         goto bailout;
@@ -81,8 +80,7 @@
         if (res == GNOME_VFS_OK && type == GNOME_VFS_FILE_TYPE_DIRECTORY)
         {
             // There exists a directory, copy into it using the original filename
-            dest_dir = gnome_cmd_dir_new (
-                con, gnome_cmd_con_create_path (con, dest_path));
+            dest_dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, dest_path));
             dest_fn = g_strdup (gnome_cmd_file_get_name (finfo));
         }
         else
@@ -115,15 +113,13 @@
             else
             {
                 // Nothing exists, ask the user if a new directory might be suitable in the path that he specified
-                gchar *msg = g_strdup_printf (
-                    _("The directory '%s' doesn't exist, do you want to create it?"),
-                    g_basename (parent_dir));
-                gint choise = run_simple_dialog (
-                    GTK_WIDGET (dialog), TRUE, GTK_MESSAGE_QUESTION, msg, "",
-                    -1, _("No"), _("Yes"), NULL);
+                gchar *msg = g_strdup_printf (_("The directory '%s' doesn't exist, do you want to create it?"),
+                                              g_basename (parent_dir));
+                gint choice = run_simple_dialog (GTK_WIDGET (dialog), TRUE, GTK_MESSAGE_QUESTION, msg, "",
+                                                 -1, _("No"), _("Yes"), NULL);
                 g_free (msg);
 
-                if (choise == 1)
+                if (choice == 1)
                 {
                     GnomeVFSResult mkdir_result = gnome_cmd_con_mkdir (con, parent_dir);
                     if (mkdir_result != GNOME_VFS_OK)
@@ -135,8 +131,7 @@
                 else
                     goto bailout;
 
-                dest_dir = gnome_cmd_dir_new (
-                    con, gnome_cmd_con_create_path (con, parent_dir));
+                dest_dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, parent_dir));
                 g_free (parent_dir);
                 dest_fn = g_strdup (g_basename (dest_path));
             }
@@ -164,10 +159,10 @@
                                                         GTK_MESSAGE_QUESTION,
                                                         GTK_BUTTONS_OK_CANCEL,
                                                         msg);
-            gint choise = gtk_dialog_run (GTK_DIALOG (dialog));
+            gint choice = gtk_dialog_run (GTK_DIALOG (dialog));
             g_free (msg);
 
-            if (choise == GTK_RESPONSE_OK)
+            if (choice == GTK_RESPONSE_OK)
             {
                 GnomeVFSResult mkdir_result = gnome_cmd_con_mkdir (con, dest_path);
                 if (mkdir_result != GNOME_VFS_OK)



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