GType gtk_css_node_get_widget_type (GtkCssNode *cssnode) { return gtk_css_node_declaration_get_type (cssnode->decl); }
/** * gtk_widget_path_to_string: * @path: the path * * Dumps the widget path into a string representation. It tries to match * the CSS style as closely as possible (Note that there might be paths * that cannot be represented in CSS). * * The main use of this code is for debugging purposes, so that you can * g_print() the path or dump it in a gdb session. * * Returns: A new string describing @path. * * Since: 3.2 **/ char * gtk_widget_path_to_string (const GtkWidgetPath *path) { GString *string; guint i, j, n; gtk_internal_return_val_if_fail (path != NULL, NULL); string = g_string_new (""); for (i = 0; i < path->elems->len; i++) { GtkPathElement *elem; GtkStateFlags state; const GQuark *classes; GList *list, *regions; elem = &g_array_index (path->elems, GtkPathElement, i); if (i > 0) g_string_append_c (string, ' '); g_string_append (string, g_type_name (gtk_css_node_declaration_get_type (elem->decl))); if (gtk_css_node_declaration_get_id (elem->decl)) { g_string_append_c (string, '('); g_string_append (string, gtk_css_node_declaration_get_id (elem->decl)); g_string_append_c (string, ')'); } state = gtk_css_node_declaration_get_state (elem->decl); if (state) { GFlagsClass *fclass; fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS); for (j = 0; j < fclass->n_values; j++) { if (state & fclass->values[j].value) { g_string_append_c (string, ':'); g_string_append (string, fclass->values[j].value_nick); } } g_type_class_unref (fclass); } if (elem->siblings) g_string_append_printf (string, "[%d/%d]", elem->sibling_index + 1, gtk_widget_path_length (elem->siblings)); classes = gtk_css_node_declaration_get_classes (elem->decl, &n); for (j = 0; j < n; j++) { g_string_append_c (string, '.'); g_string_append (string, g_quark_to_string (classes[j])); } regions = gtk_css_node_declaration_list_regions (elem->decl); for (list = regions; list; list = list->next) { static const char *flag_names[] = { "even", "odd", "first", "last", "only", "sorted" }; GtkRegionFlags flags; GQuark region = GPOINTER_TO_UINT (regions->data); gtk_css_node_declaration_has_region (elem->decl, region, &flags); g_string_append_c (string, ' '); g_string_append (string, g_quark_to_string (region)); for (j = 0; j < G_N_ELEMENTS(flag_names); j++) { if (flags & (1 << j)) { g_string_append_c (string, ':'); g_string_append (string, flag_names[j]); } } } g_list_free (regions); } return g_string_free (string, FALSE); }