GtkWidgetPath: Make iter API deal with gints.
now gtk_widget_path_iter_* takes gints instead of guints, and also accept numbers == -1 or > path_length for the path head.
This commit is contained in:
@ -215,7 +215,7 @@ gtk_widget_path_free (GtkWidgetPath *path)
|
|||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
guint
|
gint
|
||||||
gtk_widget_path_length (const GtkWidgetPath *path)
|
gtk_widget_path_length (const GtkWidgetPath *path)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (path != NULL, 0);
|
g_return_val_if_fail (path != NULL, 0);
|
||||||
@ -256,7 +256,7 @@ gtk_widget_path_prepend_type (GtkWidgetPath *path,
|
|||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
guint
|
gint
|
||||||
gtk_widget_path_append_type (GtkWidgetPath *path,
|
gtk_widget_path_append_type (GtkWidgetPath *path,
|
||||||
GType type)
|
GType type)
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ gtk_widget_path_append_type (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_get_widget_type:
|
* gtk_widget_path_iter_get_widget_type:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to get the widget type for
|
* @pos: position to get the widget type for, -1 for the path head
|
||||||
*
|
*
|
||||||
* Returns the widget #GType that is at position @pos in the widget
|
* Returns the widget #GType that is at position @pos in the widget
|
||||||
* hierarchy defined in @path.
|
* hierarchy defined in @path.
|
||||||
@ -285,12 +285,15 @@ gtk_widget_path_append_type (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
GType
|
GType
|
||||||
gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, G_TYPE_INVALID);
|
g_return_val_if_fail (path != NULL, G_TYPE_INVALID);
|
||||||
g_return_val_if_fail (pos < path->elems->len, G_TYPE_INVALID);
|
g_return_val_if_fail (path->elems->len != 0, G_TYPE_INVALID);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
return elem->type;
|
return elem->type;
|
||||||
@ -299,7 +302,7 @@ gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_set_widget_type:
|
* gtk_widget_path_iter_set_widget_type:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @type: widget type to set
|
* @type: widget type to set
|
||||||
*
|
*
|
||||||
* Sets the widget type for a given position in the widget hierarchy
|
* Sets the widget type for a given position in the widget hierarchy
|
||||||
@ -309,15 +312,18 @@ gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GType type)
|
GType type)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET));
|
g_return_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET));
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
elem->type = type;
|
elem->type = type;
|
||||||
}
|
}
|
||||||
@ -325,7 +331,7 @@ gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_get_name:
|
* gtk_widget_path_iter_get_name:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to get the widget name for
|
* @pos: position to get the widget name for, -1 for the path head
|
||||||
*
|
*
|
||||||
* Returns the name corresponding to the widget found at
|
* Returns the name corresponding to the widget found at
|
||||||
* the position @pos in the widget hierarchy defined by
|
* the position @pos in the widget hierarchy defined by
|
||||||
@ -335,12 +341,15 @@ gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
G_CONST_RETURN gchar *
|
G_CONST_RETURN gchar *
|
||||||
gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
g_return_val_if_fail (path != NULL, NULL);
|
||||||
g_return_val_if_fail (pos < path->elems->len, NULL);
|
g_return_val_if_fail (path->elems->len != 0, NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
return g_quark_to_string (elem->name);
|
return g_quark_to_string (elem->name);
|
||||||
@ -349,7 +358,7 @@ gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_set_name:
|
* gtk_widget_path_iter_set_name:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @name: widget name
|
* @name: widget name
|
||||||
*
|
*
|
||||||
* Sets the widget name for the widget found at position @pos
|
* Sets the widget name for the widget found at position @pos
|
||||||
@ -359,15 +368,18 @@ gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
elem->name = g_quark_from_string (name);
|
elem->name = g_quark_from_string (name);
|
||||||
@ -376,7 +388,7 @@ gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_qname:
|
* gtk_widget_path_iter_has_qname:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @qname: widget name as a #GQuark
|
* @qname: widget name as a #GQuark
|
||||||
*
|
*
|
||||||
* See gtk_widget_path_iter_has_name(). This is a version
|
* See gtk_widget_path_iter_has_name(). This is a version
|
||||||
@ -388,14 +400,17 @@ gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname)
|
GQuark qname)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (qname != 0, FALSE);
|
g_return_val_if_fail (qname != 0, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
@ -405,7 +420,7 @@ gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_name:
|
* gtk_widget_path_iter_has_name:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @name: a widget name
|
* @name: a widget name
|
||||||
*
|
*
|
||||||
* Returns %TRUE if the widget at position @pos has the name @name,
|
* Returns %TRUE if the widget at position @pos has the name @name,
|
||||||
@ -417,14 +432,16 @@ gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GQuark qname;
|
GQuark qname;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
qname = g_quark_try_string (name);
|
qname = g_quark_try_string (name);
|
||||||
|
|
||||||
@ -437,7 +454,7 @@ gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_add_class:
|
* gtk_widget_path_iter_add_class:
|
||||||
* @path: a #GtkWidget
|
* @path: a #GtkWidget
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @name: a class name
|
* @name: a class name
|
||||||
*
|
*
|
||||||
* Adds the class @name to the widget at position @pos in
|
* Adds the class @name to the widget at position @pos in
|
||||||
@ -448,7 +465,7 @@ gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
@ -457,9 +474,12 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
|||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
qname = g_quark_from_string (name);
|
qname = g_quark_from_string (name);
|
||||||
|
|
||||||
@ -493,7 +513,7 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_remove_class:
|
* gtk_widget_path_iter_remove_class:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @name: class name
|
* @name: class name
|
||||||
*
|
*
|
||||||
* Removes the class @name from the widget at position @pos in
|
* Removes the class @name from the widget at position @pos in
|
||||||
@ -503,7 +523,7 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
@ -511,9 +531,12 @@ gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
|||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
qname = g_quark_try_string (name);
|
qname = g_quark_try_string (name);
|
||||||
|
|
||||||
if (qname == 0)
|
if (qname == 0)
|
||||||
@ -543,7 +566,7 @@ gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_clear_classes:
|
* gtk_widget_path_iter_clear_classes:
|
||||||
* @path: a #GtkWidget
|
* @path: a #GtkWidget
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
*
|
*
|
||||||
* Removes all classes from the widget at position @pos in the
|
* Removes all classes from the widget at position @pos in the
|
||||||
* hierarchy defined in @path.
|
* hierarchy defined in @path.
|
||||||
@ -552,12 +575,15 @@ gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
@ -571,7 +597,7 @@ gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_list_classes:
|
* gtk_widget_path_iter_list_classes:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
*
|
*
|
||||||
* Returns a list with all the class names defined for the widget
|
* Returns a list with all the class names defined for the widget
|
||||||
* at position @pos in the hierarchy defined in @path.
|
* at position @pos in the hierarchy defined in @path.
|
||||||
@ -585,14 +611,17 @@ gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
GSList *
|
GSList *
|
||||||
gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
g_return_val_if_fail (path != NULL, NULL);
|
||||||
g_return_val_if_fail (pos < path->elems->len, NULL);
|
g_return_val_if_fail (path->elems->len != 0, NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
@ -613,7 +642,7 @@ gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_qclass:
|
* gtk_widget_path_iter_has_qclass:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @qname: class name as a #GQuark
|
* @qname: class name as a #GQuark
|
||||||
*
|
*
|
||||||
* See gtk_widget_path_iter_has_class(). This is a version that operates
|
* See gtk_widget_path_iter_has_class(). This is a version that operates
|
||||||
@ -625,16 +654,19 @@ gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname)
|
GQuark qname)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (qname != 0, FALSE);
|
g_return_val_if_fail (qname != 0, FALSE);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
if (!elem->classes)
|
if (!elem->classes)
|
||||||
@ -658,7 +690,7 @@ gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_class:
|
* gtk_widget_path_iter_has_class:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @name: class name
|
* @name: class name
|
||||||
*
|
*
|
||||||
* Returns %TRUE if the widget at position @pos has the class @name
|
* Returns %TRUE if the widget at position @pos has the class @name
|
||||||
@ -670,15 +702,18 @@ gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GQuark qname;
|
GQuark qname;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
qname = g_quark_try_string (name);
|
qname = g_quark_try_string (name);
|
||||||
|
|
||||||
if (qname == 0)
|
if (qname == 0)
|
||||||
@ -690,7 +725,7 @@ gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_add_region:
|
* gtk_widget_path_iter_add_region:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @name: region name
|
* @name: region name
|
||||||
* @flags: flags affecting the region
|
* @flags: flags affecting the region
|
||||||
*
|
*
|
||||||
@ -702,7 +737,7 @@ gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkRegionFlags flags)
|
GtkRegionFlags flags)
|
||||||
{
|
{
|
||||||
@ -710,9 +745,12 @@ gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
|||||||
GQuark qname;
|
GQuark qname;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
qname = g_quark_from_string (name);
|
qname = g_quark_from_string (name);
|
||||||
|
|
||||||
@ -727,7 +765,7 @@ gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_remove_region:
|
* gtk_widget_path_iter_remove_region:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
* @name: region name
|
* @name: region name
|
||||||
*
|
*
|
||||||
* Removes the region @name from the widget at position @pos in
|
* Removes the region @name from the widget at position @pos in
|
||||||
@ -737,16 +775,19 @@ gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
GQuark qname;
|
GQuark qname;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
qname = g_quark_try_string (name);
|
qname = g_quark_try_string (name);
|
||||||
|
|
||||||
if (qname == 0)
|
if (qname == 0)
|
||||||
@ -761,7 +802,7 @@ gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_clear_regions:
|
* gtk_widget_path_iter_clear_regions:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to modify
|
* @pos: position to modify, -1 for the path head
|
||||||
*
|
*
|
||||||
* Removes all regions from the widget at position @pos in the
|
* Removes all regions from the widget at position @pos in the
|
||||||
* hierarchy defined in @path.
|
* hierarchy defined in @path.
|
||||||
@ -770,12 +811,15 @@ gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
|
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (pos < path->elems->len);
|
g_return_if_fail (path->elems->len != 0);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
@ -786,7 +830,7 @@ gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_list_regions:
|
* gtk_widget_path_iter_list_regions:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
*
|
*
|
||||||
* Returns a list with all the region names defined for the widget
|
* Returns a list with all the region names defined for the widget
|
||||||
* at position @pos in the hierarchy defined in @path.
|
* at position @pos in the hierarchy defined in @path.
|
||||||
@ -800,7 +844,7 @@ gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
GSList *
|
GSList *
|
||||||
gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
||||||
guint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
GtkPathElement *elem;
|
GtkPathElement *elem;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
@ -808,7 +852,10 @@ gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
|||||||
gpointer key;
|
gpointer key;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
g_return_val_if_fail (path != NULL, NULL);
|
||||||
g_return_val_if_fail (pos < path->elems->len, NULL);
|
g_return_val_if_fail (path->elems->len != 0, NULL);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
@ -831,7 +878,7 @@ gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_qregion:
|
* gtk_widget_path_iter_has_qregion:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @qname: region name as a #GQuark
|
* @qname: region name as a #GQuark
|
||||||
* @flags: (out): return location for the region flags
|
* @flags: (out): return location for the region flags
|
||||||
*
|
*
|
||||||
@ -844,7 +891,7 @@ gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname,
|
GQuark qname,
|
||||||
GtkRegionFlags *flags)
|
GtkRegionFlags *flags)
|
||||||
{
|
{
|
||||||
@ -852,9 +899,12 @@ gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
|||||||
gpointer value;
|
gpointer value;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (qname != 0, FALSE);
|
g_return_val_if_fail (qname != 0, FALSE);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
elem = &g_array_index (path->elems, GtkPathElement, pos);
|
||||||
|
|
||||||
if (!elem->regions)
|
if (!elem->regions)
|
||||||
@ -874,7 +924,7 @@ gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
|||||||
/**
|
/**
|
||||||
* gtk_widget_path_iter_has_region:
|
* gtk_widget_path_iter_has_region:
|
||||||
* @path: a #GtkWidgetPath
|
* @path: a #GtkWidgetPath
|
||||||
* @pos: position to query
|
* @pos: position to query, -1 for the path head
|
||||||
* @name: region name
|
* @name: region name
|
||||||
* @flags: (out): return location for the region flags
|
* @flags: (out): return location for the region flags
|
||||||
*
|
*
|
||||||
@ -887,16 +937,19 @@ gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
|
gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkRegionFlags *flags)
|
GtkRegionFlags *flags)
|
||||||
{
|
{
|
||||||
GQuark qname;
|
GQuark qname;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
g_return_val_if_fail (pos < path->elems->len, FALSE);
|
g_return_val_if_fail (path->elems->len != 0, FALSE);
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
|
|
||||||
|
if (pos < 0 || pos > path->elems->len)
|
||||||
|
pos = path->elems->len - 1;
|
||||||
|
|
||||||
qname = g_quark_try_string (name);
|
qname = g_quark_try_string (name);
|
||||||
|
|
||||||
if (qname == 0)
|
if (qname == 0)
|
||||||
|
@ -33,67 +33,67 @@ GtkWidgetPath * gtk_widget_path_new (void);
|
|||||||
GtkWidgetPath * gtk_widget_path_copy (const GtkWidgetPath *path);
|
GtkWidgetPath * gtk_widget_path_copy (const GtkWidgetPath *path);
|
||||||
void gtk_widget_path_free (GtkWidgetPath *path);
|
void gtk_widget_path_free (GtkWidgetPath *path);
|
||||||
|
|
||||||
guint gtk_widget_path_length (const GtkWidgetPath *path);
|
gint gtk_widget_path_length (const GtkWidgetPath *path);
|
||||||
|
|
||||||
guint gtk_widget_path_append_type (GtkWidgetPath *path,
|
gint gtk_widget_path_append_type (GtkWidgetPath *path,
|
||||||
GType type);
|
GType type);
|
||||||
void gtk_widget_path_prepend_type (GtkWidgetPath *path,
|
void gtk_widget_path_prepend_type (GtkWidgetPath *path,
|
||||||
GType type);
|
GType type);
|
||||||
|
|
||||||
GType gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
GType gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
void gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
void gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GType type);
|
GType type);
|
||||||
|
|
||||||
G_CONST_RETURN gchar * gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
G_CONST_RETURN gchar * gtk_widget_path_iter_get_name (const GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
void gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
void gtk_widget_path_iter_set_name (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
gboolean gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
gboolean gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_qname (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname);
|
GQuark qname);
|
||||||
|
|
||||||
void gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
void gtk_widget_path_iter_add_class (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
void gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
void gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
void gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
void gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
GSList * gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
GSList * gtk_widget_path_iter_list_classes (const GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
gboolean gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_class (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
gboolean gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_qclass (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname);
|
GQuark qname);
|
||||||
|
|
||||||
void gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
void gtk_widget_path_iter_add_region (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkRegionFlags flags);
|
GtkRegionFlags flags);
|
||||||
void gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
void gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
void gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
void gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
|
|
||||||
GSList * gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
GSList * gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
|
||||||
guint pos);
|
gint pos);
|
||||||
|
|
||||||
gboolean gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkRegionFlags *flags);
|
GtkRegionFlags *flags);
|
||||||
gboolean gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
gboolean gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
|
||||||
guint pos,
|
gint pos,
|
||||||
GQuark qname,
|
GQuark qname,
|
||||||
GtkRegionFlags *flags);
|
GtkRegionFlags *flags);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user