now you can add notes
This commit is contained in:
parent
02e81b12b0
commit
6ffc144936
3 changed files with 88 additions and 47 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ out/
|
|||
yahoo.html
|
||||
.vs/
|
||||
/buypeeb.sln
|
||||
\#*.glade#
|
||||
|
|
|
@ -336,6 +336,12 @@ namespace Buypeeb {
|
|||
l.Text = row.Value;
|
||||
}
|
||||
|
||||
var noteBuffer = (TextBuffer)this.builder.GetObject("TextBufferSelectedNotes");
|
||||
noteBuffer.Clear();
|
||||
if (!String.IsNullOrWhiteSpace(item.notes)) {
|
||||
noteBuffer.Text = item.notes;
|
||||
}
|
||||
|
||||
var f = (ToggleButton)this.builder.GetObject("ButtonSelectedFavourite");
|
||||
f.Active = item.favourite;
|
||||
|
||||
|
@ -651,6 +657,26 @@ namespace Buypeeb {
|
|||
}
|
||||
}
|
||||
|
||||
private void ButtonSelectedNotesClearClicked(object sender, EventArgs args) {
|
||||
var item = this.selectedItem;
|
||||
var md = this.MsgBox($"Are you sure you want to clear the notes for \"{item.name}\"?");
|
||||
if (md.Run() == (int)ResponseType.Ok) {
|
||||
var noteBuffer = (TextBuffer)this.builder.GetObject("TextBufferSelectedNotes");
|
||||
noteBuffer.Clear();
|
||||
this.selectedItem.notes = null;
|
||||
}
|
||||
md.Dispose();
|
||||
}
|
||||
|
||||
private void TextViewSelectedNotesFocusOut(object sender, FocusOutEventArgs args) {
|
||||
// the "save" button does nothing, however, when you click the save button, you transfer focus to it, firing this event!
|
||||
// how very sneaky
|
||||
var noteBuffer = (TextBuffer)this.builder.GetObject("TextBufferSelectedNotes");
|
||||
if (this.selectedItem != null) {
|
||||
this.selectedItem.notes = String.IsNullOrWhiteSpace(noteBuffer.Text) ? null : noteBuffer.Text;
|
||||
}
|
||||
}
|
||||
|
||||
// timers
|
||||
|
||||
private bool UpdateSelectionEndTime() {
|
||||
|
|
108
ui/main.glade
108
ui/main.glade
|
@ -232,48 +232,6 @@
|
|||
<property name="homogeneous">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Undo</property>
|
||||
<property name="label" translatable="yes">Undo</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-undo</property>
|
||||
<accelerator key="z" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Redo</property>
|
||||
<property name="label" translatable="yes">Redo</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-redo</property>
|
||||
<accelerator key="z" signal="clicked" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="ButtonClearEnded">
|
||||
<property name="visible">True</property>
|
||||
|
@ -979,16 +937,72 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<child>
|
||||
<object class="GtkTextView">
|
||||
<property name="height_request">100</property>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="wrap_mode">word</property>
|
||||
<property name="buffer">TextBufferSelectedNotes</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">3</property>
|
||||
<property name="margin_end">3</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkTextView">
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="wrap_mode">word</property>
|
||||
<property name="buffer">TextBufferSelectedNotes</property>
|
||||
<signal name="focus-out-event" handler="TextViewSelectedNotesFocusOut" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Clear</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="ButtonSelectedNotesClearClicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
|
|
Loading…
Reference in a new issue