/// <summary> /// Initializes a new instance of class. /// </summary> /// <param name="plugin">Plugin.</param> /// <param name="list">List of plugins.</param> public EditSnippetWindow(Snippets plugin, ListStore list) : base(WindowType.Toplevel) { this.Build(); this.list = list; this.plugin = plugin; try { this.Icon = IconTheme.Default.LoadIcon("glippy", 128, IconLookupFlags.GenericFallback); } catch (Exception ex) { Core.Tools.PrintInfo(ex, this.GetType()); } this.Destroyed += (s, e) => this.Purge(); }
/// <summary> /// Initializes a new instance of class. /// </summary> /// <param name="plugin">Plugin.</param> /// <param name="list">List of snippets.</param> public SnippetsPreferencesPage(Snippets plugin, ListStore list) { this.Build(); this.plugin = plugin; this.list = list; this.enable.Active = Core.Settings.Instance[SettingsKeys.Enable].AsBoolean(); this.pasteOnSnippetSelection.Active = Core.Settings.Instance[SettingsKeys.PasteOnSelection].AsBoolean(); TreeViewColumn column = new TreeViewColumn(); column.Title = Catalog.GetString("Label"); CellRendererText cell = new CellRendererText(); column.PackStart(cell, true); column.SetCellDataFunc(cell, delegate(TreeViewColumn col, CellRenderer c, TreeModel m, TreeIter i) { Snippet s = (Snippet)m.GetValue(i, 0); ((CellRendererText)c).Text = s.Label; }); this.snippets.AppendColumn(column); column = new TreeViewColumn(); column.Title = Catalog.GetString("Content"); cell = new CellRendererText(); column.PackStart(cell, true); column.SetCellDataFunc(cell, delegate(TreeViewColumn col, CellRenderer c, TreeModel m, TreeIter i) { Snippet s = (Snippet)m.GetValue(i, 0); ((CellRendererText)c).Text = s.Content; }); this.snippets.AppendColumn(column); this.snippets.Model = list; this.snippets.ShowAll(); this.SetSnippetsSensitivity(); this.handleEvents = true; }
/// <summary> /// Initializes a new instance of class. /// </summary> /// <param name="plugin">Plugin.</param> /// <param name="list">List of snippets.</param> public SnippetsPreferencesPage(Snippets plugin, ListStore list) { this.Build(); this.plugin = plugin; this.list = list; this.enable.Active = Core.Settings.Instance[SettingsKeys.Enable].AsBoolean(); this.pasteOnSnippetSelection.Active = Core.Settings.Instance[SettingsKeys.PasteOnSelection].AsBoolean(); TreeViewColumn column = new TreeViewColumn(); column.Title = Catalog.GetString("Label"); CellRendererText cell = new CellRendererText(); column.PackStart(cell, true); column.SetCellDataFunc(cell, delegate (TreeViewColumn col, CellRenderer c, TreeModel m, TreeIter i) { Snippet s = (Snippet)m.GetValue(i, 0); ((CellRendererText)c).Text = s.Label; }); this.snippets.AppendColumn(column); column = new TreeViewColumn(); column.Title = Catalog.GetString("Content"); cell = new CellRendererText(); column.PackStart(cell, true); column.SetCellDataFunc(cell, delegate (TreeViewColumn col, CellRenderer c, TreeModel m, TreeIter i) { Snippet s = (Snippet)m.GetValue(i, 0); ((CellRendererText)c).Text = s.Content; }); this.snippets.AppendColumn(column); this.snippets.Model = list; this.snippets.ShowAll(); this.SetSnippetsSensitivity(); this.handleEvents = true; }
/// <summary> /// Initializes a new instance of the <see cref="Glippy.Snippets.EditSnippetWindow"/> class. /// </summary> /// <param name="plugin">Plugin.</param> /// <param name="list">List of plugins.</param> /// <param name="snippet">Snippet to edit.</param> /// <param name="path">Snippets treeview path.</param> /// <param name="iter">Snippets treeview iterator.</param> public EditSnippetWindow(Snippets plugin, ListStore list, Snippet snippet, TreePath path, TreeIter iter) : this(plugin, list) { this.snippet = snippet; this.iter = iter; this.path = path; this.label.Text = snippet.Label; this.content.Buffer.Text = snippet.Content; this.Title = Catalog.GetString("Edit snippet"); }
/// <summary> /// Initializes a new instance of class. /// </summary> /// <param name="plugin">Plugin.</param> /// <param name="list">List of plugins.</param> /// <param name="newSnippetText">Text of new snippet.</param> public EditSnippetWindow(Snippets plugin, ListStore list, string newSnippetText) : this(plugin, list) { this.content.Buffer.Text = newSnippetText; }