mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-20 05:50:11 +00:00
stylecontext: Change semantics of gtk_style_context_get_path()
Widget contexts now return NULL here. A non-NULL result requires a previous call to gtk_style_context_set_path()
This commit is contained in:
parent
b9c81b1b94
commit
c85d9a3259
@ -262,7 +262,7 @@ draw_menu (GtkWidget *widget,
|
||||
gint toggle_x, toggle_y, toggle_width, toggle_height;
|
||||
|
||||
/* This information is taken from the GtkMenu docs, see "CSS nodes" */
|
||||
menu_context = get_style (gtk_widget_get_style_context(widget), "menu");
|
||||
menu_context = get_style (NULL, "menu");
|
||||
hovermenuitem_context = get_style (menu_context, "menuitem:hover");
|
||||
hoveredarrowmenuitem_context = get_style (hovermenuitem_context, "arrow.right:dir(ltr)");
|
||||
menuitem_context = get_style (menu_context, "menuitem");
|
||||
|
@ -970,14 +970,26 @@ gtk_style_context_set_path (GtkStyleContext *context,
|
||||
* gtk_style_context_get_path:
|
||||
* @context: a #GtkStyleContext
|
||||
*
|
||||
* Returns the widget path used for style matching.
|
||||
* Returns the widget path used for style matching set via
|
||||
* gtk_style_context_set_path().
|
||||
*
|
||||
* Returns: (transfer none): A #GtkWidgetPath
|
||||
* If no path has been set - in particular if this style context
|
||||
* was returned from a #GtkWidget - this function returns %NULL.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): A #GtkWidgetPath or %NULL
|
||||
**/
|
||||
const GtkWidgetPath *
|
||||
gtk_style_context_get_path (GtkStyleContext *context)
|
||||
{
|
||||
return gtk_css_node_get_widget_path (gtk_style_context_get_root (context));
|
||||
GtkCssNode *root;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
|
||||
|
||||
root = gtk_style_context_get_root (context);
|
||||
if (!GTK_IS_CSS_PATH_NODE (root))
|
||||
return NULL;
|
||||
|
||||
return gtk_css_path_node_get_widget_path (GTK_CSS_PATH_NODE (root));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user