3
using System.Collections;
8
namespace Stetic.Editor
10
public class EditIconFactoryDialog: IDisposable
12
[Glade.Widget] Gtk.ScrolledWindow iconListScrolledwindow;
13
[Glade.Widget ("EditIconFactoryDialog")] Gtk.Dialog dialog;
15
ProjectIconList customIconList;
18
Stetic.IProject project;
19
ProjectIconFactory iconFactory;
21
public EditIconFactoryDialog (Gtk.Window parent, Stetic.IProject project, ProjectIconFactory iconFactory)
23
this.iconFactory = iconFactory;
25
this.project = project;
27
Glade.XML xml = new Glade.XML (null, "stetic.glade", "EditIconFactoryDialog", null);
28
xml.Autoconnect (this);
30
customIconList = new ProjectIconList (project, iconFactory);
31
iconListScrolledwindow.AddWithViewport (customIconList);
37
dialog.TransientFor = parent;
41
public void Dispose ()
46
protected void OnAddIcon (object ob, EventArgs args)
48
ProjectIconSet icon = new ProjectIconSet ();
49
using (EditIconDialog dlg = new EditIconDialog (project, icon)) {
50
if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
51
iconFactory.Icons.Add (icon);
52
customIconList.Refresh ();
53
customIconList.Selection = icon.Name;
54
project.Modified = true;
59
protected void OnRemoveIcon (object ob, EventArgs args)
61
string name = customIconList.Selection;
62
ProjectIconSet icon = iconFactory.GetIcon (name);
64
Gtk.MessageDialog md = new Gtk.MessageDialog (dialog, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, string.Format (Catalog.GetString ("Are you sure you want to delete the icon '{0}'"), icon.Name));
65
if (md.Run () == (int) Gtk.ResponseType.Yes) {
66
iconFactory.Icons.Remove (icon);
67
customIconList.Refresh ();
68
project.Modified = true;
74
protected void OnEditIcon (object ob, EventArgs args)
76
string name = customIconList.Selection;
77
ProjectIconSet icon = iconFactory.GetIcon (name);
79
using (EditIconDialog dlg = new EditIconDialog (project, icon)) {
80
if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
81
customIconList.Refresh ();
82
customIconList.Selection = icon.Name;
83
project.Modified = true;