Commit 04192d04 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

docs: enum cleanup

Move types that are only used in binding parsing to
gtkrc, together with the deprecated api.
parent e5a1734c
......@@ -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
......
......@@ -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);
}
}
......@@ -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__ */
......@@ -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)
......
......@@ -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__ */
......@@ -374,49 +374,6 @@ typedef enum
GTK_PACK_END
} 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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment