From 0a98409be5eedb9ee27a9fd1b526e99c764f55f5 Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Thu, 24 Jan 2013 15:35:50 +0000 Subject: 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 Acked-by: Simon Schampijer --- 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() -- cgit v0.9.1