gnome-commander r1550 - trunk/src



Author: epiotr
Date: Mon Jan 28 22:39:00 2008
New Revision: 1550
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1550&view=rev

Log:
Code cleanup

Modified:
   trunk/src/gnome-cmd-file-selector.cc
   trunk/src/gnome-cmd-file.cc
   trunk/src/utils.cc

Modified: trunk/src/gnome-cmd-file-selector.cc
==============================================================================
--- trunk/src/gnome-cmd-file-selector.cc	(original)
+++ trunk/src/gnome-cmd-file-selector.cc	Mon Jan 28 22:39:00 2008
@@ -1483,10 +1483,12 @@
 
     // create a command with an empty argument to the editor
     gchar *cmd = g_strdup_printf (gnome_cmd_data_get_editor (), "");
-
     gchar *dpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (fs->priv->cwd));
+
     run_command_indir (cmd, dpath, FALSE);
+
     g_free (dpath);
+    g_free (cmd);
 }
 
 

Modified: trunk/src/gnome-cmd-file.cc
==============================================================================
--- trunk/src/gnome-cmd-file.cc	(original)
+++ trunk/src/gnome-cmd-file.cc	Mon Jan 28 22:39:00 2008
@@ -159,8 +159,7 @@
 }
 
 
-GnomeCmdFile *
-gnome_cmd_file_new (GnomeVFSFileInfo *info, GnomeCmdDir *dir)
+GnomeCmdFile *gnome_cmd_file_new (GnomeVFSFileInfo *info, GnomeCmdDir *dir)
 {
     GnomeCmdFile *finfo = (GnomeCmdFile *) gtk_type_new (gnome_cmd_file_get_type ());
 
@@ -309,12 +308,12 @@
     g_return_val_if_fail (finfo != NULL, NULL);
     g_return_val_if_fail (finfo->info != NULL, NULL);
 
-    gchar *path_str;
-    GnomeCmdPath *path;
-
     if (strcmp (finfo->info->name, G_DIR_SEPARATOR_S) == 0)
         return g_strdup (G_DIR_SEPARATOR_S);
 
+    GnomeCmdPath *path;
+    gchar *path_str;
+
     if (!has_parent_dir (finfo))
     {
         if (GNOME_CMD_IS_DIR (finfo))
@@ -346,14 +345,10 @@
 
 gchar *gnome_cmd_file_get_quoted_real_path (GnomeCmdFile *finfo)
 {
-    gchar *ret = NULL;
     gchar *path = gnome_cmd_file_get_real_path (finfo);
+    gchar *ret = path ? quote_if_needed (path) : NULL;
 
-    if (path)
-    {
-        ret = quote_if_needed (path);
-        g_free (path);
-    }
+    g_free (path);
 
     return ret;
 }
@@ -950,7 +945,7 @@
 
 inline gulong tv2ms (const GTimeVal &t)
 {
-    return t.tv_sec * 1000 + t.tv_usec/1000;
+    return t.tv_sec*1000 + t.tv_usec/1000;
 }
 
 

Modified: trunk/src/utils.cc
==============================================================================
--- trunk/src/utils.cc	(original)
+++ trunk/src/utils.cc	Mon Jan 28 22:39:00 2008
@@ -459,7 +459,7 @@
 
         if (!path_str) return;
 
-        dldata->args[1] = (gpointer)path_str;
+        dldata->args[1] = (gpointer) path_str;
 
         GnomeVFSURI *src_uri = gnome_vfs_uri_dup (gnome_cmd_file_get_uri (dldata->finfo));
         GnomeCmdPath *path = gnome_cmd_plain_path_new (path_str);
@@ -505,17 +505,16 @@
         {
             gchar *fname = get_utf8 (finfo->info->name);
             gchar *msg = g_strdup_printf (_("\"%s\" seems to be a binary executable file but it lacks the executable bit. Do you want to set it and then run the file?"), fname);
-            gint ret = run_simple_dialog (
-                GTK_WIDGET (main_win), FALSE, GTK_MESSAGE_QUESTION, msg,
-                _("Make Executable?"),
-                -1, _("Cancel"), _("OK"), NULL);
+            gint ret = run_simple_dialog (GTK_WIDGET (main_win), FALSE, GTK_MESSAGE_QUESTION, msg,
+                                          _("Make Executable?"),
+                                          -1, _("Cancel"), _("OK"), NULL);
             g_free (fname);
             g_free (msg);
 
             if (ret != 1)  return;  else
             {
-                GnomeVFSResult res = gnome_cmd_file_chmod (finfo, (GnomeVFSFilePermissions) (finfo->info->permissions|GNOME_VFS_PERM_USER_EXEC));
-                if (res != GNOME_VFS_OK)
+                GnomeVFSResult result = gnome_cmd_file_chmod (finfo, (GnomeVFSFilePermissions) (finfo->info->permissions|GNOME_VFS_PERM_USER_EXEC));
+                if (result != GNOME_VFS_OK)
                     return;
             }
         }
@@ -535,9 +534,8 @@
             {
                 gchar *fname = get_utf8 (finfo->info->name);
                 gchar *msg = g_strdup_printf (_("\"%s\" is an executable text file. Do you want to run it, or display its contents?"), fname);
-                gint ret = run_simple_dialog (
-                    GTK_WIDGET (main_win), FALSE, GTK_MESSAGE_QUESTION, msg, _("Run or Display"),
-                    -1, _("Cancel"), _("Display"), _("Run"), NULL);
+                gint ret = run_simple_dialog (GTK_WIDGET (main_win), FALSE, GTK_MESSAGE_QUESTION, msg, _("Run or Display"),
+                                              -1, _("Cancel"), _("Display"), _("Run"), NULL);
                 g_free (fname);
                 g_free (msg);
 
@@ -564,27 +562,25 @@
 
     if (gnome_cmd_file_is_local (finfo))
     {
-        args[0] = (gpointer)app;
-        args[1] = (gpointer)g_strdup (gnome_cmd_file_get_real_path (finfo));
+        args[0] = (gpointer) app;
+        args[1] = (gpointer) g_strdup (gnome_cmd_file_get_real_path (finfo));
         do_mime_exec_single (args);
     }
     else
     {
-        if (gnome_cmd_app_get_handles_uris (app)
-            && gnome_cmd_data_get_honor_expect_uris())
+        if (gnome_cmd_app_get_handles_uris (app) && gnome_cmd_data_get_honor_expect_uris())
         {
-            args[0] = (gpointer)app;
-            args[1] = (gpointer)g_strdup (gnome_cmd_file_get_uri_str (finfo));
+            args[0] = (gpointer) app;
+            args[1] = (gpointer) g_strdup (gnome_cmd_file_get_uri_str (finfo));
             do_mime_exec_single (args);
         }
         else
         {
             gchar *msg = g_strdup_printf (_("%s does not know how to open remote file. Do you want to download the file to a temporary location and then open it?"), gnome_cmd_app_get_name (app));
-            GtkWidget *dialog = gtk_message_dialog_new (
-                GTK_WINDOW (main_win), GTK_DIALOG_MODAL,
-                GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, msg);
+            GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (main_win), GTK_DIALOG_MODAL,
+                                                        GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, msg);
             TmpDlData *dldata = g_new0 (TmpDlData, 1);
-            args[0] = (gpointer)app;
+            args[0] = (gpointer) app;
             dldata->finfo = finfo;
             dldata->dialog = dialog;
             dldata->args = args;



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