mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Reindent Mac version of gnc_gnome_help.
This commit is contained in:
parent
e068366277
commit
3eab36e832
@ -241,15 +241,15 @@ void
|
|||||||
gnc_gnome_help (const char *dir, const char *detail)
|
gnc_gnome_help (const char *dir, const char *detail)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSString *subdir = [NSString stringWithUTF8String: dir];
|
NSString *subdir = [NSString stringWithUTF8String: dir];
|
||||||
NSString *tag, *subdirectory;
|
NSString *tag, *subdirectory;
|
||||||
NSURL *url = NULL;
|
NSURL *url = NULL;
|
||||||
|
|
||||||
if (detail)
|
if (detail)
|
||||||
tag = [NSString stringWithUTF8String: detail];
|
tag = [NSString stringWithUTF8String: detail];
|
||||||
else if ([subdir compare: @HF_HELP] == NSOrderedSame)
|
else if ([subdir compare: @HF_HELP] == NSOrderedSame)
|
||||||
tag = @"help";
|
tag = @"help";
|
||||||
else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
|
else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
|
||||||
tag = @"index";
|
tag = @"index";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -266,18 +266,18 @@ else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
|
|||||||
* add some more pieces, and put it all back together again. Then,
|
* add some more pieces, and put it all back together again. Then,
|
||||||
* because the gettext way of handling localizations is different from
|
* because the gettext way of handling localizations is different from
|
||||||
* OSX's, we have to figure out which translation to use. */
|
* OSX's, we have to figure out which translation to use. */
|
||||||
NSArray *components = [NSArray arrayWithObjects: @"share", @"doc", @"gnucash-docs", nil ];
|
NSArray *components = [NSArray arrayWithObjects: @"share", @"doc", @"gnucash-docs", nil ];
|
||||||
NSString *prefix = [[[NSBundle mainBundle] resourcePath]
|
NSString *prefix = [[[NSBundle mainBundle] resourcePath]
|
||||||
stringByDeletingLastPathComponent];
|
stringByDeletingLastPathComponent];
|
||||||
NSArray *prefix_comps = [[prefix pathComponents]
|
NSArray *prefix_comps = [[prefix pathComponents]
|
||||||
arrayByAddingObjectsFromArray: components];
|
arrayByAddingObjectsFromArray: components];
|
||||||
NSString *docs_dir = [NSString pathWithComponents: prefix_comps];
|
NSString *docs_dir = [NSString pathWithComponents: prefix_comps];
|
||||||
NSArray *languages = [[NSUserDefaults standardUserDefaults]
|
NSArray *languages = [[NSUserDefaults standardUserDefaults]
|
||||||
objectForKey: @"AppleLanguages"];
|
objectForKey: @"AppleLanguages"];
|
||||||
BOOL dir;
|
BOOL dir;
|
||||||
subdir = [[[subdir lowercaseString] componentsSeparatedByString: @" "]
|
subdir = [[[subdir lowercaseString] componentsSeparatedByString: @" "]
|
||||||
componentsJoinedByString: @"-"];
|
componentsJoinedByString: @"-"];
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
|
if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
|
||||||
{
|
{
|
||||||
const gchar *message =
|
const gchar *message =
|
||||||
_("GnuCash could not find the files for the help documentation. "
|
_("GnuCash could not find the files for the help documentation. "
|
||||||
@ -296,28 +296,28 @@ if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
|
|||||||
NSArray *elements;
|
NSArray *elements;
|
||||||
unsigned int paths;
|
unsigned int paths;
|
||||||
NSString *completed_path = [NSString alloc];
|
NSString *completed_path = [NSString alloc];
|
||||||
this_lang = [this_lang stringByTrimmingCharactersInSet:
|
this_lang = [this_lang stringByTrimmingCharactersInSet:
|
||||||
[NSCharacterSet characterSetWithCharactersInString:
|
[NSCharacterSet characterSetWithCharactersInString:
|
||||||
@"\""]];
|
@"\""]];
|
||||||
elements = [this_lang componentsSeparatedByString: @"-"];
|
elements = [this_lang componentsSeparatedByString: @"-"];
|
||||||
this_lang = [elements objectAtIndex: 0];
|
this_lang = [elements objectAtIndex: 0];
|
||||||
path = [docs_dir stringByAppendingPathComponent: this_lang];
|
path = [docs_dir stringByAppendingPathComponent: this_lang];
|
||||||
paths = [path completePathIntoString: &completed_path
|
paths = [path completePathIntoString: &completed_path
|
||||||
caseSensitive: FALSE
|
caseSensitive: FALSE
|
||||||
matchesIntoArray: NULL filterTypes: NULL];
|
matchesIntoArray: NULL filterTypes: NULL];
|
||||||
if (paths > 1 &&
|
if (paths > 1 &&
|
||||||
[[NSFileManager defaultManager]
|
[[NSFileManager defaultManager]
|
||||||
fileExistsAtPath: completed_path
|
fileExistsAtPath: completed_path
|
||||||
isDirectory: &dir])
|
isDirectory: &dir])
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
@try
|
@try
|
||||||
{
|
{
|
||||||
url = [NSURL fileURLWithPath:
|
url = [NSURL fileURLWithPath:
|
||||||
[[[completed_path
|
[[[completed_path
|
||||||
stringByAppendingPathComponent: subdir]
|
stringByAppendingPathComponent: subdir]
|
||||||
stringByAppendingPathComponent: tag]
|
stringByAppendingPathComponent: tag]
|
||||||
stringByAppendingPathExtension: @"html"]];
|
stringByAppendingPathExtension: @"html"]];
|
||||||
}
|
}
|
||||||
@catch (NSException *e)
|
@catch (NSException *e)
|
||||||
{
|
{
|
||||||
@ -327,7 +327,7 @@ url = [NSURL fileURLWithPath:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ([this_lang compare: @"en"] == NSOrderedSame)
|
if ([this_lang compare: @"en"] == NSOrderedSame)
|
||||||
break; /* Special case, forces use of "C" locale */
|
break; /* Special case, forces use of "C" locale */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,11 +336,11 @@ if ([this_lang compare: @"en"] == NSOrderedSame)
|
|||||||
@try
|
@try
|
||||||
{
|
{
|
||||||
url = [NSURL
|
url = [NSURL
|
||||||
fileURLWithPath: [[[[docs_dir
|
fileURLWithPath: [[[[docs_dir
|
||||||
stringByAppendingPathComponent: @"C"]
|
stringByAppendingPathComponent: @"C"]
|
||||||
stringByAppendingPathComponent: subdir]
|
stringByAppendingPathComponent: subdir]
|
||||||
stringByAppendingPathComponent: tag]
|
stringByAppendingPathComponent: tag]
|
||||||
stringByAppendingPathExtension: @"html"]];
|
stringByAppendingPathExtension: @"html"]];
|
||||||
}
|
}
|
||||||
@catch (NSException *e)
|
@catch (NSException *e)
|
||||||
{
|
{
|
||||||
@ -355,10 +355,10 @@ if ([this_lang compare: @"en"] == NSOrderedSame)
|
|||||||
{
|
{
|
||||||
@try
|
@try
|
||||||
{
|
{
|
||||||
url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
|
url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
|
||||||
pathForResource: tag
|
pathForResource: tag
|
||||||
ofType: @"html"
|
ofType: @"html"
|
||||||
inDirectory: subdir ]];
|
inDirectory: subdir ]];
|
||||||
}
|
}
|
||||||
@catch (NSException *e)
|
@catch (NSException *e)
|
||||||
{
|
{
|
||||||
@ -369,7 +369,7 @@ url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
|
|||||||
}
|
}
|
||||||
/* Now just open the URL in the default app for opening URLs */
|
/* Now just open the URL in the default app for opening URLs */
|
||||||
if (url)
|
if (url)
|
||||||
[[NSWorkspace sharedWorkspace] openURL: url];
|
[[NSWorkspace sharedWorkspace] openURL: url];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const gchar *message =
|
const gchar *message =
|
||||||
|
Loading…
Reference in New Issue
Block a user