[meld] ui.statusbar: Add a new view settings popover to the status bar (#62)



commit 8c7d5e0c5391d5e5fedbb33595f4d1f89afec4b6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Jan 4 11:46:39 2019 +1000

    ui.statusbar: Add a new view settings popover to the status bar (#62)
    
    This exposes several view options that were previously preference-only
    in the status bar.

 meld/resources/ui/statusbar-menu.ui | 17 +++++++++++++++++
 meld/ui/statusbar.py                | 18 ++++++++++++++++++
 2 files changed, 35 insertions(+)
---
diff --git a/meld/resources/ui/statusbar-menu.ui b/meld/resources/ui/statusbar-menu.ui
new file mode 100644
index 00000000..8f16c77a
--- /dev/null
+++ b/meld/resources/ui/statusbar-menu.ui
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <menu id="statusbar-menu">
+    <item>
+      <attribute name="label">Display line numbers</attribute>
+      <attribute name="action">show-line-numbers</attribute>
+    </item>
+    <item>
+      <attribute name="label">Highlight current line</attribute>
+      <attribute name="action">highlight-current-line-local</attribute>
+    </item>
+    <item>
+      <attribute name="label">Text wrapping</attribute>
+      <attribute name="action">wrap-mode-bool</attribute>
+    </item>
+  </menu>
+</interface>
diff --git a/meld/ui/statusbar.py b/meld/ui/statusbar.py
index f640efc8..f8d0790b 100644
--- a/meld/ui/statusbar.py
+++ b/meld/ui/statusbar.py
@@ -146,6 +146,8 @@ class MeldStatusBar(Gtk.Statusbar):
             self.construct_highlighting_selector(), False, True, 0)
         self.box_box.pack_end(
             self.construct_encoding_selector(), False, True, 0)
+        self.box_box.pack_end(
+            self.construct_display_popover(), False, True, 0)
         self.box_box.show_all()
 
     def construct_line_display(self):
@@ -264,3 +266,19 @@ class MeldStatusBar(Gtk.Statusbar):
         button.show()
 
         return button
+
+    def construct_display_popover(self):
+        builder = Gtk.Builder.new_from_resource(
+            '/org/gnome/meld/ui/statusbar-menu.ui')
+        menu = builder.get_object('statusbar-menu')
+
+        pop = Gtk.Popover()
+        pop.bind_model(menu, 'view')
+        pop.set_position(Gtk.PositionType.TOP)
+
+        button = MeldStatusMenuButton()
+        button.set_label(_('Display'))
+        button.set_popover(pop)
+        button.show()
+
+        return button


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]