1
0
Fork 0
Commit graph

32 commits

Author SHA1 Message Date
Emmanuele Bassi
67d9d92814 docs: Document the "columns" syntax for ClutterModel
Like we do for other classes implementing custom properties, we should
document the syntax of the "columns" scriptable property of ClutterModel.
2010-02-25 23:23:53 +00:00
Bastian Winkler
96c31bbf0e model: Implement ClutterScriptable interface
Allow a ClutterModel to be constructed through the ClutterScript API.
Currently this allows a model to be generated like like this:

{
  "id" : "test-model",
  "type" : "ClutterListModel",
  "columns" : [
    [ "text-column", "gchararray" ],
    [ "int-column", "gint" ],
    [ "actor-column", "ClutterRectangle" ]
  ]
}

where 'columns' is an array containing arrays of column-name,
column-type pairs.

http://bugzilla.openedhand.com/show_bug.cgi?id=2007
2010-02-25 23:09:11 +00:00
Emmanuele Bassi
8ba65cfd4a analysis: ClutterModel
Remove unused variables.
2010-02-12 14:50:11 +00:00
Damien Lespiau
6e3afa4ebe [docs] Clutter's model implementation is called ClutterListModel
It was renamed from ClutterModelDefault to ClutterListModel a while
back. Update the reference to this class in ClutterModel documentation.
2009-09-10 13:28:54 +01:00
Emmanuele Bassi
a5e081dc9c [model] Do not attempt to free empty column names
The column names are optional - ClutterModel will use the GType name
if there is no user-specified column name. Hence, the ::finalize vfunc
should not try to free an empty column names vector.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1790
2009-09-02 15:30:45 +01:00
Rob Bradford
41bb885486 [model] Add a private row mutator to ClutterModelIter
When calling clutter_model_iter_next () / clutter_model_iter_prev () we need
to update the row for the iterator. In order to improve the peformance of
iterating this change adds a private row mutator and switches ClutterListModel
to use it.
2009-05-05 20:18:28 +01:00
Emmanuele Bassi
01d172293c [model] Rework Model behaviour with a filter
Currently ClutterModel::get_iter_at_row() ignores whether we have
a filter in place. This also extends to the get_n_rows() method.

The more consistent, more intuitive and surely more correct way to
handle a Model with a filter in place is to take into account the
presence of the filter itself -- that is:

  - get_n_rows() should take into account the filter and return the
    number of *filtered* rows

  - get_iter_at_row() should also take the filter into account and
    get the first non-filtered row

These two changes make the ClutterModel with a filter function
behave like a subset of the original Model without a filter in
place.

For instance, given a model with three rows:

  - [row 0]     <does not match filter>
  - [row 1]     <matches filter>
  - [row 2]     <matches filter>
  - [row 3]     <does not match filter>

The get_n_rows() method will return "2", since only two rows will
match the filter; the get_first_iter() method will ask for the
zero-eth row, which will return an iterator pointing to the contents
of row 1 (but the :row property of the iterator will be set to 0);
the get_last_iter() method will ask for the last row, which will
return an iterator pointing to the contents of row 2 (but the :row
property of the iterator will be set to 1).

This changes will hopefully make the Model API more consistent
in its usage whether there is a filter in place or not.
2009-04-29 15:26:05 +01:00
Emmanuele Bassi
44fefa2afe [model] Add :filter-set
Currently, there is no way for implementations of the ClutterModel
abstract class to know whether there is a filter in place. Since
subclasses might implement some optimization in case there is no
filter present, we need a simple (and public) API to ask the model
itself.
2009-04-29 15:14:40 +01:00
Emmanuele Bassi
ccca24ab76 Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Owen W. Taylor
c5afd98416 Add gobject-introspection annotations
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.

The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".

http://bugzilla.openedhand.com/show_bug.cgi?id=1452

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-20 12:09:07 +00:00
Neil Roberts
d6496254d6 * clutter/clutter-model.c (clutter_model_set_sorting_column): This
function is supposed to accept -1 to disable sorting. However it
	checks for whether the column is >= the number of columns, but
	clutter_model_get_n_columns() returns an unsigned int so the
	column number also gets promoted to unsigned for the
	comparison. Therefore -1 is always greater than the number of
	columns so it wouldn't let you set it.
