Commit Graph

514 Commits

Author SHA1 Message Date
Benjamin Otte
24cc721bc6 cssprovider: Mark whole @import statement on import error 2019-04-12 19:34:28 +02:00
Benjamin Otte
2e0a56665a css: Move gtkcsssection.[ch] into gtk/css 2019-04-12 19:34:28 +02:00
Benjamin Otte
37671d2bd0 cssprovider: Redo error emission
Emit all errors via the parser, don't try to have a custom error
handling machinery.

The only exception is the initial file load error - we need to do that
one directly, because there is no parser.
2019-04-12 19:34:28 +02:00
Benjamin Otte
04d24b7cd2 csssection: Make printing functions public 2019-04-12 19:34:28 +02:00
Benjamin Otte
085d34cbb0 cssprovider: Advance parser to start of declaration
This way, the block will reference the right location.
2019-04-12 19:34:28 +02:00
Benjamin Otte
46143492a2 cssprovider: Change section handling
Instead of building a full tree of sections that then nobody cares
about, just create sections as necessary for when we use it in the
inspector.
2019-04-12 19:34:28 +02:00
Benjamin Otte
2fb202187c css: Remove GtkCssSectionType
It's unused.
2019-04-12 19:34:28 +02:00
Benjamin Otte
207c0b32b4 csssection: Redo constructors
Remove the unused one and rename the old one to new_from_parser().
2019-04-12 19:34:28 +02:00
Benjamin Otte
e0a01ba174 css: Redo for new parser
This commit is still way too big, but I couldn't make it smaller.

It transitions the old CSS parser to the new parser. CSS parsing is now
tokenized, everything else is probably still buggy.
2019-04-12 19:34:28 +02:00
Benjamin Otte
607502ef43 cssparser: Add gtk_css_parser_consume_url()
Another slight renaming and semantics change.
2019-04-12 19:34:28 +02:00
Benjamin Otte
acddc317da cssparser: Add gtk_css_parser_resolve_url()
Another slight change of semantics and naming for the new parser.
2019-04-12 19:34:28 +02:00
Benjamin Otte
f0d2f99239 cssparser: Add gtk_css_parser_consume_string()
Well, just rename _gtk_css_parser_read_string() for the new semantics,
but this sounds cooler.
2019-04-12 19:34:28 +02:00
Benjamin Otte
e7b9ecc99a cssparser: Add gtk_css_parser_try_at_keyword() 2019-04-12 19:34:28 +02:00
Benjamin Otte
7ccec19501 parser: Get rid of _gtk_css_parser_is_eof()
Use gtk_css_parser_has_token() instead.
2019-04-12 19:34:28 +02:00
Benjamin Otte
3fb44ae651 cssparser: Add gtk_css_parser_try_token() 2019-04-12 19:34:28 +02:00
Benjamin Otte
684b6459f1 cssparser: Get rid of _gtk_css_parser_begins_with()
Replace it with calls to gtk_css_parser_has_token().
2019-04-12 19:34:28 +02:00
Benjamin Otte
904a9d0c98 parser: Add gtk_css_parser_has_token()
This is ithe first step towards converting the parsing code to use
tokens. For now, the topken type is just a magic enum value that only
works as-needed.
2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Matthias Clasen
96fa1fb5c1 Drop key themes
These were an abuse of css, and not very successful
as a concept. We are going to replace bindings with
a new way of doing customizable shortcuts.
2019-02-21 12:22:50 -05:00
Alberts Muktupāvels
7a8f5ca970 gtkcssprovider: remove gtk_css_provider_get_default
This function is unused since cdc6e82720 commit and does not
contain fallback style.

https://gitlab.gnome.org/GNOME/gtk/issues/1226
2018-07-19 19:25:17 +03:00
Timm Bäder
aa32fc1708 cssprovider: Remove priv pointer 2018-02-13 18:48:44 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Benjamin Otte
452f2f0394 cssprovider: Use g_file_load_bytes()
This way, we get a special no-copy case for resources.

https://bugzilla.gnome.org/show_bug.cgi?id=790270
2018-02-05 17:22:56 +01:00
Matthias Clasen
d005109133 Drop unused gtkcssstylefuncs.c
Clean up all the places where the header was still
included needlessly.
2017-11-30 18:46:54 -05:00
Daniel Boles
6f54e1fc6d CssProvider: Fix doc of min theme version loaded
The code shows that we only load back to 4.0, but this still said 3.0.
2017-11-08 09:22:49 +00:00
Daniel Boles
6a9c14b2fa CssProvider: Use consistent theme name placeholder
commit 475d916eb9 added various paths that
use theme-name for this, but the existing path already used THEME, with
a subsequent description referring to the latter. So use that everywhere
2017-11-08 09:22:46 +00:00
Benjamin Otte
83fb7a649f css: Merge GtkStyleProviderPrivate into GtkStyleProvider
This is just lots of renaming.

