elementary / elementary/granite

Introduce a wrapper widget of Gtk.DropDown with easier integration with GSettings

Open
#952 0 comments 1 reaction 0 assignees View on GitHub
Priority: Wishlist
Dominant language
Vala
Stars
329
Forks
65
Avg merge
1d 14h
Merged PRs (30d)
31

Description

### Problem

Gtk.DropDown is a replacement for Gtk.ComboBox and Gtk.ComboBoxText, but you need complicated work to bind its selection with a GSettings keys.

### Proposal

Introduce a wrapper widget of Gtk.DropDown with easier integration with GSettings, something like this:

```vala
var settings = new Settings ("io.github.yourname.yourapp");

var dropdown = new Granite.DropDown ();
dropdown.append ("option-1", _("Option 1"));
dropdown.append ("option-2", _("Option 2"));
dropdown.append ("option-3", _("Option 3"));

dropdown.bind_selected (settings, "keyname", SettingsBindFlags.DEFAULT);
```

### Prior Art (Optional)

I've done similar things before: https://github.com/ryonakano/ryokucha/blob/main/lib/DropDownText.vala

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.