diff --git a/kml.module b/kml.module
index e7fe008..8100e6b 100644
--- a/kml.module
+++ b/kml.module
@@ -6,6 +6,15 @@
  */
 
 /**
+ * Implements hook_init().
+ */
+function kml_init() {
+  // We have to include our theme preprocessors here until:
+  // http://drupal.org/node/1096770 is fixed.
+  module_load_include('inc', 'kml', 'views/kml_views.theme');
+}
+
+/**
  * Implements hook_views_api().
  */
 function kml_views_api() {
@@ -33,5 +42,15 @@ function kml_theme() {
       'template' => 'kml-style',
       'path' => "$path/views",
     ),
+    'kml_feed_icon' => array(
+      'variables' => array(
+        'image_path' => '',
+        'url' => '',
+        'query' => NULL,
+        'title' => '',
+      ),
+      'file' => 'kml_views.theme.inc',
+      'path' => $path . "/views",
+    ),
   );
 }
diff --git a/views/kml.views.inc b/views/kml.views.inc
index bcd5571..93771a9 100644
--- a/views/kml.views.inc
+++ b/views/kml.views.inc
@@ -25,6 +25,7 @@ function kml_views_plugins() {
         'uses options' => TRUE,
         'uses grouping' => FALSE,
         'type' => 'feed',
+        'export feed icon' => drupal_get_path('module', 'kml') . '/images/kml.png',
       ),
     ),
   );
diff --git a/views/kml_views.theme.inc b/views/kml_views.theme.inc
index 9e80c5e..b7d44d3 100644
--- a/views/kml_views.theme.inc
+++ b/views/kml_views.theme.inc
@@ -47,12 +47,46 @@ function template_preprocess_kml_placemark(&$vars) {
 }
 
 /**
+ * Implements MODULE_preprocess_HOOK().
+ *
+ * Preprocess theme variables for a specific theme hook.
+ *
+ * This hook allows modules to preprocess theme variables for a specific theme
+ * hook. It should only be used if a module needs to override or add to the
+ * theme preprocessing for a theme hook it didn't define.
+ *
+ * For more detailed information, see theme().
+ *
+ * @param $variables
+ *   The variables array (modify in place).
+ */
+function kml_preprocess_image(&$variables) {
+  $path = drupal_get_path('module', 'kml');
+  // Assume the default text 'Subscribe to KML'
+  // is included in $variables['alt'].
+  // See theme_feed_icon() in includes/theme.inc
+  if (substr($variables['alt'], 0, 12) == 'Subscribe to') {
+    $type = substr($variables['alt'], -3);
+    switch ($type) {
+      case 'KML':
+        $variables['title'] = t('Export as KML');
+        $variables['path'] = $path . '/images/' . strtolower($type) . '.png';
+        $variables['width'] = NULL;
+        $variables['height'] = NULL;
+        break;
+    }
+  }
+}
+
+/**
  * Theme function for kml feed icon.
  */
-function theme_kml_feed_icon($url, $title, $icon) {
-  // TODO: Should this theme kml_feed_icon be declared in hook_theme()?
-  if ($image = theme('image', array('path' => $icon, 'width' => t('Download KML Feed'), 'height' => $title))) {
-    return '<a href="' . check_url($url)
-      . '" class="feed-icon">' . $image . '</a>';
+function theme_kml_feed_icon($variables) {
+  extract($variables, EXTR_SKIP);
+  $url_options = array('html' => TRUE);
+  if ($query) {
+    $url_options['query'] = $query;
   }
+  $image = theme('image', array('path' => $image_path, 'alt' => $title, 'text' => $title));
+  return l($image, $url, $url_options);
 }
diff --git a/views/views_plugin_style_kml.inc b/views/views_plugin_style_kml.inc
index 682b7b5..122c821 100644
--- a/views/views_plugin_style_kml.inc
+++ b/views/views_plugin_style_kml.inc
@@ -23,7 +23,12 @@ class views_plugin_style_kml extends views_plugin_style {
    * feed image link.
    */
   function attach_to($display_id, $path, $title) {
-    $url_options = array('html' => TRUE);
+    // Force the URL to be absolute, for consistency
+    // with other <link> tags output by Drupal.
+    $url_options = array(
+      'absolute' => TRUE,
+      'html' => TRUE,
+    );
 
     // Include exposed filters
     $query = $this->view->get_exposed_input();
@@ -31,8 +36,26 @@ class views_plugin_style_kml extends views_plugin_style {
       $url_options['query'] = $query;
     }
 
-    $image = theme('image', array('path' => $this->feed_image));
-    $this->view->feed_icon .= l($image, $this->view->get_url(NULL, $path), $url_options);
+    $display = $this->view->display[$display_id]->handler;
+    $url = url($this->view->get_url(NULL, $path), $url_options);
+    if ($display->has_path() && !$this->options['feed_in_links']) {
+      if (empty($this->preview)) {
+        $feed_links = drupal_add_feed($url, $title);
+      }
+    }
+    else {
+      if (empty($this->view->feed_icon)) {
+        $this->view->feed_icon = '';
+      }
+      $variables = array(
+        'image_path' => $this->definition['export feed icon'],
+        'url' => $url,
+        'query' => $query,
+        'title' => 'Subscribe to KML',
+      );
+      $image = theme('kml_feed_icon', $variables);
+      $this->view->feed_icon .= l($image, $url, $url_options);
+    }
   }
 
   function option_definition() {
@@ -57,6 +80,12 @@ class views_plugin_style_kml extends views_plugin_style {
       'translatable' => FALSE,
     );
 
+    // Other feed settings defaults.
+    $options['feed_in_links'] = array(
+      'default' => FALSE,
+      'translatable' => FALSE,
+    );
+
     return $options;
   }
 
@@ -121,6 +150,11 @@ class views_plugin_style_kml extends views_plugin_style {
           '#required' => ($k == 'class' ? FALSE : TRUE),
         );
       }
+      $form['feed_in_links'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Display feed icon in the links attached to the view'),
+        '#default_value' => !empty($this->options['feed_in_links']),
+      );
     }
   }
 
