couple new, more updated
[webos-internals:modifications.git] / top-bar / top-bar-ringer-switch-icon.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/app-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/app-assistant.js
2 index a4f244c..f9b1657 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/app-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/app-assistant.js
5 @@ -129,6 +129,9 @@ AppAssistant.prototype.handleLaunch = function(params) {
6         else if(params.action === 'launchTutorialDashboard') {
7                 Mojo.Controller.stageController.delegateToSceneAssistant('reScheduleTutorialActivity', params);
8         }
9 +       else if(params.action === 'updateRingerIcon') {
10 +               Mojo.Controller.stageController.delegateToSceneAssistant("checkRingerStatus");
11 +       }
12  }
13  
14  AppAssistant.prototype.requestPermission = function(params) {
15 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
16 index 6d0a87a..51d111a 100644
17 --- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
18 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
19 @@ -95,6 +95,9 @@ var BarAssistant = Foundations.Class.create({
20                 //Initialize and Subscribe for Storage / Media Mode Notification.                       
21                 this.storageInit();
22                 
23 +               //Subscribe for Ringer Switch Status
24 +               this.ringerStatus();
25 +
26                 //Initialize and Subscribe for Power Off Notification.
27                 this.powerOffInit();
28                 
29 @@ -3376,6 +3379,30 @@ showAudioAlert: function(volume,showringer,audioTarget) {
30                 }       
31  },
32  
33 +ringerStatus: function() {
34 +       this.controller.serviceRequest('palm://com.palm.keys/switches', {
35 +               method:'status',
36 +               parameters: {"subscribe":true},
37 +               onSuccess: function(payload) {
38 +                       this.controller.serviceRequest('palm://com.palm.audio/media', {
39 +                               method:'status',
40 +                               onSuccess: function(response) {
41 +                                       this.displayMutedIcon(!response['ringer switch']);
42 +                               }.bind(this)
43 +                       });
44 +               }.bind(this)
45 +       });
46 +},
47 +
48 +displayMutedIcon: function(mute) {
49 +       if(mute) {
50 +               $('ringer').className = 'off';
51 +       }
52 +       else {
53 +               $('ringer').className = 'on';   
54 +       }
55 +},
56 +
57  dataImportInit: function() {
58         //Subscribe to Data Srevice status Notifications.
59         this.dataImportNotificationSession = new Mojo.Service.Request('palm://com.palm.dataimport/', {
60 diff --git a/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html b/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
61 index d728ec9..4c0952f 100644
62 --- a/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
63 +++ b/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
64 @@ -14,6 +14,7 @@
65  
66         <div id="devicemenu">
67                 <div id="power"></div>
68 +               <div id="ringer"></div>
69                 <div id="rssi"></div>
70                 <div id="ev1x">
71                         <div id="rssi-ev"></div>
72 diff --git a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
73 index f3cacab..ec1842e 100644
74 --- a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
75 +++ b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
76 @@ -129,6 +129,7 @@ body.palm-default {
77  #tty,
78  #hac,
79  #callforward,
80 +#ringer,
81  #gps,
82  #ev1x {
83         float: right;
84 @@ -173,6 +174,17 @@ body.palm-default {
85  #power.battery-charging-11 { background-image: url(../images/battery-charging-11.png); }
86  #power.battery-charged { background-image: url(../images/battery-charged.png); }
87  
88 +#ringer {
89 +       width: 20px;
90 +       margin-left: 2px;
91 +}
92 +#ringer.off {
93 +       background: url(../../../../../palm/applications/com.palm.app.soundsandalerts/images/prefs-mute.png) center left no-repeat;
94 +}
95 +#ringer.on {
96 +       display: none;
97 +}
98 +
99  #rssi {
100         width: 19px;
101  }