diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2013-01-24 15:35:50 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2013-02-20 14:42:48 (GMT) |
commit | c48dcb87493d21528f26013432e0d952fd303686 (patch) | |
tree | 1495684107cb4e23cb078db0a49db894eaf59c12 | |
parent | c1cba44320b84f2e92576d67d6c9122e7b62e335 (diff) |
Hide the Remove button if there is only one language - SL #4352
This behaviour was removed along with other code in a removal commit
4ae3bf07 .
Signed-off-by: Manuel QuiƱones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | extensions/cpsection/language/view.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py index 77f7207..99275d4 100644 --- a/extensions/cpsection/language/view.py +++ b/extensions/cpsection/language/view.py @@ -136,6 +136,12 @@ class Language(SectionView): previous_add_removes = self._add_remove_boxes[-2] previous_add_removes.hide() + # Hide the Remove button if the new added row is the only + # language. + elif self._selected_lang_count == 1: + add_button_, remove_button = add_remove_box.get_children() + remove_button.props.visible = False + combobox.show() def _attach_to_table(self, widget, row, column, padding=20, \ @@ -160,6 +166,15 @@ class Language(SectionView): self._add_remove_boxes[-1].show_all() + # Hide or show the Remove button in the new last row, + # depending if it is the only language. + add_remove_box = self._add_remove_boxes[-1] + add_button_, remove_button = add_remove_box.get_children() + if self._selected_lang_count == 1: + remove_button.props.visible = False + else: + remove_button.props.visible = True + def _get_last_row(self): label = self._labels.pop() add_remove_box = self._add_remove_boxes.pop() |