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

« back to all changes in this revision

Viewing changes to src/addins/SourceEditor2/MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//  EditTemplateGroupDialog.cs
2
 
//
3
 
//  This file was derived from a file from #Develop. 
4
 
//
5
 
//  Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
6
 
// 
7
 
//  This program is free software; you can redistribute it and/or modify
8
 
//  it under the terms of the GNU General Public License as published by
9
 
//  the Free Software Foundation; either version 2 of the License, or
10
 
//  (at your option) any later version.
11
 
// 
12
 
//  This program is distributed in the hope that it will be useful,
13
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 
//  GNU General Public License for more details.
16
 
//  
17
 
//  You should have received a copy of the GNU General Public License
18
 
//  along with this program; if not, write to the Free Software
19
 
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
 
 
21
 
using System;
22
 
using System.IO;
23
 
 
24
 
using MonoDevelop.Ide.CodeTemplates;
25
 
using MonoDevelop.Core;
26
 
 
27
 
namespace MonoDevelop.SourceEditor.Gui.Dialogs
28
 
{
29
 
        public class EditTemplateGroupDialog : Gtk.Dialog 
30
 
        {
31
 
                CodeTemplateGroup codeTemplateGroup;
32
 
                string titlePrefix = string.Empty;
33
 
                
34
 
                // Gtk members
35
 
                Gtk.Entry templateExtensionsTextBox;            
36
 
                
37
 
                public CodeTemplateGroup CodeTemplateGroup {
38
 
                        get {
39
 
                                return codeTemplateGroup;
40
 
                        }
41
 
                }
42
 
                
43
 
                public EditTemplateGroupDialog(CodeTemplateGroup codeTemplateGroup, string titlePrefix)
44
 
                {
45
 
                        this.codeTemplateGroup = codeTemplateGroup;
46
 
                        this.titlePrefix = titlePrefix;
47
 
                        InitializeComponents();
48
 
                        this.ShowAll();
49
 
                }
50
 
                
51
 
                void AcceptEvent(object sender, EventArgs e)
52
 
                {
53
 
                        codeTemplateGroup.ExtensionStrings = templateExtensionsTextBox.Text.Split(';');
54
 
                        
55
 
                        // close the window
56
 
                        CancelEvent(sender, EventArgs.Empty);
57
 
                }
58
 
                
59
 
                void CancelEvent(object sender, EventArgs e)
60
 
                {
61
 
                        this.Destroy();
62
 
                }
63
 
                
64
 
                void InitializeComponents()
65
 
                {
66
 
                        // set up this actual dialog
67
 
                        this.Modal = true;
68
 
                        // FIXME: make this a resource in the resource file
69
 
                        this.Title = String.Format (GettextCatalog.GetString ("{0} Code Group"), titlePrefix);
70
 
                        
71
 
                        // set up the dialog fields and add them
72
 
                        templateExtensionsTextBox = new Gtk.Entry();
73
 
                        templateExtensionsTextBox.ActivatesDefault = true;
74
 
                        // FIXME: make this a resource in the resource file
75
 
                        Gtk.Label label1 = new Gtk.Label("Extensions (; seperated)");
76
 
                        
77
 
                        label1.Xalign = 0;                      
78
 
                        templateExtensionsTextBox.Text    = string.Join(";", codeTemplateGroup.ExtensionStrings);
79
 
                        
80
 
                        // FIXME: make the labels both part of the same sizing group so they have the same left and right rows.
81
 
                        Gtk.HBox hBox1 = new Gtk.HBox(false, 6);
82
 
                        hBox1.PackStart(label1, false, false, 6);
83
 
                        hBox1.PackStart(templateExtensionsTextBox, false, false, 6);
84
 
                        
85
 
                        this.VBox.PackStart(hBox1, false, false, 6);
86
 
                        
87
 
                        // set up the buttons and add them
88
 
                        this.DefaultResponse = Gtk.ResponseType.Ok;
89
 
                        Gtk.Button cancelButton = new Gtk.Button(Gtk.Stock.Cancel);
90
 
                        Gtk.Button okButton = new Gtk.Button(Gtk.Stock.Ok);
91
 
                        okButton.Clicked += new EventHandler(AcceptEvent);
92
 
                        cancelButton.Clicked += new EventHandler(CancelEvent);
93
 
                        this.AddActionWidget (cancelButton, Gtk.ResponseType.Cancel);
94
 
                        this.AddActionWidget (okButton, (int) Gtk.ResponseType.Ok);
95
 
                }
96
 
        }
97
 
}