~bratsche/indicator-sound/icon-placement

« back to all changes in this revision

Viewing changes to src/player-controller.vala

  • Committer: Conor Curran
  • Date: 2010-07-15 12:27:06 UTC
  • mfrom: (101.1.6 indicator-sound)
  • Revision ID: conor.curran@canonical.com-20100715122706-qv9q1o05fulp87zg
merged scrub bar work

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
public class PlayerController : GLib.Object
25
25
{
26
 
        public const int METADATA = 2;  
27
 
        private const int TRANSPORT = 3;
 
26
        public const int WIDGET_QUANTITY = 5;
 
27
 
 
28
        public static enum widget_order{
 
29
                SEPARATOR,
 
30
                TITLE,
 
31
                METADATA,
 
32
                SCRUB,
 
33
                TRANSPORT
 
34
        }
28
35
 
29
36
        public enum state{
30
37
                OFFLINE,
51
58
                this.custom_items = new ArrayList<PlayerItem>();
52
59
                this.update_state(initial_state);
53
60
                this.menu_offset = offset;
54
 
                debug("offset = %i", offset);
55
61
                construct_widgets();
56
62
                establish_mpris_connection();
57
63
                update_layout();
66
72
        public void activate()
67
73
        {
68
74
                this.establish_mpris_connection();      
69
 
                this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true);             
 
75
                this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true);                
70
76
        }
71
77
 
72
78
        /*
126
132
                        visibility = false;
127
133
                }
128
134
                debug("about the set the visibility on both the transport and metadata widget to %s", visibility.to_string());
129
 
                this.custom_items[TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
130
 
                this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
 
135
                this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
 
136
                this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
 
137
                this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);          
131
138
                // DEBUG
132
139
                if(this.mpris_adaptor == null){
133
140
                        warning("Why is the mpris object null");
134
141
                }
135
142
        }
136
 
        
137
 
        
 
143
                
138
144
        private void construct_widgets()
139
145
        {
140
146
                // Separator item
147
153
                // Metadata item
148
154
                MetadataMenuitem metadata_item = new MetadataMenuitem();
149
155
                this.custom_items.add(metadata_item);
150
 
                
 
156
 
 
157
                // Scrub item
 
158
                ScrubMenuitem scrub_item = new ScrubMenuitem(this);
 
159
                this.custom_items.add(scrub_item);
 
160
 
151
161
                // Transport item
152
162
                TransportMenuitem transport_item = new TransportMenuitem(this);
153
163
                this.custom_items.add(transport_item);
154
164
 
 
165
                
155
166
                foreach(PlayerItem item in this.custom_items){
156
167
                        root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item));                        
157
168
                }