Commit Graph

40 Commits

Author SHA1 Message Date
f89d5c8280 Optimize gtk_widget_path_copy() by preallocating "elems" array
gtk_widget_path_copy() currently calls g_array_append_val() in a loop,
which is inefficient due to reallocating the array's memory. Calling
g_array_set_size() before entering the loop reduces the number of CPU
cycles used by roughly 30%.

Patch by John Lindgren,
https://bugzilla.gnome.org/show_bug.cgi?id=679978
2012-08-07 00:38:48 -04:00
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
92e6444163 widgetpath: correctly print the siblings index
In gtk_widget_path_to_string() we were counting siblings from zero
instead of one, resulting in confusing output.
2011-11-23 11:22:30 -05:00
1f2cfb5619 all: add an 'only-child' pseudo-class selector
Add an :only-child pseudo-class selector, which selects single children
of a parent container.

https://bugzilla.gnome.org/show_bug.cgi?id=660833
2011-10-04 11:47:47 -04:00
e81426dbd6 Add sibling information to widget path string representations 2011-06-18 12:36:38 -04:00
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
79de8e4d08 API: Add support for siblings to widget paths 2011-06-02 02:03:51 +02:00
b669efa1a3 docs: Fix typo 2011-06-02 02:03:51 +02:00
67fe600b2e widgetpath: Factor out the element copy function
I'll need that function soon.
2011-06-02 02:03:51 +02:00
f0e5b57699 widgetpath: Use ref/unref in boxed function
This way we avoid lots of copying when using widget paths as properties.

Keeping this as a separate patch so bugs where people were modifying a
structure they shouldn't are easily visible.
2011-06-02 02:03:51 +02:00
03eb4c38c9 widgetpath: Make structure refcounted
I want to use widget paths in a way that make a lot more sense with a
refcounted structure. See the following patches.
2011-06-02 02:03:51 +02:00
abe63e8aa1 gtk: add "Since: 3.2" to gtk_widget_path_to_string() 2011-03-27 15:43:31 +02:00
8b4b3cf090 API: Add gtk_widget_path_to_string()
Dumps the widget path into a string representation. It tries to match the CSS
style as closely as possible (Note that there might be paths that cannot be
represented in CSS).

The main use of this code is for debugging purposes, so that you can
g_print() the path or dump it in a gdb session.
2011-03-27 01:47:17 +01:00
06f590456f widgetpath: Sanitize pos argument for iters correctly
The comparison done was off by one and would have caused invalid
reads or writes.
2011-03-26 23:51:28 +01:00
a12dad75a2 Split out private style context api into a private header 2011-01-23 18:29:28 -05:00
3c8fc21e9b [GI] Fixes of existing incorrect annotations 2011-01-20 13:56:06 +01:00
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
b792a31995 widgetpath: allow GTypes non-derived from GTK_TYPE_WIDGET
This makes things like GtkCellRenderer or GtkNumerableIcon more easily
themeable.

https://bugzilla.gnome.org/show_bug.cgi?id=637169
2010-12-17 18:30:57 +01:00
2578f4f4c3 Trivial doc fixes 2010-12-04 15:39:47 +01:00
b2d338d370 GtkWidgetPath documentation tweaks 2010-12-04 15:39:27 +01:00
6d1cf76822 GtkWidgetPath: Make iter API deal with gints.
now gtk_widget_path_iter_* takes gints instead of guints, and also accept
numbers == -1 or > path_length for the path head.
2010-12-04 15:39:18 +01:00
5f88997297 GtkWidgetPath: Make gtk_widget_path_prepend_type() return nothing.
It's senseless to always return 0
2010-12-04 15:39:18 +01:00
e1819055b9 Copy GtkWidgetPaths correctly
The code was forgetting to copy class information.
2010-12-04 15:39:17 +01:00
770f050d8c GtkWidgetPath: turn into a boxed type. 2010-12-04 15:38:24 +01:00
c9a3da5025 GtkStyleContext: s/set/add/ and s/unset/remove/ for classes/regions.
Several classes and regions may be set to GtkStyleContext, so rename
the functions to be more intuitive.
2010-12-04 15:38:24 +01:00
a79626b7fb Add theming docs
Both API and file format is documented, there's still missing
a migration doc though.
2010-12-04 15:38:21 +01:00
88b78953b6 GtkContainer: Add method to get the GtkWidgetPath for a child.
This is now used throughout in order to have the full path for a given widget,
including intermediate named regions, the default implementation just returns
the GtkContainer's path copy, no intermediate regions between.
2010-12-04 15:38:19 +01:00
c9d626523d Remove gtkalias from style context code. 2010-12-04 15:38:09 +01:00
0ce649e965 Plug a bunch of leaks. 2010-12-04 15:38:09 +01:00
8a1b6e8224 GtkWidgetPath: Add methods to include class info in paths. 2010-12-04 15:37:36 +01:00
a3637ec60d s/child class/region/ everywhere.
"Child class" is an invented term anyway, and it conceptually defines
identifiable regions in widgets.
2010-12-04 15:37:35 +01:00
56e4ffabea Compare widget names as GQuarks in style matching. 2010-12-04 15:37:34 +01:00
09d8592b5b GtkWidgetPath: Make API more consistent. 2010-12-04 15:37:34 +01:00
ad08330fae Compare region names as quarks in style matching. 2010-12-04 15:37:34 +01:00
27bc581dca GtkWidgetPath: properly use const
* gtk/gtkwidgetpath.c,
* gtk/gtkwidgetpath.h: use const where possible
2010-12-04 15:37:32 +01:00
d748ea983d GtkWidgetPath: Add to gtkalias. 2010-12-04 15:37:14 +01:00
37335fbb6f GtkWidgetPath: Add methods to check topmost widget type. 2010-12-04 15:37:12 +01:00
11c874619b GtkWidgetPath: Add API for named regions. 2010-12-04 15:37:07 +01:00
71949e05c4 Refurbish GtkWidgetPath API.
The foreach() function is now gone, there's now API to get
GTypes and names from the position in the path.
2010-12-04 15:37:07 +01:00
61360dfddf Add GtkWidgetPath.
GtkWidgetPath represents a widget path. It will mainly used by theming
engines to know detail about the widget hierarchy without actually
accessing the widget.
2010-12-04 15:36:51 +01:00