~ubuntu-branches/ubuntu/jaunty/gnome-do-plugins/jaunty-proposed

« back to all changes in this revision

Viewing changes to Text/src/AppendTextAction.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers, Christopher James Halse Rogers, Iain Lane
  • Date: 2009-02-05 16:58:51 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090205165851-bku2c9rmrny93b31
Tags: 0.8.0.2+dfsg-1~ubuntu1
[ Christopher James Halse Rogers ]
* New upstream version
* debian/control:
  + gnome-sharp2 transition (LP: #314516)
  + Add banshee build-dep
  + Drop monodevelop build-dep; upstream uses mautil rather than mdtool now
  + Bump required gnome-do version in Build-Dep & Depends.
  + Suggest Banshee
* debian/copyright:
  + Refresh for new upstream version; new plugins added.
* debian/rules:
  + Rework clean target to simply delete files generated by autoreconf,
    rather than trying to preserve them.
  + Remove XDG_CONFIG_DIR hack needed for mdtool
* debian/patches/01_firefox_iceweasel_rename:
  + Refresh for new upsteam changes.
  + Extend to also make the Firefox bookmark plugin index iceweasel bookmarks

[ Iain Lane ]
* Tag pkg-cli-apps SVN revision into Jaunty, to get in before Feature
  Freeze. Should be a sync after the next Debian upload.
* debian/control: Add ${misc:Depends} build-dep 
* debian/rules: Do not fail if configure is missing (e.g. clean twice in a
  row) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
using System;
22
22
using System.IO;
 
23
using System.Collections.Generic;
 
24
using System.Linq;
 
25
 
 
26
using Mono.Unix;
23
27
 
24
28
using Do.Universe;
25
 
using Mono.Unix;
 
29
using Do.Universe.Common;
26
30
 
27
31
namespace Text {        
28
 
        public class AppendTextAction : IAction {
29
 
 
30
 
                public string Name { get { return Catalog.GetString ("Append to..."); } }
31
 
                public string Description { get { return Catalog.GetString ("Appends text to a selected file."); } }
32
 
                public string Icon { get { return "text-editor"; } }
33
 
 
34
 
                public Type[] SupportedItemTypes {
35
 
                        get {
36
 
                                return new Type[] { typeof (ITextItem) };
37
 
                        }
38
 
                }
39
 
                
40
 
                public Type[] SupportedModifierItemTypes {
41
 
                        get {
42
 
                                return new Type[] { typeof (FileItem), typeof(ITextItem) };
43
 
                        }
44
 
                }
45
 
                
46
 
                public bool ModifierItemsOptional {
47
 
                        get { return false; }
48
 
                }
49
 
                
50
 
 
51
 
                public bool SupportsItem (IItem item)
52
 
                {
53
 
                        return true;
54
 
                }
55
 
                
56
 
                public bool SupportsModifierItemForItems (IItem[] items, IItem modItem)
57
 
                {
58
 
                        if (modItem is FileItem) {
59
 
                                string mime = (modItem as FileItem).MimeType;
 
32
        public class AppendTextAction : Act {
 
33
 
 
34
                public override string Name { get { return Catalog.GetString ("Append to..."); } }
 
35
                public override string Description { get { return Catalog.GetString ("Appends text to a selected file."); } }
 
36
                public override string Icon { get { return "text-editor"; } }
 
37
 
 
38
                public override IEnumerable<Type> SupportedItemTypes {
 
39
                        get {
 
40
                                yield return typeof (ITextItem);
 
41
                        }
 
42
                }
 
43
                
 
44
                public override IEnumerable<Type> SupportedModifierItemTypes {
 
45
                        get {
 
46
                                //yield return typeof (IFileItem);
 
47
                                yield return typeof (ITextItem);
 
48
                        }
 
49
                }
 
50
                
 
51
                public override bool SupportsModifierItemForItems (IEnumerable<Item> items, Item modItem)
 
52
                {
 
53
                        /*
 
54
                        if (modItem is IFileItem) {
 
55
                                string mime = (modItem as IFileItem).MimeType;
60
56
                                return mime == "x-directory/normal" || mime.StartsWith ("text/");
61
57
                        }
 
58
                        */
62
59
                        return modItem is ITextItem;
63
60
                }
64
 
                
65
 
                public IItem[] DynamicModifierItemsForItem (IItem item)
66
 
                {
67
 
                        return null;
68
 
                }
69
61
 
70
 
                public IItem[] Perform (IItem[] items, IItem[] modItems)
 
62
                public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
71
63
                {
72
 
                        if (modItems [0] is FileItem) {
73
 
                                string text = (items [0] as ITextItem).Text;
74
 
                                string mime = (modItems [0] as FileItem).MimeType;
75
 
                                string file = (modItems [0] as FileItem).Path;
 
64
                        /*
 
65
                        if (modItems.First () is IFileItem) {
 
66
                                string text = (items.First () as ITextItem).Text;
 
67
                                string mime = (modItems.First () as IFileItem).MimeType;
 
68
                                string file = (modItems.First () as IFileItem).Path;
76
69
                                
77
70
                                if (mime == "x-directory/normal") return null;
78
71
                                
81
74
                                        w.Close ();
82
75
                                }
83
76
 
84
 
                                return null;
85
 
                        }
86
 
                        else {
87
 
                                string text = (items [0] as ITextItem).Text;
88
 
                                string text2 = (modItems [0] as ITextItem).Text;
89
 
                                return new IItem[] { new TextItem (text + text2) };
90
 
                        }
 
77
                                yield break;
 
78
                        } else {
 
79
                        */
 
80
                                string text = (items.First () as ITextItem).Text;
 
81
                                string text2 = (modItems.First () as ITextItem).Text;
 
82
                                yield return new TextItem (text + text2);
 
83
                        //}
91
84
                }
92
85
        }
93
86
}