Skip to content

Commit

Permalink
Add viennaplugin support for packaging up plugins.
Browse files Browse the repository at this point in the history
Added a couple of new strings that need to be localized.
Viennaplugin icon is temporary and needs to be replaced.



git-svn-id: https://vienna-rss.svn.sourceforge.net/svnroot/vienna-rss/trunk/2.5.0@1484 09869ea3-740d-0410-b225-97ef48a472b4
  • Loading branch information
stevewpalmer committed Jan 16, 2010
1 parent 94142b7 commit fc230c7
Show file tree
Hide file tree
Showing 25 changed files with 127 additions and 98 deletions.
166 changes: 85 additions & 81 deletions AppController.m
Expand Up @@ -60,54 +60,55 @@
#include <IOKit/IOMessage.h>

@interface AppController (Private)
-(NSMenu *)searchFieldMenu;
-(void)installSleepHandler;
-(void)installScriptsFolderWatcher;
-(void)handleTabChange:(NSNotification *)nc;
-(void)handleFolderSelection:(NSNotification *)nc;
-(void)handleCheckFrequencyChange:(NSNotification *)nc;
-(void)handleFolderNameChange:(NSNotification *)nc;
-(void)handleDidBecomeKeyWindow:(NSNotification *)nc;
-(void)handleReloadPreferences:(NSNotification *)nc;
-(void)handleShowAppInStatusBar:(NSNotification *)nc;
-(void)handleShowStatusBar:(NSNotification *)nc;
-(void)handleShowFilterBar:(NSNotification *)nc;
-(void)setAppStatusBarIcon;
-(void)localiseMenus:(NSArray *)arrayOfMenus;
-(void)updateNewArticlesNotification;
-(void)showAppInStatusBar;
-(void)initSortMenu;
-(void)initColumnsMenu;
-(void)initBlogWithMenu;
-(void)initScriptsMenu;
-(void)initFiltersMenu;
-(NSMenu *)getStylesMenu;
-(void)startProgressIndicator;
-(void)stopProgressIndicator;
-(void)doEditFolder:(Folder *)folder;
-(void)refreshOnTimer:(NSTimer *)aTimer;
-(void)setStatusBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)setFilterBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)setPersistedFilterBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)doConfirmedDelete:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-(void)doConfirmedEmptyTrash:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-(void)runAppleScript:(NSString *)scriptName;
-(NSString *)appName;
-(void)sendBlogEvent:(NSString *)externalEditorBundleIdentifier title:(NSString *)title url:(NSString *)url body:(NSString *)body author:(NSString *)author guid:(NSString *)guid;
-(void)setLayout:(int)newLayout withRefresh:(BOOL)refreshFlag;
-(void)updateAlternateMenuTitle;
-(void)updateSearchPlaceholder;
-(void)toggleOptionKeyButtonStates;
-(FoldersTree *)foldersTree;
-(void)updateCloseCommands;
-(void)loadOpenTabs;
-(BOOL)isFilterBarVisible;
-(BOOL)isStatusBarVisible;
-(NSDictionary *)registrationDictionaryForGrowl;
-(NSTimer *)checkTimer;
-(ToolbarItem *)toolbarItemWithIdentifier:(NSString *)theIdentifier;
-(void)searchArticlesWithString:(NSString *)searchString;
-(void)sourceWindowWillClose:(NSNotification *)notification;
-(NSMenu *)searchFieldMenu;
-(void)installSleepHandler;
-(void)installScriptsFolderWatcher;
-(void)handleTabChange:(NSNotification *)nc;
-(void)handleFolderSelection:(NSNotification *)nc;
-(void)handleCheckFrequencyChange:(NSNotification *)nc;
-(void)handleFolderNameChange:(NSNotification *)nc;
-(void)handleDidBecomeKeyWindow:(NSNotification *)nc;
-(void)handleReloadPreferences:(NSNotification *)nc;
-(void)handleShowAppInStatusBar:(NSNotification *)nc;
-(void)handleShowStatusBar:(NSNotification *)nc;
-(void)handleShowFilterBar:(NSNotification *)nc;
-(void)setAppStatusBarIcon;
-(void)localiseMenus:(NSArray *)arrayOfMenus;
-(void)updateNewArticlesNotification;
-(void)showAppInStatusBar;
-(void)initSortMenu;
-(void)initColumnsMenu;
-(void)initBlogWithMenu;
-(void)initScriptsMenu;
-(void)initFiltersMenu;
-(NSMenu *)getStylesMenu;
-(void)startProgressIndicator;
-(void)stopProgressIndicator;
-(void)doEditFolder:(Folder *)folder;
-(void)refreshOnTimer:(NSTimer *)aTimer;
-(BOOL)installFilename:(NSString *)srcFile toPath:(NSString *)path;
-(void)setStatusBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)setFilterBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)setPersistedFilterBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate;
-(void)doConfirmedDelete:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-(void)doConfirmedEmptyTrash:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-(void)runAppleScript:(NSString *)scriptName;
-(NSString *)appName;
-(void)sendBlogEvent:(NSString *)externalEditorBundleIdentifier title:(NSString *)title url:(NSString *)url body:(NSString *)body author:(NSString *)author guid:(NSString *)guid;
-(void)setLayout:(int)newLayout withRefresh:(BOOL)refreshFlag;
-(void)updateAlternateMenuTitle;
-(void)updateSearchPlaceholder;
-(void)toggleOptionKeyButtonStates;
-(FoldersTree *)foldersTree;
-(void)updateCloseCommands;
-(void)loadOpenTabs;
-(BOOL)isFilterBarVisible;
-(BOOL)isStatusBarVisible;
-(NSDictionary *)registrationDictionaryForGrowl;
-(NSTimer *)checkTimer;
-(ToolbarItem *)toolbarItemWithIdentifier:(NSString *)theIdentifier;
-(void)searchArticlesWithString:(NSString *)searchString;
-(void)sourceWindowWillClose:(NSNotification *)notification;
@end

