~jezra/shnerkel/stable

« back to all changes in this revision

Viewing changes to src/main.vala

  • Committer: jezra
  • Date: 2011-06-11 21:06:33 UTC
  • mfrom: (5.1.4 shnerkel)
  • Revision ID: jezra@jezra.net-20110611210633-qh6y0xx7v5x9a0ob
progress bar

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    {
27
27
                app_name = name;
28
28
                app_version = version;
29
 
        //set the ogg_feed_url
30
 
        //TODO: read this from a config file
31
 
        feed_url = "http://feeds.feedburner.com/linuxoutlaws-ogg";
 
29
                //set the ogg_feed_url
 
30
                //TODO: read this from a config file
 
31
                feed_url = "http://feeds.feedburner.com/linuxoutlaws-ogg";
32
32
                current_playing_file="";
33
33
    }
34
34
    
37
37
    {
38
38
        //create our application window
39
39
        window = new appWindow ();
 
40
                //what is the icon path?
 
41
                string icon_path = Config.PKGDATADIR+"/icons/shnerkel.png";
 
42
                window.set_icon_from_file(icon_path);
40
43
        //attach signal actions
41
44
        window.update_button_clicked.connect( update_xml );
42
45
        window.play_button_clicked.connect( play_clicked );
51
54
                        } );
52
55
                window.set_volume( START_VOLUME);
53
56
                //create the audioplayer
54
 
                player = new UriPlayer(app_name,app_version);
 
57
                player = new UriPlayer();
 
58
                //connect the player progress_duration
 
59
                player.position_duration.connect( 
 
60
                        (p,d)=> {
 
61
                                float f = (float)p/d;
 
62
                                window.set_progress(f);
 
63
                        });
55
64
                //set the audio players volume
56
65
                player.set_volume( START_VOLUME );
57
66
                
95
104
    //run the controller
96
105
    private void run()
97
106
    {
98
 
                //read the xml if it exists
99
 
                if(!read_xml() ) {
100
 
                        //update the xml
101
 
                        update_xml();
 
107
                        //read the xml if it exists
 
108
                        if(!read_xml() ) {
 
109
                                //update the xml
 
110
                                update_xml();
 
111
                        }
 
112
                        //update the progress bar every 2 seconds?
 
113
                        GLib.Timeout.add(2000, get_duration_info );
 
114
                        //start the gtk main loop
 
115
                        Gtk.main ();
 
116
    }
 
117
    private bool get_duration_info() {
 
118
                        player.get_duration_info();
 
119
                        return true;
102
120
                }
103
 
        //start the gtk main loop
104
 
        Gtk.main ();
105
 
    }
 
121
    
106
122
    private void clear_all_episodes()
107
123
    {
108
 
        //remove all of the data from the treeview
109
 
                window.clear_all_episodes();
 
124
                        //remove all of the data from the treeview
 
125
                        window.clear_all_episodes();
110
126
    }
111
127
        
112
128
        private bool download_feed(){