Commit Graph

27355 Commits

Author SHA1 Message Date
Benjamin Otte
607846879e cssprovider: Keep track of passed in error differently
Instead of having an error member in the CSS provider's private struct,
connect a signal handler when an error is passed in. This has two
advantages:
1) It makes the code clearer as we don't have to keep track of an error
   member anywhere.
2) It causes a non-emission of the g_warning() when an error was passed
   in, because it only triggers when no signal handlers are connected.
   So we get identical behavior to GTK 3.0 where warnings where only
   emitted when no error was passed in.
2011-05-18 21:58:45 +02:00
Benjamin Otte
8fb6fdd3e7 cssprovider: Do error handling differently
Instead of aborting a parse whenever we encounter an error, parse to the
end. But if a GError was passed in, reset the provider completely as if
nothing had been parsed.
2011-05-18 21:58:45 +02:00
Benjamin Otte
992ee6a203 cssprovider: Emit a g_warning() when a css file is erroneous
... and no other error handler is active. See the source code comment
for the reasoning.
2011-05-18 21:58:45 +02:00
Benjamin Otte
2d75dd2fdf cssprovider: No need to restore after @import parsing
With the recent changes, this just resets the error, and we don't the
error reset from subfile parsing.
2011-05-18 21:58:45 +02:00
Benjamin Otte
3e146b468b cssprovider: Store current properties and selectors in scanner
They don't belong in the css provider
2011-05-18 21:58:45 +02:00
Benjamin Otte
f3bb815517 cssprovider: Use scanner variable instead of priv->scanner 2011-05-18 21:58:45 +02:00
Benjamin Otte
d85cbfe157 cssprovider: Pass scanner argument explicitly to error functions 2011-05-18 21:58:45 +02:00
Benjamin Otte
5bc2ae1a91 cssprovider: Update the scope modifying functions
Make them take the scanner as an argument, as that's what gets changed,
not the CssProvider.
2011-05-18 21:58:45 +02:00
Benjamin Otte
83ebc91dce cssprovider: track state in the scanner
This way, we don't have to do magic copies when we create a new scanner
for a subfile.
2011-05-18 21:58:45 +02:00
Benjamin Otte
740f2458bf cssprovider: Add a private structure to the scanner
So far, it's unused
2011-05-18 21:58:45 +02:00
Benjamin Otte
073d75a880 cssprovider: Add a custom gtk_css_scanner_destroy() function
So far, it does nothing
2011-05-18 21:58:45 +02:00
Benjamin Otte
5ca9f25523 cssprovider: Pass the scanner explicitly to parse_stylesheet()
This is the first step in decoupling the scanner from the provider.
2011-05-18 21:58:45 +02:00
Benjamin Otte
318a3af96e cssprovider: No need to set user data anymore 2011-05-18 21:58:45 +02:00
Benjamin Otte
796d593cc1 tests: Make css-parser test take files as argument
Takes the css files to be tested as argument and runs with it.
2011-05-18 21:58:45 +02:00
Benjamin Otte
1f4b09b2fb tests: Add a test for border parsing 2011-05-18 21:58:45 +02:00
Benjamin Otte
195589feac tests: Add new test checking weird behavior for declarations 2011-05-18 21:58:44 +02:00
Benjamin Otte
cb8a595a65 cssprovider: Clean up declaration parser to conform to more tests
The tests will follow with the next commits
2011-05-18 21:58:44 +02:00
Benjamin Otte
22bda2b92f cssprovider: Rework declaration parsing loop
The new loop can cope better with invalid identifiers and manages to
resume parsing properly.
2011-05-18 21:58:44 +02:00
Benjamin Otte
fbf658b04e tests: Add CSS integer parsing tests 2011-05-18 21:58:44 +02:00
Benjamin Otte
d28816bdba tests: Add test for booleans to CSS tests 2011-05-18 21:58:44 +02:00
Benjamin Otte
5e054b37a2 cssprovider: Don't fail with invalid syntax when parsing a value
Instead, raise a PROPERTY_VALUE error, find the next semicolon or
closing bracket and resume parsing.
2011-05-18 21:58:44 +02:00
Benjamin Otte
be1da7ef92 tests: (Try to) print the actual enum value in the errors file
Instead of gtk-some-error-quark 5, print
GTK_SOME_ERROR_SOMETHING_FAILED.
2011-05-18 21:58:44 +02:00
Benjamin Otte
71b18a9006 test: Add a bunch of default properties to the CSS parser
One of each type, so that we can test the parsing of them.
2011-05-18 21:58:44 +02:00
Benjamin Otte
a94ea9a4e3 css: Overhaul value parsing
Value parsing only sometimes emitted errors. Sometimes it didn't emit
errors but ignored the value, sometimes it took a default, sometimes it
converted it to something it deemed suitable.

