summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Slimber/Cocoa')
-rw-r--r--Slimber/Cocoa/Makefile.inc4
-rw-r--r--Slimber/Cocoa/Menulet.m16
2 files changed, 15 insertions, 5 deletions
diff --git a/Slimber/Cocoa/Makefile.inc b/Slimber/Cocoa/Makefile.inc
index be03429..6658dea 100644
--- a/Slimber/Cocoa/Makefile.inc
+++ b/Slimber/Cocoa/Makefile.inc
@@ -11,7 +11,9 @@ SLIMBER_COCOA_XIBS = \
Slimber/Cocoa/MainMenu.xib
SLIMBER_COCOA_RESOURCES = \
Slimber/Resources/Online.png \
- Slimber/Resources/Offline.png
+ Slimber/Resources/Offline.png \
+ Slimber/Resources/UsersOnline.png \
+ Slimber/Resources/UsersOffline.png
SLIMBER_COCOA_NIBS = \
$(SLIMBER_COCOA_XIBS:.xib=.nib)
diff --git a/Slimber/Cocoa/Menulet.m b/Slimber/Cocoa/Menulet.m
index 9eda07c..b2af97f 100644
--- a/Slimber/Cocoa/Menulet.m
+++ b/Slimber/Cocoa/Menulet.m
@@ -30,20 +30,21 @@
NSBundle* bundle = [NSBundle bundleForClass: [self class]];
NSString* path;
if (online) {
- path = [bundle pathForResource: @"Online" ofType:@"png"];
+ path = [bundle pathForResource: @"UsersOnline" ofType:@"png"];
}
else {
- path = [bundle pathForResource: @"Offline" ofType:@"png"];
+ path = [bundle pathForResource: @"UsersOffline" ofType:@"png"];
}
- menuIcon = [[NSImage alloc] initWithContentsOfFile: path];
- [statusItem setImage: menuIcon];
+ [statusItem setImage: [[NSImage alloc] initWithContentsOfFile: path]];
}
- (void) updateMenu {
+ // Clear the menu
while ([statusMenu numberOfItems] > 0) {
[statusMenu removeItemAtIndex: 0];
}
+ // User items
if ([userNames count] > 0) {
[statusMenu addItem: [[NSMenuItem alloc] initWithTitle: @"Online users:" action: NULL keyEquivalent: @""]];
int i;
@@ -58,16 +59,23 @@
[self updateIcon: [userNames count] > 0];
[statusMenu addItem: [NSMenuItem separatorItem]];
+ // Self item
NSMenuItem* loggedInItem;
+ NSBundle* bundle = [NSBundle bundleForClass: [self class]];
+ NSString* path;
if (selfOnline) {
loggedInItem = [[NSMenuItem alloc] initWithTitle: @"You are logged in" action: NULL keyEquivalent: @""];
+ path = [bundle pathForResource: @"Online" ofType:@"png"];
}
else {
loggedInItem = [[NSMenuItem alloc] initWithTitle: @"You are not logged in" action: NULL keyEquivalent: @""];
+ path = [bundle pathForResource: @"Offline" ofType:@"png"];
}
+ [loggedInItem setImage: [[NSImage alloc] initWithContentsOfFile: path]];
[statusMenu addItem: loggedInItem];
[statusMenu addItem: [NSMenuItem separatorItem]];
+ // Exit item
NSMenuItem* exitMenuItem = [[NSMenuItem alloc] initWithTitle: @"Exit" action: @selector(terminate:) keyEquivalent: @""];
[exitMenuItem setTarget: [NSApplication sharedApplication]];
[statusMenu addItem: exitMenuItem];