2008-07-30 10:32:25 +00:00
Emmanuele Bassi
3ab2ff9846 2008-06-01 Emmanuele Bassi <ebassi@openedhand.com>
Merge from clutter-0-6:

	* clutter/clutter-model.c:
	(clutter_model_iter_set_internal_valist): Add an internal function
	wrapping ClutterModelIter::set_value that does not emit the
	::row-changed signal. Emitting this signal before the ::row-added
	one is wrong: a row cannot change before being inserted.

	(clutter_model_append), (clutter_model_prepend),
	(clutter_model_insert): Use the non-signal emitting variant of
	clutter_model_iter_set_valist().

	(clutter_model_iter_set_valist): Use the internal version and emit
	the ::row-changed signal at the end.
2008-06-01 19:57:42 +00:00
Emmanuele Bassi
7c05499865 2008-03-19 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.[ch]: Add a ::copy() virtual function
	for copying iterators.

	* clutter/clutter-list-model.c:
	(clutter_list_model_iter_copy),
	(clutter_list_model_iter_class_init): Implement the ::copy()
	function inside the ListModel iterator subclass.
2008-03-19 18:33:33 +00:00
Chris Lord
781661e9c3 * clutter/clutter-model.c: (clutter_model_set_sorting_column):
Don't disable sorting on column 0
2008-03-06 11:44:37 +00:00
Chris Lord
015eba286f * clutter/clutter-model.c: (clutter_model_resort):
Don't return when there's no sort function set, leave that to the
        model sub-class
2008-02-19 12:31:50 +00:00
Emmanuele Bassi
ccc4ad400b 2008-01-14 Emmanuele Bassi <ebassi@openedhand.com>
* clutter.symbols: Add clutter_model_insertv()

	* clutter/clutter-model.[ch] (clutter_model_insertv): Add a vector
	based insertion API, for language bindings
2008-01-14 10:13:35 +00:00
Emmanuele Bassi
e85d5eab84 2008-01-09 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model-default.c:
	(clutter_model_default_new),
	(clutter_model_default_newv): Move the constructors in the
	right file

	* clutter/clutter-model-private.h: Add a private header for
	the ClutterModel implementations

	* clutter/clutter-model.c:
	(clutter_model_check_type),
	(clutter_model_set_n_columns),
	(clutter_model_set_column_type): Mark as private to Clutter,
	not static to ClutterModel

	* clutter/Makefile.am: Add clutter-model-private.h
2008-01-09 14:18:53 +00:00
Emmanuele Bassi
6fdeda0e8f 2008-01-08 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.c:
	(clutter_model_appendv),
	(clutter_model_prependv): Fix the columns length pre-condition
2008-01-08 14:12:11 +00:00
Emmanuele Bassi
09263f94b0 2008-01-07 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.h:
	* clutter/clutter-model.c:
	(clutter_model_appendv),
	(clutter_model_prependv): Add vector based API for bindings.
	
	(clutter_model_get_column_name),
	(clutter_model_get_column_type),
	(clutter_model_set_sorting_column): Fix the check in the condition
	on the column index.

	* tests/test-scale.c (on_timeline_completed), (main): Fix spelling

	* clutter.symbols: Update public symbols
2008-01-07 17:17:43 +00:00
Emmanuele Bassi
9becd34a37 2007-12-28 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.c:
	(clutter_model_real_get_n_rows), (clutter_model_class_init),
	(clutter_model_get_n_rows): Provide a default implementation of
	the get_n_rows() method, so that subclasses do not strictly need
	to override it
2007-12-28 15:33:20 +00:00
Emmanuele Bassi
afaa4fe26f 2007-12-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model-default.c:
	(clutter_model_default_iter_next),
	(clutter_model_default_iter_prev): Do not instantiate a new
	iterator, and update the passed one instead, as we say we do
	in the documentation. This avoid leaking tons of iterators.

	* clutter/clutter-model.[ch]: Update the documentation.

	* tests/test-model.c: Prettify some output.
2007-12-15 13:02:06 +00:00
Emmanuele Bassi
6193beb8be 2007-12-14 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-behaviour.c:
	(clutter_knot_get_type): Use the I_() macro.

	* clutter/clutter-model.[ch]: Make ClutterModel and ClutterModelIter
	abstract classes; also, provide more virtual functions inside the
	ClutterModel vtable, to allow subclasses and language bindings to
	override the entire ClutterModel using other/native data types
	to store the rows.
	
	* clutter/clutter-model-default.[ch]: ClutterModelDefault is a
	default implementation of ClutterModel and ClutterModelIter using
	GSequence.

	* clutter/Makefile.am:
	* clutter/clutter.h: Build glue for ClutterModelDefault.

	* tests/test-model.c: Update for constructor changes.

	* tests/test-shader.c: Fix a typo.
