[meld] ui.statusbar: Bind button label to active highlighting language
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] ui.statusbar: Bind button label to active highlighting language
- Date: Sat, 25 Nov 2017 22:06:07 +0000 (UTC)
commit e0f6cb916ba121e3c6ff13826a63581b67af11d9
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Feb 7 09:49:45 2015 +1000
ui.statusbar: Bind button label to active highlighting language
meld/ui/statusbar.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/meld/ui/statusbar.py b/meld/ui/statusbar.py
index a538895..6ed7f89 100644
--- a/meld/ui/statusbar.py
+++ b/meld/ui/statusbar.py
@@ -80,8 +80,15 @@ class MeldStatusBar(Gtk.Statusbar):
pop.set_position(Gtk.PositionType.TOP)
pop.add(selector)
+ def get_language_label(binding, language, *args):
+ if not language:
+ return _("Plain Text")
+ return language.get_name()
+
button = Gtk.MenuButton()
- button.set_label("Foo")
+ self.bind_property(
+ 'source-language', button, 'label', GObject.BindingFlags.DEFAULT,
+ get_language_label)
button.set_popover(pop)
button.show()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]