// Static constant strings that are typically never tweaked
Expand Down Expand Up @@ -636,24 +637,8 @@ -(BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
Preferences * prefs = [Preferences standardPreferences];
if ([[filename pathExtension] isEqualToString:@"viennastyle"])
{
NSString * path = [prefs stylesFolder];
NSString * styleName = [[filename lastPathComponent] stringByDeletingPathExtension];
NSString * fullPath = [path stringByAppendingPathComponent:[filename lastPathComponent]];

// Make sure we actually have a Styles folder.
NSFileManager * fileManager = [NSFileManager defaultManager];
BOOL isDir = NO;

if (![fileManager fileExistsAtPath:path isDirectory:&isDir])
{
if (![fileManager createDirectoryAtPath:path attributes:NULL])
{
runOKAlertPanel(NSLocalizedString(@"Cannot create style folder title", nil), NSLocalizedString(@"Cannot create style folder body", nil), path);
return NO;
}
}
[fileManager removeFileAtPath:fullPath handler:nil];
if (![fileManager copyPath:filename toPath:fullPath handler:nil])
if (![self installFilename:filename toPath:[prefs stylesFolder]])
[[Preferences standardPreferences] setDisplayStyle:styleName];
else
{
Expand All @@ -666,25 +651,19 @@ -(BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
}
return YES;
}
if ([[filename pathExtension] isEqualToString:@"scpt"])
if ([[filename pathExtension] isEqualToString:@"viennaplugin"])
{
NSString * path = [prefs scriptsFolder];
NSString * fullPath = [path stringByAppendingPathComponent:[filename lastPathComponent]];

// Make sure we actually have a Scripts folder.
NSFileManager * fileManager = [NSFileManager defaultManager];
BOOL isDir = NO;

if (![fileManager fileExistsAtPath:path isDirectory:&isDir])
NSString * path = [prefs pluginsFolder];
if ([self installFilename:filename toPath:path])
{
if (![fileManager createDirectoryAtPath:path attributes:NULL])
{
runOKAlertPanel(NSLocalizedString(@"Cannot create scripts folder title", nil), NSLocalizedString(@"Cannot create scripts folder body", nil), path);
return NO;
}
NSString * fullPath = [path stringByAppendingPathComponent:[filename lastPathComponent]];
[pluginManager loadPlugin:fullPath];
}
[fileManager removeFileAtPath:fullPath handler:nil];
if ([fileManager copyPath:filename toPath:fullPath handler:nil])
return YES;
}
if ([[filename pathExtension] isEqualToString:@"scpt"])
{
if ([self installFilename:filename toPath:[prefs scriptsFolder]])
{
if (!hasOSScriptsMenu())
[self initScriptsMenu];
Expand All @@ -700,6 +679,31 @@ -(BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
return NO;
}

/* installFilename
* Copies the folder at srcFile to the specified path. The path is created if it doesn't already exist and
* an error is reported if we fail to create the path. The return value is the result of copying the source
* folder to the new path.
*/
-(BOOL)installFilename:(NSString *)srcFile toPath:(NSString *)path
{
NSString * fullPath = [path stringByAppendingPathComponent:[srcFile lastPathComponent]];

// Make sure we actually have a destination folder.
NSFileManager * fileManager = [NSFileManager defaultManager];
BOOL isDir = NO;

if (![fileManager fileExistsAtPath:path isDirectory:&isDir])
{
if (![fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:NULL error:NULL])
{
runOKAlertPanel(NSLocalizedString(@"Cannot create folder title", nil), NSLocalizedString(@"Cannot create folder body", nil), path);
return NO;
}
}
[fileManager removeFileAtPath:fullPath handler:nil];
return [fileManager copyPath:srcFile toPath:fullPath handler:nil];
}

/* searchFieldMenu
* Allocates a popup menu for one of the search fields we use.
*/
Expand Down
14 changes: 14 additions & 0 deletions Info.plist
Expand Up @@ -22,6 +22,20 @@
<key>LSTypeIsPackage</key>
<string>YES</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>viennaplugin</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>vienna2plugin.icns</string>
<key>CFBundleTypeName</key>
<string>Vienna Plugin Package</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<string>YES</string>
</dict>
<dict>
<key>CFBundleTypeExtension</key>
<array>
Expand Down
1 change: 1 addition & 0 deletions PluginManager.h
Expand Up @@ -28,5 +28,6 @@
-(void)resetPlugins;
-(NSArray *)toolbarItems;
-(NSArray *)defaultToolbarItems;
-(void)loadPlugin:(NSString *)pluginPath;
-(void)toolbarItem:(ToolbarItem *)item withIdentifier:(NSString *)itemIdentifier;
@end
32 changes: 20 additions & 12 deletions PluginManager.m
Expand Up @@ -70,24 +70,32 @@ -(void)resetPlugins
for (pluginName in pluginPaths)
{
NSString * pluginPath = [pluginPaths objectForKey:pluginName];
NSString * listFile = [pluginPath stringByAppendingPathComponent:@"info.plist"];
NSMutableDictionary * pluginInfo = [NSMutableDictionary dictionaryWithContentsOfFile:listFile];

// If the info.plist is missing or corrupted, warn but then just move on and the user
// will have to figure it out.
if (pluginInfo == nil)
{
NSAssert1(false, @"Missing or corrupt info.plist in %@", pluginPath);
continue;
}
[self loadPlugin:pluginPath];
}

[pluginPaths release];
}

/* loadPlugin
* Load the plugin at the specified path.
*/
-(void)loadPlugin:(NSString *)pluginPath
{
NSString * listFile = [pluginPath stringByAppendingPathComponent:@"info.plist"];
NSString * pluginName = [pluginPath lastPathComponent];
NSMutableDictionary * pluginInfo = [NSMutableDictionary dictionaryWithContentsOfFile:listFile];

// If the info.plist is missing or corrupted, warn but then just move on and the user
// will have to figure it out.
if (pluginInfo == nil)
NSAssert1(false, @"Missing or corrupt info.plist in %@", pluginPath);
else
{
// We need to save the path to the plugin in the plugin object for later access to other
// resources in the plugin folder.
[pluginInfo setObject:pluginPath forKey:@"Path"];
[allPlugins setObject:pluginInfo forKey:pluginName];
}

[pluginPaths release];
}

/* toolbarItems
Expand Down
2 changes: 2 additions & 0 deletions Vienna.xcodeproj/project.pbxproj
Expand Up @@ -395,6 +395,7 @@
AA1A2A2E0C09D83B005968DC /* skipFolderButtonPressed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = skipFolderButtonPressed.tiff; sourceTree = "<group>"; };
AA1A2A320C09D84E005968DC /* subscribeButtonPressed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = subscribeButtonPressed.tiff; sourceTree = "<group>"; };
AA1A2C2F0C0A1EC1005968DC /* emptyTrashButton.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = emptyTrashButton.tiff; sourceTree = "<group>"; };
AA1A3DC61100FA6E00F89575 /* vienna2plugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vienna2plugin.icns; sourceTree = "<group>"; };
AA20DC9D0882CCC300A226F5 /* unread.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = unread.tiff; sourceTree = "<group>"; };
AA2185010861E7600024DD4A /* TexturedHeader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TexturedHeader.m; sourceTree = "<group>"; };
AA2185020861E7600024DD4A /* TexturedHeader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TexturedHeader.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1115,6 +1116,7 @@
AA67F3980897377C008BBC37 /* stopRefresh.tiff */,
AA34582C084BE802003D992E /* vienna2.icns */,
AA4AB5E008971B28006C843E /* vienna2style.icns */,
AA1A3DC61100FA6E00F89575 /* vienna2plugin.icns */,
AA2185050861E7E10024DD4A /* metal_column_header.png */,
AAB90EFC061D059D00CA4741 /* searchFolder.tiff */,
AAFDB7AE0C0B1516000D1643 /* smartFolder.tiff */,
Expand Down
Binary file modified cs.lproj/Localizable.strings
Binary file not shown.
Binary file modified da.lproj/Localizable.strings
Binary file not shown.
Binary file modified de.lproj/Localizable.strings
Binary file not shown.
Binary file modified en.lproj/Localizable.strings
Binary file not shown.
Binary file modified es.lproj/Localizable.strings
Binary file not shown.
Binary file modified eus.lproj/Localizable.strings
Binary file not shown.
Binary file modified fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified it.lproj/Localizable.strings
Binary file not shown.
Binary file modified ja.lproj/Localizable.strings
Binary file not shown.
Binary file modified ko.lproj/Localizable.strings
Binary file not shown.
Binary file modified nl.lproj/Localizable.strings
Binary file not shown.
Binary file modified pt.lproj/Localizable.strings
Binary file not shown.
Binary file modified pt_BR.lproj/Localizable.strings
Binary file not shown.
10 changes: 5 additions & 5 deletions ru.lproj/Localizable.strings
Expand Up @@ -57,8 +57,6 @@
"Refresh all your subscriptions" = "Обновить все подписки";
"New style title" = "Vienna установила новый Стиль";
"New style body" = "Стиль \"%@\" был установлен в папку стилей и добавлен в меню Стиль.";
"Cannot create style folder title" = "Невозможно создать папку Стиля";
"Cannot create style folder body" = "Невозможно создать папку Стиля в \"%@\". Vienna не сможет установить выбранный Стиль.";
"More Styles..." = "Больше Стилей...";
"Delete selected message" = "Вы уверены, что хотите безвозвратно удалить выбранные статьи?";
"Delete selected message text" = "Это действие не может быть отменено.";
Expand Down Expand Up @@ -188,8 +186,6 @@
"Preferences" = "Настройки";
"General" = "Общие";
"Appearance" = "Внешний Вид";
"Cannot create scripts folder title" = "Невозможно создать папку скриптов";
"Cannot create scripts folder body" = "Невозможно создать папку скриптов в \"%@\". Vienna не установит выбранный скрипт.";
"Locate Title" = "Невозможно создать базу данных Vienna";
"Locate Text" = "Новая база данных Vienna не может быть создана в \"%@\" из-за того, что папка, возможно, находится на удаленном сервере, а текущая версия Vienna не может работать с удаленными базами данных. Пожалуйста, выберите папку на своем компьютере.\n";
"Empty Trash message" = "Удалить все сообщения в Корзине?";
Expand Down Expand Up @@ -397,4 +393,8 @@
"Search all articles or the current web page" = "Search all articles or the current web page";
"Database Upgrade" = "Database Upgrade";
"Vienna must upgrade its database to the latest version. This may take a minute or so. We apologize for the inconveninece." = "Vienna must upgrade its database to the latest version. This may take a minute or so. We apologize for the inconveninece.";
"Upgrade Database" = "Upgrade Database";
"Upgrade Database" = "Upgrade Database";

/* Added in 2.5.0 */
"Cannot create folder title" = "Cannot create folder";
"Cannot create folder body" = "The \"%@\" folder cannot be created.";
Binary file modified sv.lproj/Localizable.strings
Binary file not shown.
Binary file modified tr.lproj/Localizable.strings
Binary file not shown.
Binary file modified uk.lproj/Localizable.strings
Binary file not shown.
Binary file added vienna2plugin.icns
Binary file not shown.
Binary file modified zh_CN.lproj/Localizable.strings
Binary file not shown.
Binary file modified zh_TW.lproj/Localizable.strings
Binary file not shown.

0 comments on commit fc230c7

Please sign in to comment.