~cszikszoy/do-plugins/fix-confluence

« back to all changes in this revision

Viewing changes to DiskMounter/OpenVolumeAction.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
// OpenVolumeAction.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, write to the Free Software
 
15
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
16
//
 
17
//
 
18
 
 
19
using System;
 
20
using System.Diagnostics;
 
21
using System.Collections.Generic;
 
22
 
 
23
using Gnome.Vfs;
 
24
 
 
25
using Mount;
 
26
using Do.Universe;
 
27
using Do.Addins;
 
28
 
 
29
namespace Mount
 
30
{
 
31
        public class OpenVolume : AbstractAction
 
32
        {
 
33
        
 
34
                public OpenVolume ()
 
35
                {
 
36
                }
 
37
                
 
38
                public override string Name {
 
39
                        get { return "Open"; }
 
40
                }
 
41
                
 
42
                public override string Description {
 
43
                        get { return "Open"; }
 
44
                }
 
45
                
 
46
                public override string Icon {
 
47
                        get { return "gtk-open"; }
 
48
                }
 
49
                
 
50
                public override Type[] SupportedItemTypes {
 
51
                        get {
 
52
                                return new Type[] {
 
53
                                
 
54
                                        typeof (MountedDriveItem),
 
55
                                };
 
56
                        }
 
57
                }
 
58
                
 
59
                public override bool SupportsItem (IItem item) 
 
60
                {
 
61
                        return true;
 
62
                }
 
63
                
 
64
                public override bool SupportsModifierItemForItems (IItem[] items, IItem modItem)
 
65
                {
 
66
                        return false;
 
67
                }
 
68
                
 
69
                public override IItem[] Perform (IItem[] items, IItem[] modItems)
 
70
                {
 
71
                        try {
 
72
                                Util.Environment.Open((items[0] as MountedDriveItem).Path);
 
73
                        } catch (Exception e) {
 
74
                                Console.WriteLine("Error opening {0} - {1}", (items[0] as MountedDriveItem).Path, e.Message);
 
75
                        }
 
76
                        return null;
 
77
                }
 
78
        }
 
79
}