How to check if a view is grouped?
Some tips about your solution:

1- It looks right to me. I would try keep the logic separate from the template. I'd also declare my own template to avoid problems. Another style plugin, for example a custom style plugin, could use the original template.

HOOK_preprocess_views_view_unformatted(&amp;$vars){
  if(!empty($options['grouping'])){
    $vars['heading_classes'] = $grouped ? ' class="group-heading"' : '';
    // My own template
    $vars['theme_hook_suggestions'] = 'views_view_unformatted_group';
  }
}

/*
* Implement hook_theme
*/
HOOK_theme($existing, $type, $theme, $path){
  return array(
    'views_view_unformatted_group' =&gt; array(
     'variables' =&gt; array(),
     'path' =&gt; 'PATH/TO/YOUR/MODULE',
     'template' =&gt; 'views_view_unformatted_group',
  ),
} 


Template views_view_unformatted_group.tpl.php

&lt;div class="views-group clearfix"&gt;
 &lt;?php if (!empty($title)): ?&gt;
 &lt;h3&lt;?php print $heading_classes; ?&gt;&gt;&lt;?php print $title; ?&gt;&lt;/h3&gt;
&lt;?php endif; ?&gt;
&lt;?php foreach ($rows as $id =&gt; $row): ?&gt;
  &lt;div&lt;?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?&gt;&gt;
  &lt;?php print $row; ?&gt;
  &lt;/div&gt;
&lt;?php endforeach; ?&gt;
&lt;/div&gt;


2 - The default function that manage the grouping is render_grouping_sets() in an style plugin object. The documentation warn about that:


  Plugins may override this method if they wish some other way of handling
     * grouping


The unformatted list, html list, grid and table style inherit the default methods and they don't override it.

3 - If you have nested groups, Views wrap the parent group with the next function in theme.inc:

function theme_views_view_grouping($vars) {
  $view = $vars['view'];
  $title = $vars['title'];
  $content = $vars['content'];

  $output = '&lt;div class="view-grouping"&gt;';
  $output .= '&lt;div class="view-grouping-header"&gt;' . $title . '&lt;/div&gt;';
  $output .= '&lt;div class="view-grouping-content"&gt;' . $content . '&lt;/div&gt;' ;
  $output .= '&lt;/div&gt;';

  return $output;
}