Index: screen.c
===================================================================
--- screen.c	(révision 1244)
+++ screen.c	(copie de travail)
@@ -1233,7 +1233,10 @@ update_client_list (WnckScreen *screen)
 	  class_group = wnck_class_group_get (res_class);
 	  if (class_group == NULL)
 	    {
-	      class_group = _wnck_class_group_create (res_class);
+              const char *res_name;
+
+              res_name = _wnck_window_get_resource_name (window);
+	      class_group = _wnck_class_group_create (res_class, res_name);
 	      created_class_groups = g_list_prepend (created_class_groups, class_group);
 	    }
 
Index: class-group.c
===================================================================
--- class-group.c	(révision 1237)
+++ class-group.c	(copie de travail)
@@ -29,6 +29,7 @@
 /* Private part of the WnckClassGroup structure */
 struct _WnckClassGroupPrivate {
   char *res_class;
+  char *res_name;
   char *name;
   GList *windows;
 
@@ -125,6 +126,7 @@ wnck_class_group_init (WnckClassGroup *c
   class_group->priv = priv;
 
   priv->res_class = NULL;
+  priv->res_name = NULL;
   priv->name = NULL;
   priv->windows = NULL;
 
@@ -144,6 +146,9 @@ wnck_class_group_finalize (GObject *obje
   if (priv->res_class)
     g_free (priv->res_class);
 
+  if (priv->res_name)
+    g_free (priv->res_name);
+
   if (priv->name)
     g_free (priv->name);
 
@@ -180,7 +185,8 @@ wnck_class_group_get (const char *res_cl
 
 /**
  * _wnck_class_group_create:
- * @res_class: Name of the resource class for the group.
+ * @res_class: Class name of the resource class for the group.
+ * @res_name: Name of the resource class for the group.
  *
  * Creates a new WnckClassGroup with the specified resource class name.  If
  * @res_class is #NULL, then windows without a resource class name will get
@@ -190,7 +196,8 @@ wnck_class_group_get (const char *res_cl
  * matches the @res_class.
  **/
 WnckClassGroup *
-_wnck_class_group_create (const char *res_class)
+_wnck_class_group_create (const char *res_class,
+                          const char *res_name)
 {
   WnckClassGroup *class_group;
   WnckClassGroupPrivate *priv;
@@ -205,6 +212,7 @@ _wnck_class_group_create (const char *re
   priv = class_group->priv;
 
   priv->res_class = g_strdup (res_class ? res_class : "");
+  priv->res_name = g_strdup (res_name ? res_name : "");
 
   g_hash_table_insert (class_group_hash, priv->res_class, class_group);
   /* Hash now owns one ref, caller gets none */
@@ -261,7 +269,7 @@ get_name_from_applications (WnckClassGro
 
       if (!first_name)
 	{
-	  if (app)
+	  if (app && wnck_application_has_name (app))
 	    first_name = wnck_application_get_name (app);
 	}
       else
@@ -301,7 +309,7 @@ get_name_from_windows (WnckClassGroup *c
 
       window = WNCK_WINDOW (l->data);
 
-      if (!first_name)
+      if (!first_name && wnck_window_has_name (window))
 	first_name = wnck_window_get_name (window);
       else
 	if (strcmp (first_name, wnck_window_get_name (window)) != 0)
@@ -317,7 +325,6 @@ get_name_from_windows (WnckClassGroup *c
     return NULL;
 }
 
-
 /* Gets a sensible name for the class group from the application group leaders
  * or from individual windows.
  */
@@ -329,12 +336,6 @@ set_name (WnckClassGroup *class_group)
 
   priv = class_group->priv;
 
-  if (priv->name)
-    {
-      g_free (priv->name);
-      priv->name = NULL;
-    }
-
   new_name = get_name_from_applications (class_group);
 
   if (!new_name)
@@ -342,7 +343,7 @@ set_name (WnckClassGroup *class_group)
       new_name = get_name_from_windows (class_group);
 
       if (!new_name)
-	new_name = priv->res_class;
+        new_name = priv->res_name;
     }
 
   g_assert (new_name != NULL);
@@ -555,6 +556,26 @@ wnck_class_group_get_res_class (WnckClas
 }
 
 /**
+ * wnck_class_group_get_res_name:
+ * @class_group: A window class group.
+ * 
+ * Queries the resource name for a class group.
+ * 
+ * Return value: The resource name of the specified @class_group, or the
+ * empty string if the group has no name.  The string should not be freed.
+ **/
+const char *
+wnck_class_group_get_res_name (WnckClassGroup *class_group)
+{
+  WnckClassGroupPrivate *priv;
+
+  g_return_val_if_fail (class_group != NULL, NULL);
+
+  priv = class_group->priv;
+  return priv->res_name;
+}
+
+/**
  * wnck_class_group_get_name:
  * @class_group: A window class group.
  * 
Index: application.c
===================================================================
--- application.c	(révision 1237)
+++ application.c	(copie de travail)
@@ -217,6 +217,28 @@ wnck_application_get_n_windows (WnckAppl
 }
 
 /**
+ * wnck_application_has_name:
+ * @app: a #WnckApplication
+ *
+ * Checks whether or not @app has a name. wnck_application_get_name()
+ * will always return some value, even if the application hasn't set a
+ * name; wnck_application_has_name() can be used to tell if that name is
+ * real or not.
+ *
+ * For icons titles, use wnck_application_has_icon_name() instead.
+ *
+ * Return value: %TRUE if wnck_application_get_name() returns the application's
+ * real name, %FALSE if it returns a fallback name.
+ **/
+gboolean
+wnck_application_has_name (WnckApplication *app)
+{
+  g_return_val_if_fail (WNCK_IS_APPLICATION (app), FALSE);
+
+  return app->priv->name != NULL;
+}
+
+/**
  * wnck_application_get_name:
  * @app: a #WnckApplication
  * 
@@ -241,6 +263,35 @@ wnck_application_get_name (WnckApplicati
 }
 
 /**
+ * wnck_application_has_icon_name:
+ * @app: a #WnckApplication
+ *
+ * Checks whether or not @app has an icon name.
+ * wnck_application_get_icon_name() will always return some value, even if
+ * the application hasn't set an icon name; wnck_application_has_icon_name() can
+ * be used to tell if that name is real or not.
+ *
+ * (Note that if wnck_application_has_icon_name() returns %FALSE, but
+ * wnck_application_has_name() returns %TRUE, then the icon name returned by
+ * wnck_application_get_icon_name() is the application icon name. Only when
+ * both methods return %FALSE does wnck_application_get_icon_name() return a
+ * generic fallback icon name.)
+ *
+ * Return value: %TRUE if wnck_application_get_icon_name() returns the
+ * application's real icon name, %FALSE if it returns a fallback icon name.
+ **/
+gboolean
+wnck_application_has_icon_name (WnckApplication *app)
+{
+  g_return_val_if_fail (WNCK_IS_APPLICATION (app), FALSE);
+
+  /* FIXME this isn't actually implemented, should be different
+   * from regular name
+   */
+  return app->priv->name != NULL;
+}
+
+/**
  * wnck_application_get_icon_name:
  * @app: a #WnckApplication
  * 
Index: class-group.h
===================================================================
--- class-group.h	(révision 1237)
+++ class-group.h	(copie de travail)
@@ -60,13 +60,15 @@ WnckClassGroup *wnck_class_group_get (co
 
 GList *wnck_class_group_get_windows (WnckClassGroup *class_group);
 const char * wnck_class_group_get_res_class (WnckClassGroup *class_group);
+const char * wnck_class_group_get_res_name (WnckClassGroup *class_group);
 
 const char * wnck_class_group_get_name (WnckClassGroup *class_group);
 
 GdkPixbuf *wnck_class_group_get_icon (WnckClassGroup *class_group);
 GdkPixbuf *wnck_class_group_get_mini_icon (WnckClassGroup *class_group);
 
-WnckClassGroup *_wnck_class_group_create (const char *res_class);
+WnckClassGroup *_wnck_class_group_create (const char *res_class,
+                                          const char *res_name);
 void _wnck_class_group_destroy (WnckClassGroup *class_group);
 void _wnck_class_group_add_window (WnckClassGroup *class_group, WnckWindow *window);
 void _wnck_class_group_remove_window (WnckClassGroup *class_group, WnckWindow *window);
Index: window.c
===================================================================
--- window.c	(révision 1237)
+++ window.c	(copie de travail)
@@ -496,16 +496,16 @@ wnck_window_get_name (WnckWindow *window
  * Checks whether or not @window has an icon name.
  * wnck_window_get_icon_name() will always return some value, even if
  * the window hasn't set an icon name; wnck_window_has_icon_name() can
- * be used to tell if that name is real or not.
+ * be used to tell if that icon name is real or not.
  *
  * (Note that if wnck_window_has_icon_name() returns %FALSE, but
- * wnck_window_has_name() returns %TRUE, then the name returned by
- * wnck_window_get_icon_name() is the window name. Only when both
+ * wnck_window_has_name() returns %TRUE, then the icon name returned by
+ * wnck_window_get_icon_name() is the window icon name. Only when both
  * methods return %FALSE does wnck_window_get_icon_name() return a
- * generic fallback name.)
+ * generic fallback icon name.)
  *
  * Return value: %TRUE if wnck_window_get_icon_name() returns the
- * window's real icon name, %FALSE if it returns a fallback name.
+ * window's real icon name, %FALSE if it returns a fallback icon name.
  **/
 gboolean
 wnck_window_has_icon_name (WnckWindow *window)
Index: application.h
===================================================================
--- application.h	(révision 1237)
+++ application.h	(copie de travail)
@@ -70,7 +70,9 @@ int    wnck_application_get_n_windows (W
  * prop is the same for all windows in the app, return the values for
  * the window. Failing that, they make stuff up.
  */
+gboolean    wnck_application_has_name      (WnckApplication *app);
 const char* wnck_application_get_name      (WnckApplication *app);
+gboolean    wnck_application_has_icon_name (WnckApplication *app);
 const char* wnck_application_get_icon_name (WnckApplication *app);
 int         wnck_application_get_pid       (WnckApplication *app);
 GdkPixbuf*  wnck_application_get_icon      (WnckApplication *app);
