Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to bind a TextView to the key "text" by TextBuffer. I get the text, but this property is not recorded.

widget = self.builder.get_object('textbuffer_text')
settings.bind("text", widget, "text", Gio.SettingsBindFlags.DEFAULT)

I would be grateful for any hints or help

share|improve this question
add comment

1 Answer

I set it manually, but it is annoying.

widget = self.builder.get_object('textbuffer_text')
#~ self.settings.bind("text", widget, "text", Gio.SettingsBindFlags.DEFAULT)
text = self.settings.get_string("text")
widget.set_text(text, len(text))

...

def on_textbuffer_text_changed (self, widget):
    b,e = widget.get_bounds()
    self.settings.set_string("text", widget.get_text(b,e,False).decode('utf-8'))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.