Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac-remote and mac-mediakey extension updates #366

Open
wants to merge 7 commits into
base: sb-trunk-oldxul
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions extensions/apple-mediakeys/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ include $(DEPTH)/build/autodefs.mk
IS_EXTENSION = 1
INSTALL_EXTENSION = 1

SUBDIRS = component \
SUBDIRS = chrome \
component \
defaults \
$(NULL)

#JAR_MANIFEST = jar.mn

CREATEDIRS = $(SONGBIRD_COMPONENTSDIR)
CREATEDIRS = $(SONGBIRD_COMPONENTSDIR) \
$(SONGBIRD_PREFERENCESDIR) \
$(NULL)

include $(topsrcdir)/build/rules.mk
36 changes: 36 additions & 0 deletions extensions/apple-mediakeys/chrome/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# BEGIN NIGHTINGALE GPL
#
# This file is part of the Nightingale Media Player.
#
# Copyright(c) 2014
# http://getnightingale.com
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the "GPL").
#
# Software distributed under the License is distributed
# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# END NIGHTINGALE GPL
#

DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/build/autodefs.mk

IS_EXTENSION = 1

JAR_MANIFEST = jar.mn.in

include $(topsrcdir)/build/rules.mk
74 changes: 74 additions & 0 deletions extensions/apple-mediakeys/chrome/content/firstrun.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
//
// BEGIN NIGHTINGALE GPL
//
// This file is part of the Nightingale Media Player.
//
// Copyright(c) 2014
// http://getnightingale.com
//
// This file may be licensed under the terms of of the
// GNU General Public License Version 2 (the "GPL").
//
// Software distributed under the License is distributed
// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
// express or implied. See the GPL for the specific language
// governing rights and limitations.
//
// You should have received a copy of the GPL along with this
// program. If not, go to http://www.gnu.org/licenses/gpl.html
// or write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// END NIGHTINGALE GPL
//
*/

// Make a namespace.
if (typeof AppleMediaKeysFirstRun == 'undefined') {
var AppleMediaKeysFirstRun = {};
}

/**
* UI controller that is loaded into the main player window
*/
AppleMediaKeysFirstRun.Controller = {

/**
* Called when the window finishes loading
*/
onLoad: function() {

// initialization code
this._initialized = true;
this._strings = document.getElementById("apple-mediakeys-strings");

// Perform extra actions the first time the extension is run
if (Application.prefs.get("extensions.apple-mediakeys.firstrun").value) {
Application.prefs.setValue("extensions.apple-mediakeys.firstrun", false);
this._firstRunSetup();
}

},

/**
* Perform extra setup the first time the extension is run
*/
_firstRunSetup : function() {

// Call this.firstrun() after a 3 second timeout
setTimeout(function(controller) { controller.firstrun(); }, 3000, this);

},

firstrun : function() {
var welcomeTitle = this._strings.getString("WelcomeTitle");
var welcomeMsg = this._strings.getString("WelcomeMessage");
var promptService = Cc['@mozilla.org/embedcomp/prompt-service;1']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentiation seems to have gotten messed up here. Generally it's two spaces, irrc.

.getService(Ci.nsIPromptService);
promptService.alert(null, welcomeTitle, welcomeMsg);
},

};

window.addEventListener("load", function(e) { AppleMediaKeysFirstRun.Controller.onLoad(e); }, false);
14 changes: 14 additions & 0 deletions extensions/apple-mediakeys/chrome/content/prefsOverlay.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>

<!DOCTYPE overlay SYSTEM "chrome://apple-mediakeys/locale/options.dtd">

<overlay id="radio-prefs-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<prefWindow id="BrowserPreferences">
<prefpane id="mediakeysPrefPane"
label="&apple-mediakeys-prefs-overlay.label;"
src="chrome://apple-mediakeys/content/prefsPane.xul" />
</prefWindow>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you do this by changing the pref type? Or is this because the extension is hidden by default?


</overlay>
28 changes: 28 additions & 0 deletions extensions/apple-mediakeys/chrome/content/prefsPane.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>

<!DOCTYPE prefwindow SYSTEM "chrome://apple-mediakeys/locale/options.dtd">

<overlay id="radio_preferences_overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<prefwindow id="BrowserPreferences">
<prefpane id="mediakeysPrefPane" label="&apple-mediakeys-prefs-overlay.label;"
onpaneload="onPrefPaneLoad()">

<vbox>
<groupbox>
<caption label="&apple-mediakeys.prefs.disable-itunes.groupcaption;"/>
<description>&apple-mediakeys.prefs.disable-itunes.description;</description>
<label class="text-link" href="http://www.thebitguru.com/projects/iTunesPatch" value="&apple-mediakeys.prefs.disable-itunes.link.label;"/>
</groupbox>
<groupbox>
<caption label="&apple-mediakeys.prefs.bluetooth.groupcaption;"/>
<description>&apple-mediakeys.prefs.bluetooth.description;</description>
<label class="text-link" href="https://github.com/jguice/mac-bt-headset-fix" value="&apple-mediakeys.prefs.bluetooth.link.label;"/>
</groupbox>
</vbox>

</prefpane>
</prefwindow>

</overlay>
10 changes: 10 additions & 0 deletions extensions/apple-mediakeys/chrome/content/scripts-overlay.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<overlay id="apple-mediakeys-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script src="firstrun.js"/>

