summaryrefslogtreecommitdiff
path: root/audio/Songbird/no.gconf.patch
blob: 215f1730a784ead88dec03cb8f597562acda5859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 app/content/scripts/appInit.js |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git app/content/scripts/appInit.js app/content/scripts/appInit.js
index 516c815..c982363 100644
--- app/content/scripts/appInit.js
+++ app/content/scripts/appInit.js
@@ -155,26 +155,30 @@ function SBAppInitialize()
     // On Windows and Linux, register the songbird:// protocol.
     // (Mac is in the info.plist)
     var platform = Components.classes["@mozilla.org/system-info;1"]
                              .getService(Components.interfaces.nsIPropertyBag2) 
                              .getProperty("name");
     if (platform == "Windows_NT") {
       SBRegisterWindowsSongbirdProtocol();
     }
-    else if (platform == "Linux") {
+    else {
       SBRegisterGConfSongbirdProtocol();
     }
   }
   catch( err ) {
     alert( "SBAppInitialize:SBRegisterSongbirdProtocol()\n" + err );
   }
 }
 
 function SBRegisterWindowsSongbirdProtocol() {
+  if (!("@mozilla.org/windows-registry-key;1" in Components.classes)) {
+    // no windows registry key, probably not Windows
+    return;
+  }
   var path = Components.classes["@mozilla.org/file/directory_service;1"]
                        .getService(Components.interfaces.nsIProperties)
                        .get("CurProcD", Components.interfaces.nsIFile);
   var file = path.clone();
   // It'd be nice if there were a way to look this up. 
   // (mook suggests) ::GetModuleFileNameW(). 
   // http://mxr.mozilla.org/seamonkey/source/browser/components/shell/src/nsWindowsShellService.cpp#264
   file.append("songbird.exe");
@@ -199,24 +203,28 @@ function SBRegisterWindowsSongbirdProtocol() {
   wrk.create(wrk.ROOT_KEY_CURRENT_USER,
              "Software\\Classes\\songbird\\shell\\open\\command",
              wrk.ACCESS_WRITE);
   wrk.writeStringValue("", '"' + file.path + '" "%1"');
   wrk.close();
 }
 
 function SBRegisterGConfSongbirdProtocol() {
+  if (!("@mozilla.org/gnome-gconf-service;1" in Components.classes)) {
+    // gnome-gconf-service doesn't exist
+    return;
+  }
   var path = Components.classes["@mozilla.org/file/directory_service;1"]
                        .getService(Components.interfaces.nsIProperties)
                        .get("CurProcD", Components.interfaces.nsIFile);
   var file = path.clone();
   file.append("songbird");
 
   var gconf = Components.classes["@mozilla.org/gnome-gconf-service;1"]
-                                       .getService(Components.interfaces.nsIGConfService);
+                        .getService(Components.interfaces.nsIGConfService);
   gconf.setString("/desktop/gnome/url-handlers/songbird/command", '"' + file.path + '" "%s"');
   gconf.setBool("/desktop/gnome/url-handlers/songbird/enabled", true);
   gconf.setBool("/desktop/gnome/url-handlers/songbird/needs_terminal", false);
 }
 
 //
 // Called on window-unload of songbird.xul.
 //
-- 
1.5.5.1015.g9d258