[cheese/shareable-media] Make code more efficient



commit f0dd5983aeb4e0c277d61fb63dff738523193967
Author: Patricia Santana Cruz <patriciasantanacruz gmail com>
Date:   Fri Dec 23 13:07:06 2011 +0000

    Make code more efficient
    
    Replaced a _for_ loop with a foreach and removed several function calls
    that are not necessary any longer due to this replacement.

 src/cheese-shareable-media.vala |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/src/cheese-shareable-media.vala b/src/cheese-shareable-media.vala
index d1dec06..3bf56bc 100644
--- a/src/cheese-shareable-media.vala
+++ b/src/cheese-shareable-media.vala
@@ -9,16 +9,10 @@ namespace ShareableMedia {
     if (mainWindow == null)
       stdout.printf ("Test: NULL mainWindow\n");
 
-    if (files.length () == 0)
-        return;
+    string[] argv = {};
+    argv += SENDTO_EXEC;
 
-    string[] argv = new string[files.length ()+ 1];
-    argv[0] = SENDTO_EXEC;
-
-    for (int i = 0; i < files.length (); i++)
-    {
-      argv[i + 1] = files<GLib.File>.nth (i).data.get_path ();
-    }
+    files.foreach ((file) => argv += file.get_path());
 
     try {
       mainWindow.set_busy_cursor();



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