While refactoring, I moved the whole GValue <=> char * conversion
routines to a separate file, to make navigating the core css provider
easier.
2011-05-18 21:58:44 +02:00
Benjamin Otte
a50a06b583 cssprovider: Remove now useless variables 2011-05-18 21:58:44 +02:00
Benjamin Otte
469ed3e8ed cssprovider: Remove scanner_report_warning() function
That function does superbad stuff just to print out something on stderr.
Don't do superbad stuff.
2011-05-18 21:58:44 +02:00
Benjamin Otte
f1307ef428 tests: Make CSS parser pass NULL as error.
We are trapping errors via signals now.
2011-05-18 21:58:44 +02:00
Benjamin Otte
2d0162c97b tests: Check errors in css test 2011-05-18 21:58:44 +02:00
Benjamin Otte
35c9650752 tests: Change the way the code does diffs
Use a temp file for intermediate storage and properly unlink that
tempfile after the diff is done.
2011-05-18 21:58:44 +02:00
Benjamin Otte
4622614784 cssprovider: use INVALID_SYNTAX for unexpected token error 2011-05-18 21:58:44 +02:00
Benjamin Otte
b34f004f43 cssprovider: Change declaration parsing for error reporting
Previously, we only checked for errors after parsing the full
declaration. Now we detect errors with the property before even
attempting to parse its value.
The benefit here is that the error reporting reports the correct line
and position numbers.
2011-05-18 21:58:44 +02:00
Benjamin Otte
ee53156762 API: cssprovider: Add more error codes 2011-05-18 21:58:44 +02:00
Benjamin Otte
78afa9671e API: cssprovider: Make error a signal 2011-05-18 21:58:44 +02:00
Benjamin Otte
06d4dab48c cssprovider: Handle errors completely via new error functions 2011-05-18 21:58:43 +02:00
Benjamin Otte
582aa955c2 cssprovider: Provide better API to set errors 2011-05-18 21:58:43 +02:00
Benjamin Otte
707ba8597f cssprovider: Have a private error variable 2011-05-18 21:58:43 +02:00
Benjamin Otte
c18dc15694 tests: Add test for auto-closing at end of file 2011-05-18 21:58:43 +02:00
Benjamin Otte
38ca304825 cssprovider: Automatically add final closing bracket to last rule 2011-05-18 21:58:43 +02:00
Benjamin Otte
224d65032e tests: Add CSS test checking that we don't need a semicolon 2011-05-18 21:58:43 +02:00
Benjamin Otte
8fd6bd323c tests: Add two simple css tests 2011-05-18 21:58:43 +02:00
Benjamin Otte
64fd32cdef tests: Add a test for the CSS parser
Tests in the parser need 1 or 2 files:
1) test.css
2) test.ref.css (optional, defaults to test.css)

The test instantiates a CSS provider, loads test.css, then dumps the
loaded file to test.out.css and then checks that that file matches
test.ref.css. If not, it dumps a diff between those two to the log and
fails.

You want to run the test with --verbose to get the output dumped to
stdout.
2011-05-18 21:58:43 +02:00
Benjamin Otte
9d9f1e38b2 cssprovider: Ignore empty rules 2011-05-18 21:58:43 +02:00
Benjamin Otte
b1556abe04 API: gtk: Add gtk_css_provider_to_string()
This is intented to convert the contents of a CSS provider back to a
string.
It is not complete yet but good enough for starting a testsuite. :)
2011-05-18 21:58:43 +02:00
Benjamin Otte
8b6f92d087 API: Add gtk_gradient_to_string() 2011-05-18 21:58:43 +02:00
Benjamin Otte
dc43239a61 gtk: Add _gtk_animation_description_to_string()
Reverses _gtk_animation_description_from_string()
2011-05-18 21:58:43 +02:00
Benjamin Otte
6e18b5f3de API: gtk: Add gtk_symbolic_color_to_string()
See future commits for why this is useful. Or try to debug some color
problem.
2011-05-18 21:58:43 +02:00
Benjamin Otte
b566debef9 cssprovider: Add a function for signalling errors 2011-05-18 21:58:43 +02:00
Benjamin Otte
f5bc27f7ef cssprovider: Store cssprovider in scanner's user data 2011-05-18 21:58:43 +02:00
Cosimo Cecchi
f398745a15 treeview: don't arbitrairly add 2 to the expander size
Bump the default expander size by 2 pixels instead.

https://bugzilla.gnome.org/show_bug.cgi?id=650424
2011-05-18 11:12:47 -04:00
Cosimo Cecchi
42f5856e77 treeview: render a frame around the rows, after drawing their background
https://bugzilla.gnome.org/show_bug.cgi?id=650424
2011-05-18 11:12:31 -04:00