2007-12-14 17:25:55 +00:00
Emmanuele Bassi
6e61c0a999 2007-12-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.c:
	(clutter_model_get_sorting_column): Fix wrong type check.
2007-12-10 16:42:21 +00:00
Emmanuele Bassi
81e908f9fb 2007-12-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.[ch]: Allow unsorting the model (passing
	-1 as the sorting column)

	(clutter_model_iter_get_valist): Do not initialise twice che
	return value.
2007-12-10 16:22:05 +00:00
Emmanuele Bassi
002adaf305 2007-12-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.c (clutter_model_iter_get_value): Initialise
	the passed GValue like the other getters do.
2007-12-10 16:02:46 +00:00
Emmanuele Bassi
be8fdbe5c1 2007-12-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.h:
	* clutter/clutter-model.c:
	(clutter_model_append_value),
	(clutter_model_prepend_value),
	(clutter_model_insert_value): Add a _value() variant for the
	insertion methods, for use of the language bindings.

	(clutter_model_append), 
	(clutter_model_prepend),
	(clutter_model_insert): Do not return a boolean: insertion should
	never fail unless for a programming error, in which case we have
	plenty of warnings.
2007-12-10 15:08:53 +00:00
Emmanuele Bassi
687561dfe2 2007-11-29 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.[ch]: Slight API change in the constructor
	functions for ClutterModel: clutter_model_new() now takes a list
	of GType/string pairs for both the column type and the column name.

	(clutter_model_set_n_columns),
	(clutter_model_set_names),
	(clutter_model_set_types): Subclasses of ClutterModel will be able
	to call clutter_model_set_types() and clutter_model_set_names() in
	any order, provided that they don't call each function more than
	once.

	* tests/test-model.c: Update the test case.
2007-11-29 15:01:21 +00:00
Emmanuele Bassi
9800eb0639 2007-11-28 Emmanuele Bassi <ebassi@openedhand.com>
Add more introspection capabilities to the base model class

	* clutter/clutter-model.h:
	* clutter/clutter-model.c:
	(clutter_model_finalize): Do no leak the column types array.

	(clutter_model_get_n_columns): Function for getting the number
	of columns inside a model.

	(clutter_model_set_names): Add API for setting the names of the
	columns.

	(clutter_model_get_column_name),
	(_model_get_column_type): Add API for getting each column's name
	and the default implementation for ClutterModel.

	(clutter_model_get_column_type),
	(_model_get_iter_at_row): Add API for getting each column's type
	and the default implementation for ClutterModel.

	* clutter.symbols: Add ClutterModel and ClutterModelIter symbols,
	and keep the symbols file sorted.
2007-11-28 18:04:24 +00:00
Emmanuele Bassi
07079204ac 2007-11-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c:
	* clutter/clutter-alpha.c:
	* clutter/clutter-effect.c:
	* clutter/clutter-event.c:
	* clutter/clutter-event.h:
	* clutter/clutter-group.h:
	* clutter/clutter-model.c:,
	* clutter/clutter-script.c:
	* clutter/clutter-scriptable.h:
	* clutter/clutter-stage.c: Documentation fixes.

	* clutter/clutter-score.c: Fix implementation.
2007-11-23 13:11:10 +00:00
Emmanuele Bassi
fd0e52848b 2007-11-18 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model.c: Add gtk-doc section for
	ClutterModelIter

	* clutter/clutter-script.h: Fix argument name.

	* clutter/x11/clutter-x11.h:
	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-backend-x11.c: Document functions and
	types.
2007-11-18 15:41:47 +00:00
Neil J. Patel
35cecde0c8 2007-11-15 Neil J. Patel <njp@o-hand.com>
* clutter/clutter-model.c:
	Added some more examples to the documentation, plus explained how the
	iters work internally.
2007-11-15 17:10:12 +00:00
Neil J. Patel
70e09ab9df 2007-11-15 Neil J. Patel <njp@o-hand.com>
* clutter/Makefile.am:
	* clutter/clutter-model.c: 
	* clutter/clutter-model.h:
	* clutter/clutter.h:
	* tests/Makefile.am:
	* tests/test-model.c:
	Merged ClutterModel, which closes #443.
2007-11-15 10:02:25 +00:00