Skip to content

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

@ryonakano

Description

@ryonakano

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: WishlistNot a bug; but a new feature or enhancement

    Projects

    Status

    Confirmed

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions