Patch #511284 by Damien Tournoud: make the toolbar a proper block and revert unneeded CSS hackery. Drupal core should stay simple!

From: damz <damz@damz-dev.local>


---
 toolbar/toolbar.css     |   48 +++++++++++------------------------------------
 toolbar/toolbar.module  |   30 +++++++++++++++++------------
 toolbar/toolbar.tpl.php |    2 --
 3 files changed, 28 insertions(+), 52 deletions(-)

diff --git modules/toolbar/toolbar.css modules/toolbar/toolbar.css
index a005a02..500db87 100644
--- modules/toolbar/toolbar.css
+++ modules/toolbar/toolbar.css
@@ -1,13 +1,5 @@
 /* $Id: toolbar.css,v 1.1 2009-07-04 05:37:30 dries Exp $ */
 
-body.toolbar {
-  padding-top: 30px;
-}
-
-body.toolbar-shortcuts {
-  padding-top: 80px;
-}
-
 /**
  * Aggressive resets so we can achieve a consistent look in hostile CSS
  * environments.
@@ -26,13 +18,23 @@ div#toolbar * {
 }
 
 /**
+ * Hide the block title.
+ */
+div#block-toolbar-toolbar h2 {
+  display: none;
+}
+
+div#block-toolbar-toolbar .content {
+  margin: 0;
+}
+
+/**
  * Base styles.
  */
 div#toolbar {
   font: normal 11px/20px "Lucida Grande", Verdana, sans-serif;
   background: #666;
   color: #ccc;
-  position: fixed;
   left: 0;
   right: 0;
   top: 0;
@@ -41,15 +43,6 @@ div#toolbar {
 
 div#toolbar .collapsed {
   display: none;
-}  
-
-div#toolbar div.shadow {
-  position: absolute;
-  left: 0;
-  right: 0;
-  bottom: -15px;
-  height: 15px;
-  background: url(toolbar.png) 0 -85px repeat-x;
 }
 
 div#toolbar a {
@@ -156,22 +149,3 @@ div#toolbar div.toolbar-shortcuts span.icon {
   -moz-border-radius: 5px;
   -webkit-border-radius: 5px;
 }
-
-/**
- * IE 6 Fixes.
- *
- * Since IE 6 has severe problems interpreting fixed positioning, we downgrade
- * the behavior of the admin toolbar entirely to static positioning.
- */
-* html body.toolbar,
-* html body.toolbar-shortcuts {
-  padding-top: 0;
-}
-
-* html div#toolbar {
-  position: static;
-}
-
-* html div#toolbar div.shadow {
-  display: none;
-}
diff --git modules/toolbar/toolbar.module modules/toolbar/toolbar.module
index 6c24e49..9a53add 100644
--- modules/toolbar/toolbar.module
+++ modules/toolbar/toolbar.module
@@ -31,24 +31,28 @@ function toolbar_theme($existing, $type, $theme, $path) {
 }
 
 /**
- * Implementation of hook_page_alter().
- * 
- * Add admin toolbar to the page_top region automatically.
+ * Implement hook_block_list().
  */
-function toolbar_page_alter(&$page) {
-  if (user_access('access toolbar')) {
-    $page['page_top']['toolbar'] = toolbar_build();
-  }
+function toolbar_block_list() {
+  return array(
+    'toolbar' => array(
+      'info' => t('Toolbar'),
+      'cache' => BLOCK_NO_CACHE,
+      'status' => 1,
+      'region' => 'page_top',
+    ),
+  );
 }
 
 /**
- * Implementation of hook_preprocess_page().
- *
- * Add some page classes, so global page theming can adjust to the toolbar.
+ * Implement hook_block_view().
  */
-function toolbar_preprocess_page(&$vars) {
-  if (user_access('access toolbar')) {
-    $vars['classes_array'][] = 'toolbar toolbar-shortcuts';
+function toolbar_block_view($delta) {
+  if ($delta == 'toolbar') {
+    return array(
+      'subject' => t('Toolbar'),
+      'content' => toolbar_build(),
+    );
   }
 }
 
diff --git modules/toolbar/toolbar.tpl.php modules/toolbar/toolbar.tpl.php
index 3e507d7..72e9781 100644
--- modules/toolbar/toolbar.tpl.php
+++ modules/toolbar/toolbar.tpl.php
@@ -24,6 +24,4 @@
   <div class="toolbar-shortcuts clearfix">
     <?php print render($toolbar['toolbar_shortcuts']); ?>
   </div>
-
-  <div class="shadow"></div>
 </div>
