Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Garg <ajay@activitycentral.com>2012-08-15 15:24:41 (GMT)
committer Ajay Garg <ajay@activitycentral.com>2012-08-15 15:24:41 (GMT)
commit8c88f8ddf23d00481f710b834487669e244bdba4 (patch)
tree0cdb58cbc604fb754b90ea89672f3320ecb4f1f0
parentd38a77e91712d9cf275a529e447d0c87835b731a (diff)
Multi-Select REVIEW: Speed Optimisation for "Deselect All":
now, the deselect-all is instantaneous. Thanks Gary Martin :)
-rw-r--r--rpms/sugar/0124-Multi-Select-REVIEW-Speed-Optimisation-for-Deselect-.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/rpms/sugar/0124-Multi-Select-REVIEW-Speed-Optimisation-for-Deselect-.patch b/rpms/sugar/0124-Multi-Select-REVIEW-Speed-Optimisation-for-Deselect-.patch
new file mode 100644
index 0000000..8d3f407
--- /dev/null
+++ b/rpms/sugar/0124-Multi-Select-REVIEW-Speed-Optimisation-for-Deselect-.patch
@@ -0,0 +1,97 @@
+From 9876c182b5d0706b1ddfad243def4426d2f166c9 Mon Sep 17 00:00:00 2001
+From: Ajay Garg <ajay@activitycentral.com>
+Date: Wed, 15 Aug 2012 20:48:06 +0530
+Subject: [sugar PATCH] Multi-Select REVIEW: Speed Optimisation for "Deselect All":
+ now, the deselect-all is instantaneous.
+Organization: Sugar Labs Foundation
+Signed-off-by: Ajay Garg <ajay@activitycentral.com>
+---
+
+Thanks Gary Martin :)
+
+ src/jarabe/journal/journaltoolbox.py | 42 +++++++--------------------------
+ src/jarabe/journal/palettes.py | 9 +++++-
+ 2 files changed, 16 insertions(+), 35 deletions(-)
+
+diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
+index b8db6c5..b471b45 100644
+--- a/src/jarabe/journal/journaltoolbox.py
++++ b/src/jarabe/journal/journaltoolbox.py
+@@ -565,45 +565,21 @@ class EditToolbar(gtk.Toolbar):
+ return self._multi_select_info_widget.get_current_entry_number()
+
+
+-class SelectNoneButton(ToolButton, palettes.ActionItem):
++class SelectNoneButton(ToolButton):
+ def __init__(self):
+ ToolButton.__init__(self, 'select-none')
+- palettes.ActionItem.__init__(self, '', [],
+- show_editing_alert=False,
+- show_progress_info_alert=False,
+- batch_mode=True,
+- auto_deselect_source_entries=True,
+- need_to_popup_options=False,
+- operate_on_deselected_entries=False,
+- switch_to_normal_mode_after_completion=True,
+- show_post_selected_confirmation=False,
+- show_not_completed_ops_info=False)
+ self.props.tooltip = _('Deselect all')
+
+- def _get_actionable_signal(self):
+- return 'clicked'
+-
+- def _get_editing_alert_operation(self):
+- return _('Deselect all')
+-
+- def _get_info_alert_title(self):
+- return _('Deselecting')
+-
+- def _get_post_selection_alert_message_entries_len(self):
+- return self._metadata_list_initial_len
++ self.connect('clicked', self.__do_deselect_all)
+
+- def _get_post_selection_alert_message(self, entries_len):
+- return ngettext('You have deselected %d entry.',
+- 'You have deselected %d entries.',
+- entries_len) % (entries_len,)
+-
+- def _operate(self, metadata):
+- # Nothing specific needs to be done.
+- # The checkboxes are unchecked as part of the toggling of any
+- # operation that operates on selected entries.
++ def __do_deselect_all(self, widget_clicked):
++ from jarabe.journal.journalactivity import get_journal
++ journal = get_journal()
+
+- # This is sync-operation. Thus, call the callback.
+- self._post_operate_per_metadata_per_action(metadata)
++ journal.get_list_view()._selected_entries = 0
++ journal.switch_to_editing_mode(False)
++ journal.get_list_view().inhibit_refresh(False)
++ journal.get_list_view().refresh()
+
+
+ class SelectAllButton(ToolButton, palettes.ActionItem):
+diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py
+index 73bc07b..4046be5 100644
+--- a/src/jarabe/journal/palettes.py
++++ b/src/jarabe/journal/palettes.py
+@@ -440,8 +440,13 @@ class ActionItem(gobject.GObject):
+ # Also, get the initial length of the model.
+ self._model_len = self._get_list_model_len()
+
+- # For batch-operations, fetch the metadata list again.
+- self._metadata_list = self._get_metadata_list()
++ # Speed Optimisation:
++ # ===================
++ # If the metadata-list is empty, fetch it;
++ # else we have already fetched it, when we showed the
++ # "editing-alert".
++ if len(self._metadata_list) == 0:
++ self._metadata_list = self._get_metadata_list()
+
+ # Set the initial length of metadata-list.
+ self._metadata_list_initial_len = len(self._metadata_list)
+--
+1.7.4.4
+