mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
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.
This commit is contained in:
parent
8efb98edae
commit
7c05499865
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
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 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-03-19 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-group.c:
|
* clutter/clutter-group.c:
|
||||||
|
@ -418,6 +418,33 @@ clutter_list_model_iter_prev (ClutterModelIter *iter)
|
|||||||
|
|
||||||
return CLUTTER_MODEL_ITER (iter_default);
|
return CLUTTER_MODEL_ITER (iter_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterModelIter *
|
||||||
|
clutter_list_model_iter_copy (ClutterModelIter *iter)
|
||||||
|
{
|
||||||
|
ClutterListModelIter *iter_default;
|
||||||
|
ClutterListModelIter *iter_copy;
|
||||||
|
ClutterModel *model;
|
||||||
|
guint row;
|
||||||
|
|
||||||
|
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||||
|
|
||||||
|
model = clutter_model_iter_get_model (iter);
|
||||||
|
row = clutter_model_iter_get_row (iter) - 1;
|
||||||
|
|
||||||
|
iter_copy = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
|
||||||
|
"model", model,
|
||||||
|
"row", row,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* this is safe, because the seq_iter pointer on the passed
|
||||||
|
* iterator will be always be overwritten in ::next or ::prev
|
||||||
|
*/
|
||||||
|
iter_copy->seq_iter = iter_default->seq_iter;
|
||||||
|
|
||||||
|
return CLUTTER_MODEL_ITER (iter_copy);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
|
clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
|
||||||
{
|
{
|
||||||
@ -429,6 +456,7 @@ clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
|
|||||||
iter_class->is_last = clutter_list_model_iter_is_last;
|
iter_class->is_last = clutter_list_model_iter_is_last;
|
||||||
iter_class->next = clutter_list_model_iter_next;
|
iter_class->next = clutter_list_model_iter_next;
|
||||||
iter_class->prev = clutter_list_model_iter_prev;
|
iter_class->prev = clutter_list_model_iter_prev;
|
||||||
|
iter_class->copy = clutter_list_model_iter_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1473,6 +1473,16 @@ clutter_model_iter_prev_unimplemented (ClutterModelIter *iter)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterModelIter *
|
||||||
|
clutter_model_iter_copy_unimplemented (ClutterModelIter *iter)
|
||||||
|
{
|
||||||
|
g_warning ("%s: Iterator of type `%s' does not implement the "
|
||||||
|
"ClutterModelIter::copy() virtual function",
|
||||||
|
G_STRLOC,
|
||||||
|
g_type_name (G_OBJECT_TYPE (iter)));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_model_iter_get_property (GObject *object,
|
clutter_model_iter_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -1535,6 +1545,7 @@ clutter_model_iter_class_init (ClutterModelIterClass *klass)
|
|||||||
klass->prev = clutter_model_iter_prev_unimplemented;
|
klass->prev = clutter_model_iter_prev_unimplemented;
|
||||||
klass->get_value = clutter_model_iter_get_value_unimplemented;
|
klass->get_value = clutter_model_iter_get_value_unimplemented;
|
||||||
klass->set_value = clutter_model_iter_set_value_unimplemented;
|
klass->set_value = clutter_model_iter_set_value_unimplemented;
|
||||||
|
klass->copy = clutter_model_iter_copy_unimplemented;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
|
||||||
@ -1989,3 +2000,27 @@ clutter_model_iter_get_row (ClutterModelIter *iter)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_model_iter_copy:
|
||||||
|
* @iter: a #ClutterModelIter
|
||||||
|
*
|
||||||
|
* Copies the passed iterator.
|
||||||
|
*
|
||||||
|
* Return value: a copy of the iterator, or %NULL
|
||||||
|
*
|
||||||
|
* Since: 0.8
|
||||||
|
*/
|
||||||
|
ClutterModelIter *
|
||||||
|
clutter_model_iter_copy (ClutterModelIter *iter)
|
||||||
|
{
|
||||||
|
ClutterModelIterClass *klass;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_MODEL_ITER (iter), NULL);
|
||||||
|
|
||||||
|
klass = CLUTTER_MODEL_ITER_GET_CLASS (iter);
|
||||||
|
if (klass->copy)
|
||||||
|
return klass->copy (iter);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -325,9 +325,11 @@ struct _ClutterModelIterClass
|
|||||||
ClutterModelIter *(* next) (ClutterModelIter *iter);
|
ClutterModelIter *(* next) (ClutterModelIter *iter);
|
||||||
ClutterModelIter *(* prev) (ClutterModelIter *iter);
|
ClutterModelIter *(* prev) (ClutterModelIter *iter);
|
||||||
|
|
||||||
ClutterModel* (* get_model) (ClutterModelIter *iter);
|
ClutterModel * (* get_model) (ClutterModelIter *iter);
|
||||||
guint (* get_row) (ClutterModelIter *iter);
|
guint (* get_row) (ClutterModelIter *iter);
|
||||||
|
|
||||||
|
ClutterModelIter *(* copy) (ClutterModelIter *iter);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* padding for future */
|
/* padding for future */
|
||||||
void (*_clutter_model_iter_1) (void);
|
void (*_clutter_model_iter_1) (void);
|
||||||
@ -361,6 +363,7 @@ ClutterModelIter *clutter_model_iter_prev (ClutterModelIter *iter);
|
|||||||
ClutterModel * clutter_model_iter_get_model (ClutterModelIter *iter);
|
ClutterModel * clutter_model_iter_get_model (ClutterModelIter *iter);
|
||||||
guint clutter_model_iter_get_row (ClutterModelIter *iter);
|
guint clutter_model_iter_get_row (ClutterModelIter *iter);
|
||||||
|
|
||||||
|
ClutterModelIter *clutter_model_iter_copy (ClutterModelIter *iter);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user