StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of these functions (return TRUE or FALSE and return the actual value in an out parameter) is useful, it's mostly just annoying at the application level, where you generally know that the CSS property is going to specified, and there is no especially sane fallback if it's not. So rename the current methods to lookup_color, lookup_double, and lookup_length, and add new get_color, get_double, and get_length methods that don't take an "inherit" parameter, and return their values directly. (Well, except for get_color, due to the lack of (out caller-allocates) in gjs.) And update the code to use either the old or new methods as appropriate. https://bugzilla.gnome.org/show_bug.cgi?id=632590
This commit is contained in:
@@ -99,20 +99,27 @@ const char *st_theme_node_get_pseudo_class (StThemeNode *node);
|
||||
* details of the actual CSS rules, which can be complicated, especially
|
||||
* for fonts
|
||||
*/
|
||||
gboolean st_theme_node_get_color (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
ClutterColor *color);
|
||||
gboolean st_theme_node_lookup_color (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
ClutterColor *color);
|
||||
gboolean st_theme_node_lookup_double (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
double *value);
|
||||
gboolean st_theme_node_lookup_length (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
gdouble *length);
|
||||
|
||||
gboolean st_theme_node_get_double (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
double *value);
|
||||
|
||||
gboolean st_theme_node_get_length (StThemeNode *node,
|
||||
const char *property_name,
|
||||
gboolean inherit,
|
||||
gdouble *length);
|
||||
/* Easier-to-use variants of the above, for application-level use */
|
||||
void st_theme_node_get_color (StThemeNode *node,
|
||||
const char *property_name,
|
||||
ClutterColor *color);
|
||||
gdouble st_theme_node_get_double (StThemeNode *node,
|
||||
const char *property_name);
|
||||
gdouble st_theme_node_get_length (StThemeNode *node,
|
||||
const char *property_name);
|
||||
|
||||
/* Specific getters for particular properties: cached
|
||||
*/
|
||||
|
Reference in New Issue
Block a user