gtk_widget_path_append_type
gtk_widget_path_copy
gtk_widget_path_free
-gtk_widget_path_get_widget_type
+gtk_widget_path_get_object_type
gtk_widget_path_has_parent
gtk_widget_path_is_type
gtk_widget_path_iter_add_class
gtk_widget_path_iter_clear_classes
gtk_widget_path_iter_clear_regions
gtk_widget_path_iter_get_name
-gtk_widget_path_iter_get_widget_type
+gtk_widget_path_iter_get_object_type
gtk_widget_path_iter_has_class
gtk_widget_path_iter_has_name
gtk_widget_path_iter_has_qclass
gtk_widget_path_iter_remove_class
gtk_widget_path_iter_remove_region
gtk_widget_path_iter_set_name
-gtk_widget_path_iter_set_widget_type
+gtk_widget_path_iter_set_object_type
gtk_widget_path_length
gtk_widget_path_new
gtk_widget_path_prepend_type
gtk_widget_path_copy
gtk_widget_path_free
gtk_widget_path_get_type G_GNUC_CONST
-gtk_widget_path_get_widget_type
+gtk_widget_path_get_object_type
gtk_widget_path_has_parent
gtk_widget_path_is_type
gtk_widget_path_iter_add_class
gtk_widget_path_iter_clear_classes
gtk_widget_path_iter_clear_regions
gtk_widget_path_iter_get_name
-gtk_widget_path_iter_get_widget_type
+gtk_widget_path_iter_get_object_type
gtk_widget_path_iter_has_class
gtk_widget_path_iter_has_name
gtk_widget_path_iter_has_qclass
gtk_widget_path_iter_remove_class
gtk_widget_path_iter_remove_region
gtk_widget_path_iter_set_name
-gtk_widget_path_iter_set_widget_type
+gtk_widget_path_iter_set_object_type
gtk_widget_path_length
gtk_widget_path_new
gtk_widget_path_prepend_type
{
GType type;
- type = gtk_widget_path_iter_get_widget_type (path, index);
+ type = gtk_widget_path_iter_get_object_type (path, index);
if (!g_type_is_a (type, elem->type))
return FALSE;
if (!priv->widget_path)
return;
- widget_type = gtk_widget_path_get_widget_type (priv->widget_path);
+ widget_type = gtk_widget_path_get_object_type (priv->widget_path);
+
+ if (!g_type_is_a (widget_type, GTK_TYPE_WIDGET))
+ {
+ g_warning ("%s: can't get style properties for non-widget class `%s'",
+ G_STRLOC,
+ g_type_name (widget_type));
+ return;
+ }
widget_class = g_type_class_ref (widget_type);
pspec = gtk_widget_class_find_style_property (widget_class, property_name);
GtkStyleContextPrivate *priv;
const gchar *prop_name;
GtkStateFlags state;
+ GType widget_type;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
if (!priv->widget_path)
return;
+ widget_type = gtk_widget_path_get_object_type (priv->widget_path);
+
+ if (!g_type_is_a (widget_type, GTK_TYPE_WIDGET))
+ {
+ g_warning ("%s: can't get style properties for non-widget class `%s'",
+ G_STRLOC,
+ g_type_name (widget_type));
+ return;
+ }
+
state = gtk_style_context_get_state (context);
while (prop_name)
GtkWidgetClass *widget_class;
GParamSpec *pspec;
const GValue *peek_value;
- GType widget_type;
gchar *error;
- widget_type = gtk_widget_path_get_widget_type (priv->widget_path);
-
widget_class = g_type_class_ref (widget_type);
pspec = gtk_widget_class_find_style_property (widget_class, prop_name);
g_type_class_unref (widget_class);
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), FALSE);
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (gtk_widget_path_get_widget_type (path), pspec->owner_type), FALSE);
+ g_return_val_if_fail (g_type_is_a (gtk_widget_path_get_object_type (path), pspec->owner_type), FALSE);
g_return_val_if_fail (value != NULL, FALSE);
iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
* implementation with a wrong widget type in the widget path
*/
if (widget->priv->path &&
- G_OBJECT_TYPE (widget) != gtk_widget_path_get_widget_type (widget->priv->path))
+ G_OBJECT_TYPE (widget) != gtk_widget_path_get_object_type (widget->priv->path))
{
gtk_widget_path_free (widget->priv->path);
widget->priv->path = NULL;
GtkPathElement new = { 0 };
g_return_if_fail (path != NULL);
- g_return_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET));
new.type = type;
g_array_prepend_val (path->elems, new);
GtkPathElement new = { 0 };
g_return_val_if_fail (path != NULL, 0);
- g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), 0);
new.type = type;
g_array_append_val (path->elems, new);
}
/**
- * gtk_widget_path_iter_get_widget_type:
+ * gtk_widget_path_iter_get_object_type:
* @path: a #GtkWidgetPath
- * @pos: position to get the widget type for, -1 for the path head
+ * @pos: position to get the object type for, -1 for the path head
*
- * Returns the widget #GType that is at position @pos in the widget
+ * Returns the object #GType that is at position @pos in the widget
* hierarchy defined in @path.
*
* Returns: a widget type
* Since: 3.0
**/
GType
-gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
+gtk_widget_path_iter_get_object_type (const GtkWidgetPath *path,
gint pos)
{
GtkPathElement *elem;
}
/**
- * gtk_widget_path_iter_set_widget_type:
+ * gtk_widget_path_iter_set_object_type:
* @path: a #GtkWidgetPath
* @pos: position to modify, -1 for the path head
- * @type: widget type to set
+ * @type: object type to set
*
- * Sets the widget type for a given position in the widget hierarchy
- * defined by @path. @type must be a #GtkWidget derived #GType.
+ * Sets the object type for a given position in the widget hierarchy
+ * defined by @path.
*
* Since: 3.0
**/
void
-gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
+gtk_widget_path_iter_set_object_type (GtkWidgetPath *path,
gint pos,
GType type)
{
g_return_if_fail (path != NULL);
g_return_if_fail (path->elems->len != 0);
- g_return_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET));
if (pos < 0 || pos > path->elems->len)
pos = path->elems->len - 1;
}
/**
- * gtk_widget_path_get_widget_type:
+ * gtk_widget_path_get_object_type:
* @path: a #GtkWidget
*
- * Returns the topmost widget type, that is, the widget type this path
+ * Returns the topmost object type, that is, the object type this path
* is representing.
*
- * Returns: The widget type
+ * Returns: The object type
*
* Since: 3.0
**/
GType
-gtk_widget_path_get_widget_type (const GtkWidgetPath *path)
+gtk_widget_path_get_object_type (const GtkWidgetPath *path)
{
GtkPathElement *elem;
GtkPathElement *elem;
g_return_val_if_fail (path != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), FALSE);
elem = &g_array_index (path->elems, GtkPathElement,
path->elems->len - 1);
guint i;
g_return_val_if_fail (path != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), FALSE);
for (i = 0; i < path->elems->len - 1; i++)
{
void gtk_widget_path_prepend_type (GtkWidgetPath *path,
GType type);
-GType gtk_widget_path_iter_get_widget_type (const GtkWidgetPath *path,
+GType gtk_widget_path_iter_get_object_type (const GtkWidgetPath *path,
gint pos);
-void gtk_widget_path_iter_set_widget_type (GtkWidgetPath *path,
+void gtk_widget_path_iter_set_object_type (GtkWidgetPath *path,
gint pos,
GType type);
GQuark qname,
GtkRegionFlags *flags);
-GType gtk_widget_path_get_widget_type (const GtkWidgetPath *path);
+GType gtk_widget_path_get_object_type (const GtkWidgetPath *path);
gboolean gtk_widget_path_is_type (const GtkWidgetPath *path,
GType type);
pos = gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
g_assert_cmpint (pos, ==, 0);
g_assert_cmpint (gtk_widget_path_length (path), ==, 1);
- g_assert (gtk_widget_path_iter_get_widget_type (path, 0) == GTK_TYPE_WINDOW);
+ g_assert (gtk_widget_path_iter_get_object_type (path, 0) == GTK_TYPE_WINDOW);
g_assert (gtk_widget_path_is_type (path, GTK_TYPE_WIDGET));
g_assert (gtk_widget_path_iter_get_name (path, 0) == NULL);
pos = gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
g_assert_cmpint (pos, ==, 1);
g_assert_cmpint (gtk_widget_path_length (path), ==, 2);
- gtk_widget_path_iter_set_widget_type (path, pos, GTK_TYPE_BUTTON);
+ gtk_widget_path_iter_set_object_type (path, pos, GTK_TYPE_BUTTON);
g_assert (gtk_widget_path_is_type (path, GTK_TYPE_BUTTON));
g_assert (gtk_widget_path_has_parent (path, GTK_TYPE_WIDGET));
g_assert (gtk_widget_path_has_parent (path, GTK_TYPE_WINDOW));