Ignore:
Timestamp:
Jan 18, 2019 4:29:12 PM (23 months ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
a367778
Parents:
5212591
Message:

Mac OSX Launcher: UI code updates, integration of firefox manager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/I2PLauncher/userinterface/preferences/PreferencesViewController.swift

    r5212591 r605f987  
    1111
    1212import Cocoa
     13import ServiceManagement
    1314
    1415
     
    6566    self.updateRadioButtonEffect(mode: Preferences.shared().showAsIconMode, withSideEffect: false)
    6667   
     68    if (Preferences.shared().stopRouterOnLauncherShutdown) {
     69      self.checkboxStopWithLauncher?.state = NSOnState;
     70    } else {
     71      self.checkboxStopWithLauncher?.state = NSOffState;
     72    }
     73    if (Preferences.shared().startRouterOnLauncherStart) {
     74      self.checkboxStartWithLauncher?.state = NSOnState;
     75    } else {
     76      self.checkboxStartWithLauncher?.state = NSOffState;
     77    }
     78   
     79   
    6780  }
    6881 
     
    111124 
    112125  @IBAction func checkboxStartLauncherOnOSXStartupClicked(_ sender: NSButton) {
    113     switch sender.state {
    114     case NSOnState:
    115       print("on")
    116     case NSOffState:
    117       print("off")
     126    let launcherAppId = "net.i2p.bootstrap.macosx.StartupItemApp"
     127    switch sender.state {
     128    case NSOnState:
     129      print("on")
     130      Preferences.shared()["I2Pref_startLauncherAtLogin"] = true
     131      let success = SMLoginItemSetEnabled(launcherAppId as CFString, true)
     132      print("SMLoginItemSetEnabled returned \(success)....")
     133    case NSOffState:
     134      print("off")
     135      Preferences.shared()["I2Pref_startLauncherAtLogin"] = false
     136      let success = SMLoginItemSetEnabled(launcherAppId as CFString, false)
     137      print("SMLoginItemSetEnabled returned \(success)....")
    118138    case NSMixedState:
    119139      print("mixed")
Note: See TracChangeset for help on using the changeset viewer.