[gnome-shell] test-recorder: Create the recorder only after the stage is realized
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] test-recorder: Create the recorder only after the stage is realized
- Date: Thu, 3 May 2012 07:30:26 +0000 (UTC)
commit d579cd16051fd965c55f85b7d0d4050f7db9731f
Author: Rui Matos <tiagomatos gmail com>
Date: Wed May 2 16:23:28 2012 +0200
test-recorder: Create the recorder only after the stage is realized
The recorder needs the stage's XID so it can only be created after the
stage is realized.
https://bugzilla.gnome.org/show_bug.cgi?id=675301
src/test-recorder.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/test-recorder.c b/src/test-recorder.c
index c223bf1..1a8109f 100644
--- a/src/test-recorder.c
+++ b/src/test-recorder.c
@@ -7,12 +7,19 @@
/* Very simple test of the ShellRecorder class; shows some text strings
* moving around and records it.
*/
-static ShellRecorder *recorder;
+static ShellRecorder *recorder = NULL;
static gboolean
stop_recording_timeout (gpointer data)
{
- shell_recorder_close (recorder);
+ if (recorder)
+ {
+ shell_recorder_close (recorder);
+ g_object_unref (recorder);
+ }
+
+ clutter_main_quit ();
+
return FALSE;
}
@@ -22,6 +29,15 @@ on_animation_completed (ClutterAnimation *animation)
g_timeout_add (1000, stop_recording_timeout, NULL);
}
+static void
+on_stage_realized (ClutterActor *stage,
+ gpointer data)
+{
+ recorder = shell_recorder_new (CLUTTER_STAGE (stage));
+ shell_recorder_set_filename (recorder, "test-recorder.ogg");
+ shell_recorder_record (recorder);
+}
+
int main (int argc, char **argv)
{
ClutterActor *stage;
@@ -86,13 +102,14 @@ int main (int argc, char **argv)
"y", 240.0,
NULL);
- recorder = shell_recorder_new (CLUTTER_STAGE (stage));
- shell_recorder_set_filename (recorder, "test-recorder.ogg");
+ g_signal_connect_after (stage, "realize",
+ G_CALLBACK (on_stage_realized), NULL);
clutter_actor_show (stage);
- shell_recorder_record (recorder);
clutter_main ();
+ g_object_unref (stage);
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]