[gtk+] docs: enum cleanup



commit 04192d04a2b74ef90a7dba2104f239b55fc6ac47
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 20 07:50:38 2014 -0400

    docs: enum cleanup
    
    Move types that are only used in binding parsing to
    gtkrc, together with the deprecated api.

 docs/reference/gtk/gtk3-sections.txt |    4 +-
 gtk/deprecated/gtkrc.c               |  100 +++++++++++++++++++++++++++++++++
 gtk/deprecated/gtkrc.h               |   51 +++++++++++++++++
 gtk/gtkbindings.c                    |  101 ----------------------------------
 gtk/gtkbindings.h                    |    6 --
 gtk/gtkenums.h                       |   43 --------------
 6 files changed, 153 insertions(+), 152 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index b7f71d1..002fd70 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -6292,6 +6292,8 @@ GtkRcStyle
 GtkRcStyleClass
 GtkRcFlags
 GtkRcTokenType
+GtkPathPriorityType
+GtkPathType
 gtk_rc_scanner_new
 gtk_rc_get_style
 gtk_rc_get_style_by_paths
@@ -6521,8 +6523,6 @@ GtkJustification
 GtkMovementStep
 GtkOrientation
 GtkPackType
-GtkPathPriorityType
-GtkPathType
 GtkPositionType
 GtkReliefStyle
 GtkResizeMode
diff --git a/gtk/deprecated/gtkrc.c b/gtk/deprecated/gtkrc.c
index 8d12517..17f47be 100644
--- a/gtk/deprecated/gtkrc.c
+++ b/gtk/deprecated/gtkrc.c
@@ -1953,3 +1953,103 @@ gtk_rc_parse_color_full (GScanner   *scanner,
       return G_TOKEN_STRING;
     }
 }
+
+typedef struct {
+  GtkPathType   type;
+  GPatternSpec *pspec;
+  gpointer      user_data;
+  guint         seq_id;
+} PatternSpec;
+
+static void
+pattern_spec_free (PatternSpec *pspec)
+{
+  if (pspec->pspec)
+    g_pattern_spec_free (pspec->pspec);
+  g_free (pspec);
+}
+
+/**
+ * gtk_binding_set_add_path:
+ * @binding_set: a #GtkBindingSet to add a path to
+ * @path_type: path type the pattern applies to
+ * @path_pattern: the actual match pattern
+ * @priority: binding priority
+ *
+ * This function was used internally by the GtkRC parsing mechanism
+ * to assign match patterns to #GtkBindingSet structures.
+ *
+ * In GTK+ 3, these match patterns are unused.
+ *
+ * Deprecated: 3.0
+ */
+void
+gtk_binding_set_add_path (GtkBindingSet       *binding_set,
+                          GtkPathType          path_type,
+                          const gchar         *path_pattern,
+                          GtkPathPriorityType  priority)
+{
+  PatternSpec *pspec;
+  GSList **slist_p, *slist;
+  static guint seq_id = 0;
+
+  g_return_if_fail (binding_set != NULL);
+  g_return_if_fail (path_pattern != NULL);
+  g_return_if_fail (priority <= GTK_PATH_PRIO_MASK);
+
+  priority &= GTK_PATH_PRIO_MASK;
+
+  switch (path_type)
+    {
+    case  GTK_PATH_WIDGET:
+      slist_p = &binding_set->widget_path_pspecs;
+      break;
+    case  GTK_PATH_WIDGET_CLASS:
+      slist_p = &binding_set->widget_class_pspecs;
+      break;
+    case  GTK_PATH_CLASS:
+      slist_p = &binding_set->class_branch_pspecs;
+      break;
+    default:
+      g_assert_not_reached ();
+      slist_p = NULL;
+      break;
+    }
+
+  pspec = g_new (PatternSpec, 1);
+  pspec->type = path_type;
+  if (path_type == GTK_PATH_WIDGET_CLASS)
+    pspec->pspec = NULL;
+  else
+    pspec->pspec = g_pattern_spec_new (path_pattern);
+  pspec->seq_id = priority << 28;
+  pspec->user_data = binding_set;
+
+  slist = *slist_p;
+  while (slist)
+    {
+      PatternSpec *tmp_pspec;
+
+      tmp_pspec = slist->data;
+      slist = slist->next;
+
+      if (g_pattern_spec_equal (tmp_pspec->pspec, pspec->pspec))
+        {
+          GtkPathPriorityType lprio = tmp_pspec->seq_id >> 28;
+
+          pattern_spec_free (pspec);
+          pspec = NULL;
+          if (lprio < priority)
+            {
+              tmp_pspec->seq_id &= 0x0fffffff;
+              tmp_pspec->seq_id |= priority << 28;
+            }
+          break;
+        }
+    }
+  if (pspec)
+    {
+      pspec->seq_id |= seq_id++ & 0x0fffffff;
+      *slist_p = g_slist_prepend (*slist_p, pspec);
+    }
+}
diff --git a/gtk/deprecated/gtkrc.h b/gtk/deprecated/gtkrc.h
index 011cbc8..25b23fb 100644
--- a/gtk/deprecated/gtkrc.h
+++ b/gtk/deprecated/gtkrc.h
@@ -30,6 +30,7 @@
 #endif
 
 #include <gtk/gtkwidget.h>
+#include <gtk/gtkbindings.h>
 
 G_BEGIN_DECLS
 
@@ -309,6 +310,50 @@ typedef enum {
   GTK_RC_TOKEN_LAST
 } GtkRcTokenType;
 
+
+/**
+ * GtkPathPriorityType:
+ * @GTK_PATH_PRIO_LOWEST: Deprecated
+ * @GTK_PATH_PRIO_GTK: Deprecated
+ * @GTK_PATH_PRIO_APPLICATION: Deprecated
+ * @GTK_PATH_PRIO_THEME: Deprecated
+ * @GTK_PATH_PRIO_RC: Deprecated
+ * @GTK_PATH_PRIO_HIGHEST: Deprecated
+ *
+ * Priorities for path lookups.
+ * See also gtk_binding_set_add_path().
+ *
+ * Deprecated: 3.0
+ */
+typedef enum
+{
+  GTK_PATH_PRIO_LOWEST      = 0,
+  GTK_PATH_PRIO_GTK         = 4,
+  GTK_PATH_PRIO_APPLICATION = 8,
+  GTK_PATH_PRIO_THEME       = 10,
+  GTK_PATH_PRIO_RC          = 12,
+  GTK_PATH_PRIO_HIGHEST     = 15
+} GtkPathPriorityType;
+#define GTK_PATH_PRIO_MASK 0x0f
+
+/**
+ * GtkPathType:
+ * @GTK_PATH_WIDGET: Deprecated
+ * @GTK_PATH_WIDGET_CLASS: Deprecated
+ * @GTK_PATH_CLASS: Deprecated
+ *
+ * Widget path types.
+ * See also gtk_binding_set_add_path().
+ *
+ * Deprecated: 3.0
+ */
+typedef enum
+{
+  GTK_PATH_WIDGET,
+  GTK_PATH_WIDGET_CLASS,
+  GTK_PATH_CLASS
+} GtkPathType;
+
 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
 GScanner* gtk_rc_scanner_new    (void);
 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
@@ -349,6 +394,12 @@ struct _GtkRcProperty
   GValue value;
 };
 
+GDK_DEPRECATED_IN_3_0
+void      gtk_binding_set_add_path (GtkBindingSet       *binding_set,
+                                    GtkPathType          path_type,
+                                    const gchar         *path_pattern,
+                                    GtkPathPriorityType  priority);
+
 G_END_DECLS
 
 #endif /* __GTK_RC_H__ */
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index 11ce5d3..f2f9c01 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -143,13 +143,6 @@ GType gtk_identifier_get_type (void) G_GNUC_CONST;
 
 
 /* --- structures --- */
-typedef struct {
-  GtkPathType   type;
-  GPatternSpec *pspec;
-  gpointer      user_data;
-  guint         seq_id;
-} PatternSpec;
-
 typedef enum {
   GTK_BINDING_TOKEN_BIND,
   GTK_BINDING_TOKEN_UNBIND
@@ -178,14 +171,6 @@ gtk_identifier_get_type (void)
   return our_type;
 }
 
-static void
-pattern_spec_free (PatternSpec *pspec)
-{
-  if (pspec->pspec)
-    g_pattern_spec_free (pspec->pspec);
-  g_free (pspec);
-}
-
 static GtkBindingSignal*
 binding_signal_new (const gchar *signal_name,
                     guint        n_args)
@@ -1401,92 +1386,6 @@ gtk_binding_entry_add_signal_from_string (GtkBindingSet *binding_set,
   return ret;
 }
 
