[libwnck] core, wnckprop: Use "ID" instead of "resource class" in WnckClassGroup



commit de8fb576b2db973e0adf98f412a5667a2c4b2d09
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Aug 12 12:46:49 2011 +0200

    core, wnckprop: Use "ID" instead of "resource class" in WnckClassGroup
    
    To avoid any confusion for people not knowing what the WM_CLASS is, we
    talk about "identifier" instead of "resource class".
    
    This means we deprecate wnck_class_group_get_res_class();
    wnck_class_group_get_id() should be used instead.

 libwnck/class-group.c |   35 +++++++++++++++++++++++++++++------
 libwnck/class-group.h |    8 ++++++--
 libwnck/tasklist.c    |    2 +-
 libwnck/window.c      |    4 ++--
 libwnck/wnckprop.c    |   17 ++++++++++-------
 5 files changed, 48 insertions(+), 18 deletions(-)
---
diff --git a/libwnck/class-group.c b/libwnck/class-group.c
index 4adbdc1..f0fee23 100644
--- a/libwnck/class-group.c
+++ b/libwnck/class-group.c
@@ -22,6 +22,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#undef WNCK_DISABLE_DEPRECATED
+
 #include <string.h>
 #include "class-group.h"
 #include "window.h"
@@ -161,24 +163,24 @@ wnck_class_group_finalize (GObject *object)
 
 /**
  * wnck_class_group_get:
- * @res_class: name of the sought resource class.
+ * @id: identifier name of the sought resource class.
  *
- * Gets the #WnckClassGroup corresponding to @res_class.
+ * Gets the #WnckClassGroup corresponding to @id.
  *
  * Return value: (transfer none): the #WnckClassGroup corresponding to
- * @res_class, or %NULL if there is no #WnckClassGroup with the specified
- * @res_class. The returned #WnckClassGroup is owned by libwnck and must not be
+ * @id, or %NULL if there is no #WnckClassGroup with the specified
+ * @id. The returned #WnckClassGroup is owned by libwnck and must not be
  * referenced or unreferenced.
  *
  * Since: 2.2
  **/
 WnckClassGroup *
-wnck_class_group_get (const char *res_class)
+wnck_class_group_get (const char *id)
 {
   if (!class_group_hash)
     return NULL;
   else
-    return g_hash_table_lookup (class_group_hash, res_class ? res_class : "");
+    return g_hash_table_lookup (class_group_hash, id ? id : "");
 }
 
 /**
@@ -526,6 +528,26 @@ wnck_class_group_get_windows (WnckClassGroup *class_group)
 }
 
 /**
+ * wnck_class_group_get_id:
+ * @class_group: a #WnckClassGroup.
+ *
+ * Gets the identifier name for @class_group. This is the resource class for
+ * @class_group.
+ *
+ * Return value: the identifier name of @class_group, or an
+ * empty string if the group has no identifier name.
+ *
+ * Since: 3.2
+ **/
+const char *
+wnck_class_group_get_id (WnckClassGroup *class_group)
+{
+  g_return_val_if_fail (class_group != NULL, NULL);
+
+  return class_group->priv->res_class;
+}
+
+/**
  * wnck_class_group_get_res_class:
  * @class_group: a #WnckClassGroup.
  *
@@ -535,6 +557,7 @@ wnck_class_group_get_windows (WnckClassGroup *class_group)
  * empty string if the group has no resource class name.
  *
  * Since: 2.2
+ * Deprecated:3.2: Use wnck_class_group_get_id() instead.
  **/
 const char *
 wnck_class_group_get_res_class (WnckClassGroup *class_group)
diff --git a/libwnck/class-group.h b/libwnck/class-group.h
index 337ecab..ab77ec2 100644
--- a/libwnck/class-group.h
+++ b/libwnck/class-group.h
@@ -74,16 +74,20 @@ struct _WnckClassGroupClass
 
 GType wnck_class_group_get_type (void) G_GNUC_CONST;
 
-WnckClassGroup *wnck_class_group_get (const char *res_class);
+WnckClassGroup *wnck_class_group_get (const char *id);
 
 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_id (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);
 
+#ifndef WNCK_DISABLE_DEPRECATED
+const char * wnck_class_group_get_res_class (WnckClassGroup *class_group);
+#endif
+
 G_END_DECLS
 
 #endif /* WNCK_CLASS_GROUP_H */
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index 178d670..3d9aae5 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -2162,7 +2162,7 @@ wnck_tasklist_update_lists (WnckTasklist *tasklist)
 
 	  class_group = wnck_window_get_class_group (win);
           /* don't group windows if they do not belong to any class */
-          if (strcmp (wnck_class_group_get_res_class (class_group), "") != 0)
+          if (strcmp (wnck_class_group_get_id (class_group), "") != 0)
             {
               class_group_task =
                         g_hash_table_lookup (tasklist->priv->class_group_hash,
diff --git a/libwnck/window.c b/libwnck/window.c
index 8ddd78b..0796957 100644
--- a/libwnck/window.c
+++ b/libwnck/window.c
@@ -1180,8 +1180,8 @@ _wnck_window_get_startup_id (WnckWindow *window)
  * url="http://tronche.com/gui/x/icccm/sec-4.html&num;WM_CLASS";>WM_CLASS Property</ulink>
  * for @window.
  *
- * The class group name can also be fetched from the #WnckClassGroup to which
- * @window belongs.
+ * The class group name is also the identifier name of the #WnckClassGroup to
+ * which @window belongs.
  *
  * Return value: the class group name for @window, or %NULL if @window belongs
  * to no class group.
diff --git a/libwnck/wnckprop.c b/libwnck/wnckprop.c
index 5691f52..ac00217 100644
--- a/libwnck/wnckprop.c
+++ b/libwnck/wnckprop.c
@@ -1347,10 +1347,13 @@ print_class_group (WnckClassGroup *class_group)
 
   windows = wnck_class_group_get_windows (class_group);
 
-  /* Translators: Resource class is the name to identify a class. */
-  g_print (_("Resource Class: %s\n"),
-           wnck_class_group_get_res_class (class_group));
-  g_print (_("Group Name: %s\n"), wnck_class_group_get_name (class_group));
+  /* Translators: A class is like a "family". E.g., all gvim windows are of the
+   * same class. */
+  g_print (_("Class Group ID: %s\n"),
+           wnck_class_group_get_id (class_group));
+  /* Translators: A class is like a "family". E.g., all gvim windows are of the
+   * same class. */
+  g_print (_("Class Group Name: %s\n"), wnck_class_group_get_name (class_group));
 
   /* TODO: missing API */
 #if 0
@@ -1498,14 +1501,14 @@ print_window (WnckWindow *window)
   g_print (_("Geometry (x, y, width, height): %d, %d, %d, %d\n"), x, y, w, h);
 
   class_group = wnck_window_get_class_group (window);
-  if (strcmp (wnck_class_group_get_res_class (class_group), ""))
-    buf = wnck_class_group_get_res_class (class_group);
+  if (strcmp (wnck_class_group_get_id (class_group), ""))
+    buf = wnck_class_group_get_id (class_group);
   else
     /* Translators: 'unset' in the sense of "something has not been set". */
     buf = _("<unset>");
   /* Translators: A class is like a "family". E.g., all gvim windows are of the
    * same class. */
-  g_print (_("Class Group: %s\n"), buf);
+  g_print (_("Class Group ID: %s\n"), buf);
 
   if (g_strcmp0 (wnck_window_get_class_instance_name (window), ""))
     buf = wnck_window_get_class_instance_name (window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]