The interface remains private, so the public API does not change, apart
from removing the definition of the Interface object to avoid
subclassing.
2017-10-31 04:33:54 +01:00
Benjamin Otte
9151e0b9f5 stylecontext: Port to use display instead of screen 2017-10-31 03:05:54 +01:00
Matthias Clasen
d1b77fd60f Drop code handling deprecated style properties
We no longer have any deprecated style properties.
2017-09-17 16:59:26 -04:00
Timm Bäder
e36ddfec17 Remove all widget style property code 2017-07-19 21:27:14 -04:00
Rico Tzschichholz
8abf05e194 gtk: Update path references from gtk-3.0 to gtk-4.0 2016-10-23 20:22:38 +02:00
Benjamin Otte
4322b69528 cssprovider: Return void, not TRUE
Parsing a css file always succeeds as CSS can recover from parsing
errors.
2016-10-17 17:41:03 +02:00
Benjamin Otte
dbeeaf7de6 cssprovider: Remove GError out argument from load functions
People should use the GtkCssProvider::parsing-error signal instead.
2016-10-17 16:52:05 +02:00
Matthias Clasen
34986231f4 css parser: Improve an error message
Say what property we are dealing with when we complain about the
value.
2016-07-03 17:46:30 -04:00
Matthias Clasen
46b51e36b4 Trivial typo fix 2016-05-23 19:24:07 -04:00
Matthias Clasen
7cb36aba40 Load theme settings from the right location
When loading a per-theme settings.ini file, look for it in
the same directory where we found the gtk.css file for the
theme. Previously, we were always looking in
$prefix/share/themes/THEME/gtk-3.0/, even if the css was
loaded from somewhere else.

https://bugzilla.gnome.org/show_bug.cgi?id=641354
2016-03-21 22:19:19 -04:00
Matthias Clasen
475d916eb9 Also look in system data dirs for themes
With this change, we now look in
$XDG_DATA_HOME/themes/THEME/gtk-3.x
$HOME/.themes/THEME/gtk-3.x
$XDG_DATA_DIRS/themes/THEME/gtk-3.x
GTK_DATA_PREFIX/themes/THEME/gtk-3.x

https://bugzilla.gnome.org/show_bug.cgi?id=641354
2016-03-21 22:19:19 -04:00
Matthias Clasen
804d330195 Typo fixes
Fix s/occurence/occurrence in many places.
2016-03-10 22:46:02 -05:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Benjamin Otte
d0fd7990c3 cssprovider: Change location of builtin themes
Instead of
  /org/gtk/libgtk/theme/$THEME-$VARIANT.css
look at
  /org/gtk/libgtk/theme/$THEME/gtk-$VARIANT.css
and that way mirror the directory layout of real themes.
2016-02-04 13:35:21 +01:00
Matthias Clasen
2c7fdf6432 CSS provider: Add a way to emit errors
Currently, GtkCssProvider can emit ::parsing-error only during
the actual parsing, although the documentation hints that it might
happen at other times.

This commit adds a emit_error method to the GtkStyleProviderPrivate
interface that will let us emit errors from the compute() implementations
as well, which can be useful (e.g. if an image fails to load).
2016-01-30 00:29:04 -05:00
Eric Williams
276101a3bc Fix typo in previous documentation fix for gtk_css_provider_load_from_data() 2016-01-14 17:01:26 -05:00
Eric Williams
bbfec07e06 Clarified the function docs for gtk_css_provider_load_from_data().
https://bugzilla.gnome.org/show_bug.cgi?id=760238
2016-01-06 22:42:37 -05:00
Matthias Clasen
26d8688cb4 Redo the CSS docs
Split the CSS docs off from the GtkCssProvider docs and
give them their own chapter. Among other things, this commit
introduces more or less complete definitions of the syntax for
the supported selectors, a complete list of all supported
properties, and definitions for their values. This includes
documentation for GTK+-specific properties such as -gtk-icon-source.
2015-12-25 22:58:52 -05:00
Matthias Clasen
db7f269c03 Some updates to the CSS docs
Remove references to regions and engines, emphasize
element names over type names, update the list of
pseudo-states.
2015-12-20 01:03:38 -05:00
Krzesimir Nowak
f6ce2cd975 cssprovider: Pass NULL unconditionally
We know that parent is NULL at this point.

Also, fix indentation.
2015-12-02 12:46:21 +01:00
Matthias Clasen
5f73e8a720 Rename the icon-shadow property
This is not a standard CSS property, so rename it to
-gtk-icon-shadow. We still support the old name, with a
deprecation warning.
2015-11-20 20:35:39 -05:00
Matthias Clasen
f3e4e8660d Warn if a property alias is used
Emit a deprecation warning if a property is not used
by its official name.
2015-11-20 20:35:39 -05:00
Matthias Clasen
d2d521d4b5 Add a deprecation error for the engine css property
This helps people fix up their css.
2015-11-20 20:35:39 -05:00
Matthias Clasen
08c4bc8aa5 css provider: Issue deprecation warnings for style properties
This makes G_PARAM_DEPRECATED useful for style properties.
2015-11-16 14:37:23 -05:00