-/**
- * gtk_binding_set_add_path:
- * @binding_set: a #GtkBindingSet to add a path to
- * @path_type: path type the pattern applies to
- * @path_pattern: the actual match pattern
- * @priority: binding priority
- *
- * This function was used internally by the GtkRC parsing mechanism
- * to assign match patterns to #GtkBindingSet structures.
- *
- * In GTK+ 3, these match patterns are unused.
- *
- * Deprecated: 3.0
- */
-void
-gtk_binding_set_add_path (GtkBindingSet       *binding_set,
-                          GtkPathType          path_type,
-                          const gchar         *path_pattern,
-                          GtkPathPriorityType  priority)
-{
-  PatternSpec *pspec;
-  GSList **slist_p, *slist;
-  static guint seq_id = 0;
-
-  g_return_if_fail (binding_set != NULL);
-  g_return_if_fail (path_pattern != NULL);
-  g_return_if_fail (priority <= GTK_PATH_PRIO_MASK);
-
-  priority &= GTK_PATH_PRIO_MASK;
-
-  switch (path_type)
-    {
-    case  GTK_PATH_WIDGET:
-      slist_p = &binding_set->widget_path_pspecs;
-      break;
-    case  GTK_PATH_WIDGET_CLASS:
-      slist_p = &binding_set->widget_class_pspecs;
-      break;
-    case  GTK_PATH_CLASS:
-      slist_p = &binding_set->class_branch_pspecs;
-      break;
-    default:
-      g_assert_not_reached ();
-      slist_p = NULL;
-      break;
-    }
-
-  pspec = g_new (PatternSpec, 1);
-  pspec->type = path_type;
-  if (path_type == GTK_PATH_WIDGET_CLASS)
-    pspec->pspec = NULL;
-  else
-    pspec->pspec = g_pattern_spec_new (path_pattern);
-
-  pspec->seq_id = priority << 28;
-  pspec->user_data = binding_set;
-
-  slist = *slist_p;
-  while (slist)
-    {
-      PatternSpec *tmp_pspec;
-
-      tmp_pspec = slist->data;
-      slist = slist->next;
-
-      if (g_pattern_spec_equal (tmp_pspec->pspec, pspec->pspec))
-        {
-          GtkPathPriorityType lprio = tmp_pspec->seq_id >> 28;
-
-          pattern_spec_free (pspec);
-          pspec = NULL;
-          if (lprio < priority)
-            {
-              tmp_pspec->seq_id &= 0x0fffffff;
-              tmp_pspec->seq_id |= priority << 28;
-            }
-          break;
-        }
-    }
-  if (pspec)
-    {
-      pspec->seq_id |= seq_id++ & 0x0fffffff;
-      *slist_p = g_slist_prepend (*slist_p, pspec);
-    }
-}
-
 static gint
 find_entry_with_binding (GtkBindingEntry *entry,
                          GtkBindingSet   *binding_set)
diff --git a/gtk/gtkbindings.h b/gtk/gtkbindings.h
index ca40775..d0c6030 100644
--- a/gtk/gtkbindings.h
+++ b/gtk/gtkbindings.h
@@ -188,12 +188,6 @@ void           gtk_binding_entry_remove      (GtkBindingSet       *binding_set,
                                               guint                keyval,
                                               GdkModifierType      modifiers);
 
-GDK_DEPRECATED_IN_3_0
-void           gtk_binding_set_add_path      (GtkBindingSet       *binding_set,
-                                              GtkPathType          path_type,
-                                              const gchar         *path_pattern,
-                                              GtkPathPriorityType  priority);
-
 G_END_DECLS
 
 #endif /* __GTK_BINDINGS_H__ */
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index be3bd75..7800aa2 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -375,49 +375,6 @@ typedef enum
 } GtkPackType;
 
 /**
- * GtkPathPriorityType:
- * @GTK_PATH_PRIO_LOWEST: Deprecated
- * @GTK_PATH_PRIO_GTK: Deprecated
- * @GTK_PATH_PRIO_APPLICATION: Deprecated
- * @GTK_PATH_PRIO_THEME: Deprecated
- * @GTK_PATH_PRIO_RC: Deprecated
- * @GTK_PATH_PRIO_HIGHEST: Deprecated
- *
- * Priorities for path lookups.
- * See also gtk_binding_set_add_path().
- *
- * Deprecated: 3.0
- */
-typedef enum
-{
-  GTK_PATH_PRIO_LOWEST      = 0,
-  GTK_PATH_PRIO_GTK        = 4,
-  GTK_PATH_PRIO_APPLICATION = 8,
-  GTK_PATH_PRIO_THEME       = 10,
-  GTK_PATH_PRIO_RC          = 12,
-  GTK_PATH_PRIO_HIGHEST     = 15
-} GtkPathPriorityType;
-#define GTK_PATH_PRIO_MASK 0x0f
-
-/**
- * GtkPathType:
- * @GTK_PATH_WIDGET: Deprecated
- * @GTK_PATH_WIDGET_CLASS: Deprecated
- * @GTK_PATH_CLASS: Deprecated
- *
- * Widget path types.
- * See also gtk_binding_set_add_path().
- *
- * Deprecated: 3.0
- */
-typedef enum
-{
-  GTK_PATH_WIDGET,
-  GTK_PATH_WIDGET_CLASS,
-  GTK_PATH_CLASS
-} GtkPathType;
-
-/**
  * GtkPositionType:
  * @GTK_POS_LEFT: The feature is at the left edge.
  * @GTK_POS_RIGHT: The feature is at the right edge.


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