=== modified file 'modules/system/system.admin.inc'
--- modules/system/system.admin.inc	2009-11-03 05:27:18 +0000
+++ modules/system/system.admin.inc	2009-11-04 09:17:34 +0000
@@ -193,11 +193,8 @@ function system_settings_overview() {
 
 /**
  * Menu callback; displays a listing of all themes.
- *
- * @ingroup forms
- * @see system_themes_form_submit()
  */
-function system_themes_form() {
+function system_themes_page() {
   // Get current list of themes.
   $themes = system_rebuild_theme_data();
 
@@ -210,12 +207,16 @@ function system_themes_form() {
 
   uasort($themes, 'system_sort_modules_by_info_name');
 
-  $status = array();
-  $incompatible_core = array();
-  $incompatible_php = array();
+  $theme_default = variable_get('theme_default', 'garland');
+  $theme_groups  = array();
+
+  foreach ($themes as $key => $theme) {
+
+    $admin_theme_options[$key] = $theme->name;
+    $theme->is_default = ($theme->name == $theme_default);
 
-  foreach ($themes as $theme) {
-    $screenshot = NULL;
+    // Identify theme screenshot.
+    $theme->screenshot = NULL;
     // Create a list which includes the current theme and all its base themes.
     if (isset($themes[$theme->name]->base_themes)) {
       $theme_keys = array_keys($themes[$theme->name]->base_themes);
@@ -227,50 +228,56 @@ function system_themes_form() {
     // Look for a screenshot in the current theme or in its closest ancestor.
     foreach (array_reverse($theme_keys) as $theme_key) {
       if (isset($themes[$theme_key]) && file_exists($themes[$theme_key]->info['screenshot'])) {
-        $screenshot = $themes[$theme_key]->info['screenshot'];
+        $theme->screenshot = $themes[$theme_key]->info['screenshot'];
         break;
       }
     }
-    $screenshot = $screenshot ? theme('image', array('path' => $screenshot, 'alt' => t('Screenshot for %theme theme', array('%theme' => $theme->info['name'])), 'title' => '', 'attributes' => array('class' => array('screenshot')), 'getsize' => FALSE)) : t('no screenshot');
-
-    $form[$theme->name]['screenshot'] = array('#markup' => $screenshot);
-    $form[$theme->name]['info'] = array(
-      '#type' => 'value',
-      '#value' => $theme->info,
-    );
-    $options[$theme->name] = $theme->info['name'];
 
-    $form[$theme->name]['operations'] = drupal_theme_access($theme) ? array('#type' => 'link', '#title' => t('configure'), '#href' => 'admin/appearance/settings/' . $theme->name) : array();
-
-    if (!empty($theme->status)) {
-      $status[] = $theme->name;
+    if (drupal_theme_access($theme)) {
+      $theme->operations = array(
+        l(t('Configure'), 'admin/appearance/settings/' . $theme->name),
+        l(t('Disable'), 'admin/appearance/disable/' . $theme->name),
+      );
+      if (!$theme->is_default) {
+        $theme->operations[] = l(t('Set default'), 'admin/appearance/default/' . $theme->name);
+      }
     }
     else {
-      // Ensure this theme is compatible with this version of core.
-      // Require the 'content' region to make sure the main page
-      // content has a common place in all themes.
-      if (!isset($theme->info['core']) || ($theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content']))) {
-        $incompatible_core[] = $theme->name;
-      }
-      if (version_compare(phpversion(), $theme->info['php']) < 0) {
-        $incompatible_php[$theme->name] = $theme->info['php'];
-      }
+      $theme->operations = array(
+        l(t('Enable'), 'admin/appearance/enable/' . $theme->name),
+        l(t('Set default'), 'admin/appearance/default/' . $theme->name),
+      );
     }
+
+    if (empty($theme->status)) {
+     // Ensure this theme is compatible with this version of core.
+     // Require the 'content' region to make sure the main page
+     // content has a common place in all themes.
+      $theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content']));
+      $theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0;
+    }
+
+    // Add notes to default and administration theme.
+    $theme->notes = array();
+    $theme->classes = array();
+    if ($theme->is_default) {
+      $theme->classes[] = 'theme-default';
+      $theme->notes[] = t('default theme');
+    }
+
+    // Sort enabled and disabled themes into their own groups.
+    $theme_groups[$theme->status ? 'enabled' : 'disabled'][] = $theme;
   }
 
-  $form['status'] = array(
-    '#type' => 'checkboxes',
-    '#options' => array_fill_keys(array_keys($options), ''),
-    '#default_value' => $status,
-    '#incompatible_themes_core' => drupal_map_assoc($incompatible_core),
-    '#incompatible_themes_php' => $incompatible_php,
-  );
-  $form['theme_default'] = array(
-    '#type' => 'radios',
-    '#options' => array_fill_keys(array_keys($options), ''),
-    '#default_value' => variable_get('theme_default', 'garland'),
-  );
+  uasort($theme_groups['enabled'], 'system_sort_themes');
+  $admin_form = drupal_get_form('system_themes_admin_form', $admin_theme_options);
+  return theme('system_themes_page', array('theme_groups' => $theme_groups)) . drupal_render($admin_form);
+}
 
+/**
+ * Form to select the administration theme.
+ */
+function system_themes_admin_form($form_state, $theme_options) {
   // Administration theme settings.
   $form['admin_theme'] = array(
     '#type' => 'fieldset',
@@ -280,7 +287,7 @@ function system_themes_form() {
   );
   $form['admin_theme']['admin_theme'] = array(
     '#type' => 'select',
-    '#options' => array(0 => t('Default theme')) + $options,
+    '#options' => array(0 => t('Default theme')) + $theme_options,
     '#title' => t('Administration theme'),
     '#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'),
     '#default_value' => variable_get('admin_theme', 0),
@@ -290,12 +297,10 @@ function system_themes_form() {
     '#title' => t('Use the administration theme when editing or creating content'),
     '#default_value' => variable_get('node_admin_theme', '0'),
   );
-
-  $form['buttons']['submit'] = array(
+  $form['admin_theme']['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save configuration'),
   );
-
   return $form;
 }
 
@@ -776,6 +781,19 @@ function system_sort_modules_by_info_nam
 }
 
 /**
+ * Array sorting callback; sorts modules or themes by their name.
+ */
+function system_sort_themes($a, $b) {
+  if ($a->is_default) {
+    return -1;
+  }
+  if ($b->is_default) {
+    return 1;
+  }
+  return strcasecmp($a->info['name'], $b->info['name']);
+}
+
+/**
  * Build a table row for the system modules page.
  */
 function _system_modules_build_row($info, $extra) {
@@ -2395,61 +2413,57 @@ function theme_system_modules_uninstall(
  *
  * @param $variables
  *   An associative array containing:
- *   - form: An associative array containing the structure of the form.
+ *   - theme_groups: An associative array containing groups of themes.
  *
  * @ingroup themeable
  */
-function theme_system_themes_form($variables) {
-  $form = $variables['form'];
+function theme_system_themes_page($variables) {
+  $theme_groups = $variables['theme_groups'];
 
-  foreach (element_children($form) as $key) {
-    // Only look for themes
-    if (!isset($form[$key]['info'])) {
+  $output = '<div id="system-themes-page">';
+
+  // There are four possible theme groups.
+  $states = array(
+    'enabled' => format_plural(count($theme_groups['enabled']), 'Enabled theme', 'Enabled themes'),
+    'disabled' => format_plural(count($theme_groups['disabled']), 'Disabled theme', 'Disabled themes'),
+  );
+
+  foreach ($states as $state => $title) {
+    if (!count($theme_groups[$state])) {
+      // Skip this group of themes if no theme is there.
       continue;
     }
+    // Start new theme group.
+    $output .= '<div class="system-themes-list system-themes-list-'. $state .'"><h2>'. $title .'</h2>';
 
-    // Fetch info
-    $info = $form[$key]['info']['#value'];
-    // Localize theme description.
-    $description = t($info['description']);
-    // Make sure it is compatible and render the checkbox if so.
-    if (isset($form['status']['#incompatible_themes_core'][$key])) {
-      unset($form['status'][$key]);
-      $status = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('incompatible'), 'title' => t('Incompatible with this version of Drupal core')));
-      $description .= '<div class="incompatible">' . t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) . '</div>';
-    }
-    elseif (isset($form['status']['#incompatible_themes_php'][$key])) {
-      unset($form['status'][$key]);
-      $status = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('incompatible'), 'title' => t('Incompatible with this version of PHP')));
-      $php_required = $form['status']['#incompatible_themes_php'][$key];
-      if (substr_count($php_required, '.') < 2) {
-        $php_required .= '.*';
-      }
-      $description .= '<div class="incompatible">' . t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion())) . '</div>';
-    }
-    else {
-      $status = drupal_render($form['status'][$key]);
-    }
+    foreach($theme_groups[$state] as $theme) {
 
-    // Style theme info
-    $theme = '<div class="theme-info"><h2>' . $info['name'] . '</h2><div class="description">' . $description . '</div></div>';
+      // Theme the screenshot.
+      $screenshot = $theme->screenshot ? theme('image', array('path' => $theme->screenshot, 'alt' => t('Screenshot for %theme theme', array('%theme' => $theme->info['name'])), 'title' => '', 'attributes' => array('class' => array('screenshot')), 'getsize' => FALSE)) : t('no screenshot');
 
-    // Build rows
-    $row = array();
-    $row[] = drupal_render($form[$key]['screenshot']);
-    $row[] = $theme;
-    $row[] = isset($info['version']) ? $info['version'] : '';
-    $row[] = array('data' => $status, 'align' => 'center');
-    if ($form['theme_default']) {
-      $row[] = array('data' => drupal_render($form['theme_default'][$key]), 'align' => 'center');
-      $row[] = array('data' => drupal_render($form[$key]['operations']), 'align' => 'center');
+      // Localize the theme description.
+      $description = t($theme->info['description']);
+
+      // Make sure to provide feedback on compatibility.
+      if (!empty($theme->incompatible_core)) {
+        $description .= '<div class="incompatible">' . t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) . '</div>';
+      }
+      elseif (!empty($theme->incompatible_php)) {
+        if (substr_count($theme->info['php'], '.') < 2) {
+          $theme->info['php'] .= '.*';
+        }
+        $description .= '<div class="incompatible">' . t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $theme->info['php'], '!php_version' => phpversion())) . '</div>';
+      }
+
+      // Style theme info
+      $notes = count($theme->notes) ? ' (' . join(', ', $theme->notes) . ')' : '';
+      $theme->classes[] = 'theme-selector';
+      $output .= '<div class="'. join(' ', $theme->classes) .'">' . $screenshot . '<div class="theme-info"><h3>' . $theme->info['name'] . ' ' . (isset($theme->info['version']) ? $theme->info['version'] : '') . $notes . '</h3><div class="description">' . $description . '</div><div class="operations">' . theme('item_list', array('items' => $theme->operations)) . '</div></div></div>';
     }
-    $rows[] = $row;
+    $output .= '<div class="theme-selector-end"></div></div>';
   }
+  $output .= '</div>';
 
-  $header = array(t('Screenshot'), t('Name'), t('Version'), t('Enabled'), t('Default'), t('Operations'));
-  $output = theme('table', array('header' => $header, 'rows' => $rows));
-  $output .= drupal_render_children($form);
   return $output;
 }
 

=== modified file 'modules/system/system.css'
--- modules/system/system.css	2009-09-21 08:52:41 +0000
+++ modules/system/system.css	2009-11-04 09:25:42 +0000
@@ -513,8 +513,58 @@ html.js .js-hide {
 /*
 ** Styles for the system themes page (admin/appearance)
 */
-#system-themes-form div.incompatible {
-  font-weight: bold;
+#block-system-main #system-themes-page h2 {
+  clear: both;
+  font-weight: normal;
+  text-transform: uppercase;
+}
+.theme-selector {
+  clear: both;
+  padding-top: 1em;
+}
+.theme-selector .screenshot {
+  padding: 2px;
+}
+.system-themes-list-enabled .theme-selector .screenshot {
+  float: left;
+  margin-right: 1em;
+}
+.theme-admin img,
+.theme-default img {
+  border: 1px solid #aaa;
+}
+#block-system-main .theme-selector h3 {
+  font-weight: normal;
+}
+#block-system-main .system-themes-list-enabled .theme-selector h3 {
+  padding-top: 2em;
+}
+.system-themes-list-disabled .theme-selector {
+  width: 256px;
+  float: left;
+  clear: none;
+  padding: 1em 1em 1em 0;
+}
+.system-themes-list-disabled .theme-selector .screenshot {
+  padding-bottom: 0.5em;
+}
+.theme-selector .item-list li {
+  float: left;
+  padding: 0 0.7em 0 0.7em;
+  border-right: 1px solid #cdcdcd;
+}
+.theme-selector .item-list li.last {
+  padding: 0 0 0 0.7em;
+  border-right: none;
+}
+.theme-selector .item-list li.first {
+  padding: 0 0.7em 0 0;
+}
+.theme-selector-end {
+  border-bottom: 1px solid #cdcdcd;
+  clear: both;
+  padding-bottom: 1em;
+  margin-bottom: 1em;
 }
 
 /*

=== modified file 'modules/system/system.module'
--- modules/system/system.module	2009-11-03 06:47:22 +0000
+++ modules/system/system.module	2009-11-04 07:01:29 +0000
@@ -134,8 +134,8 @@ function system_help($path, $arg) {
  */
 function system_theme() {
   return array_merge(drupal_common_theme(), array(
-    'system_themes_form' => array(
-      'render element' => 'form',
+    'system_themes_page' => array(
+      'variables' => array('theme_groups' => NULL),
       'file' => 'system.admin.inc',
     ),
     'system_settings_form' => array(
@@ -578,8 +578,7 @@ function system_menu() {
   $items['admin/appearance'] = array(
     'title' => 'Appearance',
     'description' => 'Select and configure your site theme.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('system_themes_form'),
+    'page callback' => 'system_themes_page',
     'access arguments' => array('administer site configuration'),
     'position' => 'left',
     'weight' => -6,

