~trh/+junk/irrawaddy

« back to all changes in this revision

Viewing changes to src/DownloadService.vala

  • Committer: Thura
  • Date: 2010-10-06 12:28:19 UTC
  • Revision ID: trhura@gmail.com-20101006122819-d6xd2elsle9ua51d
update prototype

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
                    last_uid = 0;
40
40
                    load_state ();
41
41
                }
42
 
 
 
42
                
43
43
        ~DownloadService () {
44
44
            save_state ();
45
45
        }
62
62
                                if (download.url == url)
63
63
                                        return download;
64
64
                        }
65
 
 
 
65
                        
66
66
                        string message = "No download with url %s found.".printf (url);
67
67
                        throw new DownloadError.NO_SUCH_DOWNLOAD (message);
68
68
                }
69
69
                
70
70
                public Downloadable add_download (string url,
71
 
                                                                                  string local_path,
72
 
                                                                                  FinishAction action=Services.settings.get_int ("default-finish-action"),
 
71
                                                                                  string local_path, 
73
72
                                                                                  Backend backend_enum=0) //FIXME 
74
73
                        throws Error
75
74
                {
76
75
                        DownloadBackend backend = get_download_backend (backend_enum);
77
 
                        Downloadable download  = backend.new_download (url, local_path, last_uid);
78
 
                        download.finish_action = action;
 
76
                        Downloadable download  = backend.new_download (url, local_path, last_uid); 
79
77
 
80
78
                    download.start (false);
81
79
                        download.status_changed.connect ((status) => { save_state (); });
99
97
                        remove_download (download);             
100
98
                        gfile.delete ();     
101
99
            }
102
 
                    
 
100
                
103
101
                private DownloadBackend get_download_backend (Backend backend) {
104
102
                        if (backend == Backend.GIO_BACKEND)
105
103
                                return _gio_backend;