~do-plugins/do-plugins/trunk

« back to all changes in this revision

Viewing changes to DiskMounter/UnmountedDriveItem.cs

  • Committer: Guillaume Beland
  • Date: 2008-04-08 14:58:27 UTC
  • Revision ID: guillaume@inspiron-20080408145827-2eccz89bbu0335sg
Added DiksMounter plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// UnmountedDriveItem.cs
 
2
//
 
3
// This program is free software; you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation; either version 3 of the License, or
 
6
// (at your option) any later version.
 
7
//
 
8
// This program is distributed in the hope that it will be useful,
 
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
11
// GNU General Public License for more details.
 
12
// 
 
13
// You should have received a copy of the GNU General Public License
 
14
// along with this program; if not, see <http://www.gnu.org/licenses/> or 
 
15
// write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
 
16
// Boston, MA 02111-1307 USA
 
17
//
 
18
 
 
19
using System;
 
20
using Do.Universe;
 
21
 
 
22
using Gnome.Vfs;
 
23
 
 
24
namespace Mount
 
25
{
 
26
        public class UnmountedDriveItem : IItem
 
27
        {
 
28
 
 
29
                private Drive drive;
 
30
                
 
31
                public UnmountedDriveItem (Drive drive){
 
32
                        if (!drive.IsMounted)
 
33
                                this.drive = drive;
 
34
                }
 
35
 
 
36
                public void Mount ()
 
37
                {
 
38
                        try {
 
39
                                drive.Mount (VolumeOpCallback);
 
40
                        } catch
 
41
                        {  // error message will be handled by VolumeOpCallback    
 
42
                        }
 
43
                         
 
44
                }
 
45
               
 
46
                public void VolumeOpCallback (bool succeeded, string error, string detailed_error)
 
47
                {
 
48
                        if ( succeeded )
 
49
                                Console.WriteLine("Mount operation succeeded");
 
50
                        else
 
51
                                Console.Error.WriteLine("Mount operation failed {0}, detail : {1}" , error, detailed_error );
 
52
                }
 
53
                                                
 
54
                public string Name {
 
55
                        get { return drive.DisplayName; }               
 
56
                }
 
57
                
 
58
                public string Description {
 
59
                        get { return String.Format("{0}",drive.DeviceType); }
 
60
                }
 
61
                
 
62
                public string Icon {
 
63
                        get { return drive.Icon; }
 
64
                }
 
65
        }
 
66
}
 
 
b'\\ No newline at end of file'