Skip to content

Instantly share code, notes, and snippets.

@datenimperator
Created October 13, 2009 10:28
Show Gist options
  • Save datenimperator/209138 to your computer and use it in GitHub Desktop.
Save datenimperator/209138 to your computer and use it in GitHub Desktop.
#
# SipFaxPref.m
# SipFax
#
# Created by Christian on 12.10.09.
# Copyright (c) 2009 Christian Aust. All rights reserved.
#
require 'osx/cocoa'
require 'client'
require 'logging'
OSX.require_framework 'PreferencePanes'
OSX.load_bridge_support_file File.expand_path('../Security.bridgesupport', __FILE__)
class PrefPaneSipFax < OSX::NSPreferencePane
include Logging
ib_outlet :authorizationView
kvc_accessor :sipclient, :authorized, :running
def init
if super_init
@sipclient = SipClient.alloc.init
self
end
end
def mainViewDidLoad
log("Into mainViewDidLoad", self.sipclient.username)
@authorized = false
@running = false
@authorizationView.string = OSX::KAuthorizationRightExecute
@authorizationView.delegate = self
@authorizationView.updateStatus self
@authorizationView.autoupdate = true
log("SipFax PreferencePane loaded")
end
def btnTestAccount(sender=nil)
log("#{@username} #{@password}")
end
ib_action :btnTestAccount
def rbSetValue_forKey(value, key)
super
log("PrefPane #{key}: #{value}")
end
def authorizationViewDidAuthorize(authorizationView = nil)
OSX::SecurityHelper.sharedInstance.authorizationRef = @authorizationView.authorization.authorizationRef
self.authorized = true
end
def authorizationViewDidDeauthorize(authorizationView = nil)
OSX::SecurityHelper.sharedInstance.deauthorize
self.authorized = false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment