mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter: remove unused deprecated types
They weren't being used anywhere, so they can be easily removed without going into other files.
This commit is contained in:
parent
787bb4316d
commit
1c7472b24d
@ -271,16 +271,11 @@ deprecated_h = \
|
||||
deprecated/clutter-box.h \
|
||||
deprecated/clutter-cairo-texture.h \
|
||||
deprecated/clutter-container.h \
|
||||
deprecated/clutter-frame-source.h \
|
||||
deprecated/clutter-group.h \
|
||||
deprecated/clutter-input-device.h \
|
||||
deprecated/clutter-keysyms.h \
|
||||
deprecated/clutter-list-model.h \
|
||||
deprecated/clutter-main.h \
|
||||
deprecated/clutter-media.h \
|
||||
deprecated/clutter-model.h \
|
||||
deprecated/clutter-rectangle.h \
|
||||
deprecated/clutter-score.h \
|
||||
deprecated/clutter-shader.h \
|
||||
deprecated/clutter-stage-manager.h \
|
||||
deprecated/clutter-stage.h \
|
||||
@ -288,7 +283,6 @@ deprecated_h = \
|
||||
deprecated/clutter-table-layout.h \
|
||||
deprecated/clutter-texture.h \
|
||||
deprecated/clutter-timeline.h \
|
||||
deprecated/clutter-timeout-pool.h \
|
||||
deprecated/clutter-util.h \
|
||||
$(NULL)
|
||||
|
||||
@ -307,31 +301,14 @@ deprecated_c = \
|
||||
deprecated/clutter-behaviour-scale.c \
|
||||
deprecated/clutter-box.c \
|
||||
deprecated/clutter-cairo-texture.c \
|
||||
deprecated/clutter-frame-source.c \
|
||||
deprecated/clutter-group.c \
|
||||
deprecated/clutter-input-device-deprecated.c \
|
||||
deprecated/clutter-layout-manager-deprecated.c \
|
||||
deprecated/clutter-list-model.c \
|
||||
deprecated/clutter-media.c \
|
||||
deprecated/clutter-model.c \
|
||||
deprecated/clutter-rectangle.c \
|
||||
deprecated/clutter-score.c \
|
||||
deprecated/clutter-shader.c \
|
||||
deprecated/clutter-state.c \
|
||||
deprecated/clutter-table-layout.c \
|
||||
deprecated/clutter-texture.c \
|
||||
deprecated/clutter-timeout-pool.c \
|
||||
$(NULL)
|
||||
|
||||
# deprecated private headers; these should not be installed
|
||||
deprecated_h_priv = \
|
||||
deprecated/clutter-model-private.h \
|
||||
deprecated/clutter-timeout-interval.h \
|
||||
$(NULL)
|
||||
|
||||
# deprecated private source code; these should not be introspected
|
||||
deprecated_c_priv = \
|
||||
deprecated/clutter-timeout-interval.c \
|
||||
$(NULL)
|
||||
|
||||
# built sources
|
||||
@ -595,8 +572,6 @@ libmutter_clutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
|
||||
$(source_h_priv) \
|
||||
$(deprecated_c) \
|
||||
$(deprecated_h) \
|
||||
$(deprecated_c_priv) \
|
||||
$(deprecated_h_priv) \
|
||||
$(cally_sources_c) \
|
||||
$(cally_sources_h) \
|
||||
$(cally_sources_private) \
|
||||
|
@ -20,16 +20,11 @@
|
||||
#include "deprecated/clutter-box.h"
|
||||
#include "deprecated/clutter-cairo-texture.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
#include "deprecated/clutter-input-device.h"
|
||||
#include "deprecated/clutter-keysyms.h"
|
||||
#include "deprecated/clutter-list-model.h"
|
||||
#include "deprecated/clutter-main.h"
|
||||
#include "deprecated/clutter-media.h"
|
||||
#include "deprecated/clutter-model.h"
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
#include "deprecated/clutter-score.h"
|
||||
#include "deprecated/clutter-shader.h"
|
||||
#include "deprecated/clutter-stage-manager.h"
|
||||
#include "deprecated/clutter-stage.h"
|
||||
@ -37,7 +32,6 @@
|
||||
#include "deprecated/clutter-table-layout.h"
|
||||
#include "deprecated/clutter-texture.h"
|
||||
#include "deprecated/clutter-timeline.h"
|
||||
#include "deprecated/clutter-timeout-pool.h"
|
||||
#include "deprecated/clutter-util.h"
|
||||
|
||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Neil Roberts <neil@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-timeout-interval.h"
|
||||
|
||||
typedef struct _ClutterFrameSource ClutterFrameSource;
|
||||
|
||||
struct _ClutterFrameSource
|
||||
{
|
||||
GSource source;
|
||||
|
||||
ClutterTimeoutInterval timeout;
|
||||
};
|
||||
|
||||
static gboolean clutter_frame_source_prepare (GSource *source,
|
||||
gint *timeout);
|
||||
static gboolean clutter_frame_source_check (GSource *source);
|
||||
static gboolean clutter_frame_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data);
|
||||
|
||||
static GSourceFuncs clutter_frame_source_funcs =
|
||||
{
|
||||
clutter_frame_source_prepare,
|
||||
clutter_frame_source_check,
|
||||
clutter_frame_source_dispatch,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* clutter_frame_source_add_full: (rename-to clutter_frame_source_add)
|
||||
* @priority: the priority of the frame source. Typically this will be in the
|
||||
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
* @notify: function to call when the timeout source is removed
|
||||
*
|
||||
* Sets a function to be called at regular intervals with the given
|
||||
* priority. The function is called repeatedly until it returns
|
||||
* %FALSE, at which point the timeout is automatically destroyed and
|
||||
* the function will not be called again. The @notify function is
|
||||
* called when the timeout is destroyed. The first call to the
|
||||
* function will be at the end of the first @interval.
|
||||
*
|
||||
* This function is similar to g_timeout_add_full() except that it
|
||||
* will try to compensate for delays. For example, if @func takes half
|
||||
* the interval time to execute then the function will be called again
|
||||
* half the interval time after it finished. In contrast
|
||||
* g_timeout_add_full() would not fire until a full interval after the
|
||||
* function completes so the delay between calls would be 1.0 / @fps *
|
||||
* 1.5. This function does not however try to invoke the function
|
||||
* multiple times to catch up missing frames if @func takes more than
|
||||
* @interval ms to execute.
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API.
|
||||
*/
|
||||
guint
|
||||
clutter_frame_source_add_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
guint ret;
|
||||
GSource *source = g_source_new (&clutter_frame_source_funcs,
|
||||
sizeof (ClutterFrameSource));
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
|
||||
_clutter_timeout_interval_init (&frame_source->timeout, fps);
|
||||
|
||||
if (priority != G_PRIORITY_DEFAULT)
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_name (source, "Clutter frame timeout");
|
||||
g_source_set_callback (source, func, data, notify);
|
||||
|
||||
ret = g_source_attach (source, NULL);
|
||||
|
||||
g_source_unref (source);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_frame_source_add: (skip)
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
*
|
||||
* Simple wrapper around clutter_frame_source_add_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_frame_source_add (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
return clutter_frame_source_add_full (G_PRIORITY_DEFAULT,
|
||||
fps, func, data, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_prepare (GSource *source,
|
||||
gint *delay)
|
||||
{
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
gint64 current_time;
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
current_time = g_source_get_time (source) / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal source_time;
|
||||
g_source_get_current_time (source, &source_time);
|
||||
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _clutter_timeout_interval_prepare (current_time,
|
||||
&frame_source->timeout,
|
||||
delay);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_check (GSource *source)
|
||||
{
|
||||
return clutter_frame_source_prepare (source, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
|
||||
return _clutter_timeout_interval_dispatch (&frame_source->timeout,
|
||||
callback, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_add_frame_source_full: (rename-to clutter_threads_add_frame_source)
|
||||
* @priority: the priority of the frame source. Typically this will be in the
|
||||
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
* @notify: function to call when the timeout source is removed
|
||||
*
|
||||
* Sets a function to be called at regular intervals holding the Clutter
|
||||
* threads lock, with the given priority. The function is called repeatedly
|
||||
* until it returns %FALSE, at which point the timeout is automatically
|
||||
* removed and the function will not be called again. The @notify function
|
||||
* is called when the timeout is removed.
|
||||
*
|
||||
* This function is similar to clutter_threads_add_timeout_full()
|
||||
* except that it will try to compensate for delays. For example, if
|
||||
* @func takes half the interval time to execute then the function
|
||||
* will be called again half the interval time after it finished. In
|
||||
* contrast clutter_threads_add_timeout_full() would not fire until a
|
||||
* full interval after the function completes so the delay between
|
||||
* calls would be @interval * 1.5. This function does not however try
|
||||
* to invoke the function multiple times to catch up missing frames if
|
||||
* @func takes more than @interval ms to execute.
|
||||
*
|
||||
* See also clutter_threads_add_idle_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_threads_add_frame_source_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
ClutterThreadsDispatch *dispatch;
|
||||
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
dispatch = g_slice_new (ClutterThreadsDispatch);
|
||||
dispatch->func = func;
|
||||
dispatch->data = data;
|
||||
dispatch->notify = notify;
|
||||
|
||||
return clutter_frame_source_add_full (priority,
|
||||
fps,
|
||||
_clutter_threads_dispatch, dispatch,
|
||||
_clutter_threads_dispatch_free);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_add_frame_source: (skip)
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
*
|
||||
* Simple wrapper around clutter_threads_add_frame_source_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_threads_add_frame_source (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
|
||||
fps,
|
||||
func, data,
|
||||
NULL);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_FRAME_SOURCE_H__
|
||||
#define __CLUTTER_FRAME_SOURCE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_frame_source_add (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_frame_source_add_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_FRAME_SOURCE_H__ */
|
@ -1,834 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Neil Jagdish Patel <njp@o-hand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-list-model
|
||||
* @short_description: List model implementation
|
||||
*
|
||||
* #ClutterListModel is a #ClutterModel implementation provided by
|
||||
* Clutter. #ClutterListModel uses a #GSequence for storing the
|
||||
* values for each row, so it's optimized for insertion and look up
|
||||
* in sorted lists.
|
||||
*
|
||||
* #ClutterListModel is available since Clutter 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use a #GListStore instance containing a custom
|
||||
* object type with properties for each column instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter-list-model.h"
|
||||
|
||||
#include "clutter-model.h"
|
||||
#include "clutter-model-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
#define CLUTTER_TYPE_LIST_MODEL_ITER \
|
||||
(clutter_list_model_iter_get_type())
|
||||
#define CLUTTER_LIST_MODEL_ITER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
|
||||
CLUTTER_TYPE_LIST_MODEL_ITER, \
|
||||
ClutterListModelIter))
|
||||
#define CLUTTER_IS_LIST_MODEL_ITER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), \
|
||||
CLUTTER_TYPE_LIST_MODEL_ITER))
|
||||
#define CLUTTER_LIST_MODEL_ITER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_LIST_MODEL_ITER, \
|
||||
ClutterListModelIterClass))
|
||||
#define CLUTTER_IS_LIST_MODEL_ITER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_LIST_MODEL_ITER))
|
||||
#define CLUTTER_LIST_MODEL_ITER_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_LIST_MODEL_ITER, \
|
||||
ClutterListModelIterClass))
|
||||
|
||||
typedef struct _ClutterListModelIter ClutterListModelIter;
|
||||
typedef struct _ClutterModelIterClass ClutterListModelIterClass;
|
||||
|
||||
struct _ClutterListModelPrivate
|
||||
{
|
||||
GSequence *sequence;
|
||||
|
||||
ClutterModelIter *temp_iter;
|
||||
};
|
||||
|
||||
struct _ClutterListModelIter
|
||||
{
|
||||
ClutterModelIter parent_instance;
|
||||
|
||||
GSequenceIter *seq_iter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
GType clutter_list_model_iter_get_type (void);
|
||||
|
||||
/*
|
||||
* ClutterListModel
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (ClutterListModelIter,
|
||||
clutter_list_model_iter,
|
||||
CLUTTER_TYPE_MODEL_ITER)
|
||||
|
||||
static void
|
||||
clutter_list_model_iter_get_value (ClutterModelIter *iter,
|
||||
guint column,
|
||||
GValue *value)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
GValue *values;
|
||||
GValue *iter_value;
|
||||
GValue real_value = G_VALUE_INIT;
|
||||
gboolean converted = FALSE;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
values = g_sequence_get (iter_default->seq_iter);
|
||||
iter_value = &values[column];
|
||||
g_assert (iter_value != NULL);
|
||||
|
||||
if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
|
||||
{
|
||||
if (!g_value_type_compatible (G_VALUE_TYPE (value),
|
||||
G_VALUE_TYPE (iter_value)) &&
|
||||
!g_value_type_compatible (G_VALUE_TYPE (iter_value),
|
||||
G_VALUE_TYPE (value)))
|
||||
{
|
||||
g_warning ("%s: Unable to convert from %s to %s",
|
||||
G_STRLOC,
|
||||
g_type_name (G_VALUE_TYPE (value)),
|
||||
g_type_name (G_VALUE_TYPE (iter_value)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_value_transform (iter_value, &real_value))
|
||||
{
|
||||
g_warning ("%s: Unable to make conversion from %s to %s",
|
||||
G_STRLOC,
|
||||
g_type_name (G_VALUE_TYPE (value)),
|
||||
g_type_name (G_VALUE_TYPE (iter_value)));
|
||||
g_value_unset (&real_value);
|
||||
}
|
||||
|
||||
converted = TRUE;
|
||||
}
|
||||
|
||||
if (converted)
|
||||
{
|
||||
g_value_copy (&real_value, value);
|
||||
g_value_unset (&real_value);
|
||||
}
|
||||
else
|
||||
g_value_copy (iter_value, value);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_iter_set_value (ClutterModelIter *iter,
|
||||
guint column,
|
||||
const GValue *value)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
GValue *values;
|
||||
GValue *iter_value;
|
||||
GValue real_value = G_VALUE_INIT;
|
||||
gboolean converted = FALSE;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
values = g_sequence_get (iter_default->seq_iter);
|
||||
iter_value = &values[column];
|
||||
g_assert (iter_value != NULL);
|
||||
|
||||
if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
|
||||
{
|
||||
if (!g_value_type_compatible (G_VALUE_TYPE (value),
|
||||
G_VALUE_TYPE (iter_value)) &&
|
||||
!g_value_type_compatible (G_VALUE_TYPE (iter_value),
|
||||
G_VALUE_TYPE (value)))
|
||||
{
|
||||
g_warning ("%s: Unable to convert from %s to %s\n",
|
||||
G_STRLOC,
|
||||
g_type_name (G_VALUE_TYPE (value)),
|
||||
g_type_name (G_VALUE_TYPE (iter_value)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_value_transform (value, &real_value))
|
||||
{
|
||||
g_warning ("%s: Unable to make conversion from %s to %s\n",
|
||||
G_STRLOC,
|
||||
g_type_name (G_VALUE_TYPE (value)),
|
||||
g_type_name (G_VALUE_TYPE (iter_value)));
|
||||
g_value_unset (&real_value);
|
||||
}
|
||||
|
||||
converted = TRUE;
|
||||
}
|
||||
|
||||
if (converted)
|
||||
{
|
||||
g_value_copy (&real_value, iter_value);
|
||||
g_value_unset (&real_value);
|
||||
}
|
||||
else
|
||||
g_value_copy (value, iter_value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_list_model_iter_is_first (ClutterModelIter *iter)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
ClutterModel *model;
|
||||
ClutterModelIter *temp_iter;
|
||||
GSequence *sequence;
|
||||
GSequenceIter *begin, *end;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
model = clutter_model_iter_get_model (iter);
|
||||
|
||||
sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
|
||||
|
||||
begin = g_sequence_get_begin_iter (sequence);
|
||||
end = iter_default->seq_iter;
|
||||
|
||||
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
|
||||
|
||||
while (!g_sequence_iter_is_begin (begin))
|
||||
{
|
||||
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
|
||||
|
||||
if (clutter_model_filter_iter (model, temp_iter))
|
||||
{
|
||||
end = begin;
|
||||
break;
|
||||
}
|
||||
|
||||
begin = g_sequence_iter_next (begin);
|
||||
}
|
||||
|
||||
/* This is because the 'begin_iter' is always *before* the last valid
|
||||
* iter, otherwise we'd have endless loops
|
||||
*/
|
||||
end = g_sequence_iter_prev (end);
|
||||
|
||||
return iter_default->seq_iter == end;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_list_model_iter_is_last (ClutterModelIter *iter)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
ClutterModelIter *temp_iter;
|
||||
ClutterModel *model;
|
||||
GSequence *sequence;
|
||||
GSequenceIter *begin, *end;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
if (g_sequence_iter_is_end (iter_default->seq_iter))
|
||||
return TRUE;
|
||||
|
||||
model = clutter_model_iter_get_model (iter);
|
||||
|
||||
sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
|
||||
|
||||
begin = g_sequence_get_end_iter (sequence);
|
||||
begin = g_sequence_iter_prev (begin);
|
||||
end = iter_default->seq_iter;
|
||||
|
||||
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
|
||||
|
||||
while (!g_sequence_iter_is_begin (begin))
|
||||
{
|
||||
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
|
||||
|
||||
if (clutter_model_filter_iter (model, temp_iter))
|
||||
{
|
||||
end = begin;
|
||||
break;
|
||||
}
|
||||
|
||||
begin = g_sequence_iter_prev (begin);
|
||||
}
|
||||
|
||||
/* This is because the 'end_iter' is always *after* the last valid iter.
|
||||
* Otherwise we'd have endless loops
|
||||
*/
|
||||
end = g_sequence_iter_next (end);
|
||||
|
||||
return iter_default->seq_iter == end;
|
||||
}
|
||||
|
||||
static ClutterModelIter *
|
||||
clutter_list_model_iter_next (ClutterModelIter *iter)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
ClutterModelIter *temp_iter;
|
||||
ClutterModel *model = NULL;
|
||||
GSequenceIter *filter_next;
|
||||
guint row;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
model = clutter_model_iter_get_model (iter);
|
||||
row = clutter_model_iter_get_row (iter);
|
||||
|
||||
filter_next = g_sequence_iter_next (iter_default->seq_iter);
|
||||
g_assert (filter_next != NULL);
|
||||
|
||||
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
|
||||
|
||||
while (!g_sequence_iter_is_end (filter_next))
|
||||
{
|
||||
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_next;
|
||||
|
||||
if (clutter_model_filter_iter (model, temp_iter))
|
||||
{
|
||||
row += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
filter_next = g_sequence_iter_next (filter_next);
|
||||
}
|
||||
|
||||
if (g_sequence_iter_is_end (filter_next))
|
||||
row += 1;
|
||||
|
||||
/* update the iterator and return it */
|
||||
_clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
|
||||
iter_default->seq_iter = filter_next;
|
||||
|
||||
return CLUTTER_MODEL_ITER (iter_default);
|
||||
}
|
||||
|
||||
static ClutterModelIter *
|
||||
clutter_list_model_iter_prev (ClutterModelIter *iter)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
ClutterModelIter *temp_iter;
|
||||
ClutterModel *model;
|
||||
GSequenceIter *filter_prev;
|
||||
guint row;
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
g_assert (iter_default->seq_iter != NULL);
|
||||
|
||||
model = clutter_model_iter_get_model (iter);
|
||||
row = clutter_model_iter_get_row (iter);
|
||||
|
||||
filter_prev = g_sequence_iter_prev (iter_default->seq_iter);
|
||||
g_assert (filter_prev != NULL);
|
||||
|
||||
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
|
||||
|
||||
while (!g_sequence_iter_is_begin (filter_prev))
|
||||
{
|
||||
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_prev;
|
||||
|
||||
if (clutter_model_filter_iter (model, temp_iter))
|
||||
{
|
||||
row -= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
filter_prev = g_sequence_iter_prev (filter_prev);
|
||||
}
|
||||
|
||||
if (g_sequence_iter_is_begin (filter_prev))
|
||||
row -= 1;
|
||||
|
||||
/* update the iterator and return it */
|
||||
_clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
|
||||
iter_default->seq_iter = filter_prev;
|
||||
|
||||
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
|
||||
clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
|
||||
{
|
||||
ClutterModelIterClass *iter_class = CLUTTER_MODEL_ITER_CLASS (klass);
|
||||
|
||||
iter_class->get_value = clutter_list_model_iter_get_value;
|
||||
iter_class->set_value = clutter_list_model_iter_set_value;
|
||||
iter_class->is_first = clutter_list_model_iter_is_first;
|
||||
iter_class->is_last = clutter_list_model_iter_is_last;
|
||||
iter_class->next = clutter_list_model_iter_next;
|
||||
iter_class->prev = clutter_list_model_iter_prev;
|
||||
iter_class->copy = clutter_list_model_iter_copy;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_iter_init (ClutterListModelIter *iter)
|
||||
{
|
||||
iter->seq_iter = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterListModel
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterListModel, clutter_list_model, CLUTTER_TYPE_MODEL)
|
||||
|
||||
static ClutterModelIter *
|
||||
clutter_list_model_get_iter_at_row (ClutterModel *model,
|
||||
guint row)
|
||||
{
|
||||
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
|
||||
GSequence *sequence = model_default->priv->sequence;
|
||||
GSequenceIter *filter_next;
|
||||
gint seq_length = g_sequence_get_length (sequence);
|
||||
ClutterListModelIter *retval;
|
||||
gint count = -1;
|
||||
|
||||
if (row >= seq_length)
|
||||
return NULL;
|
||||
|
||||
retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
|
||||
"model", model,
|
||||
"row", row,
|
||||
NULL);
|
||||
|
||||
/* short-circuit in case we don't have a filter in place */
|
||||
if (!clutter_model_get_filter_set (model))
|
||||
{
|
||||
retval->seq_iter = g_sequence_get_iter_at_pos (sequence, row);
|
||||
|
||||
return CLUTTER_MODEL_ITER (retval);
|
||||
}
|
||||
|
||||
filter_next = g_sequence_get_begin_iter (sequence);
|
||||
g_assert (filter_next != NULL);
|
||||
|
||||
while (!g_sequence_iter_is_end (filter_next))
|
||||
{
|
||||
retval->seq_iter = filter_next;
|
||||
|
||||
if (clutter_model_filter_iter (model, CLUTTER_MODEL_ITER (retval)))
|
||||
{
|
||||
/* We've found a row that is valid under the filter */
|
||||
count++;
|
||||
if (count == row)
|
||||
break;
|
||||
}
|
||||
|
||||
filter_next = g_sequence_iter_next (filter_next);
|
||||
}
|
||||
|
||||
if (count != row)
|
||||
{
|
||||
g_object_unref (retval);
|
||||
return NULL;
|
||||
}
|
||||
return CLUTTER_MODEL_ITER (retval);
|
||||
}
|
||||
|
||||
static ClutterModelIter *
|
||||
clutter_list_model_insert_row (ClutterModel *model,
|
||||
gint index_)
|
||||
{
|
||||
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
|
||||
GSequence *sequence = model_default->priv->sequence;
|
||||
ClutterListModelIter *retval;
|
||||
guint n_columns, i, pos;
|
||||
GValue *values;
|
||||
GSequenceIter *seq_iter;
|
||||
|
||||
n_columns = clutter_model_get_n_columns (model);
|
||||
values = g_new0 (GValue, n_columns);
|
||||
|
||||
for (i = 0; i < n_columns; i++)
|
||||
g_value_init (&values[i], clutter_model_get_column_type (model, i));
|
||||
|
||||
if (index_ < 0)
|
||||
{
|
||||
seq_iter = g_sequence_append (sequence, values);
|
||||
pos = g_sequence_get_length (sequence) - 1;
|
||||
}
|
||||
else if (index_ == 0)
|
||||
{
|
||||
seq_iter = g_sequence_prepend (sequence, values);
|
||||
pos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
seq_iter = g_sequence_get_iter_at_pos (sequence, index_);
|
||||
seq_iter = g_sequence_insert_before (seq_iter, values);
|
||||
pos = index_;
|
||||
}
|
||||
|
||||
retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
|
||||
"model", model,
|
||||
"row", pos,
|
||||
NULL);
|
||||
retval->seq_iter = seq_iter;
|
||||
|
||||
return CLUTTER_MODEL_ITER (retval);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_remove_row (ClutterModel *model,
|
||||
guint row)
|
||||
{
|
||||
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
|
||||
GSequence *sequence = model_default->priv->sequence;
|
||||
GSequenceIter *seq_iter;
|
||||
guint pos = 0;
|
||||
|
||||
seq_iter = g_sequence_get_begin_iter (sequence);
|
||||
while (!g_sequence_iter_is_end (seq_iter))
|
||||
{
|
||||
if (clutter_model_filter_row (model, pos))
|
||||
{
|
||||
if (pos == row)
|
||||
{
|
||||
ClutterModelIter *iter;
|
||||
|
||||
iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
|
||||
"model", model,
|
||||
"row", pos,
|
||||
NULL);
|
||||
CLUTTER_LIST_MODEL_ITER (iter)->seq_iter = seq_iter;
|
||||
|
||||
/* the actual row is removed from the sequence inside
|
||||
* the ::row-removed signal class handler, so that every
|
||||
* handler connected to ::row-removed will still get
|
||||
* a valid iterator, and every signal connected to
|
||||
* ::row-removed with the AFTER flag will get an updated
|
||||
* model
|
||||
*/
|
||||
g_signal_emit_by_name (model, "row-removed", iter);
|
||||
|
||||
g_object_unref (iter);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pos += 1;
|
||||
seq_iter = g_sequence_iter_next (seq_iter);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ClutterModel *model;
|
||||
guint column;
|
||||
ClutterModelSortFunc func;
|
||||
gpointer data;
|
||||
} SortClosure;
|
||||
|
||||
static gint
|
||||
sort_model_default (gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer data)
|
||||
{
|
||||
const GValue *row_a = a;
|
||||
const GValue *row_b = b;
|
||||
SortClosure *clos = data;
|
||||
|
||||
return clos->func (clos->model,
|
||||
&row_a[clos->column],
|
||||
&row_b[clos->column],
|
||||
clos->data);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_resort (ClutterModel *model,
|
||||
ClutterModelSortFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
SortClosure sort_closure = { NULL, 0, NULL, NULL };
|
||||
|
||||
sort_closure.model = model;
|
||||
sort_closure.column = clutter_model_get_sorting_column (model);
|
||||
sort_closure.func = func;
|
||||
sort_closure.data = data;
|
||||
|
||||
g_sequence_sort (CLUTTER_LIST_MODEL (model)->priv->sequence,
|
||||
sort_model_default,
|
||||
&sort_closure);
|
||||
}
|
||||
|
||||
static guint
|
||||
clutter_list_model_get_n_rows (ClutterModel *model)
|
||||
{
|
||||
ClutterListModel *list_model = CLUTTER_LIST_MODEL (model);
|
||||
|
||||
/* short-circuit in case we don't have a filter in place */
|
||||
if (!clutter_model_get_filter_set (model))
|
||||
return g_sequence_get_length (list_model->priv->sequence);
|
||||
|
||||
return CLUTTER_MODEL_CLASS (clutter_list_model_parent_class)->get_n_rows (model);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_row_removed (ClutterModel *model,
|
||||
ClutterModelIter *iter)
|
||||
{
|
||||
ClutterListModelIter *iter_default;
|
||||
guint i, n_columns;
|
||||
GValue *values;
|
||||
|
||||
n_columns = clutter_model_get_n_columns (model);
|
||||
|
||||
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
|
||||
|
||||
values = g_sequence_get (iter_default->seq_iter);
|
||||
|
||||
for (i = 0; i < n_columns; i++)
|
||||
g_value_unset (&values[i]);
|
||||
|
||||
g_free (values);
|
||||
|
||||
g_sequence_remove (iter_default->seq_iter);
|
||||
iter_default->seq_iter = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
|
||||
GSequence *sequence = model->priv->sequence;
|
||||
GSequenceIter *iter;
|
||||
guint n_columns, i;
|
||||
|
||||
n_columns = clutter_model_get_n_columns (CLUTTER_MODEL (gobject));
|
||||
|
||||
iter = g_sequence_get_begin_iter (sequence);
|
||||
while (!g_sequence_iter_is_end (iter))
|
||||
{
|
||||
GValue *values = g_sequence_get (iter);
|
||||
|
||||
for (i = 0; i < n_columns; i++)
|
||||
g_value_unset (&values[i]);
|
||||
|
||||
g_free (values);
|
||||
|
||||
iter = g_sequence_iter_next (iter);
|
||||
}
|
||||
g_sequence_free (sequence);
|
||||
|
||||
G_OBJECT_CLASS (clutter_list_model_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
|
||||
|
||||
if (model->priv->temp_iter)
|
||||
{
|
||||
g_object_unref (model->priv->temp_iter);
|
||||
model->priv->temp_iter = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_list_model_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_class_init (ClutterListModelClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterModelClass *model_class = CLUTTER_MODEL_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = clutter_list_model_finalize;
|
||||
gobject_class->dispose = clutter_list_model_dispose;
|
||||
|
||||
model_class->get_iter_at_row = clutter_list_model_get_iter_at_row;
|
||||
model_class->insert_row = clutter_list_model_insert_row;
|
||||
model_class->remove_row = clutter_list_model_remove_row;
|
||||
model_class->resort = clutter_list_model_resort;
|
||||
model_class->get_n_rows = clutter_list_model_get_n_rows;
|
||||
model_class->row_removed = clutter_list_model_row_removed;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_list_model_init (ClutterListModel *model)
|
||||
{
|
||||
model->priv = clutter_list_model_get_instance_private (model);
|
||||
|
||||
model->priv->sequence = g_sequence_new (NULL);
|
||||
model->priv->temp_iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
|
||||
"model",
|
||||
model,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_list_model_new:
|
||||
* @n_columns: number of columns in the model
|
||||
* @...: @n_columns number of #GType and string pairs
|
||||
*
|
||||
* Creates a new default model with @n_columns columns with the types
|
||||
* and names passed in.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* model = clutter_list_model_new (3,
|
||||
* G_TYPE_INT, "Score",
|
||||
* G_TYPE_STRING, "Team",
|
||||
* GDK_TYPE_PIXBUF, "Logo");
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* will create a new #ClutterModel with three columns of type int,
|
||||
* string and #GdkPixbuf respectively.
|
||||
*
|
||||
* Note that the name of the column can be set to %NULL, in which case
|
||||
* the canonical name of the type held by the column will be used as
|
||||
* the title.
|
||||
*
|
||||
* Return value: a new #ClutterListModel
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListStore instead
|
||||
*/
|
||||
ClutterModel *
|
||||
clutter_list_model_new (guint n_columns,
|
||||
...)
|
||||
{
|
||||
ClutterModel *model;
|
||||
va_list args;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (n_columns > 0, NULL);
|
||||
|
||||
model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
|
||||
_clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
|
||||
|
||||
va_start (args, n_columns);
|
||||
|
||||
for (i = 0; i < n_columns; i++)
|
||||
{
|
||||
GType type = va_arg (args, GType);
|
||||
const gchar *name = va_arg (args, gchar*);
|
||||
|
||||
if (!_clutter_model_check_type (type))
|
||||
{
|
||||
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
|
||||
g_object_unref (model);
|
||||
model = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
_clutter_model_set_column_type (model, i, type);
|
||||
_clutter_model_set_column_name (model, i, name);
|
||||
}
|
||||
|
||||
out:
|
||||
va_end (args);
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_list_model_newv:
|
||||
* @n_columns: number of columns in the model
|
||||
* @types: (array length=n_columns): an array of #GType types for the columns, from first to last
|
||||
* @names: (array length=n_columns): an array of names for the columns, from first to last
|
||||
*
|
||||
* Non-vararg version of clutter_list_model_new(). This function is
|
||||
* useful for language bindings.
|
||||
*
|
||||
* Return value: (transfer full): a new default #ClutterModel
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListStore instead
|
||||
*/
|
||||
ClutterModel *
|
||||
clutter_list_model_newv (guint n_columns,
|
||||
GType *types,
|
||||
const gchar * const names[])
|
||||
{
|
||||
ClutterModel *model;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (n_columns > 0, NULL);
|
||||
|
||||
model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
|
||||
_clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
|
||||
|
||||
for (i = 0; i < n_columns; i++)
|
||||
{
|
||||
if (!_clutter_model_check_type (types[i]))
|
||||
{
|
||||
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (types[i]));
|
||||
g_object_unref (model);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_clutter_model_set_column_type (model, i, types[i]);
|
||||
_clutter_model_set_column_name (model, i, names[i]);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Neil Jagdish Patel <njp@o-hand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* NB: Inspiration for column storage taken from GtkListStore
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_LIST_MODEL_H__
|
||||
#define __CLUTTER_LIST_MODEL_H__
|
||||
|
||||
#include <clutter/deprecated/clutter-model.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_LIST_MODEL (clutter_list_model_get_type ())
|
||||
#define CLUTTER_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModel))
|
||||
#define CLUTTER_IS_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LIST_MODEL))
|
||||
#define CLUTTER_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
|
||||
#define CLUTTER_IS_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LIST_MODEL))
|
||||
#define CLUTTER_LIST_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
|
||||
|
||||
typedef struct _ClutterListModel ClutterListModel;
|
||||
typedef struct _ClutterListModelPrivate ClutterListModelPrivate;
|
||||
typedef struct _ClutterListModelClass ClutterListModelClass;
|
||||
|
||||
/**
|
||||
* ClutterListModel:
|
||||
*
|
||||
* The #ClutterListModel struct contains only private data.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListStore instead
|
||||
*/
|
||||
struct _ClutterListModel
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterModel parent_instance;
|
||||
|
||||
ClutterListModelPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterListModelClass:
|
||||
*
|
||||
* The #ClutterListModelClass struct contains only private data.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListStore instead
|
||||
*/
|
||||
struct _ClutterListModelClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterModelClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(g_list_store_get_type)
|
||||
GType clutter_list_model_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(g_list_store_new)
|
||||
ClutterModel *clutter_list_model_new (guint n_columns,
|
||||
...);
|
||||
CLUTTER_DEPRECATED_FOR(g_list_store_new)
|
||||
ClutterModel *clutter_list_model_newv (guint n_columns,
|
||||
GType *types,
|
||||
const gchar * const names[]);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_LIST_MODEL_H__ */
|
@ -1,664 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By: Matthew Allum <mallum@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-media
|
||||
* @short_description: An interface for controlling playback of media data
|
||||
*
|
||||
* #ClutterMedia is an interface for controlling playback of media sources.
|
||||
*
|
||||
* Clutter core does not provide an implementation of this interface, but
|
||||
* other integration libraries like Clutter-GStreamer implement it to offer
|
||||
* a uniform API for applications.
|
||||
*
|
||||
* #ClutterMedia is available since Clutter 0.2
|
||||
*
|
||||
* #ClutterMedia is deprecated since Clutter 1.12. Use the Clutter-GStreamer
|
||||
* API directly instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-media.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h" /* for DBG */
|
||||
|
||||
enum
|
||||
{
|
||||
EOS_SIGNAL,
|
||||
ERROR_SIGNAL, /* can't be called 'ERROR' otherwise it clashes with wingdi.h */
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint media_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
typedef ClutterMediaIface ClutterMediaInterface;
|
||||
|
||||
G_DEFINE_INTERFACE (ClutterMedia, clutter_media, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
clutter_media_default_init (ClutterMediaInterface *iface)
|
||||
{
|
||||
GParamSpec *pspec = NULL;
|
||||
|
||||
/**
|
||||
* ClutterMedia:uri:
|
||||
*
|
||||
* The location of a media file, expressed as a valid URI.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_string ("uri",
|
||||
P_("URI"),
|
||||
P_("URI of a media file"),
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:playing:
|
||||
*
|
||||
* Whether the #ClutterMedia actor is playing.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("playing",
|
||||
P_("Playing"),
|
||||
P_("Whether the actor is playing"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:progress:
|
||||
*
|
||||
* The current progress of the playback, as a normalized
|
||||
* value between 0.0 and 1.0.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_double ("progress",
|
||||
P_("Progress"),
|
||||
P_("Current progress of the playback"),
|
||||
0.0, 1.0, 0.0,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:subtitle-uri:
|
||||
*
|
||||
* The location of a subtitle file, expressed as a valid URI.
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_string ("subtitle-uri",
|
||||
P_("Subtitle URI"),
|
||||
P_("URI of a subtitle file"),
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:subtitle-font-name:
|
||||
*
|
||||
* The font used to display subtitles. The font description has to
|
||||
* follow the same grammar as the one recognized by
|
||||
* pango_font_description_from_string().
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_string ("subtitle-font-name",
|
||||
P_("Subtitle Font Name"),
|
||||
P_("The font used to display subtitles"),
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:audio-volume:
|
||||
*
|
||||
* The volume of the audio, as a normalized value between
|
||||
* 0.0 and 1.0.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_double ("audio-volume",
|
||||
P_("Audio Volume"),
|
||||
P_("The volume of the audio"),
|
||||
0.0, 1.0, 0.5,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:can-seek:
|
||||
*
|
||||
* Whether the current stream is seekable.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("can-seek",
|
||||
P_("Can Seek"),
|
||||
P_("Whether the current stream is seekable"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:buffer-fill:
|
||||
*
|
||||
* The fill level of the buffer for the current stream,
|
||||
* as a value between 0.0 and 1.0.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_double ("buffer-fill",
|
||||
P_("Buffer Fill"),
|
||||
P_("The fill level of the buffer"),
|
||||
0.0, 1.0, 0.0,
|
||||
CLUTTER_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:duration:
|
||||
*
|
||||
* The duration of the current stream, in seconds
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
pspec = g_param_spec_double ("duration",
|
||||
P_("Duration"),
|
||||
P_("The duration of the stream, in seconds"),
|
||||
0, G_MAXDOUBLE, 0,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia::eos:
|
||||
* @media: the #ClutterMedia instance that received the signal
|
||||
*
|
||||
* The ::eos signal is emitted each time the media stream ends.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
media_signals[EOS_SIGNAL] =
|
||||
g_signal_new (I_("eos"),
|
||||
CLUTTER_TYPE_MEDIA,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterMediaIface, eos),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
/**
|
||||
* ClutterMedia::error:
|
||||
* @media: the #ClutterMedia instance that received the signal
|
||||
* @error: the #GError
|
||||
*
|
||||
* The ::error signal is emitted each time an error occurred.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
media_signals[ERROR_SIGNAL] =
|
||||
g_signal_new (I_("error"),
|
||||
CLUTTER_TYPE_MEDIA,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterMediaIface, error),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_media_set_uri:
|
||||
* @media: a #ClutterMedia
|
||||
* @uri: the URI of the media stream
|
||||
*
|
||||
* Sets the URI of @media to @uri.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_uri (ClutterMedia *media,
|
||||
const gchar *uri)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "uri", uri, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_uri:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the URI from @media.
|
||||
*
|
||||
* Return value: the URI of the media stream. Use g_free()
|
||||
* to free the returned string
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gchar *
|
||||
clutter_media_get_uri (ClutterMedia *media)
|
||||
{
|
||||
gchar *retval = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (media), "uri", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_playing:
|
||||
* @media: a #ClutterMedia
|
||||
* @playing: %TRUE to start playing
|
||||
*
|
||||
* Starts or stops playing of @media.
|
||||
|
||||
* The implementation might be asynchronous, so the way to know whether
|
||||
* the actual playing state of the @media is to use the #GObject::notify
|
||||
* signal on the #ClutterMedia:playing property and then retrieve the
|
||||
* current state with clutter_media_get_playing(). ClutterGstVideoTexture
|
||||
* in clutter-gst is an example of such an asynchronous implementation.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_playing (ClutterMedia *media,
|
||||
gboolean playing)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "playing", playing, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_playing:
|
||||
* @media: A #ClutterMedia object
|
||||
*
|
||||
* Retrieves the playing status of @media.
|
||||
*
|
||||
* Return value: %TRUE if playing, %FALSE if stopped.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gboolean
|
||||
clutter_media_get_playing (ClutterMedia *media)
|
||||
{
|
||||
gboolean is_playing = FALSE;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
|
||||
|
||||
g_object_get (G_OBJECT (media), "playing", &is_playing, NULL);
|
||||
|
||||
return is_playing;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_progress:
|
||||
* @media: a #ClutterMedia
|
||||
* @progress: the progress of the playback, between 0.0 and 1.0
|
||||
*
|
||||
* Sets the playback progress of @media. The @progress is
|
||||
* a normalized value between 0.0 (begin) and 1.0 (end).
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_progress (ClutterMedia *media,
|
||||
gdouble progress)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "progress", progress, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_progress:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the playback progress of @media.
|
||||
*
|
||||
* Return value: the playback progress, between 0.0 and 1.0
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gdouble
|
||||
clutter_media_get_progress (ClutterMedia *media)
|
||||
{
|
||||
gdouble retval = 0.0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
|
||||
|
||||
g_object_get (G_OBJECT (media), "progress", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_subtitle_uri:
|
||||
* @media: a #ClutterMedia
|
||||
* @uri: the URI of a subtitle file
|
||||
*
|
||||
* Sets the location of a subtitle file to display while playing @media.
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_subtitle_uri (ClutterMedia *media,
|
||||
const char *uri)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "subtitle-uri", uri, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_subtitle_uri:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the URI of the subtitle file in use.
|
||||
*
|
||||
* Return value: the URI of the subtitle file. Use g_free()
|
||||
* to free the returned string
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gchar *
|
||||
clutter_media_get_subtitle_uri (ClutterMedia *media)
|
||||
{
|
||||
gchar *retval = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (media), "subtitle-uri", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_subtitle_font_name:
|
||||
* @media: a #ClutterMedia
|
||||
* @font_name: a font name, or %NULL to set the default font name
|
||||
*
|
||||
* Sets the font used by the subtitle renderer. The @font_name string must be
|
||||
* either %NULL, which means that the default font name of the underlying
|
||||
* implementation will be used; or must follow the grammar recognized by
|
||||
* pango_font_description_from_string() like:
|
||||
*
|
||||
* |[
|
||||
* clutter_media_set_subtitle_font_name (media, "Sans 24pt");
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_subtitle_font_name (ClutterMedia *media,
|
||||
const char *font_name)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "subtitle-font-name", font_name, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_subtitle_font_name:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the font name currently used.
|
||||
*
|
||||
* Return value: a string containing the font name. Use g_free()
|
||||
* to free the returned string
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gchar *
|
||||
clutter_media_get_subtitle_font_name (ClutterMedia *media)
|
||||
{
|
||||
gchar *retval = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (media), "subtitle-font-name", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_audio_volume:
|
||||
* @media: a #ClutterMedia
|
||||
* @volume: the volume as a double between 0.0 and 1.0
|
||||
*
|
||||
* Sets the playback volume of @media to @volume.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_audio_volume (ClutterMedia *media,
|
||||
gdouble volume)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "audio-volume", volume, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_audio_volume:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the playback volume of @media.
|
||||
*
|
||||
* Return value: The playback volume between 0.0 and 1.0
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gdouble
|
||||
clutter_media_get_audio_volume (ClutterMedia *media)
|
||||
{
|
||||
gdouble retval = 0.0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0.0);
|
||||
|
||||
g_object_get (G_OBJECT (media), "audio-volume", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_can_seek:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves whether @media is seekable or not.
|
||||
*
|
||||
* Return value: %TRUE if @media can seek, %FALSE otherwise.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gboolean
|
||||
clutter_media_get_can_seek (ClutterMedia *media)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
|
||||
|
||||
g_object_get (G_OBJECT (media), "can-seek", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_buffer_fill:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the amount of the stream that is buffered.
|
||||
*
|
||||
* Return value: the fill level, between 0.0 and 1.0
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gdouble
|
||||
clutter_media_get_buffer_fill (ClutterMedia *media)
|
||||
{
|
||||
gdouble retval = 0.0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
|
||||
|
||||
g_object_get (G_OBJECT (media), "buffer-fill", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_duration:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the duration of the media stream that @media represents.
|
||||
*
|
||||
* Return value: the duration of the media stream, in seconds
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gdouble
|
||||
clutter_media_get_duration (ClutterMedia *media)
|
||||
{
|
||||
gdouble retval = 0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), 0);
|
||||
|
||||
g_object_get (G_OBJECT (media), "duration", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* helper funcs */
|
||||
|
||||
/**
|
||||
* clutter_media_set_filename:
|
||||
* @media: a #ClutterMedia
|
||||
* @filename: A filename
|
||||
*
|
||||
* Sets the source of @media using a file path.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_media_set_filename (ClutterMedia *media,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *uri;
|
||||
GError *uri_error = NULL;
|
||||
|
||||
if (!g_path_is_absolute (filename))
|
||||
{
|
||||
gchar *abs_path;
|
||||
|
||||
abs_path = g_build_filename (g_get_current_dir (), filename, NULL);
|
||||
uri = g_filename_to_uri (abs_path, NULL, &uri_error);
|
||||
g_free (abs_path);
|
||||
}
|
||||
else
|
||||
uri = g_filename_to_uri (filename, NULL, &uri_error);
|
||||
|
||||
if (uri_error)
|
||||
{
|
||||
g_signal_emit (media, media_signals[ERROR_SIGNAL], 0, uri_error);
|
||||
g_error_free (uri_error);
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_media_set_uri (media, uri);
|
||||
|
||||
g_free (uri);
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By: Matthew Allum <mallum@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_MEDIA_H__
|
||||
#define __CLUTTER_MEDIA_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_MEDIA (clutter_media_get_type ())
|
||||
#define CLUTTER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MEDIA, ClutterMedia))
|
||||
#define CLUTTER_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MEDIA))
|
||||
#define CLUTTER_MEDIA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_MEDIA, ClutterMediaIface))
|
||||
|
||||
typedef struct _ClutterMedia ClutterMedia; /* dummy typedef */
|
||||
typedef struct _ClutterMediaIface ClutterMediaIface;
|
||||
|
||||
/**
|
||||
* ClutterMedia:
|
||||
*
|
||||
* #ClutterMedia is an opaque structure whose members cannot be directly
|
||||
* accessed
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterMediaIface:
|
||||
* @eos: handler for the #ClutterMedia::eos signal
|
||||
* @error: handler for the #ClutterMedia::error signal
|
||||
*
|
||||
* Interface vtable for #ClutterMedia implementations
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
struct _ClutterMediaIface
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface base_iface;
|
||||
|
||||
/*< public >*/
|
||||
/* signals */
|
||||
void (* eos) (ClutterMedia *media);
|
||||
void (* error) (ClutterMedia *media,
|
||||
const GError *error);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_media_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
CLUTTER_DEPRECATED
|
||||
gchar * clutter_media_get_uri (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_filename (ClutterMedia *media,
|
||||
const gchar *filename);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_playing (ClutterMedia *media,
|
||||
gboolean playing);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_media_get_playing (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_progress (ClutterMedia *media,
|
||||
gdouble progress);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_media_get_progress (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_subtitle_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
CLUTTER_DEPRECATED
|
||||
gchar * clutter_media_get_subtitle_uri (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_subtitle_font_name (ClutterMedia *media,
|
||||
const char *font_name);
|
||||
CLUTTER_DEPRECATED
|
||||
gchar * clutter_media_get_subtitle_font_name (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_media_set_audio_volume (ClutterMedia *media,
|
||||
gdouble volume);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_media_get_can_seek (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_media_get_duration (ClutterMedia *media);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_MEDIA_H__ */
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Neil Jagdish Patel <njp@o-hand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_MODEL_PRIVATE_H__
|
||||
#define __CLUTTER_MODEL_PRIVATE_H__
|
||||
|
||||
#include "clutter-types.h"
|
||||
#include "clutter-model.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_model_set_n_columns (ClutterModel *model,
|
||||
gint n_columns,
|
||||
gboolean set_types,
|
||||
gboolean set_names);
|
||||
gboolean _clutter_model_check_type (GType gtype);
|
||||
|
||||
void _clutter_model_set_column_type (ClutterModel *model,
|
||||
gint column,
|
||||
GType gtype);
|
||||
void _clutter_model_set_column_name (ClutterModel *model,
|
||||
gint column,
|
||||
const gchar *name);
|
||||
|
||||
void _clutter_model_iter_set_row (ClutterModelIter *iter,
|
||||
guint row);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_MODEL_PRIVATE_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,436 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Neil Jagdish Patel <njp@o-hand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_MODEL_H__
|
||||
#define __CLUTTER_MODEL_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_MODEL (clutter_model_get_type ())
|
||||
#define CLUTTER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL, ClutterModel))
|
||||
#define CLUTTER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL, ClutterModelClass))
|
||||
#define CLUTTER_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL))
|
||||
#define CLUTTER_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL))
|
||||
#define CLUTTER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL, ClutterModelClass))
|
||||
|
||||
typedef struct _ClutterModel ClutterModel;
|
||||
typedef struct _ClutterModelClass ClutterModelClass;
|
||||
typedef struct _ClutterModelPrivate ClutterModelPrivate;
|
||||
typedef struct _ClutterModelIter ClutterModelIter;
|
||||
typedef struct _ClutterModelIterClass ClutterModelIterClass;
|
||||
typedef struct _ClutterModelIterPrivate ClutterModelIterPrivate;
|
||||
|
||||
|
||||
/**
|
||||
* ClutterModelFilterFunc:
|
||||
* @model: a #ClutterModel
|
||||
* @iter: the iterator for the row
|
||||
* @user_data: data passed to clutter_model_set_filter()
|
||||
*
|
||||
* Filters the content of a row in the model.
|
||||
*
|
||||
* Return value: If the row should be displayed, return %TRUE
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Implement filters using a custom #GListModel instead
|
||||
*/
|
||||
typedef gboolean (*ClutterModelFilterFunc) (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* ClutterModelSortFunc:
|
||||
* @model: a #ClutterModel
|
||||
* @a: a #GValue representing the contents of the row
|
||||
* @b: a #GValue representing the contents of the second row
|
||||
* @user_data: data passed to clutter_model_set_sort()
|
||||
*
|
||||
* Compares the content of two rows in the model.
|
||||
*
|
||||
* Return value: a positive integer if @a is after @b, a negative integer if
|
||||
* @a is before @b, or 0 if the rows are the same
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Implement sorting using a custom #GListModel instead
|
||||
*/
|
||||
typedef gint (*ClutterModelSortFunc) (ClutterModel *model,
|
||||
const GValue *a,
|
||||
const GValue *b,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* ClutterModelForeachFunc:
|
||||
* @model: a #ClutterModel
|
||||
* @iter: the iterator for the row
|
||||
* @user_data: data passed to clutter_model_foreach()
|
||||
*
|
||||
* Iterates on the content of a row in the model
|
||||
*
|
||||
* Return value: %TRUE if the iteration should continue, %FALSE otherwise
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListModel
|
||||
*/
|
||||
typedef gboolean (*ClutterModelForeachFunc) (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* ClutterModel:
|
||||
*
|
||||
* Base class for list models. The #ClutterModel structure contains
|
||||
* only private data and should be manipulated using the provided
|
||||
* API.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListModel instead
|
||||
*/
|
||||
struct _ClutterModel
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterModelPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterModelClass:
|
||||
* @row_added: signal class handler for ClutterModel::row-added
|
||||
* @row_removed: signal class handler for ClutterModel::row-removed
|
||||
* @row_changed: signal class handler for ClutterModel::row-changed
|
||||
* @sort_changed: signal class handler for ClutterModel::sort-changed
|
||||
* @filter_changed: signal class handler for ClutterModel::filter-changed
|
||||
* @get_column_name: virtual function for returning the name of a column
|
||||
* @get_column_type: virtual function for returning the type of a column
|
||||
* @get_iter_at_row: virtual function for returning an iterator for the
|
||||
* given row
|
||||
* @get_n_rows: virtual function for returning the number of rows
|
||||
* of the model
|
||||
* @get_n_columns: virtual function for retuning the number of columns
|
||||
* of the model
|
||||
* @resort: virtual function for sorting the model using the passed
|
||||
* sorting function
|
||||
* @insert_row: virtual function for inserting a row at the given index
|
||||
* and returning an iterator pointing to it; if the index is a negative
|
||||
* integer, the row should be appended to the model
|
||||
* @remove_row: virtual function for removing a row at the given index
|
||||
*
|
||||
* Class for #ClutterModel instances.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use #GListModel instead
|
||||
*/
|
||||
struct _ClutterModelClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
/* vtable */
|
||||
guint (* get_n_rows) (ClutterModel *model);
|
||||
guint (* get_n_columns) (ClutterModel *model);
|
||||
const gchar * (* get_column_name) (ClutterModel *model,
|
||||
guint column);
|
||||
GType (* get_column_type) (ClutterModel *model,
|
||||
guint column);
|
||||
ClutterModelIter *(* insert_row) (ClutterModel *model,
|
||||
gint index_);
|
||||
void (* remove_row) (ClutterModel *model,
|
||||
guint row);
|
||||
ClutterModelIter *(* get_iter_at_row) (ClutterModel *model,
|
||||
guint row);
|
||||
void (* resort) (ClutterModel *model,
|
||||
ClutterModelSortFunc func,
|
||||
gpointer data);
|
||||
|
||||
/* signals */
|
||||
void (* row_added) (ClutterModel *model,
|
||||
ClutterModelIter *iter);
|
||||
void (* row_removed) (ClutterModel *model,
|
||||
ClutterModelIter *iter);
|
||||
void (* row_changed) (ClutterModel *model,
|
||||
ClutterModelIter *iter);
|
||||
void (* sort_changed) (ClutterModel *model);
|
||||
void (* filter_changed) (ClutterModel *model);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
void (*_clutter_model_1) (void);
|
||||
void (*_clutter_model_2) (void);
|
||||
void (*_clutter_model_3) (void);
|
||||
void (*_clutter_model_4) (void);
|
||||
void (*_clutter_model_5) (void);
|
||||
void (*_clutter_model_6) (void);
|
||||
void (*_clutter_model_7) (void);
|
||||
void (*_clutter_model_8) (void);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(g_list_model_get_type)
|
||||
GType clutter_model_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_set_types (ClutterModel *model,
|
||||
guint n_columns,
|
||||
GType *types);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_set_names (ClutterModel *model,
|
||||
guint n_columns,
|
||||
const gchar * const names[]);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_append (ClutterModel *model,
|
||||
...);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_appendv (ClutterModel *model,
|
||||
guint n_columns,
|
||||
guint *columns,
|
||||
GValue *values);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_prepend (ClutterModel *model,
|
||||
...);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_prependv (ClutterModel *model,
|
||||
guint n_columns,
|
||||
guint *columns,
|
||||
GValue *values);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_insert (ClutterModel *model,
|
||||
guint row,
|
||||
...);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_insertv (ClutterModel *model,
|
||||
guint row,
|
||||
guint n_columns,
|
||||
guint *columns,
|
||||
GValue *values);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_insert_value (ClutterModel *model,
|
||||
guint row,
|
||||
guint column,
|
||||
const GValue *value);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_remove (ClutterModel *model,
|
||||
guint row);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
guint clutter_model_get_n_rows (ClutterModel *model);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
guint clutter_model_get_n_columns (ClutterModel *model);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
const gchar * clutter_model_get_column_name (ClutterModel *model,
|
||||
guint column);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
GType clutter_model_get_column_type (ClutterModel *model,
|
||||
guint column);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
ClutterModelIter * clutter_model_get_first_iter (ClutterModel *model);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
ClutterModelIter * clutter_model_get_last_iter (ClutterModel *model);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
ClutterModelIter * clutter_model_get_iter_at_row (ClutterModel *model,
|
||||
guint row);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_set_sorting_column (ClutterModel *model,
|
||||
gint column);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
gint clutter_model_get_sorting_column (ClutterModel *model);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_foreach (ClutterModel *model,
|
||||
ClutterModelForeachFunc func,
|
||||
gpointer user_data);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_set_sort (ClutterModel *model,
|
||||
gint column,
|
||||
ClutterModelSortFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_set_filter (ClutterModel *model,
|
||||
ClutterModelFilterFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
gboolean clutter_model_get_filter_set (ClutterModel *model);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
void clutter_model_resort (ClutterModel *model);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
gboolean clutter_model_filter_row (ClutterModel *model,
|
||||
guint row);
|
||||
CLUTTER_DEPRECATED_FOR(GListModel)
|
||||
gboolean clutter_model_filter_iter (ClutterModel *model,
|
||||
ClutterModelIter *iter);
|
||||
|
||||
/*
|
||||
* ClutterModelIter
|
||||
*/
|
||||
|
||||
#define CLUTTER_TYPE_MODEL_ITER (clutter_model_iter_get_type ())
|
||||
#define CLUTTER_MODEL_ITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIter))
|
||||
#define CLUTTER_MODEL_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
|
||||
#define CLUTTER_IS_MODEL_ITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL_ITER))
|
||||
#define CLUTTER_IS_MODEL_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL_ITER))
|
||||
#define CLUTTER_MODEL_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
|
||||
|
||||
/**
|
||||
* ClutterModelIter:
|
||||
*
|
||||
* Base class for list models iters. The #ClutterModelIter structure
|
||||
* contains only private data and should be manipulated using the
|
||||
* provided API.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use custom iterators for #GListModel
|
||||
*/
|
||||
struct _ClutterModelIter
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterModelIterPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterModelIterClass:
|
||||
* @get_value: Virtual function for retrieving the value at the given
|
||||
* column of the row pointed by the iterator
|
||||
* @set_value: Virtual function for setting the value at the given
|
||||
* column of the row pointer by the iterator
|
||||
* @is_last: Virtual function for knowing whether the iterator points
|
||||
* at the last row in the model
|
||||
* @is_first: Virtual function for knowing whether the iterator points
|
||||
* at the first row in the model
|
||||
* @next: Virtual function for moving the iterator to the following
|
||||
* row in the model
|
||||
* @prev: Virtual function for moving the iterator toe the previous
|
||||
* row in the model
|
||||
* @get_model: Virtual function for getting the model to which the
|
||||
* iterator belongs to
|
||||
* @get_row: Virtual function for getting the row to which the iterator
|
||||
* points
|
||||
* @copy: Virtual function for copying a #ClutterModelIter.
|
||||
*
|
||||
* Class for #ClutterModelIter instances.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.24: Use custom iterators for #GListModel
|
||||
*/
|
||||
struct _ClutterModelIterClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
/* vtable not signals */
|
||||
void (* get_value) (ClutterModelIter *iter,
|
||||
guint column,
|
||||
GValue *value);
|
||||
void (* set_value) (ClutterModelIter *iter,
|
||||
guint column,
|
||||
const GValue *value);
|
||||
|
||||
gboolean (* is_first) (ClutterModelIter *iter);
|
||||
gboolean (* is_last) (ClutterModelIter *iter);
|
||||
|
||||
ClutterModelIter *(* next) (ClutterModelIter *iter);
|
||||
ClutterModelIter *(* prev) (ClutterModelIter *iter);
|
||||
|
||||
ClutterModel * (* get_model) (ClutterModelIter *iter);
|
||||
guint (* get_row) (ClutterModelIter *iter);
|
||||
|
||||
ClutterModelIter *(* copy) (ClutterModelIter *iter);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
void (*_clutter_model_iter_1) (void);
|
||||
void (*_clutter_model_iter_2) (void);
|
||||
void (*_clutter_model_iter_3) (void);
|
||||
void (*_clutter_model_iter_4) (void);
|
||||
void (*_clutter_model_iter_5) (void);
|
||||
void (*_clutter_model_iter_6) (void);
|
||||
void (*_clutter_model_iter_7) (void);
|
||||
void (*_clutter_model_iter_8) (void);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_model_iter_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_get (ClutterModelIter *iter,
|
||||
...);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_get_valist (ClutterModelIter *iter,
|
||||
va_list args);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_get_value (ClutterModelIter *iter,
|
||||
guint column,
|
||||
GValue *value);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_set (ClutterModelIter *iter,
|
||||
...);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_set_valist (ClutterModelIter *iter,
|
||||
va_list args);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_model_iter_set_value (ClutterModelIter *iter,
|
||||
guint column,
|
||||
const GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_model_iter_is_first (ClutterModelIter *iter);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_model_iter_is_last (ClutterModelIter *iter);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterModelIter *clutter_model_iter_next (ClutterModelIter *iter);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterModelIter *clutter_model_iter_prev (ClutterModelIter *iter);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterModel * clutter_model_iter_get_model (ClutterModelIter *iter);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_model_iter_get_row (ClutterModelIter *iter);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterModelIter *clutter_model_iter_copy (ClutterModelIter *iter);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_MODEL_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_SCORE_H__
|
||||
#define __CLUTTER_SCORE_H__
|
||||
|
||||
#include <clutter/clutter-timeline.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_SCORE (clutter_score_get_type ())
|
||||
|
||||
#define CLUTTER_SCORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCORE, ClutterScore))
|
||||
#define CLUTTER_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCORE, ClutterScoreClass))
|
||||
#define CLUTTER_IS_SCORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCORE))
|
||||
#define CLUTTER_IS_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCORE))
|
||||
#define CLUTTER_SCORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCORE, ClutterScoreClass))
|
||||
|
||||
typedef struct _ClutterScore ClutterScore;
|
||||
typedef struct _ClutterScorePrivate ClutterScorePrivate;
|
||||
typedef struct _ClutterScoreClass ClutterScoreClass;
|
||||
|
||||
/**
|
||||
* ClutterScore:
|
||||
*
|
||||
* The #ClutterScore structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
struct _ClutterScore
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent;
|
||||
ClutterScorePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterScoreClass:
|
||||
* @timeline_started: handler for the #ClutterScore::timeline-started signal
|
||||
* @timeline_completed: handler for the #ClutterScore::timeline-completed
|
||||
* signal
|
||||
* @started: handler for the #ClutterScore::started signal
|
||||
* @completed: handler for the #ClutterScore::completed signal
|
||||
* @paused: handler for the #ClutterScore::paused signal
|
||||
*
|
||||
* The #ClutterScoreClass structure contains only private data
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
struct _ClutterScoreClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* timeline_started) (ClutterScore *score,
|
||||
ClutterTimeline *timeline);
|
||||
void (* timeline_completed) (ClutterScore *score,
|
||||
ClutterTimeline *timeline);
|
||||
|
||||
void (* started) (ClutterScore *score);
|
||||
void (* completed) (ClutterScore *score);
|
||||
void (* paused) (ClutterScore *score);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
void (*_clutter_score_1) (void);
|
||||
void (*_clutter_score_2) (void);
|
||||
void (*_clutter_score_3) (void);
|
||||
void (*_clutter_score_4) (void);
|
||||
void (*_clutter_score_5) (void);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_score_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterScore * clutter_score_new (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_set_loop (ClutterScore *score,
|
||||
gboolean loop);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_score_get_loop (ClutterScore *score);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_score_append (ClutterScore *score,
|
||||
ClutterTimeline *parent,
|
||||
ClutterTimeline *timeline);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_score_append_at_marker (ClutterScore *score,
|
||||
ClutterTimeline *parent,
|
||||
const gchar *marker_name,
|
||||
ClutterTimeline *timeline);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_remove (ClutterScore *score,
|
||||
gulong id_);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_remove_all (ClutterScore *score);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline *clutter_score_get_timeline (ClutterScore *score,
|
||||
gulong id_);
|
||||
CLUTTER_DEPRECATED
|
||||
GSList * clutter_score_list_timelines (ClutterScore *score);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_start (ClutterScore *score);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_stop (ClutterScore *score);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_pause (ClutterScore *score);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_score_rewind (ClutterScore *score);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_score_is_playing (ClutterScore *score);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_SCORE_H__ */
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Neil Roberts <neil@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
/* This file contains the common code to check whether an interval has
|
||||
expired used in clutter-frame-source and clutter-timeout-pool. */
|
||||
|
||||
#include "clutter-timeout-interval.h"
|
||||
|
||||
void
|
||||
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
||||
guint fps)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
interval->start_time = g_get_monotonic_time () / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal start_time;
|
||||
g_get_current_time (&start_time);
|
||||
interval->start_time = start_time.tv_sec * 1000
|
||||
+ start_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
interval->fps = fps;
|
||||
interval->frame_count = 0;
|
||||
}
|
||||
|
||||
static gint64
|
||||
_clutter_timeout_interval_get_ticks (gint64 current_time,
|
||||
ClutterTimeoutInterval *interval)
|
||||
{
|
||||
return MAX (current_time - interval->start_time, 0);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_timeout_interval_prepare (gint64 current_time,
|
||||
ClutterTimeoutInterval *interval,
|
||||
gint *delay)
|
||||
{
|
||||
gint elapsed_time, new_frame_num;
|
||||
|
||||
elapsed_time = _clutter_timeout_interval_get_ticks (current_time, interval);
|
||||
new_frame_num = elapsed_time * interval->fps / 1000;
|
||||
|
||||
/* If time has gone backwards or the time since the last frame is
|
||||
greater than the two frames worth then reset the time and do a
|
||||
frame now */
|
||||
if (new_frame_num < interval->frame_count ||
|
||||
new_frame_num - interval->frame_count > 2)
|
||||
{
|
||||
/* Get the frame time rounded up to the nearest ms */
|
||||
guint frame_time = (1000 + interval->fps - 1) / interval->fps;
|
||||
|
||||
/* Reset the start time */
|
||||
interval->start_time = current_time;
|
||||
|
||||
/* Move the start time as if one whole frame has elapsed */
|
||||
interval->start_time -= frame_time;
|
||||
|
||||
interval->frame_count = 0;
|
||||
|
||||
if (delay)
|
||||
*delay = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (new_frame_num > interval->frame_count)
|
||||
{
|
||||
if (delay)
|
||||
*delay = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delay)
|
||||
*delay = ((interval->frame_count + 1) * 1000 / interval->fps
|
||||
- elapsed_time);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
if ((* callback) (user_data))
|
||||
{
|
||||
interval->frame_count++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
_clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
|
||||
const ClutterTimeoutInterval *b)
|
||||
{
|
||||
guint a_delay = 1000 / a->fps;
|
||||
guint b_delay = 1000 / b->fps;
|
||||
gint64 b_difference;
|
||||
gint comparison;
|
||||
|
||||
b_difference = a->start_time - b->start_time;
|
||||
|
||||
comparison = ((gint) ((a->frame_count + 1) * a_delay)
|
||||
- (gint) ((b->frame_count + 1) * b_delay + b_difference));
|
||||
|
||||
return (comparison < 0 ? -1
|
||||
: comparison > 0 ? 1
|
||||
: 0);
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Neil Roberts <neil@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_TIMEOUT_INTERVAL_H__
|
||||
#define __CLUTTER_TIMEOUT_INTERVAL_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterTimeoutInterval ClutterTimeoutInterval;
|
||||
|
||||
struct _ClutterTimeoutInterval
|
||||
{
|
||||
/* milliseconds */
|
||||
gint64 start_time;
|
||||
|
||||
guint frame_count;
|
||||
guint fps;
|
||||
};
|
||||
|
||||
void _clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
||||
guint fps);
|
||||
|
||||
gboolean _clutter_timeout_interval_prepare (gint64 current_time,
|
||||
ClutterTimeoutInterval *interval,
|
||||
gint *delay);
|
||||
|
||||
gboolean _clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data);
|
||||
|
||||
gint _clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
|
||||
const ClutterTimeoutInterval *b);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TIMEOUT_INTERVAL_H__ */
|
@ -1,498 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*
|
||||
* ClutterTimeoutPool: pool of timeout functions using the same slice of
|
||||
* the GLib main loop
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Based on similar code by Tristan van Berkom
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-main.h"
|
||||
|
||||
#include "clutter-timeout-pool.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-timeout-interval.h"
|
||||
|
||||
typedef struct _ClutterTimeout ClutterTimeout;
|
||||
typedef enum {
|
||||
CLUTTER_TIMEOUT_NONE = 0,
|
||||
CLUTTER_TIMEOUT_READY = 1 << 1
|
||||
} ClutterTimeoutFlags;
|
||||
|
||||
struct _ClutterTimeout
|
||||
{
|
||||
guint id;
|
||||
ClutterTimeoutFlags flags;
|
||||
gint refcount;
|
||||
|
||||
ClutterTimeoutInterval interval;
|
||||
|
||||
GSourceFunc func;
|
||||
gpointer data;
|
||||
GDestroyNotify notify;
|
||||
};
|
||||
|
||||
struct _ClutterTimeoutPool
|
||||
{
|
||||
GSource source;
|
||||
|
||||
guint next_id;
|
||||
|
||||
GList *timeouts;
|
||||
GList *dispatched_timeouts;
|
||||
|
||||
gint ready;
|
||||
|
||||
guint id;
|
||||
};
|
||||
|
||||
#define TIMEOUT_READY(timeout) (timeout->flags & CLUTTER_TIMEOUT_READY)
|
||||
|
||||
static gboolean clutter_timeout_pool_prepare (GSource *source,
|
||||
gint *next_timeout);
|
||||
static gboolean clutter_timeout_pool_check (GSource *source);
|
||||
static gboolean clutter_timeout_pool_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer data);
|
||||
static void clutter_timeout_pool_finalize (GSource *source);
|
||||
|
||||
static GSourceFuncs clutter_timeout_pool_funcs =
|
||||
{
|
||||
clutter_timeout_pool_prepare,
|
||||
clutter_timeout_pool_check,
|
||||
clutter_timeout_pool_dispatch,
|
||||
clutter_timeout_pool_finalize
|
||||
};
|
||||
|
||||
static gint
|
||||
clutter_timeout_sort (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
const ClutterTimeout *t_a = a;
|
||||
const ClutterTimeout *t_b = b;
|
||||
|
||||
/* Keep 'ready' timeouts at the front */
|
||||
if (TIMEOUT_READY (t_a))
|
||||
return -1;
|
||||
|
||||
if (TIMEOUT_READY (t_b))
|
||||
return 1;
|
||||
|
||||
return _clutter_timeout_interval_compare_expiration (&t_a->interval,
|
||||
&t_b->interval);
|
||||
}
|
||||
|
||||
static gint
|
||||
clutter_timeout_find_by_id (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
const ClutterTimeout *t_a = a;
|
||||
|
||||
return t_a->id == GPOINTER_TO_UINT (b) ? 0 : 1;
|
||||
}
|
||||
|
||||
static ClutterTimeout *
|
||||
clutter_timeout_new (guint fps)
|
||||
{
|
||||
ClutterTimeout *timeout;
|
||||
|
||||
timeout = g_slice_new0 (ClutterTimeout);
|
||||
_clutter_timeout_interval_init (&timeout->interval, fps);
|
||||
timeout->flags = CLUTTER_TIMEOUT_NONE;
|
||||
timeout->refcount = 1;
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_prepare (ClutterTimeoutPool *pool,
|
||||
ClutterTimeout *timeout,
|
||||
gint *next_timeout)
|
||||
{
|
||||
GSource *source = (GSource *) pool;
|
||||
gint64 now;
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
now = g_source_get_time (source) / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal source_time;
|
||||
g_source_get_current_time (source, &source_time);
|
||||
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _clutter_timeout_interval_prepare (now,
|
||||
&timeout->interval,
|
||||
next_timeout);
|
||||
}
|
||||
|
||||
/* ref and unref are always called under the main Clutter lock, so there
|
||||
* is not need for us to use g_atomic_int_* API.
|
||||
*/
|
||||
|
||||
static ClutterTimeout *
|
||||
clutter_timeout_ref (ClutterTimeout *timeout)
|
||||
{
|
||||
g_return_val_if_fail (timeout != NULL, timeout);
|
||||
g_return_val_if_fail (timeout->refcount > 0, timeout);
|
||||
|
||||
timeout->refcount += 1;
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_unref (ClutterTimeout *timeout)
|
||||
{
|
||||
g_return_if_fail (timeout != NULL);
|
||||
g_return_if_fail (timeout->refcount > 0);
|
||||
|
||||
timeout->refcount -= 1;
|
||||
|
||||
if (timeout->refcount == 0)
|
||||
{
|
||||
if (timeout->notify)
|
||||
timeout->notify (timeout->data);
|
||||
|
||||
g_slice_free (ClutterTimeout, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_free (ClutterTimeout *timeout)
|
||||
{
|
||||
if (G_LIKELY (timeout))
|
||||
{
|
||||
if (timeout->notify)
|
||||
timeout->notify (timeout->data);
|
||||
|
||||
g_slice_free (ClutterTimeout, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_prepare (GSource *source,
|
||||
gint *next_timeout)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *l = pool->timeouts;
|
||||
|
||||
/* the pool is ready if the first timeout is ready */
|
||||
if (l && l->data)
|
||||
{
|
||||
ClutterTimeout *timeout = l->data;
|
||||
return clutter_timeout_prepare (pool, timeout, next_timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
*next_timeout = -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_check (GSource *source)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *l;
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
for (l = pool->timeouts; l; l = l->next)
|
||||
{
|
||||
ClutterTimeout *timeout = l->data;
|
||||
|
||||
/* since the timeouts are sorted by expiration, as soon
|
||||
* as we get a check returning FALSE we know that the
|
||||
* following timeouts are not expiring, so we break as
|
||||
* soon as possible
|
||||
*/
|
||||
if (clutter_timeout_prepare (pool, timeout, NULL))
|
||||
{
|
||||
timeout->flags |= CLUTTER_TIMEOUT_READY;
|
||||
pool->ready += 1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return (pool->ready > 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_dispatch (GSource *source,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *dispatched_timeouts;
|
||||
|
||||
/* the main loop might have predicted this, so we repeat the
|
||||
* check for ready timeouts.
|
||||
*/
|
||||
if (!pool->ready)
|
||||
clutter_timeout_pool_check (source);
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
/* Iterate by moving the actual start of the list along so that it
|
||||
* can cope with adds and removes while a timeout is being dispatched
|
||||
*/
|
||||
while (pool->timeouts && pool->timeouts->data && pool->ready-- > 0)
|
||||
{
|
||||
ClutterTimeout *timeout = pool->timeouts->data;
|
||||
GList *l;
|
||||
|
||||
/* One of the ready timeouts may have been removed during dispatch,
|
||||
* in which case pool->ready will be wrong, but the ready timeouts
|
||||
* are always kept at the start of the list so we can stop once
|
||||
* we've reached the first non-ready timeout
|
||||
*/
|
||||
if (!(TIMEOUT_READY (timeout)))
|
||||
break;
|
||||
|
||||
/* Add a reference to the timeout so it can't disappear
|
||||
* while it's being dispatched
|
||||
*/
|
||||
clutter_timeout_ref (timeout);
|
||||
|
||||
timeout->flags &= ~CLUTTER_TIMEOUT_READY;
|
||||
|
||||
/* Move the list node to a list of dispatched timeouts */
|
||||
l = pool->timeouts;
|
||||
if (l->next)
|
||||
l->next->prev = NULL;
|
||||
|
||||
pool->timeouts = l->next;
|
||||
|
||||
if (pool->dispatched_timeouts)
|
||||
pool->dispatched_timeouts->prev = l;
|
||||
|
||||
l->prev = NULL;
|
||||
l->next = pool->dispatched_timeouts;
|
||||
pool->dispatched_timeouts = l;
|
||||
|
||||
if (!_clutter_timeout_interval_dispatch (&timeout->interval,
|
||||
timeout->func, timeout->data))
|
||||
{
|
||||
/* The timeout may have already been removed, but nothing
|
||||
* can be added to the dispatched_timeout list except in this
|
||||
* function so it will always either be at the head of the
|
||||
* dispatched list or have been removed
|
||||
*/
|
||||
if (pool->dispatched_timeouts &&
|
||||
pool->dispatched_timeouts->data == timeout)
|
||||
{
|
||||
pool->dispatched_timeouts =
|
||||
g_list_delete_link (pool->dispatched_timeouts,
|
||||
pool->dispatched_timeouts);
|
||||
|
||||
/* Remove the reference that was held by it being in the list */
|
||||
clutter_timeout_unref (timeout);
|
||||
}
|
||||
}
|
||||
|
||||
clutter_timeout_unref (timeout);
|
||||
}
|
||||
|
||||
/* Re-insert the dispatched timeouts in sorted order */
|
||||
dispatched_timeouts = pool->dispatched_timeouts;
|
||||
while (dispatched_timeouts)
|
||||
{
|
||||
ClutterTimeout *timeout = dispatched_timeouts->data;
|
||||
GList *next = dispatched_timeouts->next;
|
||||
|
||||
if (timeout)
|
||||
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
|
||||
clutter_timeout_sort);
|
||||
|
||||
dispatched_timeouts = next;
|
||||
}
|
||||
|
||||
g_list_free (pool->dispatched_timeouts);
|
||||
pool->dispatched_timeouts = NULL;
|
||||
|
||||
pool->ready = 0;
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_pool_finalize (GSource *source)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
|
||||
/* force destruction */
|
||||
g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
|
||||
g_list_free (pool->timeouts);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_new:
|
||||
* @priority: the priority of the timeout pool. Typically this will
|
||||
* be #G_PRIORITY_DEFAULT
|
||||
*
|
||||
* Creates a new timeout pool source. A timeout pool should be used when
|
||||
* multiple timeout functions, running at the same priority, are needed and
|
||||
* the g_timeout_add() API might lead to starvation of the time slice of
|
||||
* the main loop. A timeout pool allocates a single time slice of the main
|
||||
* loop and runs every timeout function inside it. The timeout pool is
|
||||
* always sorted, so that the extraction of the next timeout function is
|
||||
* a constant time operation.
|
||||
*
|
||||
* Return value: the newly created #ClutterTimeoutPool. The created pool
|
||||
* is owned by the GLib default context and will be automatically
|
||||
* destroyed when the context is destroyed. It is possible to force
|
||||
* the destruction of the timeout pool using g_source_destroy()
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
ClutterTimeoutPool *
|
||||
clutter_timeout_pool_new (gint priority)
|
||||
{
|
||||
ClutterTimeoutPool *pool;
|
||||
GSource *source;
|
||||
|
||||
source = g_source_new (&clutter_timeout_pool_funcs,
|
||||
sizeof (ClutterTimeoutPool));
|
||||
if (!source)
|
||||
return NULL;
|
||||
|
||||
g_source_set_name (source, "Clutter timeout pool");
|
||||
|
||||
if (priority != G_PRIORITY_DEFAULT)
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
pool = (ClutterTimeoutPool *) source;
|
||||
pool->next_id = 1;
|
||||
pool->id = g_source_attach (source, NULL);
|
||||
|
||||
/* let the default GLib context manage the pool */
|
||||
g_source_unref (source);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_add:
|
||||
* @pool: a #ClutterTimeoutPool
|
||||
* @fps: the time between calls to the function, in frames per second
|
||||
* @func: function to call
|
||||
* @data: (closure): data to pass to the function, or %NULL
|
||||
* @notify: function to call when the timeout is removed, or %NULL
|
||||
*
|
||||
* Sets a function to be called at regular intervals, and puts it inside
|
||||
* the @pool. The function is repeatedly called until it returns %FALSE,
|
||||
* at which point the timeout is automatically destroyed and the function
|
||||
* won't be called again. If @notify is not %NULL, the @notify function
|
||||
* will be called. The first call to @func will be at the end of @interval.
|
||||
*
|
||||
* Since Clutter 0.8 this will try to compensate for delays. For
|
||||
* example, if @func takes half the interval time to execute then the
|
||||
* function will be called again half the interval time after it
|
||||
* finished. Before version 0.8 it would not fire until a full
|
||||
* interval after the function completes so the delay between calls
|
||||
* would be @interval * 1.5. This function does not however try to
|
||||
* invoke the function multiple times to catch up missing frames if
|
||||
* @func takes more than @interval ms to execute.
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the timeout inside the pool.
|
||||
* Use clutter_timeout_pool_remove() to stop the timeout.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_timeout_pool_add (ClutterTimeoutPool *pool,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
ClutterTimeout *timeout;
|
||||
guint retval = 0;
|
||||
|
||||
timeout = clutter_timeout_new (fps);
|
||||
|
||||
retval = timeout->id = pool->next_id++;
|
||||
|
||||
timeout->func = func;
|
||||
timeout->data = data;
|
||||
timeout->notify = notify;
|
||||
|
||||
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
|
||||
clutter_timeout_sort);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_remove:
|
||||
* @pool: a #ClutterTimeoutPool
|
||||
* @id_: the id of the timeout to remove
|
||||
*
|
||||
* Removes a timeout function with @id_ from the timeout pool. The id
|
||||
* is the same returned when adding a function to the timeout pool with
|
||||
* clutter_timeout_pool_add().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
void
|
||||
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
|
||||
guint id_)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
|
||||
clutter_timeout_find_by_id)))
|
||||
{
|
||||
clutter_timeout_unref (l->data);
|
||||
pool->timeouts = g_list_delete_link (pool->timeouts, l);
|
||||
}
|
||||
else if ((l = g_list_find_custom (pool->dispatched_timeouts,
|
||||
GUINT_TO_POINTER (id_),
|
||||
clutter_timeout_find_by_id)))
|
||||
{
|
||||
clutter_timeout_unref (l->data);
|
||||
|
||||
pool->dispatched_timeouts =
|
||||
g_list_delete_link (pool->dispatched_timeouts, l);
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* ClutterTimeoutPool: pool of timeout functions using the same slice of
|
||||
* the GLib main loop
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Based on similar code by Tristan van Berkom
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_TIMEOUT_POOL_H__
|
||||
#define __CLUTTER_TIMEOUT_POOL_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* ClutterTimeoutPool: (skip)
|
||||
*
|
||||
* #ClutterTimeoutPool is an opaque structure
|
||||
* whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
typedef struct _ClutterTimeoutPool ClutterTimeoutPool;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeoutPool *clutter_timeout_pool_new (gint priority);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_timeout_pool_add (ClutterTimeoutPool *pool,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
|
||||
guint id_);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TIMEOUT_POOL_H__ */
|
@ -231,16 +231,11 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-box.h',
|
||||
'deprecated/clutter-cairo-texture.h',
|
||||
'deprecated/clutter-container.h',
|
||||
'deprecated/clutter-frame-source.h',
|
||||
'deprecated/clutter-group.h',
|
||||
'deprecated/clutter-input-device.h',
|
||||
'deprecated/clutter-keysyms.h',
|
||||
'deprecated/clutter-list-model.h',
|
||||
'deprecated/clutter-main.h',
|
||||
'deprecated/clutter-media.h',
|
||||
'deprecated/clutter-model.h',
|
||||
'deprecated/clutter-rectangle.h',
|
||||
'deprecated/clutter-score.h',
|
||||
'deprecated/clutter-shader.h',
|
||||
'deprecated/clutter-stage-manager.h',
|
||||
'deprecated/clutter-stage.h',
|
||||
@ -248,7 +243,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-table-layout.h',
|
||||
'deprecated/clutter-texture.h',
|
||||
'deprecated/clutter-timeline.h',
|
||||
'deprecated/clutter-timeout-pool.h',
|
||||
'deprecated/clutter-util.h',
|
||||
]
|
||||
|
||||
@ -266,29 +260,14 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-behaviour-scale.c',
|
||||
'deprecated/clutter-box.c',
|
||||
'deprecated/clutter-cairo-texture.c',
|
||||
'deprecated/clutter-frame-source.c',
|
||||
'deprecated/clutter-group.c',
|
||||
'deprecated/clutter-input-device-deprecated.c',
|
||||
'deprecated/clutter-layout-manager-deprecated.c',
|
||||
'deprecated/clutter-list-model.c',
|
||||
'deprecated/clutter-media.c',
|
||||
'deprecated/clutter-model.c',
|
||||
'deprecated/clutter-rectangle.c',
|
||||
'deprecated/clutter-score.c',
|
||||
'deprecated/clutter-shader.c',
|
||||
'deprecated/clutter-state.c',
|
||||
'deprecated/clutter-table-layout.c',
|
||||
'deprecated/clutter-texture.c',
|
||||
'deprecated/clutter-timeout-pool.c',
|
||||
]
|
||||
|
||||
clutter_deprecated_private_headers = [
|
||||
'deprecated/clutter-model-private.h',
|
||||
'deprecated/clutter-timeout-interval.h',
|
||||
]
|
||||
|
||||
clutter_deprecated_nonintrospected_sources = [
|
||||
'deprecated/clutter-timeout-interval.c',
|
||||
]
|
||||
|
||||
clutter_backend_sources = []
|
||||
@ -508,9 +487,7 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
|
||||
clutter_private_headers,
|
||||
clutter_nonintrospected_sources,
|
||||
clutter_deprecated_sources,
|
||||
clutter_deprecated_nonintrospected_sources,
|
||||
clutter_deprecated_headers,
|
||||
clutter_deprecated_private_headers,
|
||||
clutter_backend_sources,
|
||||
clutter_backend_nonintrospected_sources,
|
||||
clutter_backend_headers,
|
||||
|
@ -43,7 +43,6 @@ general_tests = \
|
||||
binding-pool \
|
||||
color \
|
||||
interval \
|
||||
model \
|
||||
script-parser \
|
||||
units \
|
||||
$(NULL)
|
||||
|
@ -35,7 +35,6 @@ clutter_conform_tests_general_tests = [
|
||||
'binding-pool',
|
||||
'color',
|
||||
'interval',
|
||||
'model',
|
||||
'script-parser',
|
||||
'units',
|
||||
]
|
||||
|
@ -1,528 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
typedef struct _ModelData
|
||||
{
|
||||
ClutterModel *model;
|
||||
|
||||
guint n_row;
|
||||
} ModelData;
|
||||
|
||||
typedef struct _ChangedData
|
||||
{
|
||||
ClutterModel *model;
|
||||
|
||||
ClutterModelIter *iter;
|
||||
|
||||
guint row;
|
||||
guint n_emissions;
|
||||
|
||||
gint value_check;
|
||||
} ChangedData;
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_FOO, /* G_TYPE_STRING */
|
||||
COLUMN_BAR, /* G_TYPE_INT */
|
||||
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const gchar *expected_foo;
|
||||
gint expected_bar;
|
||||
} base_model[] = {
|
||||
{ "String 1", 1 },
|
||||
{ "String 2", 2 },
|
||||
{ "String 3", 3 },
|
||||
{ "String 4", 4 },
|
||||
{ "String 5", 5 },
|
||||
{ "String 6", 6 },
|
||||
{ "String 7", 7 },
|
||||
{ "String 8", 8 },
|
||||
{ "String 9", 9 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const gchar *expected_foo;
|
||||
gint expected_bar;
|
||||
} forward_base[] = {
|
||||
{ "String 1", 1 },
|
||||
{ "String 2", 2 },
|
||||
{ "String 3", 3 },
|
||||
{ "String 4", 4 },
|
||||
{ "String 5", 5 },
|
||||
{ "String 6", 6 },
|
||||
{ "String 7", 7 },
|
||||
{ "String 8", 8 },
|
||||
{ "String 9", 9 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const gchar *expected_foo;
|
||||
gint expected_bar;
|
||||
} backward_base[] = {
|
||||
{ "String 9", 9 },
|
||||
{ "String 8", 8 },
|
||||
{ "String 7", 7 },
|
||||
{ "String 6", 6 },
|
||||
{ "String 5", 5 },
|
||||
{ "String 4", 4 },
|
||||
{ "String 3", 3 },
|
||||
{ "String 2", 2 },
|
||||
{ "String 1", 1 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const gchar *expected_foo;
|
||||
gint expected_bar;
|
||||
} filter_odd[] = {
|
||||
{ "String 1", 1 },
|
||||
{ "String 3", 3 },
|
||||
{ "String 5", 5 },
|
||||
{ "String 7", 7 },
|
||||
{ "String 9", 9 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const gchar *expected_foo;
|
||||
gint expected_bar;
|
||||
} filter_even[] = {
|
||||
{ "String 8", 8 },
|
||||
{ "String 6", 6 },
|
||||
{ "String 4", 4 },
|
||||
{ "String 2", 2 },
|
||||
};
|
||||
|
||||
static inline void
|
||||
compare_iter (ClutterModelIter *iter,
|
||||
const gint expected_row,
|
||||
const gchar *expected_foo,
|
||||
const gint expected_bar)
|
||||
{
|
||||
gchar *foo = NULL;
|
||||
gint bar = 0;
|
||||
gint row = 0;
|
||||
|
||||
row = clutter_model_iter_get_row (iter);
|
||||
clutter_model_iter_get (iter,
|
||||
COLUMN_FOO, &foo,
|
||||
COLUMN_BAR, &bar,
|
||||
-1);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Row %d => %d: Got [ '%s', '%d' ], expected [ '%s', '%d' ]\n",
|
||||
row, expected_row,
|
||||
foo, bar,
|
||||
expected_foo, expected_bar);
|
||||
|
||||
g_assert_cmpint (row, ==, expected_row);
|
||||
g_assert_cmpstr (foo, ==, expected_foo);
|
||||
g_assert_cmpint (bar, ==, expected_bar);
|
||||
|
||||
g_free (foo);
|
||||
}
|
||||
|
||||
static void
|
||||
on_row_added (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
ModelData *model_data = data;
|
||||
|
||||
compare_iter (iter,
|
||||
model_data->n_row,
|
||||
base_model[model_data->n_row].expected_foo,
|
||||
base_model[model_data->n_row].expected_bar);
|
||||
|
||||
model_data->n_row += 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
filter_even_rows (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
gint bar_value;
|
||||
|
||||
clutter_model_iter_get (iter, COLUMN_BAR, &bar_value, -1);
|
||||
|
||||
if (bar_value % 2 == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
filter_odd_rows (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
gint bar_value;
|
||||
|
||||
clutter_model_iter_get (iter, COLUMN_BAR, &bar_value, -1);
|
||||
|
||||
if (bar_value % 2 != 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
list_model_filter (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
ClutterModelIter *iter;
|
||||
gint i;
|
||||
|
||||
test_data.model = clutter_list_model_new (N_COLUMNS,
|
||||
G_TYPE_STRING, "Foo",
|
||||
G_TYPE_INT, "Bar");
|
||||
test_data.n_row = 0;
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
gchar *foo = g_strdup_printf ("String %d", i);
|
||||
|
||||
clutter_model_append (test_data.model,
|
||||
COLUMN_FOO, foo,
|
||||
COLUMN_BAR, i,
|
||||
-1);
|
||||
|
||||
g_free (foo);
|
||||
}
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Forward iteration (filter odd)...\n");
|
||||
|
||||
clutter_model_set_filter (test_data.model, filter_odd_rows, NULL, NULL);
|
||||
|
||||
iter = clutter_model_get_first_iter (test_data.model);
|
||||
g_assert (iter != NULL);
|
||||
|
||||
i = 0;
|
||||
while (!clutter_model_iter_is_last (iter))
|
||||
{
|
||||
compare_iter (iter, i,
|
||||
filter_odd[i].expected_foo,
|
||||
filter_odd[i].expected_bar);
|
||||
|
||||
iter = clutter_model_iter_next (iter);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
g_object_unref (iter);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Backward iteration (filter even)...\n");
|
||||
|
||||
clutter_model_set_filter (test_data.model, filter_even_rows, NULL, NULL);
|
||||
|
||||
iter = clutter_model_get_last_iter (test_data.model);
|
||||
g_assert (iter != NULL);
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
compare_iter (iter, G_N_ELEMENTS (filter_even) - i - 1,
|
||||
filter_even[i].expected_foo,
|
||||
filter_even[i].expected_bar);
|
||||
|
||||
iter = clutter_model_iter_prev (iter);
|
||||
i += 1;
|
||||
}
|
||||
while (!clutter_model_iter_is_first (iter));
|
||||
|
||||
g_object_unref (iter);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("get_iter_at_row...\n");
|
||||
|
||||
clutter_model_set_filter (test_data.model, filter_odd_rows, NULL, NULL);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
iter = clutter_model_get_iter_at_row (test_data.model, i);
|
||||
compare_iter (iter, i ,
|
||||
filter_odd[i].expected_foo,
|
||||
filter_odd[i].expected_bar);
|
||||
g_object_unref (iter);
|
||||
}
|
||||
|
||||
iter = clutter_model_get_iter_at_row (test_data.model, 5);
|
||||
g_assert (iter == NULL);
|
||||
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
static void
|
||||
list_model_iterate (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
ClutterModelIter *iter;
|
||||
gint i;
|
||||
|
||||
test_data.model = clutter_list_model_new (N_COLUMNS,
|
||||
G_TYPE_STRING, "Foo",
|
||||
G_TYPE_INT, "Bar");
|
||||
test_data.n_row = 0;
|
||||
|
||||
g_signal_connect (test_data.model, "row-added",
|
||||
G_CALLBACK (on_row_added),
|
||||
&test_data);
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
gchar *foo = g_strdup_printf ("String %d", i);
|
||||
|
||||
clutter_model_append (test_data.model,
|
||||
COLUMN_FOO, foo,
|
||||
COLUMN_BAR, i,
|
||||
-1);
|
||||
|
||||
g_free (foo);
|
||||
}
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Forward iteration...\n");
|
||||
|
||||
iter = clutter_model_get_first_iter (test_data.model);
|
||||
g_assert (iter != NULL);
|
||||
|
||||
i = 0;
|
||||
while (!clutter_model_iter_is_last (iter))
|
||||
{
|
||||
compare_iter (iter, i,
|
||||
forward_base[i].expected_foo,
|
||||
forward_base[i].expected_bar);
|
||||
|
||||
iter = clutter_model_iter_next (iter);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
g_object_unref (iter);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Backward iteration...\n");
|
||||
|
||||
iter = clutter_model_get_last_iter (test_data.model);
|
||||
g_assert (iter != NULL);
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
compare_iter (iter, G_N_ELEMENTS (backward_base) - i - 1,
|
||||
backward_base[i].expected_foo,
|
||||
backward_base[i].expected_bar);
|
||||
|
||||
iter = clutter_model_iter_prev (iter);
|
||||
i += 1;
|
||||
}
|
||||
while (!clutter_model_iter_is_first (iter));
|
||||
|
||||
compare_iter (iter, G_N_ELEMENTS (backward_base) - i - 1,
|
||||
backward_base[i].expected_foo,
|
||||
backward_base[i].expected_bar);
|
||||
|
||||
g_object_unref (iter);
|
||||
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
static void
|
||||
list_model_populate (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
gint i;
|
||||
|
||||
test_data.model = clutter_list_model_new (N_COLUMNS,
|
||||
G_TYPE_STRING, "Foo",
|
||||
G_TYPE_INT, "Bar");
|
||||
test_data.n_row = 0;
|
||||
|
||||
g_signal_connect (test_data.model, "row-added",
|
||||
G_CALLBACK (on_row_added),
|
||||
&test_data);
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
gchar *foo = g_strdup_printf ("String %d", i);
|
||||
|
||||
clutter_model_append (test_data.model,
|
||||
COLUMN_FOO, foo,
|
||||
COLUMN_BAR, i,
|
||||
-1);
|
||||
|
||||
g_free (foo);
|
||||
}
|
||||
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
static void
|
||||
list_model_from_script (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *model;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
const gchar *name;
|
||||
GType type;
|
||||
ClutterModelIter *iter;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-model.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
model = clutter_script_get_object (script, "test-model");
|
||||
|
||||
g_assert (CLUTTER_IS_MODEL (model));
|
||||
g_assert (clutter_model_get_n_columns (CLUTTER_MODEL (model)) == 3);
|
||||
|
||||
name = clutter_model_get_column_name (CLUTTER_MODEL (model), 0);
|
||||
type = clutter_model_get_column_type (CLUTTER_MODEL (model), 0);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("column[0]: %s, type: %s\n", name, g_type_name (type));
|
||||
|
||||
g_assert (strcmp (name, "text-column") == 0);
|
||||
g_assert (type == G_TYPE_STRING);
|
||||
|
||||
name = clutter_model_get_column_name (CLUTTER_MODEL (model), 2);
|
||||
type = clutter_model_get_column_type (CLUTTER_MODEL (model), 2);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("column[2]: %s, type: %s\n", name, g_type_name (type));
|
||||
|
||||
g_assert (strcmp (name, "actor-column") == 0);
|
||||
g_assert (g_type_is_a (type, CLUTTER_TYPE_ACTOR));
|
||||
|
||||
g_assert (clutter_model_get_n_rows (CLUTTER_MODEL (model)) == 3);
|
||||
|
||||
iter = clutter_model_get_iter_at_row (CLUTTER_MODEL (model), 0);
|
||||
clutter_model_iter_get_value (iter, 0, &value);
|
||||
g_assert (G_VALUE_HOLDS_STRING (&value));
|
||||
g_assert (strcmp (g_value_get_string (&value), "text-row-1") == 0);
|
||||
g_value_unset (&value);
|
||||
|
||||
clutter_model_iter_get_value (iter, 1, &value);
|
||||
g_assert (G_VALUE_HOLDS_INT (&value));
|
||||
g_assert (g_value_get_int (&value) == 1);
|
||||
g_value_unset (&value);
|
||||
|
||||
clutter_model_iter_get_value (iter, 2, &value);
|
||||
g_assert (G_VALUE_HOLDS_OBJECT (&value));
|
||||
g_assert (g_value_get_object (&value) == NULL);
|
||||
g_value_unset (&value);
|
||||
|
||||
iter = clutter_model_iter_next (iter);
|
||||
clutter_model_iter_get_value (iter, 2, &value);
|
||||
g_assert (G_VALUE_HOLDS_OBJECT (&value));
|
||||
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
|
||||
g_value_unset (&value);
|
||||
|
||||
iter = clutter_model_iter_next (iter);
|
||||
clutter_model_iter_get_value (iter, 2, &value);
|
||||
g_assert (G_VALUE_HOLDS_OBJECT (&value));
|
||||
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
|
||||
g_assert (strcmp (clutter_actor_get_name (g_value_get_object (&value)),
|
||||
"actor-row-3") == 0);
|
||||
g_value_unset (&value);
|
||||
g_object_unref (iter);
|
||||
}
|
||||
|
||||
static void
|
||||
on_row_changed (ClutterModel *model,
|
||||
ClutterModelIter *iter,
|
||||
ChangedData *data)
|
||||
{
|
||||
gint value = -1;
|
||||
|
||||
clutter_model_iter_get (iter, COLUMN_BAR, &value, -1);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("row-changed value-check: %d, expected: %d\n",
|
||||
value, data->value_check);
|
||||
|
||||
g_assert_cmpint (value, ==, data->value_check);
|
||||
|
||||
data->n_emissions += 1;
|
||||
}
|
||||
|
||||
static void
|
||||
list_model_row_changed (void)
|
||||
{
|
||||
ChangedData test_data = { NULL, NULL, 0, 0 };
|
||||
GValue value = { 0, };
|
||||
gint i;
|
||||
|
||||
test_data.model = clutter_list_model_new (N_COLUMNS,
|
||||
G_TYPE_STRING, "Foo",
|
||||
G_TYPE_INT, "Bar");
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
gchar *foo = g_strdup_printf ("String %d", i);
|
||||
|
||||
clutter_model_append (test_data.model,
|
||||
COLUMN_FOO, foo,
|
||||
COLUMN_BAR, i,
|
||||
-1);
|
||||
|
||||
g_free (foo);
|
||||
}
|
||||
|
||||
g_signal_connect (test_data.model, "row-changed",
|
||||
G_CALLBACK (on_row_changed),
|
||||
&test_data);
|
||||
|
||||
test_data.row = g_random_int_range (0, 9);
|
||||
test_data.iter = clutter_model_get_iter_at_row (test_data.model,
|
||||
test_data.row);
|
||||
g_assert (CLUTTER_IS_MODEL_ITER (test_data.iter));
|
||||
|
||||
test_data.value_check = 47;
|
||||
|
||||
g_value_init (&value, G_TYPE_INT);
|
||||
g_value_set_int (&value, test_data.value_check);
|
||||
|
||||
clutter_model_iter_set_value (test_data.iter, COLUMN_BAR, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("iter.set_value() emissions: %d, expected: 1\n",
|
||||
test_data.n_emissions);
|
||||
|
||||
g_assert_cmpint (test_data.n_emissions, ==, 1);
|
||||
|
||||
test_data.n_emissions = 0;
|
||||
test_data.value_check = 42;
|
||||
|
||||
clutter_model_iter_set (test_data.iter,
|
||||
COLUMN_FOO, "changed",
|
||||
COLUMN_BAR, test_data.value_check,
|
||||
-1);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("iter.set() emissions: %d, expected: 1\n",
|
||||
test_data.n_emissions);
|
||||
|
||||
g_assert_cmpint (test_data.n_emissions, ==, 1);
|
||||
|
||||
g_object_unref (test_data.iter);
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/list-model/populate", list_model_populate)
|
||||
CLUTTER_TEST_UNIT ("/list-model/iterate", list_model_iterate)
|
||||
CLUTTER_TEST_UNIT ("/list-model/filter", list_model_filter)
|
||||
CLUTTER_TEST_UNIT ("/list-model/row-changed", list_model_row_changed)
|
||||
CLUTTER_TEST_UNIT ("/list-model/from-script", list_model_from_script)
|
||||
)
|
@ -1,121 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
static guint level = 0;
|
||||
|
||||
static void
|
||||
on_score_started (ClutterScore *score)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_print ("Score started\n");
|
||||
}
|
||||
|
||||
static void
|
||||
on_score_completed (ClutterScore *score)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_print ("Score completed\n");
|
||||
}
|
||||
|
||||
static void
|
||||
on_timeline_started (ClutterScore *score,
|
||||
ClutterTimeline *timeline)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_print ("Started timeline: '%s'\n",
|
||||
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
||||
|
||||
level += 1;
|
||||
}
|
||||
|
||||
static void
|
||||
on_timeline_completed (ClutterScore *score,
|
||||
ClutterTimeline *timeline)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_print ("Completed timeline: '%s'\n",
|
||||
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
||||
|
||||
level -= 1;
|
||||
}
|
||||
|
||||
void
|
||||
score_base (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterScore *score;
|
||||
ClutterTimeline *timeline_1;
|
||||
ClutterTimeline *timeline_2;
|
||||
ClutterTimeline *timeline_3;
|
||||
ClutterTimeline *timeline_4;
|
||||
ClutterTimeline *timeline_5;
|
||||
GSList *timelines;
|
||||
|
||||
/* FIXME - this is necessary to make the master clock spin */
|
||||
ClutterActor *stage = clutter_stage_new ();
|
||||
|
||||
timeline_1 = clutter_timeline_new (100);
|
||||
g_object_set_data_full (G_OBJECT (timeline_1),
|
||||
"timeline-name", g_strdup ("Timeline 1"),
|
||||
g_free);
|
||||
|
||||
timeline_2 = clutter_timeline_new (100);
|
||||
clutter_timeline_add_marker_at_time (timeline_2, "foo", 50);
|
||||
g_object_set_data_full (G_OBJECT (timeline_2),
|
||||
"timeline-name", g_strdup ("Timeline 2"),
|
||||
g_free);
|
||||
|
||||
timeline_3 = clutter_timeline_new (100);
|
||||
g_object_set_data_full (G_OBJECT (timeline_3),
|
||||
"timeline-name", g_strdup ("Timeline 3"),
|
||||
g_free);
|
||||
|
||||
timeline_4 = clutter_timeline_new (100);
|
||||
g_object_set_data_full (G_OBJECT (timeline_4),
|
||||
"timeline-name", g_strdup ("Timeline 4"),
|
||||
g_free);
|
||||
|
||||
timeline_5 = clutter_timeline_new (100);
|
||||
g_object_set_data_full (G_OBJECT (timeline_5),
|
||||
"timeline-name", g_strdup ("Timeline 5"),
|
||||
g_free);
|
||||
|
||||
score = clutter_score_new();
|
||||
g_signal_connect (score, "started",
|
||||
G_CALLBACK (on_score_started),
|
||||
NULL);
|
||||
g_signal_connect (score, "timeline-started",
|
||||
G_CALLBACK (on_timeline_started),
|
||||
NULL);
|
||||
g_signal_connect (score, "timeline-completed",
|
||||
G_CALLBACK (on_timeline_completed),
|
||||
NULL);
|
||||
g_signal_connect (score, "completed",
|
||||
G_CALLBACK (on_score_completed),
|
||||
NULL);
|
||||
|
||||
clutter_score_append (score, NULL, timeline_1);
|
||||
clutter_score_append (score, timeline_1, timeline_2);
|
||||
clutter_score_append (score, timeline_1, timeline_3);
|
||||
clutter_score_append (score, timeline_3, timeline_4);
|
||||
|
||||
clutter_score_append_at_marker (score, timeline_2, "foo", timeline_5);
|
||||
|
||||
timelines = clutter_score_list_timelines (score);
|
||||
g_assert (5 == g_slist_length (timelines));
|
||||
g_slist_free (timelines);
|
||||
|
||||
clutter_score_start (score);
|
||||
|
||||
clutter_actor_destroy (stage);
|
||||
|
||||
g_object_unref (timeline_1);
|
||||
g_object_unref (timeline_2);
|
||||
g_object_unref (timeline_3);
|
||||
g_object_unref (timeline_4);
|
||||
g_object_unref (timeline_5);
|
||||
g_object_unref (score);
|
||||
}
|
@ -66,8 +66,6 @@ clutter/clutter/deprecated/clutter-behaviour-rotate.c
|
||||
clutter/clutter/deprecated/clutter-behaviour-scale.c
|
||||
clutter/clutter/deprecated/clutter-box.c
|
||||
clutter/clutter/deprecated/clutter-cairo-texture.c
|
||||
clutter/clutter/deprecated/clutter-fixed.c
|
||||
clutter/clutter/deprecated/clutter-media.c
|
||||
clutter/clutter/deprecated/clutter-rectangle.c
|
||||
clutter/clutter/deprecated/clutter-shader.c
|
||||
clutter/clutter/deprecated/clutter-state.c
|
||||
|
Loading…
Reference in New Issue
Block a user