commit 26ea4cbefc957ebac8744e84023646397af3fc77
Author: Szelenyi Tamas <tamas@szelenyi.hu>
Date:   Sun Jun 10 00:15:12 2012 +0200

    removing the hardcoded limit of shortcuts

diff --git a/shortcut.admin.inc b/shortcut.admin.inc
index 9f1888a..58f7477 100644
--- a/shortcut.admin.inc
+++ b/shortcut.admin.inc
@@ -9,6 +9,9 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 
 /**
  * Returns the maximum number of shortcut "slots" available per shortcut set.
+ * If this is 0 (the default), then no maximum will be enforced. Other
+ * modules may choose to enforce a limit by setting the 'shortcut_max_slots'
+ * variable to a non-zero value.
  *
  * This is used as a limitation in the user interface only.
  *
@@ -16,7 +19,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  *   The maximum number of shortcuts allowed to be added to a shortcut set.
  */
 function shortcut_max_slots() {
-  return variable_get('shortcut_max_slots', 7);
+  return variable_get('shortcut_max_slots', 0);
 }
 
 /**
@@ -376,7 +379,16 @@ function theme_shortcut_set_customize($variables) {
     }
 
     if ($status == 'enabled') {
-      for ($i = 0; $i < shortcut_max_slots(); $i++) {
+			$count_shortcuts = count(element_children($form['shortcuts'][$status]));
+			$number_of_slots = shortcut_max_slots();
+			if (empty($number_of_slots)) {
+				// If there is no hard limit on the number of shortcut slots per set,
+				// we display 7 slots by default (but make sure to expand the number if
+				// necessary so that there are always at least a couple empty slots
+				// available).
+				$number_of_slots = max($count_shortcuts + 2, 7);
+			}
+			for ($i = 0; $i < $number_of_slots; $i++) {
         $rows['empty-' . $i] = array(
           'data' => array(array(
             'colspan' => 5,
@@ -385,9 +397,8 @@ function theme_shortcut_set_customize($variables) {
           'class' => array('shortcut-slot-empty'),
         );
       }
-      $count_shortcuts = count($shortcuts_by_status[$status]);
       if (!empty($count_shortcuts)) {
-        for ($i = 0; $i < min($count_shortcuts, shortcut_max_slots()); $i++) {
+      	for ($i = 0; $i < min($count_shortcuts, $number_of_slots); $i++) {
           $rows['empty-' . $i]['class'][] = 'shortcut-slot-hidden';
         }
       }
@@ -556,11 +567,11 @@ function shortcut_link_add_submit($form, &$form_state) {
  * @param $limit
  *   (optional) The maximum number of links that are allowed to be enabled for
  *   this shortcut set. If provided, existing links at the end of the list that
- *   exceed the limit will be automatically disabled. If not provided, no limit
- *   will be enforced.
+ *   exceed the limit will be automatically disabled. If left at the default
+ *   value of 0, no limit will be enforced.
  */
-function shortcut_admin_add_link($shortcut_link, &$shortcut_set, $limit = NULL) {
-  if (isset($limit)) {
+function shortcut_admin_add_link($shortcut_link, &$shortcut_set, $limit = 0) {
+	if ($limit) {
     // Disable any existing links at the end of the list that would cause the
     // limit to be exceeded. Take into account whether or not the new link will
     // be enabled and count towards the total.