<stringbundleset id="stringbundleset">
<stringbundle id="apple-mediakeys-strings" src="chrome://apple-mediakeys/locale/overlay.properties"/>
</stringbundleset>

</overlay>
16 changes: 16 additions & 0 deletions extensions/apple-mediakeys/chrome/jar.mn.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# a little about jar.mn.in...
# lines starting with "#" (like this one) are comments

# this says we're creating a new jar file
apple-mediakeys.jar:
# map the things under content/ to chrome://xpcom_helloworld/content/
% content apple-mediakeys %content/ contentaccessible=yes
# map in the locale
% locale apple-mediakeys en-US %locale/en-US/
# map in the skin
% skin apple-mediakeys classic/1.0 %skin/
# apply an overlay to all Songbird main windows
% overlay chrome://songbird/content/xul/layoutWithBrowserOverlay.xul chrome://apple-mediakeys/content/scripts-overlay.xul
# include all the files in this jar
% overlay chrome://browser/content/preferences/preferences.xul chrome://apple-mediakeys/content/prefsOverlay.xul
@include_all_to
9 changes: 9 additions & 0 deletions extensions/apple-mediakeys/chrome/locale/en-US/options.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!ENTITY apple-mediakeys-prefs-overlay.label "Mac Media Keys">

<!ENTITY apple-mediakeys.prefs.disable-itunes.groupcaption "Disable iTunes Launching">
<!ENTITY apple-mediakeys.prefs.disable-itunes.description "In order to disable iTunes from launching when pressing the Play/Pause media key, download and run the patch from the external link below.">
<!ENTITY apple-mediakeys.prefs.disable-itunes.link.label "Play Button iTunes Patch">

<!ENTITY apple-mediakeys.prefs.bluetooth.groupcaption "Enable Bluetooth Control">
<!ENTITY apple-mediakeys.prefs.bluetooth.description "In order to enable media controls on a connected Bluetooth device, download and run the application from the external link below.">
<!ENTITY apple-mediakeys.prefs.bluetooth.link.label "Mac Bluetooth Headset Fix">
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WelcomeTitle=Welcome Mac Users!
WelcomeMessage=You can use your keyboard's media keys to control playback within Nightingale. If you wish to disable launching of iTunes when pressing Play/Pause, or if you want to control playback with a Bluetooth device, navigate to Preferences --> Mac Media Keys for instructions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We'll have to add these strings to babelzilla.

37 changes: 37 additions & 0 deletions extensions/apple-mediakeys/defaults/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# BEGIN NIGHTINGALE GPL
#
# This file is part of the Nightingale Media Player.
#
# Copyright(c) 2014
# http://getnightingale.com
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the "GPL").
#
# Software distributed under the License is distributed
# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# END NIGHTINGALE GPL
#

DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/build/autodefs.mk

IS_EXTENSION = 1

SUBDIRS = preferences \
$(NULL)

include $(topsrcdir)/build/rules.mk
37 changes: 37 additions & 0 deletions extensions/apple-mediakeys/defaults/preferences/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# BEGIN NIGHTINGALE GPL
#
# This file is part of the Nightingale Media Player.
#
# Copyright(c) 2014
# http://getnightingale.com
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the "GPL").
#
# Software distributed under the License is distributed
# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# END NIGHTINGALE GPL
#

DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/build/autodefs.mk

IS_EXTENSION = 1

SONGBIRD_PREFS = $(srcdir)/prefs.js \
$(NULL)

include $(topsrcdir)/build/rules.mk
2 changes: 2 additions & 0 deletions extensions/apple-mediakeys/defaults/preferences/prefs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Used to detect the first time the extension is run
pref("extensions.apple-mediakeys.firstrun", true);
6 changes: 3 additions & 3 deletions extensions/apple-mediakeys/extension-config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EXTENSION_NAME = apple-mediakeys
# extension.
EXTENSION_UUID = $(EXTENSION_NAME)@getnightingale.com

EXTENSION_VER = 1.5.0
EXTENSION_MIN_VER = 1.8.*
EXTENSION_MAX_VER = 1.12.*
EXTENSION_VER = 1.6.0
EXTENSION_MIN_VER = $(SB_MILESTONE)
EXTENSION_MAX_VER = $(SB_MILESTONE)

3 changes: 3 additions & 0 deletions extensions/apple-mediakeys/install.rdf.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<!-- the architecture (operating system and CPU type) of the extension.
it will be filled in by the build system -->
<em:targetPlatform>@EXTENSION_ARCH@</em:targetPlatform>

<em:hidden>true</em:hidden>
<em:appManaged>true</em:appManaged>

</Description>

Expand Down
4 changes: 2 additions & 2 deletions extensions/apple-remote/chrome/content/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ try {
shouldAutoEnable =
gPrefService.getBoolPref("extensions.apple-remote.autoenable");

if (shouldAutoEnable && gRemoteControlService.isSupported) {
if (shouldAutoEnable && !gRemoteControlService.isCandelairRequired) {
gRemoteControlService.startListening();
isListening = true;

Expand All @@ -65,7 +65,7 @@ catch (e) {
// If the current machine doesn't support the apple remote, don't
// enable the menu item.

if (!gRemoteControlService.isSupported) {
if (gRemoteControlService.isCandelairRequired) {
// HACK: Set a timeout to find the menuitem..
setTimeout(
function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ interface sbIAppleRemoteService : nsISupports
{
void startListening();
void stopListening();
readonly attribute boolean isSupported;
readonly attribute boolean isCandelairRequired;
};
Loading