Skip to content

Commit

Permalink
Allow 100% categories
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Dec 24, 2023
1 parent b9ff766 commit 95353ab
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/add-category-dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@ public class AddCategoryDialog : Adw.MessageDialog {

this.add_response ("cancel", _("Cancel"));
this.add_response ("add", _("Add"));
this.set_response_appearance ("add", Adw.ResponseAppearance.SUGGESTED);
this.set_response_appearance ("add", Adw.ResponseAppearance.SUGGESTED);

this.set_response_enabled ("add", false);
this.set_close_response ("cancel");
this.set_close_response ("cancel");

var lb = new Gtk.ListBox () { css_classes = { "boxed-list" } };
name_entry = new Adw.EntryRow () {
input_hints = Gtk.InputHints.SPELLCHECK,
title = _("Category Name")
};
lb.append (name_entry);
var lb = new Gtk.ListBox () { css_classes = { "boxed-list" } };
name_entry = new Adw.EntryRow () {
input_hints = Gtk.InputHints.SPELLCHECK,
title = _("Category Name")
};
lb.append (name_entry);

percentage = new Gtk.Adjustment (0, 0, 100, 1, 10, 1);
var percent = new Adw.SpinRow (percentage, 1, 2) {
title = _("Category Percent")
};
lb.append (percent);
percentage = new Gtk.Adjustment (0, 0, 100, 1, 10, 0);
var percent = new Adw.SpinRow (percentage, 1, 2) {
title = _("Category Percent")
};
lb.append (percent);

this.set_extra_child (lb);
this.set_extra_child (lb);

name_entry.changed.connect (() => {
this.set_response_enabled ("add", true);
});
name_entry.changed.connect (() => set_response_enabled ("add", name_entry.text.strip () != ""));

this.present ();
present ();
}
}

0 comments on commit 95353ab

Please sign in to comment.