~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/AddExternalFileDialog.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// AddExternalFileDialog.cs
 
3
//  
 
4
// Author:
 
5
//       Lluis Sanchez Gual <lluis@novell.com>
 
6
// 
 
7
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
using System;
 
27
using MonoDevelop.Core;
 
28
 
 
29
namespace MonoDevelop.Ide.Projects
 
30
{
 
31
        internal partial class AddExternalFileDialog : Gtk.Dialog
 
32
        {
 
33
                public AddExternalFileDialog (string file)
 
34
                {
 
35
                        HasSeparator = true;
 
36
                        this.Build ();
 
37
                        radioCopy.Active = true;
 
38
                        labelTitle.Markup = GettextCatalog.GetString (labelTitle.Text, "<b>" + GLib.Markup.EscapeText (file) + "</b>");
 
39
                        Resizable = false;
 
40
                }
 
41
                
 
42
                public void ShowKeepOption (string dir)
 
43
                {
 
44
                        radioKeep.Show();
 
45
                        string here = "." + System.IO.Path.DirectorySeparatorChar;
 
46
                        if (!dir.StartsWith (here))
 
47
                                dir = here + dir;
 
48
                        labelKeep.Markup = GettextCatalog.GetString (labelKeep.LabelProp, dir);
 
49
                        radioKeep.Active = true;
 
50
                }
 
51
                
 
52
                public bool ShowApplyAll {
 
53
                        get { return checkApplyAll.Visible; }
 
54
                        set { checkApplyAll.Visible = value; }
 
55
                }
 
56
                
 
57
                public AddAction SelectedAction {
 
58
                        get {
 
59
                                if (radioCopy.Active)
 
60
                                        return AddAction.Copy;
 
61
                                else if (radioMove.Active)
 
62
                                        return AddAction.Move;
 
63
                                else if (radioLink.Active)
 
64
                                        return AddAction.Link;
 
65
                                else
 
66
                                        return AddAction.Keep;
 
67
                        }
 
68
                        set {
 
69
                                switch (value) {
 
70
                                case AddAction.Copy: radioCopy.Active = true; break;
 
71
                                case AddAction.Move: radioMove.Active = true; break;
 
72
                                case AddAction.Link: radioLink.Active = true; break;
 
73
                                case AddAction.Keep: radioKeep.Active = true; break;
 
74
                                }
 
75
                        }
 
76
                }
 
77
                
 
78
                public bool ApplyToAll {
 
79
                        get { return checkApplyAll.Active; }
 
80
                        set { checkApplyAll.Active = value; }
 
81
                }
 
82
        }
 
83
        
 
84
        enum AddAction
 
85
        {
 
86
                Copy,
 
87
                Move,
 
88
                Link,
 
89
                Keep
 
90
        }
 
91
}
 
92