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:39:15 (GMT) |
commit | 0a98409be5eedb9ee27a9fd1b526e99c764f55f5 (patch) | |
tree | 5503f801b3914cc6f087b833f8ca4828fa9aee64 | |
parent | 158f4384d1f3423a6c2063723434f4f331796f81 (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() |