Commit 8c7d5e0c authored by Kai Willadsen's avatar Kai Willadsen

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.
parent 33039124
<?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>
Please register or sign in to reply
<attribute name="action">wrap-mode-bool</attribute>
</item>
</menu>
</interface>
......@@ -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'))
  • Please disambiguate this string from the identical string in meld/resources/ui/preferences.ui with context.

    https://wiki.gnome.org/TranslationProject/DevGuidelines/Translation%20contexts

  • Also in 744de362 I've added a translation comment like the other ones we have i.e., just a normal Python comment above the line. Do you happen to know whether there's a better way to add context comments for Python applications?

  • E.g. accerciser has a few strings with context (look for msgctxt in https://l10n.gnome.org/POT/accerciser.master/accerciser.master.pot) and I’m sure there are other examples, but reading the comment you’ve added, I no longer think it’s absolutely necessary, at least for my language.

  • Yeah, looks like accerciser are doing the same thing we are with adding a code comment. Thanks!

  • No, comments and context are two different things. You can add context to separate two or more identical strings (https://developer.gnome.org/glib/2.54/glib-I18N.html#C-:CAPS).

    Edited by Piotr Drąg
Please register or sign in to reply
button.set_popover(pop)
button.show()
return button
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment