Commit Graph

217 Commits

Author SHA1 Message Date
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
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
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
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
38ca304825 cssprovider: Automatically add final closing bracket to last rule 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
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
1a7239481c raleigh: clear up menu handling in the fallback CSS
Now that menus properly respect padding/border, this is not needed
anymore.
2011-05-18 10:45:51 -04:00
Benjamin Otte
a5e1337ad7 cssprovider: Move private struct definition to header
consistency, improved debugging, etc
2011-04-16 22:31:25 +02:00
Benjamin Otte
0a23796f5d cssprovider: Use g_type_depth() instead of computing the depth manually 2011-04-14 14:59:24 +02:00
Carlos Garnacho
e8c78edeb2 theme: Fix prelight on selected rows' expanders
There was no prelight effect on selected rows' expanders with the
builtin theme, noticed by Kris Rietveld.
2011-04-03 12:32:20 +02:00
Carlos Garcia Campos
ef061c4e96 gtkentry: Add hinting to GtkEntry
gtk_entry_set_placeholder_text() makes the entry display the given text
when it is empty and unfocused. Based on previous patch by Alberto
Garcia.

https://bugzilla.gnome.org/show_bug.cgi?id=440963
2011-03-21 09:37:37 +01:00
Carlos Garnacho
fe12c46531 cssprovider: Reset the scope before skipping to the next rule after an error happens.
This is so the selector token gets parsed with the correct GScanner scope/config
on all situations.
2011-03-07 23:06:54 +01:00
Carlos Garnacho
aa6eee73e5 cssprovider: plug two more leak fixes 2011-03-07 23:06:54 +01:00
Carlos Garnacho
794593a4f8 cssprovider: return immediately if there's remaining data behind a parsed value
parse_value() could fill in a GError, but yet (incorrectly) return G_TOKEN_NONE,
having the GError leaked as a result.

https://bugzilla.gnome.org/show_bug.cgi?id=642604 , Reported by Felix Riemann.
2011-03-07 23:06:54 +01:00
Carlos Garnacho
3100b76ba9 Fix parsing of color names containing numbers
They were being defined correctly through @define-color
in CSS, but parsing failed at the moment of creating
GtkSymbolicColors depending on these.
2011-02-17 20:10:49 +01:00
Michael Natterer
330158977d gtk: make the .trough background-color darker() as it was in GTK+ 2.x 2011-02-06 13:48:42 +01:00
Michael Natterer
c990699922 gtk: don't style GtkLabel:selected's color separately
or labels in selected state will not have a different color. Reviewed
by Carlos.
2011-02-05 14:10:18 +01:00
Matthias Clasen
3c1ff82b21 Fix a memory leak in GtkCSSProvider
Found by Felix Riemann
https://bugzilla.gnome.org/show_bug.cgi?id=641558
2011-02-04 21:13:56 -05:00
Emmanuele Bassi
d51c617e13 css-provider: Fix up the Switch style
As it was with the old style, when the Switch is in the "on" state the
trough should be using the selected background color.
2011-01-31 16:21:36 +00:00
Matthias Clasen
cb498c2101 Speed up expander animation
Go back to 200ms, which is what we had in GTK+ 2.x.
Themes can change this, of course.
2011-01-31 10:51:09 -05:00
Matthias Clasen
09a52de478 Add a missing id to the docs 2011-01-31 07:39:06 -05:00
Matthias Clasen
f67ab808fd doc fixes 2011-01-30 23:35:25 -05:00
Matthias Clasen
8bb0d552f1 Improve binding-set parser
Make gtk_binding_entry_add_signal_from_string() return the expected
token in case of parsing error, so that we can return a GError
instead of spewing. Also, add a separate scope for binding-set,
since allowing {} in identifiers in SCOPE_VALUE breaks the fact
that the ; after the last assignment in a rule is optional.
2011-01-30 21:27:56 -05:00
Matthias Clasen
bf9e59e392 Make documentation match behaviour 2011-01-30 21:27:55 -05:00
Carlos Garnacho
c70b65f0eb Document @binding-set and the gtk-key-bindings css parser property 2011-01-30 21:24:52 -05:00
Carlos Garnacho
d39f0411be Add the gtk-key-bindings CSS parser property.
This property takes a list of binding set names to have these
stored as a GPtrArray containing GtkBindingSets. this property
is handled so merging GtkStyleProperties will merge both
GtkBindingSet lists.
2011-01-30 21:24:51 -05:00
Carlos Garnacho
dbff92fd9f Add @binding-set rules to the CSS parser
these custom rules can be used to define key themes
as in the RC files, a series of bind/unbind rules
may be added then:

@binding foo-bar {
  bind "<alt>1" { "move-cursor" (visual-positions, 1, 0) };
  unbind "<ctl>d"
}
2011-01-30 21:24:51 -05:00
Bastien Nocera
b98caf9385 GtkCssProvider: Take into account variant
When loading a theme, make sure we take into account the variant
so we don't use the plain version when the theme changes.

Also make sure to fallback to the plain theme when loading a variant
fails.

https://bugzilla.gnome.org/show_bug.cgi?id=640983
2011-01-30 21:22:12 -05:00
Carlos Garnacho
08af1783c5 Make GtkTreeView use GtkStyleContext
Expander animation has been replaced by implicit animations
from the style context.

Column headers are also properly themed, GtkContainer::get_path_for_child()
is implemented and the treeview resets column buttons style on columns
being reordered.

The default CSS has changed to theme treeviews sensibly.
2011-01-27 20:57:11 +01:00
Matthias Clasen
ea24fa62c8 Privately export css_provider_get_theme_dir 2011-01-27 00:32:07 -05:00
Carlos Garnacho
e3be6fc24f Unset border-width for treeview rows in default CSS
Fixes bug #640391 - Display lines between rows when window is focused.
Reported by Guillaume Desmottes.
2011-01-24 18:14:05 +01:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Matthias Clasen
a12dad75a2 Split out private style context api into a private header 2011-01-23 18:29:28 -05:00
Carlos Garnacho
e3774b6ff2 Render check/radio buttons with border-color: @fg_color 2011-01-23 20:01:22 +01:00
Matthias Clasen
0a5e8ce685 Mention type vs region ambiguity in the docs 2011-01-19 12:55:48 -05:00
Carlos Garnacho
0b7496558d Make GtkCssProvider deal with widget types not being in plain CamelCase
Fixes bug #Bug 639754, reported by Kjell Ahlstedt. gtkmm doesn't
use plain CamelCase for its widget type names, so in order to
distinguish widget type names from regions in the CSS parser,
the following checks are now done:

* if it contains an uppercase letter -> widget class (that should
  also work for gtkmm)

* if it's a string compound by lowercase letters and '-' -> it's
  a region, checks have been added in gtk_style_context_add_region()
  and gtk_widget_path_iter_add_region() to ensure this.
2011-01-19 04:28:49 +01:00
Carlos Garnacho
f430a306f7 Make GtkCheckButton/GtkRadioButton background white again 2011-01-19 04:28:49 +01:00
Carlos Garnacho
e28a2695ac Improve progressbars theming.
Make progressbar itself have an outset border, and improve spacings.
2011-01-17 04:43:16 +01:00
Tristan Van Berkom
9438107bff Plugged leak in gtkcssprovider.c
SelectorStyleInfo structs were never freed.
2011-01-16 20:52:43 +09:00
Carlos Garnacho
26db0b7276 Make GtkMenu(Shell) use GtkStyleContext
The default CSS has also been modified to theme these sensibly
2011-01-12 20:55:36 +01:00
Carlos Garnacho
162380fca5 Make GtkCalendar use GtkStyleContext 2011-01-10 20:49:34 +01:00