Index: modules/shortcut/shortcut.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.admin.inc,v
retrieving revision 1.4
diff -u -p -r1.4 shortcut.admin.inc
--- modules/shortcut/shortcut.admin.inc	3 Jan 2010 21:01:04 -0000	1.4
+++ modules/shortcut/shortcut.admin.inc	13 Jan 2010 18:10:31 -0000
@@ -43,18 +43,12 @@ function shortcut_set_switch($form, &$fo
   // Prepare the list of shortcut sets.
   $sets = shortcut_sets();
   $current_set = shortcut_current_displayed_set($account);
-  $default_set = shortcut_default_set($account);
+
   $options = array();
   foreach ($sets as $name => $set) {
     $options[$name] = check_plain($set->title);
   }
 
-  // Only administrators can add shortcut sets.
-  $add_access = user_access('administer shortcuts');
-  if ($add_access) {
-    $options['new'] = t('New set');
-  }
-
   $form['account'] = array(
     '#type' => 'value',
     '#value' => $account,
@@ -67,12 +61,6 @@ function shortcut_set_switch($form, &$fo
     '#default_value' => $current_set->set_name,
   );
 
-  $form['new'] = array(
-    '#type' => 'textfield',
-    '#description' => t('The new set is created by copying items from the @default set.', array('@default' => $default_set->title)),
-    '#access' => $add_access,
-  );
-
   $form['#attached'] = array(
     'css' => array(drupal_get_path('module', 'shortcut') . '/shortcut.admin.css'),
     'js' => array(drupal_get_path('module', 'shortcut') . '/shortcut.admin.js'),
@@ -80,11 +68,12 @@ function shortcut_set_switch($form, &$fo
 
   $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions')));
   $form['actions']['submit'] = array(
-    '#type' => 'submit', 
-    '#value' => t('Save configuration'),
+    '#type' => 'submit',
+    '#value' => t('Change set'),
   );
 
   return $form;
+
 }
 
 /**
@@ -94,7 +83,92 @@ function shortcut_set_switch_submit($for
   global $user;
   $account = $form_state['values']['account'];
 
-  if ($form_state['values']['set'] == 'new') {
+  // Switch to a different shortcut set.
+  $set = shortcut_set_load($form_state['values']['set']);
+  $replacements = array(
+    '%user' => $account->name,
+    '%set_name' => $set->title,
+  );
+  drupal_set_message($account->uid == $user->uid ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
+
+  // Assign the shortcut set to the provided user account.
+  shortcut_set_assign_user($set, $account);
+}
+
+
+/**
+ * Menu callback; Build the table for administering shortcut sets.
+ *
+ * @see theme_shortcut_set_admin()
+ */
+function shortcut_set_admin() {
+  $shortcut_sets = shortcut_sets();
+  $rows = array();
+  foreach ($shortcut_sets as $set) {
+    $rows[] = array(
+      l($set->title, "admin/config/system/shortcut/$set->set_name"),
+      l('edit', "admin/config/system/shortcut/$set->set_name"),
+      //Add a delete link if it's not the default set
+      $set->set_name != shortcut_default_set()->set_name ? l('delete', "admin/config/system/shortcut/$set->set_name/delete") : NULL,
+    );
+  }
+  return theme('shortcut_set_admin', $rows);
+}
+
+/**
+ * Theme function for the shortcut set admin form.
+ *
+ * @param $rows
+ *   An associative array containing a row for each Shortcut set with
+ *   - Shortcut title
+ *   - Edit link
+ *   - Delete link, if available
+ *   
+ * @return
+ *   A themed HTML string representing the content of the form.
+ *
+ * @ingroup themeable
+ * @see shortcut_set_admin()
+ */
+function theme_shortcut_set_admin($rows) {
+  $output = '';
+  $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => 2));
+  $output .= theme('table', array('header' => $header, 'rows' => $rows));
+  return $output;
+}
+
+/**
+ * Menu callback; Build the form for adding a shortcut set.
+ *
+ * @param $form
+ *   An associative array containing the structure of the form.
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @return
+ *   An array representing the form definition.
+ *
+ * @ingroup forms
+ * @see shortcut_set_add_form_submit()
+ */
+function shortcut_set_add_form($form, &$form_state) {
+  $form['new'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Set name'),
+    '#description' => t('The new set is created by copying items from the default set.'),
+  );
+
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Create new set'),
+  );
+
+  return $form;
+}
+
+/**
+ * Submit handler for the form that adds a new shortcut set.
+ */
+function shortcut_set_add_form_submit($form, &$form_state) {
     // Save a new shortcut set with links copied from the default set.
     $default_set = shortcut_default_set();
     $set = (object) array(
@@ -102,35 +176,14 @@ function shortcut_set_switch_submit($for
       'links' => menu_links_clone($default_set->links),
     );
     shortcut_set_save($set);
+
     $replacements = array(
-      '%user' => $account->name,
-      '%set_name' => $set->title,
-      // This form can be displayed on more than one page, so make sure we link
-      // back to the correct one.
-      '@switch-url' => url($_GET['q']),
-    );
-    if ($account->uid == $user->uid) {
-      // Only administrators can create new shortcut sets, so we know they have
-      // access to switch back.
-      drupal_set_message(t('Your are now using the new %set_name shortcut set. You can customize it from this page or <a href="@switch-url">switch back to a different one.</a>', $replacements));
-    }
-    else {
-      drupal_set_message(t('%user is now using a new shortcut set called %set_name. You can customize it from this page.', $replacements));
-    }
-    $form_state['redirect'] = 'admin/config/system/shortcut/' . $set->set_name;
-  }
-  else {
-    // Switch to a different shortcut set.
-    $set = shortcut_set_load($form_state['values']['set']);
-    $replacements = array(
-      '%user' => $account->name,
       '%set_name' => $set->title,
     );
-    drupal_set_message($account->uid == $user->uid ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
-  }
 
-  // Assign the shortcut set to the provided user account.
-  shortcut_set_assign_user($set, $account);
+    drupal_set_message(t('The new %set_name shortcut set has been created. You can customize it from this page.', $replacements));
+
+    $form_state['redirect'] = 'admin/config/system/shortcut/' . $set->set_name;
 }
 
 /**
@@ -149,22 +202,27 @@ function shortcut_set_switch_submit($for
  * @see shortcut_set_customize_submit()
  */
 function shortcut_set_customize($form, &$form_state, $shortcut_set) {
+  global $user;
+
   $form['set'] = array(
-    '#markup' => t('Using set "@set"', array('@set' => $shortcut_set->title)),
+    '#markup' => t('Editing set "@set"', array('@set' => $shortcut_set->title)),
     '#prefix' => '<h4 class="shortcuts-set">',
     '#suffix' => '</h4>',
     '#weight' => -100,
   );
 
-  $form['change_set'] = array(
-    '#type' => 'link',
-    '#title' => t('Change set'),
-    '#href' => 'admin/config/system/shortcut',
-    '#prefix' => '<div class="shortcuts-change-set"> (',
-    '#suffix' => ')</div>',
-    '#weight' => -99,
-    '#access' => shortcut_set_switch_access(),
-  );
+  //only display this link if there is another set to change to.
+  if (count(shortcut_sets()) > 1) {
+    $form['change_set'] = array(
+      '#type' => 'link',
+      '#title' => t('Change set'),
+      '#href' => "user/$user->uid/shortcuts",
+      '#prefix' => '<div class="shortcuts-change-set"> (',
+      '#suffix' => ')</div>',
+      '#weight' => -99,
+      '#access' => shortcut_set_switch_access(),
+    );
+  }
 
   $form['shortcuts']['#tree'] = TRUE;
   $form['shortcuts']['enabled'] = $form['shortcuts']['disabled'] = array();
@@ -186,7 +244,7 @@ function shortcut_set_customize($form, &
       '#default_value' => $status,
       '#attributes' => array('class' => array('shortcut-status-select')),
     );
-    
+
     $form['shortcuts'][$status][$mlid]['edit']['#markup'] = l(t('edit'), 'admin/config/system/shortcut/link/' . $mlid);
     $form['shortcuts'][$status][$mlid]['delete']['#markup'] = l(t('delete'), 'admin/config/system/shortcut/link/' . $mlid . '/delete');
   }
@@ -198,7 +256,7 @@ function shortcut_set_customize($form, &
 
   $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions')));
   $form['actions']['submit'] = array(
-    '#type' => 'submit', 
+    '#type' => 'submit',
     '#value' => t('Save Changes'),
   );
 
@@ -455,6 +513,47 @@ function shortcut_admin_add_link($shortc
 }
 
 /**
+ * Menu callback; Build the form for deleting a shortcut set.
+ *
+ * @param $form
+ *   An associative array containing the structure of the form.
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @param $set_name
+ *   The unique name of the set that will be deleted.
+ * @return
+ *   An array representing the form definition.
+ *
+ * @ingroup forms
+ * @see shortcut_set_delete_form_submit()
+ */
+function shortcut_set_delete_form($form, &$form_state, $shortcut_set) {
+  $form['shortcut_set'] = array(
+    '#type' => 'value',
+    '#value' => $shortcut_set->set_name,
+  );
+
+  return confirm_form(
+    $form,
+    t('Are you sure you want to delete the shortcut set %title?', array('%title' => $shortcut_set->title)),
+    'admin/config/system/shortcut/' . $shortcut_set->set_name,
+    t('This action cannot be undone.'),
+    t('Delete'),
+    t('Cancel')
+  );
+}
+
+/**
+ * Submit handler for the shortcut link deletion form.
+ */
+function shortcut_set_delete_form_submit($form, &$form_state) {
+  $shortcut_set = shortcut_set_load($form_state['values']['shortcut_set']);
+  shortcut_set_delete($shortcut_set);
+  $form_state['redirect'] = 'admin/config/system/shortcut/';
+  drupal_set_message(t('The shortcut set %title has been deleted.', array('%title' => $shortcut_set->title)));
+}
+
+/**
  * Menu callback; Build the form for deleting a shortcut link.
  *
  * @param $form
Index: modules/shortcut/shortcut.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.module,v
retrieving revision 1.17
diff -u -p -r1.17 shortcut.module
--- modules/shortcut/shortcut.module	11 Jan 2010 00:06:58 -0000	1.17
+++ modules/shortcut/shortcut.module	13 Jan 2010 18:10:31 -0000
@@ -58,9 +58,16 @@ function shortcut_menu() {
   $items['admin/config/system/shortcut'] = array(
     'title' => 'Shortcuts',
     'description' => 'List the available shortcut sets and switch between them.',
+    'page callback' => 'shortcut_set_admin',
+    'access arguments' => array('administer shortcuts'),
+    'file' => 'shortcut.admin.inc',
+  );
+  $items['admin/config/system/shortcut/add-set'] = array(
+    'title' => 'Add shortcut set',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('shortcut_set_switch'),
+    'page arguments' => array('shortcut_set_add_form'),
     'access arguments' => array('administer shortcuts'),
+    'type' => MENU_LOCAL_ACTION,
     'file' => 'shortcut.admin.inc',
   );
   $items['admin/config/system/shortcut/%shortcut_set'] = array(
@@ -90,6 +97,14 @@ function shortcut_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'shortcut.admin.inc',
   );
+  $items['admin/config/system/shortcut/%shortcut_set/delete'] = array(
+    'title' => 'Delete this shortcut set',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('shortcut_set_delete_form', 4),
+    'access arguments' => array('administer shortcuts'),
+    'type' => MENU_CALLBACK,
+    'file' => 'shortcut.admin.inc',
+  );
   $items['admin/config/system/shortcut/link/%menu_link'] = array(
     'title' => 'Edit shortcut',
     'page callback' => 'drupal_get_form',
@@ -125,6 +140,9 @@ function shortcut_menu() {
  */
 function shortcut_theme() {
   return array(
+    'shortcut_set_admin' => array(
+      'file' => 'shortcut.admin.inc',
+    ),
     'shortcut_set_customize' => array(
       'render element' => 'form',
       'file' => 'shortcut.admin.inc',
