]> granicus.if.org Git - transmission/commitdiff
(trunk) replace the tr_metainfo_builder.isSingleFile and tr_info.isMultifile fields...
authorJordan Lee <jordan@transmissionbt.com>
Sun, 8 Jun 2014 22:16:01 +0000 (22:16 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sun, 8 Jun 2014 22:16:01 +0000 (22:16 +0000)
This makes the variable naming more uniform. It also clarifies the information we're really trying to convey -- previously, isSingleFile was false whenever the torrent held a directory tree, even if there was only a single file in the tree.

Sync the Mac OS X client's use to match the libtransmission variable names.

libtransmission/makemeta.c
libtransmission/makemeta.h
libtransmission/transmission.h
macosx/Controller.m
macosx/CreatorWindowController.m
macosx/DragOverlayWindow.m
macosx/QuickLookPlugin/GeneratePreviewForURL.m
macosx/Torrent.m

index 01b2e0fdcad8f12d6138d8e755750c1f922943d6..0d7198884ddf13ab3c26c52aec87cc18e801a2fc 100644 (file)
@@ -126,7 +126,7 @@ tr_metaInfoBuilderCreate (const char * topFileArg)
   {
     struct stat sb;
     stat (topFile, &sb);
-    ret->isSingleFile = !S_ISDIR (sb.st_mode);
+    ret->isFolder = S_ISDIR (sb.st_mode);
   }
 
   /* build a list of files containing topFile and,
@@ -334,11 +334,7 @@ makeInfoDict (tr_variant          * dict,
 
   tr_variantDictReserve (dict, 5);
 
-  if (builder->isSingleFile)
-    {
-      tr_variantDictAddInt (dict, TR_KEY_length, builder->files[0].size);
-    }
-  else /* root node is a directory */
+  if (builder->isFolder) /* root node is a directory */
     {
       uint32_t  i;
       tr_variant * list = tr_variantDictAddList (dict, TR_KEY_files,
@@ -351,6 +347,10 @@ makeInfoDict (tr_variant          * dict,
           getFileInfo (builder->top, &builder->files[i], length, pathVal);
         }
     }
+  else
+    {
+      tr_variantDictAddInt (dict, TR_KEY_length, builder->files[0].size);
+    }
 
   base = tr_basename (builder->top);
   tr_variantDictAddStr (dict, TR_KEY_name, base);
index 8c7e3e77c525ded5b5b1af2ca2bfb46807dabaee..ba9c24ae89f51ea73d5d009a127a740a7064face 100644 (file)
@@ -45,7 +45,7 @@ typedef struct tr_metainfo_builder
     uint32_t                    fileCount;
     uint32_t                    pieceSize;
     uint32_t                    pieceCount;
-    bool                        isSingleFile;
+    bool                        isFolder;
 
     /**
     ***  These are set inside tr_makeMetaInfo ()
index 39b00c479b6be5fa0c22a0ac19bc4b9f9d93e9b6..f2f0266fbfa22441bc129112c63b2d4fc35f65b8 100644 (file)
@@ -1836,7 +1836,7 @@ struct tr_info
 
     /* Flags */
     bool               isPrivate;
-    bool               isMultifile;
+    bool               isFolder;
 };
 
 static inline bool tr_torrentHasMetadata (const tr_torrent * tor)
index 60d716fd4fd6c7e4ba5db769bdf0b07adeb83e63..f7518596ba37cdc4e3180c777fb84266f13c122e 100644 (file)
@@ -953,7 +953,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         
         //determine to show the options window
         const BOOL showWindow = type == ADD_SHOW_OPTIONS || ([fDefaults boolForKey: @"DownloadAsk"]
-                                    && (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
+                                    && (info.isFolder || ![fDefaults boolForKey: @"DownloadAskMulti"])
                                     && (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
         tr_metainfoFree(&info);
         
index 95eaef70f70eb4d86b8e192549e4fc1b071c69ef..c702c44614fe43771c93a9c4cd0932c00515aefc 100644 (file)
     [fNameField setStringValue: name];
     [fNameField setToolTip: [fPath path]];
     
-    const BOOL multifile = !fInfo->isSingleFile;
+    const BOOL multifile = fInfo->isFolder;
     
     NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: multifile
                         ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [fPath pathExtension]];
index f1e5f5953d60929c120d0837a93fce5aa12ce812..9b87e88dc89046631bbf792dafbaa7efac6d453e 100644 (file)
                 if (count == 1)
                 {
                     name = [NSString stringWithUTF8String: info.name];
-                    folder = info.isMultifile;
+                    folder = info.isFolder;
                 }
             }
             tr_metainfoFree(&info);
index c1c68b2a23293305f3e139607a34dffc82300a76..72cafeabc330b833ffc74b73839a94b155fd3b8b 100644 (file)
@@ -60,13 +60,13 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
     NSMutableDictionary * allImgProps = [NSMutableDictionary dictionary];
     
     NSString * name = [NSString stringWithUTF8String: inf.name];
-    NSString * fileTypeString = inf.isMultifile ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
+    NSString * fileTypeString = inf.isFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
     
     const NSUInteger width = 32;
     [htmlString appendFormat: @"<h2><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@</h2>", generateIconData(fileTypeString, width, allImgProps), width, width, name];
     
     NSString * fileSizeString = [NSString stringForFileSize: inf.totalSize];
-    if (inf.isMultifile)
+    if (inf.isFolder)
     {
         NSString * fileCountString;
         if (inf.fileCount == 1)
@@ -132,7 +132,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
         [lists addObject: listSection];
     }
     
-    if (inf.isMultifile)
+    if (inf.isFolder)
     {
         NSMutableString * listSection = [NSMutableString string];
         [listSection appendString: @"<table>"];
index f6dbd935a4b6d39c924b5fc795f57411ef6794ef..f5b29523449d101903ebeb84b283e42a4edf1efd 100644 (file)
@@ -642,7 +642,7 @@ int trashDataFile(const char * filename)
 
 - (BOOL) isFolder
 {
-    return fInfo->isMultifile;
+    return fInfo->isFolder;
 }
 
 - (uint64_t) size