using System; using Gtk; using Glade; namespace AmicEditor { public class NewThemeDialog : Dialog { [Widget] Gtk.Dialog NewTheme; [Widget] Gtk.Entry ThemeName; [Widget] Gtk.TextView Desc; [Widget] Gtk.Button BtCancel; [Widget] Gtk.Button BtOk; Themes MyThemes; public NewThemeDialog (Themes llistaTemes) /////////////// { Application.Init (); MyThemes=llistaTemes; // Còpia de la llista de temes //Glade.XML gxml = new Glade.XML(null, AmicEditor.dir_rsrc +"/NewCathegoryDialog.glade", "NewCathegory", null); Glade.XML gxml = new Glade.XML(null, "NewThemeDialog.glade", "NewTheme", null); gxml.Autoconnect (this); BtCancel.Clicked += HandleBtCancelClicked; BtOk.Clicked += HandleBtOkClicked; } void HandleBtOkClicked (object sender, EventArgs e) { // Validació if(ThemeName.Text==""){ MessageDialog md = new MessageDialog (NewTheme, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, Mono.Unix.Catalog.GetString("The Theme should have any name. Please, write it before saving.")); //ResponseType result = (ResponseType)md.Run(); md.Run(); md.Destroy(); }else{ if(MyThemes.Exists(ThemeName.Text)){ MessageDialog md = new MessageDialog (NewTheme, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, Mono.Unix.Catalog.GetString("The Theme name already exists. Please, select another name.")); //ResponseType result = (ResponseType)md.Run(); md.Run(); md.Destroy(); }else{ AmicEditor.CreateNewTheme=true; AmicEditor.CreatedThemeName=ThemeName.Text; AmicEditor.CreatedThemeDesc=Desc.Buffer.Text; //Console.WriteLine(Desc.Buffer.Text); /*AmicEditor.CreateNewCat=true; AmicEditor.CreatedCathegoryColor=CatColor.Color; AmicEditor.CreatedCathegoryName=CatName.Text; AmicEditor.CreatedCathegoryFont=CatFont.FontName; AmicEditor.CreatedCathegoryFontColor=CatFontColor.Color;*/ Application.Quit(); NewTheme.Destroy(); } } } void HandleBtCancelClicked (object sender, EventArgs e) { /// AmicEditor.CreateNewCat=false; //AmicEditor.CreatedCathegoryColor=null; //AmicEditor.CreatedCathegoryName=null; Application.Quit(); NewTheme.Destroy(); } public new void Show(){ NewTheme.ShowAll(); Application.Run(); } } }