? .DS_Store
? modules/.DS_Store
? modules/devel
? modules/toolbar/.DS_Store
? sites/.DS_Store
? sites/default/files
? sites/default/private
? sites/default/settings.php
? themes/.DS_Store
Index: modules/shortcut/shortcut.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 shortcut.admin.inc
--- modules/shortcut/shortcut.admin.inc	17 Oct 2009 00:51:52 -0000	1.1
+++ modules/shortcut/shortcut.admin.inc	25 Oct 2009 20:52:56 -0000
@@ -505,12 +505,20 @@ function shortcut_link_delete($form, &$f
  */
 function shortcut_link_delete_submit($form, &$form_state) {
   $shortcut_link = $form_state['values']['shortcut_link'];
-  menu_link_delete($shortcut_link['mlid']);
+  _shortcut_link_delete($shortcut_link);
   $form_state['redirect'] = 'admin/config/system/shortcut/' . $shortcut_link['menu_name'];
-  drupal_set_message(t('The shortcut %title has been deleted.', array('%title' => $shortcut_link['link_title'])));
 }
 
 /**
+ * Helper function for deleting shortcuts.
+ */
+function _shortcut_link_delete($link){
+  menu_link_delete($link['mlid']);
+  drupal_set_message(t('The shortcut %title has been deleted.', array('%title' => $link['link_title'])));
+}
+
+
+/**
  * Menu callback; Creates a new link in the provided shortcut set
  *
  * After completion, redirects the user back to where they came from.
Index: modules/shortcut/shortcut.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.css,v
retrieving revision 1.1
diff -u -p -r1.1 shortcut.css
--- modules/shortcut/shortcut.css	17 Oct 2009 00:51:52 -0000	1.1
+++ modules/shortcut/shortcut.css	25 Oct 2009 20:52:56 -0000
@@ -40,7 +40,11 @@ div#toolbar div.toolbar-shortcuts span.i
   -webkit-border-radius: 5px;
 }
 
-div.add-to-shortcuts a span.icon {
+div.add-remove-shortcuts {
+	padding-top: 5px;
+}
+
+div.add-remove-shortcuts a span.icon {
   display: block;
   width: 12px;
   background: url(../toolbar/toolbar.png) no-repeat -50px -60px;
@@ -49,17 +53,23 @@ div.add-to-shortcuts a span.icon {
   margin-left:8px;
 }
 
-div.add-to-shortcuts a:hover span.icon {
+div.add-remove-shortcuts a:hover span.icon {
   background-position: -50px -72px;
 }
+div.remove-shortcut a span.icon{
+	background-position: -62px -60px;
+}
+div.remove-shortcut a:hover span.icon{
+	background-position: -62px -72px;
+}
 
-div.add-to-shortcuts a span.text {
+div.add-remove-shortcuts a span.text {
   float: left;
   padding-left:10px;
   display: none;
 }
 
-div.add-to-shortcuts a:hover span.text {
+div.add-remove-shortcuts a:hover span.text {
   font-size: 10px;
   line-height: 12px;
   color: #fff;
Index: modules/shortcut/shortcut.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.module,v
retrieving revision 1.2
diff -u -p -r1.2 shortcut.module
--- modules/shortcut/shortcut.module	23 Oct 2009 22:24:17 -0000	1.2
+++ modules/shortcut/shortcut.module	25 Oct 2009 20:52:56 -0000
@@ -381,11 +381,16 @@ function shortcut_current_displayed_set(
   $query->fields('s');
   $query->join('shortcut_set_users', 'u', 's.set_name = u.set_name');
   $query->condition('u.uid', $account->uid);
+  
   $shortcut_set = $query->execute()->fetchObject();
-  // Otherwise, use the default set.
-  if (!$shortcut_set) {
+  
+  if ($shortcut_set) {
+    $shortcut_set = shortcut_set_load($shortcut_set->set_name);
+  }
+  else { // Otherwise, use the default set.
     $shortcut_set = shortcut_default_set($account);
   }
+  
   $shortcut_sets[$account->uid] = $shortcut_set;
   return $shortcut_set;
 }
@@ -507,26 +512,49 @@ function shortcut_renderable_links($shor
  * Implement hook_page_build().
  */
 function shortcut_page_build(&$page) {
-  if (shortcut_set_edit_access()) {
+  if (shortcut_set_edit_access()) {    
     $link = $_GET['q'];
     $query_parameters = drupal_get_query_parameters();
     if (!empty($query_parameters)) {
      $link .= '?' . drupal_http_build_query($query_parameters);
     }
+    
     $query = array(
      'link' => $link,
      'name' => drupal_get_title(),
-     'token' => drupal_get_token('shortcut-add-link'),
     );
     $query += drupal_get_destination();
 
     $shortcut_set = shortcut_current_displayed_set();
-    $link_text = shortcut_set_switch_access() ? t('Add to %shortcut_set shortcuts', array('%shortcut_set' => $shortcut_set->title)) : t('Add to shortcuts');
-    $page['add_to_shortcuts'] = array(
-     '#prefix' => '<div class="add-to-shortcuts">',
-     '#markup' => l('<span class="icon"></span><span class="text">' . $link_text . '</span>', 'admin/config/system/shortcut/' . $shortcut_set->set_name . '/add-link-inline', array('query' => $query, 'html' => TRUE)),
-     '#suffix' => '</div>',
-    );
+    
+    // Check if $link is already a shortcut and set link_mode accordingly.
+    foreach ($shortcut_set->links as $shortcut) {
+      if ($link == $shortcut['link_path']) {
+        $mlid = $shortcut['mlid'];
+        break;
+      }
+    }
+    
+    // $mlid only exists if the linke is to be removed.
+    if (!isset($mlid)) { // $mlid is not set, so add the link.
+      $query['token'] = drupal_get_token('shortcut-add-link');
+      $link_text = shortcut_set_switch_access() ? t('Add to %shortcut_set shortcuts', array('%shortcut_set' => $shortcut_set->title)) : t('Add to shortcuts');
+      $page['add_remove_shortcut'] = array(
+       '#prefix' => '<div class="add-remove-shortcuts add-shortcut">',
+       '#markup' => l('<span class="icon"></span><span class="text">' . $link_text . '</span>', 'admin/config/system/shortcut/' . $shortcut_set->set_name . '/add-link-inline', array('query' => $query, 'html' => TRUE)),
+       '#suffix' => '</div>',
+      );
+    }
+    else { // $mlid is set, so remove the link.
+      $query['token'] = drupal_get_token('shortcut-remove-link');
+      $query['mlid'] = $mlid;
+      $link_text = shortcut_set_switch_access() ? t('Remove from %shortcut_set shortcuts', array('%shortcut_set' => $shortcut_set->title)) : t('Remove from shortcuts');
+      $page['add_remove_shortcut'] = array(
+       '#prefix' => '<div class="add-remove-shortcuts remove-shortcut">',
+       '#markup' => l('<span class="icon"></span><span class="text">' . $link_text . '</span>', 'admin/config/system/shortcut/link/'.$mlid.'/delete', array('query' => $query, 'html' => TRUE)),
+       '#suffix' => '</div>',
+      );
+    }
   }
 
   $links = shortcut_renderable_links();
@@ -551,7 +579,7 @@ function shortcut_page_build(&$page) {
  * Implement hook_preprocess_page().
  */
 function shortcut_preprocess_page(&$variables) {
-  if (isset($variables['page']['add_to_shortcuts'])) {
-    $variables['add_to_shortcuts'] = drupal_render($variables['page']['add_to_shortcuts']);
+  if (isset($variables['page']['add_remove_shortcut'])) {
+    $variables['add_remove_shortcut'] = drupal_render($variables['page']['add_remove_shortcut']);
   }
 }
Index: modules/toolbar/toolbar.png
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.png,v
retrieving revision 1.4
diff -u -p -r1.4 toolbar.png
Binary files /tmp/cvsiucope and toolbar.png differ
Index: themes/seven/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/seven/page.tpl.php,v
retrieving revision 1.6
diff -u -p -r1.6 page.tpl.php
--- themes/seven/page.tpl.php	17 Oct 2009 01:15:40 -0000	1.6
+++ themes/seven/page.tpl.php	25 Oct 2009 20:52:56 -0000
@@ -4,7 +4,7 @@
   <div id="branding" class="clearfix">
     <?php print $breadcrumb; ?>
     <?php if ($title): ?><h1 class="page-title"><?php print $title; ?></h1><?php endif; ?>
-    <?php if (isset($add_to_shortcuts)): ?><?php print $add_to_shortcuts; ?><?php endif; ?>
+    <?php if (isset($add_remove_shortcut)): ?><?php print $add_remove_shortcut; ?><?php endif; ?>
     <?php if ($primary_local_tasks): ?><ul class="tabs primary"><?php print render($primary_local_tasks); ?></ul><?php endif; ?>
   </div>
 
