33 lines
806 B
Vala
33 lines
806 B
Vala
namespace Streamdeck.Widgets {
|
|
public class CommandComboBox : Gtk.ComboBoxText {
|
|
private Data.CommandType? _selected;
|
|
|
|
public signal void selected (Data.CommandType type);
|
|
|
|
construct {
|
|
id_column = 1;
|
|
|
|
foreach (Data.CommandDescription cmd in Data.Command.available ()) {
|
|
append (cmd.id, cmd.name);
|
|
}
|
|
|
|
changed.connect ((_obj) => {
|
|
var id = get_active_id ();
|
|
var type = Data.Command.type_string (id);
|
|
|
|
if (type != null) {
|
|
selected (type);
|
|
}
|
|
|
|
_selected = type;
|
|
});
|
|
|
|
show_all ();
|
|
}
|
|
|
|
public Data.CommandType? get_selected_type () {
|
|
return _selected;
|
|
}
|
|
}
|
|
}
|