[Swfdec] Branch 'vivi' - 15 commits - configure.ac libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_debugger.h libswfdec/swfdec_as_object.c libswfdec/swfdec_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_types.h vivified/core vivified/ui

Benjamin Otte company at kemper.freedesktop.org
Tue Aug 21 03:49:44 PDT 2007


 configure.ac                      |    5 -
 libswfdec/Makefile.am             |    2 
 libswfdec/swfdec_as_context.c     |    9 +-
 libswfdec/swfdec_as_debugger.h    |    8 ++
 libswfdec/swfdec_as_object.c      |    5 +
 libswfdec/swfdec_movie.c          |   15 ---
 libswfdec/swfdec_script.c         |    1 
 libswfdec/swfdec_types.h          |    1 
 vivified/core/vivi_debugger.c     |   34 ++++++++
 vivified/ui/Makefile.am           |   10 +-
 vivified/ui/main.c                |   18 +++-
 vivified/ui/vivi_command_line.c   |  118 +++++++++++++++++++++++++++++
 vivified/ui/vivi_command_line.xml |   38 +++++++++
 vivified/ui/vivi_commandline.c    |  150 --------------------------------------
 vivified/ui/vivi_commandline.h    |   57 --------------
 vivified/ui/vivi_movie_list.c     |   43 ++++++----
 vivified/ui/vivi_movie_list.h     |    6 -
 vivified/ui/vivi_player.c         |   61 ++++-----------
 vivified/ui/vivi_player.h         |   57 --------------
 vivified/ui/vivi_player.xml       |   17 ++++
 vivified/ui/vivi_vivi_docklet.c   |  150 ++++++++++++++++++++++++++++++++++++++
 vivified/ui/vivi_vivi_docklet.h   |   62 +++++++++++++++
 22 files changed, 511 insertions(+), 356 deletions(-)

New commits:
diff-tree 9ee0631673a83e6a59448873ab93b90311d8d88b (from c950a3ae200518bea4d98b8f0a993d3bbaafe212)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:48:34 2007 +0200

    consistent naming please

diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am
index 386d6cb..2d492c7 100644
--- a/vivified/ui/Makefile.am
+++ b/vivified/ui/Makefile.am
@@ -7,7 +7,7 @@ vivified_LDADD = \
 	$(top_builddir)/vivified/dock/libvivified-dock.la
 
 vivified_SOURCES = \
-	vivi_commandline.c \
+	vivi_command_line.c \
 	vivi_movie_list.c \
 	vivi_player.c \
 	vivi_vivi_docklet.c \
diff --git a/vivified/ui/vivi_command_line.c b/vivified/ui/vivi_command_line.c
new file mode 100644
index 0000000..4377830
--- /dev/null
+++ b/vivified/ui/vivi_command_line.c
@@ -0,0 +1,118 @@
+/* Vivified
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * 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.1 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include "vivi_vivi_docklet.h"
+
+static void
+vivi_command_line_execute (ViviApplication *app, const char *command)
+{
+  char *run;
+
+  if (!strpbrk (command, ";\"',()[]{}")) {
+    /* special mode: interpret as space-delimited list:
+     * first argument is function name, following arguemnts are function arguments
+     */
+    char **args = g_strsplit (command, " ", -1);
+    GString *str = g_string_new (args[0]);
+    guint i;
+
+    g_string_append (str, " (");
+    for (i = 1; args[i] != NULL; i++) {
+      if (i > 1)
+	g_string_append (str, ", ");
+      g_string_append_c (str, '"');
+      g_string_append (str, args[i]);
+      g_string_append_c (str, '"');
+    }
+    g_string_append (str, ");");
+    run = g_string_free (str, FALSE);
+  } else {
+    run = (char *) command;
+  }
+
+  
+  vivi_application_execute (app, run);
+  if (command != run)
+    g_free (run);
+}
+
+void
+vivi_command_line_activate (GtkEntry *entry, ViviApplication *app);
+void
+vivi_command_line_activate (GtkEntry *entry, ViviApplication *app)
+{
+  const char *text = gtk_entry_get_text (entry);
+
+  if (text[0] == '\0')
+    return;
+
+  vivi_command_line_execute (app, text);
+  gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
+}
+
+static void
+vivi_command_line_append_message (ViviApplication *app, guint type, const char *message, GtkTextView *view)
+{
+  GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+  GtkTextIter iter;
+  GtkTextMark *mark;
+  const char *tag_names[] = { "input", "output", "error" };
+
+  gtk_text_buffer_get_end_iter (buffer, &iter);
+  mark = gtk_text_buffer_get_mark (buffer, "end");
+  if (mark == NULL)
+    mark = gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
+  if (gtk_text_buffer_get_char_count (buffer) > 0)
+    gtk_text_buffer_insert (buffer, &iter, "\n", 1);
+  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1, tag_names[type], NULL);
+  gtk_text_view_scroll_to_mark (view, mark, 0.0, TRUE, 0.0, 0.0);
+}
+
+void
+vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app);
+void
+vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
+{
+  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
+
+  g_signal_handlers_disconnect_by_func (app, vivi_command_line_append_message, view);
+}
+
+void
+vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app);
+void
+vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app)
+{
+  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
+
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "error", "foreground", "red", "left-margin", 15, NULL);
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "input", "foreground", "dark grey", NULL);
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "output", "left-margin", 15, NULL);
+
+  g_signal_connect (app, "message", G_CALLBACK (vivi_command_line_append_message), view);
+}
+
diff --git a/vivified/ui/vivi_commandline.c b/vivified/ui/vivi_commandline.c
deleted file mode 100644
index 4377830..0000000
--- a/vivified/ui/vivi_commandline.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Vivified
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * 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.1 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
- * Boston, MA  02110-1301  USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include "vivi_vivi_docklet.h"
-
-static void
-vivi_command_line_execute (ViviApplication *app, const char *command)
-{
-  char *run;
-
-  if (!strpbrk (command, ";\"',()[]{}")) {
-    /* special mode: interpret as space-delimited list:
-     * first argument is function name, following arguemnts are function arguments
-     */
-    char **args = g_strsplit (command, " ", -1);
-    GString *str = g_string_new (args[0]);
-    guint i;
-
-    g_string_append (str, " (");
-    for (i = 1; args[i] != NULL; i++) {
-      if (i > 1)
-	g_string_append (str, ", ");
-      g_string_append_c (str, '"');
-      g_string_append (str, args[i]);
-      g_string_append_c (str, '"');
-    }
-    g_string_append (str, ");");
-    run = g_string_free (str, FALSE);
-  } else {
-    run = (char *) command;
-  }
-
-  
-  vivi_application_execute (app, run);
-  if (command != run)
-    g_free (run);
-}
-
-void
-vivi_command_line_activate (GtkEntry *entry, ViviApplication *app);
-void
-vivi_command_line_activate (GtkEntry *entry, ViviApplication *app)
-{
-  const char *text = gtk_entry_get_text (entry);
-
-  if (text[0] == '\0')
-    return;
-
-  vivi_command_line_execute (app, text);
-  gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
-}
-
-static void
-vivi_command_line_append_message (ViviApplication *app, guint type, const char *message, GtkTextView *view)
-{
-  GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
-  GtkTextIter iter;
-  GtkTextMark *mark;
-  const char *tag_names[] = { "input", "output", "error" };
-
-  gtk_text_buffer_get_end_iter (buffer, &iter);
-  mark = gtk_text_buffer_get_mark (buffer, "end");
-  if (mark == NULL)
-    mark = gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
-  if (gtk_text_buffer_get_char_count (buffer) > 0)
-    gtk_text_buffer_insert (buffer, &iter, "\n", 1);
-  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1, tag_names[type], NULL);
-  gtk_text_view_scroll_to_mark (view, mark, 0.0, TRUE, 0.0, 0.0);
-}
-
-void
-vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app);
-void
-vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
-{
-  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
-
-  g_signal_handlers_disconnect_by_func (app, vivi_command_line_append_message, view);
-}
-
-void
-vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app);
-void
-vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app)
-{
-  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
-
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
-      "error", "foreground", "red", "left-margin", 15, NULL);
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
-      "input", "foreground", "dark grey", NULL);
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
-      "output", "left-margin", 15, NULL);
-
-  g_signal_connect (app, "message", G_CALLBACK (vivi_command_line_append_message), view);
-}
-
diff-tree c950a3ae200518bea4d98b8f0a993d3bbaafe212 (from 688a8514a7bb646b3417b71c37f99472793090d4)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:48:03 2007 +0200

    missed the title

diff --git a/vivified/ui/vivi_command_line.xml b/vivified/ui/vivi_command_line.xml
index e1829da..5a4b2fb 100644
--- a/vivified/ui/vivi_command_line.xml
+++ b/vivified/ui/vivi_command_line.xml
@@ -1,5 +1,6 @@
 <interface>
   <object class="ViviViviDocklet" id="command-line">
+    <property name="title">Command Line</property>
     <signal name="application-set" handler="vivi_command_line_application_set" />
     <signal name="application-unset" handler="vivi_command_line_application_unset" />
     <child>
diff-tree 688a8514a7bb646b3417b71c37f99472793090d4 (from 1bb42f2089e1c0530e34c060b8e90310f682a849)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:47:17 2007 +0200

    xml-ify the command line widget

diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am
index 147c0cb..386d6cb 100644
--- a/vivified/ui/Makefile.am
+++ b/vivified/ui/Makefile.am
@@ -14,7 +14,6 @@ vivified_SOURCES = \
 	main.c
 
 noinst_HEADERS = \
-	vivi_commandline.h \
 	vivi_movie_list.h \
 	vivi_vivi_docklet.h
 
diff --git a/vivified/ui/main.c b/vivified/ui/main.c
index e6fb346..8ca2e4b 100644
--- a/vivified/ui/main.c
+++ b/vivified/ui/main.c
@@ -25,7 +25,6 @@
 #include <libswfdec-gtk/swfdec-gtk.h>
 #include "vivified/core/vivified-core.h"
 #include "vivified/dock/vivified-dock.h"
-#include "vivi_commandline.h"
 
 static void
 try_grab_focus (GtkWidget *widget, gpointer unused)
@@ -69,7 +68,8 @@ setup (const char *filename, const char 
   vivi_application_set_variables (app, variables);
 
   builder = gtk_builder_new ();
-  if (!gtk_builder_add_from_file (builder, "vivi_player.xml", &error))
+  if (!gtk_builder_add_from_file (builder, "vivi_player.xml", &error) ||
+      !gtk_builder_add_from_file (builder, "vivi_command_line.xml", &error))
     g_error ("%s", error->message);
   gtk_builder_connect_signals (builder, app);
 
@@ -83,7 +83,8 @@ setup (const char *filename, const char 
   widget = GTK_WIDGET (gtk_builder_get_object (builder, "player"));
   g_object_set (widget, "application", app, NULL);
   vivi_vdock_add (VIVI_VDOCK (box), widget);
-  widget = vivi_command_line_new (app);
+  widget = GTK_WIDGET (gtk_builder_get_object (builder, "command-line"));
+  g_object_set (widget, "application", app, NULL);
   vivi_vdock_add (VIVI_VDOCK (box), widget);
   gtk_container_foreach (GTK_CONTAINER (widget), try_grab_focus, NULL);
 
diff --git a/vivified/ui/vivi_command_line.xml b/vivified/ui/vivi_command_line.xml
new file mode 100644
index 0000000..e1829da
--- /dev/null
+++ b/vivified/ui/vivi_command_line.xml
@@ -0,0 +1,37 @@
+<interface>
+  <object class="ViviViviDocklet" id="command-line">
+    <signal name="application-set" handler="vivi_command_line_application_set" />
+    <signal name="application-unset" handler="vivi_command_line_application_unset" />
+    <child>
+      <object class="GtkVBox" id="box">
+	<child>
+	  <object class="GtkScrolledWindow" id="scroll">
+	    <property name="hscrollbar-policy">automatic</property>
+	    <property name="vscrollbar-policy">automatic</property>
+	    <child>
+	      <object class="GtkTextView" id="text">
+		<property name="editable">false</property>
+		<property name="wrap-mode">word-char</property>
+	      </object>
+	    </child>
+	  </object>
+	  <packing>
+	    <property name="pack-type">start</property>
+	    <property name="expand">true</property>
+	    <property name="fill">true</property>
+	  </packing>
+	</child>
+	<child>
+	  <object class="GtkEntry" id="entry">
+	    <signal name="activate" handler="vivi_command_line_activate" />
+	  </object>
+	  <packing>
+	    <property name="pack-type">end</property>
+	    <property name="expand">false</property>
+	    <property name="fill">true</property>
+	  </packing>
+	</child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/vivified/ui/vivi_commandline.c b/vivified/ui/vivi_commandline.c
index 555e922..4377830 100644
--- a/vivified/ui/vivi_commandline.c
+++ b/vivified/ui/vivi_commandline.c
@@ -22,48 +22,10 @@
 #endif
 
 #include <string.h>
-#include "vivi_commandline.h"
-
-G_DEFINE_TYPE (ViviCommandLine, vivi_command_line, VIVI_TYPE_DOCKLET)
-
-static void
-vivi_command_line_append_message (ViviApplication *app, guint type, const char *message, GtkTextView *view)
-{
-  GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
-  GtkTextIter iter;
-  GtkTextMark *mark;
-  const char *tag_names[] = { "input", "output", "error" };
-
-  gtk_text_buffer_get_end_iter (buffer, &iter);
-  mark = gtk_text_buffer_get_mark (buffer, "end");
-  if (mark == NULL)
-    mark = gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
-  if (gtk_text_buffer_get_char_count (buffer) > 0)
-    gtk_text_buffer_insert (buffer, &iter, "\n", 1);
-  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1, tag_names[type], NULL);
-  gtk_text_view_scroll_to_mark (view, mark, 0.0, TRUE, 0.0, 0.0);
-}
-
-static void
-vivi_command_line_dispose (GObject *object)
-{
-  ViviCommandLine *cl = VIVI_COMMAND_LINE (object);
-
-  g_signal_handlers_disconnect_by_func (cl->app, vivi_command_line_append_message, cl->view);
-
-  G_OBJECT_CLASS (vivi_command_line_parent_class)->dispose (object);
-}
-
-static void
-vivi_command_line_class_init (ViviCommandLineClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->dispose = vivi_command_line_dispose;
-}
+#include "vivi_vivi_docklet.h"
 
 static void
-vivi_command_line_execute (ViviCommandLine *cl, const char *command)
+vivi_command_line_execute (ViviApplication *app, const char *command)
 {
   char *run;
 
@@ -90,61 +52,67 @@ vivi_command_line_execute (ViviCommandLi
   }
 
   
-  vivi_application_execute (cl->app, run);
+  vivi_application_execute (app, run);
   if (command != run)
     g_free (run);
 }
 
-static void
-command_line_entry_activate_cb (GtkEntry *entry, ViviCommandLine *command_line)
+void
+vivi_command_line_activate (GtkEntry *entry, ViviApplication *app);
+void
+vivi_command_line_activate (GtkEntry *entry, ViviApplication *app)
 {
   const char *text = gtk_entry_get_text (entry);
 
   if (text[0] == '\0')
     return;
 
-  vivi_command_line_execute (command_line, text);
+  vivi_command_line_execute (app, text);
   gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
 }
 
 static void
-vivi_command_line_init (ViviCommandLine *cl)
+vivi_command_line_append_message (ViviApplication *app, guint type, const char *message, GtkTextView *view)
 {
-  GtkWidget *box, *widget, *scroll;
+  GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+  GtkTextIter iter;
+  GtkTextMark *mark;
+  const char *tag_names[] = { "input", "output", "error" };
 
-  box = gtk_vbox_new (FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (cl), box);
-  /* the text entry */
-  widget = gtk_entry_new ();
-  g_signal_connect (widget, "activate", G_CALLBACK (command_line_entry_activate_cb), cl);
-  gtk_box_pack_end (GTK_BOX (box), widget, FALSE, TRUE, 0);
-  /* the text view for outputting messages */
-  scroll = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), 
-      GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (box), scroll, TRUE, TRUE, 0);
-  cl->view = gtk_text_view_new ();
-  gtk_text_view_set_editable (GTK_TEXT_VIEW (cl->view), FALSE);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (cl->view), GTK_WRAP_WORD_CHAR);
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cl->view)),
-      "error", "foreground", "red", "left-margin", 15, NULL);
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cl->view)),
-      "input", "foreground", "dark grey", NULL);
-  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cl->view)),
-      "output", "left-margin", 15, NULL);
-  gtk_container_add (GTK_CONTAINER (scroll), cl->view);
+  gtk_text_buffer_get_end_iter (buffer, &iter);
+  mark = gtk_text_buffer_get_mark (buffer, "end");
+  if (mark == NULL)
+    mark = gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
+  if (gtk_text_buffer_get_char_count (buffer) > 0)
+    gtk_text_buffer_insert (buffer, &iter, "\n", 1);
+  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1, tag_names[type], NULL);
+  gtk_text_view_scroll_to_mark (view, mark, 0.0, TRUE, 0.0, 0.0);
+}
 
-  gtk_widget_show_all (box);
+void
+vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app);
+void
+vivi_command_line_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
+{
+  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
+
+  g_signal_handlers_disconnect_by_func (app, vivi_command_line_append_message, view);
 }
 
-GtkWidget *
-vivi_command_line_new (ViviApplication *app)
+void
+vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app);
+void
+vivi_command_line_application_set (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  ViviCommandLine *cl;
+  GtkWidget *view = vivi_vivi_docklet_find_widget_by_type (docklet, GTK_TYPE_TEXT_VIEW);
+
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "error", "foreground", "red", "left-margin", 15, NULL);
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "input", "foreground", "dark grey", NULL);
+  gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+      "output", "left-margin", 15, NULL);
 
-  cl = g_object_new (VIVI_TYPE_COMMAND_LINE, "title", "Command Line", NULL);
-  cl->app = app;
-  g_signal_connect (cl->app, "message", G_CALLBACK (vivi_command_line_append_message), cl->view);
-  return GTK_WIDGET (cl);
+  g_signal_connect (app, "message", G_CALLBACK (vivi_command_line_append_message), view);
 }
 
diff --git a/vivified/ui/vivi_commandline.h b/vivified/ui/vivi_commandline.h
deleted file mode 100644
index 96e5924..0000000
--- a/vivified/ui/vivi_commandline.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Vivified
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * 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.1 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
- * Boston, MA  02110-1301  USA
- */
-
-#ifndef _VIVI_COMMAND_LINE_H_
-#define _VIVI_COMMAND_LINE_H_
-
-#include <vivified/core/vivified-core.h>
-#include <vivified/dock/vivified-dock.h>
-
-G_BEGIN_DECLS
-
-
-typedef struct _ViviCommandLine ViviCommandLine;
-typedef struct _ViviCommandLineClass ViviCommandLineClass;
-
-#define VIVI_TYPE_COMMAND_LINE                    (vivi_command_line_get_type())
-#define VIVI_IS_COMMAND_LINE(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_COMMAND_LINE))
-#define VIVI_IS_COMMAND_LINE_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_COMMAND_LINE))
-#define VIVI_COMMAND_LINE(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_COMMAND_LINE, ViviCommandLine))
-#define VIVI_COMMAND_LINE_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_COMMAND_LINE, ViviCommandLineClass))
-#define VIVI_COMMAND_LINE_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_COMMAND_LINE, ViviCommandLineClass))
-
-struct _ViviCommandLine {
-  ViviDocklet		docklet;
-
-  ViviApplication *	app;		/* the application we connect to */
-  GtkWidget *		view;		/* text view for outputting stuff to */
-};
-
-struct _ViviCommandLineClass
-{
-  ViviDockletClass    	docklet_class;
-};
-
-GType			vivi_command_line_get_type   	(void);
-
-GtkWidget *		vivi_command_line_new		(ViviApplication *	app);
-
-
-G_END_DECLS
-#endif
diff-tree 1bb42f2089e1c0530e34c060b8e90310f682a849 (from ab10b3c5c72a4e04b5f27027f90f58023d0a3594)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:44:15 2007 +0200

    add find_widget function to ViviViviDocklet

diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index 876eb77..6fcfee2 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -25,18 +25,6 @@
 #include "vivi_vivi_docklet.h"
 
 static void
-find_player (GtkWidget *widget, gpointer result)
-{
-  if (SWFDEC_IS_GTK_WIDGET (widget)) {
-    *(gpointer *) result = widget;
-    return;
-  }
-
-  if (GTK_IS_CONTAINER (widget))
-    gtk_container_foreach (GTK_CONTAINER (widget), find_player, result);
-}
-
-static void
 vivi_player_notify_app (ViviApplication *app, GParamSpec *pspec, SwfdecGtkWidget *player)
 {
   if (g_str_equal (pspec->name, "player")) {
@@ -51,13 +39,11 @@ vivi_player_application_set (ViviViviDoc
 void
 vivi_player_application_set (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  SwfdecGtkPlayer *player = NULL;
+  SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (vivi_vivi_docklet_find_widget_by_type (docklet, SWFDEC_TYPE_GTK_WIDGET));
 
-  find_player (GTK_WIDGET (docklet), &player);
-
-  g_signal_connect (app, "notify", G_CALLBACK (vivi_player_notify_app), player);
-  swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player), vivi_application_get_player (app));
-  swfdec_gtk_widget_set_interactive (SWFDEC_GTK_WIDGET (player), !vivi_application_get_interrupted (app));
+  g_signal_connect (app, "notify", G_CALLBACK (vivi_player_notify_app), widget);
+  swfdec_gtk_widget_set_player (widget, vivi_application_get_player (app));
+  swfdec_gtk_widget_set_interactive (widget, !vivi_application_get_interrupted (app));
 }
 
 void
@@ -65,10 +51,8 @@ vivi_player_application_unset (ViviViviD
 void
 vivi_player_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  SwfdecGtkPlayer *player = NULL;
-
-  find_player (GTK_WIDGET (docklet), &player);
+  SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (vivi_vivi_docklet_find_widget_by_type (docklet, SWFDEC_TYPE_GTK_WIDGET));
 
-  g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, player);
+  g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, widget);
 }
 
diff --git a/vivified/ui/vivi_vivi_docklet.c b/vivified/ui/vivi_vivi_docklet.c
index 9daba21..cea4f64 100644
--- a/vivified/ui/vivi_vivi_docklet.c
+++ b/vivified/ui/vivi_vivi_docklet.c
@@ -114,7 +114,37 @@ vivi_vivi_docklet_class_init (ViviViviDo
 }
 
 static void
-vivi_vivi_docklet_init (ViviViviDocklet *vivi_docklet)
+vivi_vivi_docklet_init (ViviViviDocklet *docklet)
 {
 }
 
+typedef struct {
+  GtkWidget *	result;
+  GType		desired_type;
+} FindData;
+
+static void
+find_widget (GtkWidget *widget, gpointer datap)
+{
+  FindData *data = datap;
+
+  if (G_TYPE_CHECK_INSTANCE_TYPE (widget, data->desired_type)) {
+    data->result = widget;
+    return;
+  }
+  if (GTK_IS_CONTAINER (widget))
+    gtk_container_foreach (GTK_CONTAINER (widget), find_widget, data);
+}
+
+GtkWidget *
+vivi_vivi_docklet_find_widget_by_type (ViviViviDocklet *docklet, GType type)
+{
+  FindData data = { NULL, };
+
+  g_return_val_if_fail (VIVI_IS_VIVI_DOCKLET (docklet), NULL);
+  g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), NULL);
+
+  data.desired_type = type;
+  gtk_container_foreach (GTK_CONTAINER (docklet), find_widget, &data);
+  return data.result;
+}
diff --git a/vivified/ui/vivi_vivi_docklet.h b/vivified/ui/vivi_vivi_docklet.h
index 108b531..8142ae1 100644
--- a/vivified/ui/vivi_vivi_docklet.h
+++ b/vivified/ui/vivi_vivi_docklet.h
@@ -54,6 +54,9 @@ struct _ViviViviDockletClass
 
 GType			vivi_vivi_docklet_get_type   	(void);
 
+GtkWidget *		vivi_vivi_docklet_find_widget_by_type 
+							(ViviViviDocklet *	docklet,
+							 GType			type);
 
 G_END_DECLS
 #endif
diff-tree ab10b3c5c72a4e04b5f27027f90f58023d0a3594 (from abde6f7e4fb033f3c13f204a5de24aeb22f30854)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:12:06 2007 +0200

    use the application as default data when connecting signals

diff --git a/vivified/ui/main.c b/vivified/ui/main.c
index 1d57fa8..e6fb346 100644
--- a/vivified/ui/main.c
+++ b/vivified/ui/main.c
@@ -71,7 +71,7 @@ setup (const char *filename, const char 
   builder = gtk_builder_new ();
   if (!gtk_builder_add_from_file (builder, "vivi_player.xml", &error))
     g_error ("%s", error->message);
-  gtk_builder_connect_signals (builder, NULL);
+  gtk_builder_connect_signals (builder, app);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size (GTK_WINDOW (window), 400, 450);
diff-tree abde6f7e4fb033f3c13f204a5de24aeb22f30854 (from 7bbd6ebee1796e6d396d5b5dfdb99613124fe05a)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 12:03:47 2007 +0200

    make vivified use GtkBuilder for its docklets
    
    contains a port of the player docklet to GtkBuilder

diff --git a/configure.ac b/configure.ac
index 63a0bde..b1e81b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,11 +272,12 @@ AC_ARG_ENABLE(vivified,
 if test "$enable_vivi" = "yes"; then
 	AM_PROG_AS
 	MING_REQUIRED=0.4.0.beta5
-	PKG_CHECK_MODULES(VIVI, libming >= $MING_REQUIRED, HAVE_VIVI=yes, HAVE_VIVI=no)
+	VIVI_GTK_REQUIRED=2.11.6
+	PKG_CHECK_MODULES(VIVI, libming >= $MING_REQUIRED gmodule-export-2.0 gtk+-2.0 >= $VIVI_GTK_REQUIRED, HAVE_VIVI=yes, HAVE_VIVI=no)
 	if test "x$HAVE_VIVI" = xyes; then
 	  AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
 	else
-	  AC_MSG_ERROR([Vivified requirements not met. You need at libming >= $MING_REQUIRED.])
+	  AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
 	fi
 else
 	AC_MSG_WARN([*** Vivified was not enabled. ***])
diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am
index d6dad12..147c0cb 100644
--- a/vivified/ui/Makefile.am
+++ b/vivified/ui/Makefile.am
@@ -1,7 +1,7 @@
 noinst_PROGRAMS = vivified
 
-vivified_CFLAGS = $(GLOBAL_CFLAGS) $(SWFDEC_GTK_CFLAGS)
-vivified_LDFLAGS = $(SWFDEC_GTK_LIBS)
+vivified_CFLAGS = $(GLOBAL_CFLAGS) $(VIVI_CFLAGS)
+vivified_LDFLAGS = $(VIVI_LIBS) 
 vivified_LDADD = \
 	$(top_builddir)/vivified/core/libvivified-core.la \
 	$(top_builddir)/vivified/dock/libvivified-dock.la
@@ -16,6 +16,5 @@ vivified_SOURCES = \
 noinst_HEADERS = \
 	vivi_commandline.h \
 	vivi_movie_list.h \
-	vivi_player.h \
 	vivi_vivi_docklet.h
 
diff --git a/vivified/ui/main.c b/vivified/ui/main.c
index fe4b35c..1d57fa8 100644
--- a/vivified/ui/main.c
+++ b/vivified/ui/main.c
@@ -26,7 +26,6 @@
 #include "vivified/core/vivified-core.h"
 #include "vivified/dock/vivified-dock.h"
 #include "vivi_commandline.h"
-#include "vivi_player.h"
 
 static void
 try_grab_focus (GtkWidget *widget, gpointer unused)
@@ -62,10 +61,18 @@ setup (const char *filename, const char 
 {
   GtkWidget *window, *box, *widget;
   ViviApplication *app;
+  GtkBuilder *builder;
+  GError *error = NULL;
 
   app = vivi_application_new ();
   vivi_application_set_filename (app, filename);
   vivi_application_set_variables (app, variables);
+
+  builder = gtk_builder_new ();
+  if (!gtk_builder_add_from_file (builder, "vivi_player.xml", &error))
+    g_error ("%s", error->message);
+  gtk_builder_connect_signals (builder, NULL);
+
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size (GTK_WINDOW (window), 400, 450);
   g_signal_connect_swapped (app, "notify::quit", G_CALLBACK (gtk_widget_destroy), window);
@@ -73,7 +80,8 @@ setup (const char *filename, const char 
   set_title (app, NULL, GTK_WINDOW (window));
   box = vivi_vdock_new ();
   gtk_container_add (GTK_CONTAINER (window), box);
-  widget = vivi_player_new (app);
+  widget = GTK_WIDGET (gtk_builder_get_object (builder, "player"));
+  g_object_set (widget, "application", app, NULL);
   vivi_vdock_add (VIVI_VDOCK (box), widget);
   widget = vivi_command_line_new (app);
   vivi_vdock_add (VIVI_VDOCK (box), widget);
@@ -82,6 +90,7 @@ setup (const char *filename, const char 
   g_signal_connect (window, "delete-event", G_CALLBACK (delete_event), app);
   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), app);
   gtk_widget_show_all (window);
+  g_object_unref (builder);
 }
 
 int
diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index 4732d68..876eb77 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -21,10 +21,8 @@
 #include "config.h"
 #endif
 
-#include "vivi_player.h"
 #include <libswfdec-gtk/swfdec-gtk.h>
-
-G_DEFINE_TYPE (ViviPlayer, vivi_player, VIVI_TYPE_VIVI_DOCKLET)
+#include "vivi_vivi_docklet.h"
 
 static void
 find_player (GtkWidget *widget, gpointer result)
@@ -48,7 +46,9 @@ vivi_player_notify_app (ViviApplication 
   }
 }
 
-static void
+void
+vivi_player_application_set (ViviViviDocklet *docklet, ViviApplication *app);
+void
 vivi_player_application_set (ViviViviDocklet *docklet, ViviApplication *app)
 {
   SwfdecGtkPlayer *player = NULL;
@@ -60,7 +60,9 @@ vivi_player_application_set (ViviViviDoc
   swfdec_gtk_widget_set_interactive (SWFDEC_GTK_WIDGET (player), !vivi_application_get_interrupted (app));
 }
 
-static void
+void
+vivi_player_application_unset (ViviViviDocklet *docklet, ViviApplication *app);
+void
 vivi_player_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
 {
   SwfdecGtkPlayer *player = NULL;
@@ -70,32 +72,3 @@ vivi_player_application_unset (ViviViviD
   g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, player);
 }
 
-static void
-vivi_player_class_init (ViviPlayerClass *klass)
-{
-  ViviViviDockletClass *vivi_docklet_class = VIVI_VIVI_DOCKLET_CLASS (klass);
-
-  vivi_docklet_class->application_set = vivi_player_application_set;
-  vivi_docklet_class->application_unset = vivi_player_application_unset;
-}
-
-static void
-vivi_player_init (ViviPlayer *player)
-{
-  GtkWidget *box, *widget;
-
-  box = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_container_add (GTK_CONTAINER (player), box);
-  /* the player */
-  widget = swfdec_gtk_widget_new (NULL);
-  gtk_container_add (GTK_CONTAINER (box), widget);
-
-  gtk_widget_show_all (box);
-}
-
-GtkWidget *
-vivi_player_new (ViviApplication *app)
-{
-  return g_object_new (VIVI_TYPE_PLAYER, "title", "Player", "application", app, NULL);
-}
-
diff --git a/vivified/ui/vivi_player.h b/vivified/ui/vivi_player.h
deleted file mode 100644
index c2aa1dd..0000000
--- a/vivified/ui/vivi_player.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Vivified
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * 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.1 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
- * Boston, MA  02110-1301  USA
- */
-
-#ifndef _VIVI_PLAYER_H_
-#define _VIVI_PLAYER_H_
-
-#include <vivified/core/vivified-core.h>
-#include <vivified/dock/vivified-dock.h>
-#include <vivified/ui/vivi_vivi_docklet.h>
-
-G_BEGIN_DECLS
-
-
-typedef struct _ViviPlayer ViviPlayer;
-typedef struct _ViviPlayerClass ViviPlayerClass;
-
-#define VIVI_TYPE_PLAYER                    (vivi_player_get_type())
-#define VIVI_IS_PLAYER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_PLAYER))
-#define VIVI_IS_PLAYER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_PLAYER))
-#define VIVI_PLAYER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_PLAYER, ViviPlayer))
-#define VIVI_PLAYER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_PLAYER, ViviPlayerClass))
-#define VIVI_PLAYER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_PLAYER, ViviPlayerClass))
-
-struct _ViviPlayer {
-  ViviViviDocklet     	docklet;
-};
-
-struct _ViviPlayerClass
-{
-  ViviViviDockletClass  docklet_class;
-};
-
-GType			vivi_player_get_type   	(void);
-
-GtkWidget *		vivi_player_new		(ViviApplication *	app);
-
-
-G_END_DECLS
-#endif
diff --git a/vivified/ui/vivi_player.xml b/vivified/ui/vivi_player.xml
new file mode 100644
index 0000000..bb1c630
--- /dev/null
+++ b/vivified/ui/vivi_player.xml
@@ -0,0 +1,17 @@
+<interface>
+  <object class="ViviViviDocklet" id="player">
+    <property name="title">Player</property>
+    <signal name="application-set" handler="vivi_player_application_set" />
+    <signal name="application-unset" handler="vivi_player_application_unset" />
+    <child>
+      <object class="GtkAlignment" id="1">
+	<property name="xscale">0.0</property>
+	<property name="yscale">0.0</property>
+	<child>
+	  <object class="SwfdecGtkWidget" id="2">
+	  </object>
+	</child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/vivified/ui/vivi_vivi_docklet.c b/vivified/ui/vivi_vivi_docklet.c
index ddc9d23..9daba21 100644
--- a/vivified/ui/vivi_vivi_docklet.c
+++ b/vivified/ui/vivi_vivi_docklet.c
@@ -34,7 +34,7 @@ enum {
   LAST_SIGNAL
 };
 
-G_DEFINE_ABSTRACT_TYPE (ViviViviDocklet, vivi_vivi_docklet, VIVI_TYPE_DOCKLET)
+G_DEFINE_TYPE (ViviViviDocklet, vivi_vivi_docklet, VIVI_TYPE_DOCKLET)
 guint signals[LAST_SIGNAL];
 
 static void
diff-tree 7bbd6ebee1796e6d396d5b5dfdb99613124fe05a (from 0b05aebbce303392692d38bd8b6cde457f228a6e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:45:48 2007 +0200

    compute player widget dynamically

diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index ecff252..4732d68 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -27,29 +27,47 @@
 G_DEFINE_TYPE (ViviPlayer, vivi_player, VIVI_TYPE_VIVI_DOCKLET)
 
 static void
-vivi_player_notify_app (ViviApplication *app, GParamSpec *pspec, ViviPlayer *player)
+find_player (GtkWidget *widget, gpointer result)
+{
+  if (SWFDEC_IS_GTK_WIDGET (widget)) {
+    *(gpointer *) result = widget;
+    return;
+  }
+
+  if (GTK_IS_CONTAINER (widget))
+    gtk_container_foreach (GTK_CONTAINER (widget), find_player, result);
+}
+
+static void
+vivi_player_notify_app (ViviApplication *app, GParamSpec *pspec, SwfdecGtkWidget *player)
 {
   if (g_str_equal (pspec->name, "player")) {
-    swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player->player), vivi_application_get_player (app));
+    swfdec_gtk_widget_set_player (player, vivi_application_get_player (app));
   } else if (g_str_equal (pspec->name, "interrupted")) {
-    swfdec_gtk_widget_set_interactive (SWFDEC_GTK_WIDGET (player->player), 
-	!vivi_application_get_interrupted (app));
+    swfdec_gtk_widget_set_interactive (player, !vivi_application_get_interrupted (app));
   }
 }
 
 static void
 vivi_player_application_set (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  ViviPlayer *player = VIVI_PLAYER (docklet);
+  SwfdecGtkPlayer *player = NULL;
+
+  find_player (GTK_WIDGET (docklet), &player);
 
   g_signal_connect (app, "notify", G_CALLBACK (vivi_player_notify_app), player);
-  swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player->player), vivi_application_get_player (app));
+  swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player), vivi_application_get_player (app));
+  swfdec_gtk_widget_set_interactive (SWFDEC_GTK_WIDGET (player), !vivi_application_get_interrupted (app));
 }
 
 static void
 vivi_player_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, docklet);
+  SwfdecGtkPlayer *player = NULL;
+
+  find_player (GTK_WIDGET (docklet), &player);
+
+  g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, player);
 }
 
 static void
@@ -64,13 +82,13 @@ vivi_player_class_init (ViviPlayerClass 
 static void
 vivi_player_init (ViviPlayer *player)
 {
-  GtkWidget *box;
+  GtkWidget *box, *widget;
 
   box = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
   gtk_container_add (GTK_CONTAINER (player), box);
   /* the player */
-  player->player = swfdec_gtk_widget_new (NULL);
-  gtk_container_add (GTK_CONTAINER (box), player->player);
+  widget = swfdec_gtk_widget_new (NULL);
+  gtk_container_add (GTK_CONTAINER (box), widget);
 
   gtk_widget_show_all (box);
 }
diff --git a/vivified/ui/vivi_player.h b/vivified/ui/vivi_player.h
index af3d9dc..c2aa1dd 100644
--- a/vivified/ui/vivi_player.h
+++ b/vivified/ui/vivi_player.h
@@ -39,8 +39,6 @@ typedef struct _ViviPlayerClass ViviPlay
 
 struct _ViviPlayer {
   ViviViviDocklet     	docklet;
-
-  GtkWidget *		player;		/* SwfdecGtkWidget */
 };
 
 struct _ViviPlayerClass
diff-tree 0b05aebbce303392692d38bd8b6cde457f228a6e (from bc5a502e867c9a508fc2cb3795000ccb1298dea0)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:36:42 2007 +0200

    make application_(un)set signals

diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index 0785023..ecff252 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -38,7 +38,7 @@ vivi_player_notify_app (ViviApplication 
 }
 
 static void
-vivi_player_set_app (ViviViviDocklet *docklet, ViviApplication *app)
+vivi_player_application_set (ViviViviDocklet *docklet, ViviApplication *app)
 {
   ViviPlayer *player = VIVI_PLAYER (docklet);
 
@@ -47,7 +47,7 @@ vivi_player_set_app (ViviViviDocklet *do
 }
 
 static void
-vivi_player_unset_app (ViviViviDocklet *docklet, ViviApplication *app)
+vivi_player_application_unset (ViviViviDocklet *docklet, ViviApplication *app)
 {
   g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, docklet);
 }
@@ -57,8 +57,8 @@ vivi_player_class_init (ViviPlayerClass 
 {
   ViviViviDockletClass *vivi_docklet_class = VIVI_VIVI_DOCKLET_CLASS (klass);
 
-  vivi_docklet_class->set_app = vivi_player_set_app;
-  vivi_docklet_class->unset_app = vivi_player_unset_app;
+  vivi_docklet_class->application_set = vivi_player_application_set;
+  vivi_docklet_class->application_unset = vivi_player_application_unset;
 }
 
 static void
diff --git a/vivified/ui/vivi_vivi_docklet.c b/vivified/ui/vivi_vivi_docklet.c
index 1670ea6..ddc9d23 100644
--- a/vivified/ui/vivi_vivi_docklet.c
+++ b/vivified/ui/vivi_vivi_docklet.c
@@ -28,7 +28,14 @@ enum {
   PROP_APP
 };
 
+enum {
+  APPLICATION_SET,
+  APPLICATION_UNSET,
+  LAST_SIGNAL
+};
+
 G_DEFINE_ABSTRACT_TYPE (ViviViviDocklet, vivi_vivi_docklet, VIVI_TYPE_DOCKLET)
+guint signals[LAST_SIGNAL];
 
 static void
 vivi_vivi_docklet_get_property (GObject *object, guint param_id, GValue *value, 
@@ -51,14 +58,17 @@ vivi_vivi_docklet_set_property (GObject 
     GParamSpec *pspec)
 {
   ViviViviDocklet *docklet = VIVI_VIVI_DOCKLET (object);
-  ViviViviDockletClass *klass;
 
   switch (param_id) {
     case PROP_APP:
+      if (docklet->app) {
+	g_signal_emit (docklet, signals[APPLICATION_UNSET], 0, docklet->app);
+	g_object_unref (docklet->app);
+      }
       docklet->app = g_value_dup_object (value);
-      klass = VIVI_VIVI_DOCKLET_GET_CLASS (docklet);
-      if (klass->set_app)
-	klass->set_app (docklet, docklet->app);
+      if (docklet->app) {
+	g_signal_emit (docklet, signals[APPLICATION_SET], 0, docklet->app);
+      }
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -70,12 +80,12 @@ static void
 vivi_vivi_docklet_dispose (GObject *object)
 {
   ViviViviDocklet *docklet = VIVI_VIVI_DOCKLET (object);
-  ViviViviDockletClass *klass;
 
-  klass = VIVI_VIVI_DOCKLET_GET_CLASS (docklet);
-  if (klass->unset_app)
-    klass->unset_app (docklet, docklet->app);
-  g_object_unref (docklet->app);
+  if (docklet->app) {
+    g_signal_emit (docklet, signals[APPLICATION_UNSET], 0, docklet->app);
+    g_object_unref (docklet->app);
+    docklet->app = NULL;
+  }
 
   G_OBJECT_CLASS (vivi_vivi_docklet_parent_class)->dispose (object);
 }
@@ -91,7 +101,16 @@ vivi_vivi_docklet_class_init (ViviViviDo
 
   g_object_class_install_property (object_class, PROP_APP,
       g_param_spec_object ("application", "application", "application used by this docklet",
-	  VIVI_TYPE_APPLICATION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	  VIVI_TYPE_APPLICATION, G_PARAM_READWRITE));
+
+  signals[APPLICATION_SET] = g_signal_new ("application-set", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ViviViviDockletClass, application_set), 
+      NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
+      G_TYPE_NONE, 1, VIVI_TYPE_APPLICATION);
+  signals[APPLICATION_UNSET] = g_signal_new ("application-unset", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ViviViviDockletClass, application_unset), 
+      NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
+      G_TYPE_NONE, 1, VIVI_TYPE_APPLICATION);
 }
 
 static void
diff --git a/vivified/ui/vivi_vivi_docklet.h b/vivified/ui/vivi_vivi_docklet.h
index 66b1b14..108b531 100644
--- a/vivified/ui/vivi_vivi_docklet.h
+++ b/vivified/ui/vivi_vivi_docklet.h
@@ -46,9 +46,9 @@ struct _ViviViviDockletClass
 {
   ViviDockletClass    	docklet_class;
 
-  void			(* set_app)			(ViviViviDocklet *	docklet,
+  void			(* application_set)   		(ViviViviDocklet *	docklet,
 							 ViviApplication *	app);
-  void			(* unset_app)			(ViviViviDocklet *	docklet,
+  void			(* application_unset)	      	(ViviViviDocklet *	docklet,
 							 ViviApplication *	app);
 };
 
diff-tree bc5a502e867c9a508fc2cb3795000ccb1298dea0 (from d0b370d01cd37dcaac383206aade7d886cf8f423)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:05:45 2007 +0200

    add a ViviViviDocklet class that tracks the application and provides easy vfuncs
    
    This is used to have easy access to the Application setting and getting
    Also port ViviPlayer to it

diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am
index 3413b4c..d6dad12 100644
--- a/vivified/ui/Makefile.am
+++ b/vivified/ui/Makefile.am
@@ -10,10 +10,12 @@ vivified_SOURCES = \
 	vivi_commandline.c \
 	vivi_movie_list.c \
 	vivi_player.c \
+	vivi_vivi_docklet.c \
 	main.c
 
 noinst_HEADERS = \
 	vivi_commandline.h \
 	vivi_movie_list.h \
-	vivi_player.h
+	vivi_player.h \
+	vivi_vivi_docklet.h
 
diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index f54a935..0785023 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -24,7 +24,7 @@
 #include "vivi_player.h"
 #include <libswfdec-gtk/swfdec-gtk.h>
 
-G_DEFINE_TYPE (ViviPlayer, vivi_player, VIVI_TYPE_DOCKLET)
+G_DEFINE_TYPE (ViviPlayer, vivi_player, VIVI_TYPE_VIVI_DOCKLET)
 
 static void
 vivi_player_notify_app (ViviApplication *app, GParamSpec *pspec, ViviPlayer *player)
@@ -38,21 +38,27 @@ vivi_player_notify_app (ViviApplication 
 }
 
 static void
-vivi_player_dispose (GObject *object)
+vivi_player_set_app (ViviViviDocklet *docklet, ViviApplication *app)
 {
-  ViviPlayer *player = VIVI_PLAYER (object);
+  ViviPlayer *player = VIVI_PLAYER (docklet);
 
-  g_signal_handlers_disconnect_by_func (player->app, vivi_player_notify_app, player);
+  g_signal_connect (app, "notify", G_CALLBACK (vivi_player_notify_app), player);
+  swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player->player), vivi_application_get_player (app));
+}
 
-  G_OBJECT_CLASS (vivi_player_parent_class)->dispose (object);
+static void
+vivi_player_unset_app (ViviViviDocklet *docklet, ViviApplication *app)
+{
+  g_signal_handlers_disconnect_by_func (app, vivi_player_notify_app, docklet);
 }
 
 static void
 vivi_player_class_init (ViviPlayerClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  ViviViviDockletClass *vivi_docklet_class = VIVI_VIVI_DOCKLET_CLASS (klass);
 
-  object_class->dispose = vivi_player_dispose;
+  vivi_docklet_class->set_app = vivi_player_set_app;
+  vivi_docklet_class->unset_app = vivi_player_unset_app;
 }
 
 static void
@@ -72,12 +78,6 @@ vivi_player_init (ViviPlayer *player)
 GtkWidget *
 vivi_player_new (ViviApplication *app)
 {
-  ViviPlayer *player;
-
-  player = g_object_new (VIVI_TYPE_PLAYER, "title", "Player", NULL);
-  player->app = app;
-  g_signal_connect (player->app, "notify", G_CALLBACK (vivi_player_notify_app), player);
-  swfdec_gtk_widget_set_player (SWFDEC_GTK_WIDGET (player->player), vivi_application_get_player (app));
-  return GTK_WIDGET (player);
+  return g_object_new (VIVI_TYPE_PLAYER, "title", "Player", "application", app, NULL);
 }
 
diff --git a/vivified/ui/vivi_player.h b/vivified/ui/vivi_player.h
index 9aa9102..af3d9dc 100644
--- a/vivified/ui/vivi_player.h
+++ b/vivified/ui/vivi_player.h
@@ -22,6 +22,7 @@
 
 #include <vivified/core/vivified-core.h>
 #include <vivified/dock/vivified-dock.h>
+#include <vivified/ui/vivi_vivi_docklet.h>
 
 G_BEGIN_DECLS
 
@@ -37,15 +38,14 @@ typedef struct _ViviPlayerClass ViviPlay
 #define VIVI_PLAYER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_PLAYER, ViviPlayerClass))
 
 struct _ViviPlayer {
-  ViviDocklet		docklet;
+  ViviViviDocklet     	docklet;
 
-  ViviApplication *	app;		/* the application we connect to */
   GtkWidget *		player;		/* SwfdecGtkWidget */
 };
 
 struct _ViviPlayerClass
 {
-  ViviDockletClass    	docklet_class;
+  ViviViviDockletClass  docklet_class;
 };
 
 GType			vivi_player_get_type   	(void);
diff --git a/vivified/ui/vivi_vivi_docklet.c b/vivified/ui/vivi_vivi_docklet.c
new file mode 100644
index 0000000..1670ea6
--- /dev/null
+++ b/vivified/ui/vivi_vivi_docklet.c
@@ -0,0 +1,101 @@
+/* Vivified
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * 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.1 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vivi_vivi_docklet.h"
+
+enum {
+  PROP_0,
+  PROP_APP
+};
+
+G_DEFINE_ABSTRACT_TYPE (ViviViviDocklet, vivi_vivi_docklet, VIVI_TYPE_DOCKLET)
+
+static void
+vivi_vivi_docklet_get_property (GObject *object, guint param_id, GValue *value, 
+    GParamSpec * pspec)
+{
+  ViviViviDocklet *docklet = VIVI_VIVI_DOCKLET (object);
+  
+  switch (param_id) {
+    case PROP_APP:
+      g_value_set_object (value, docklet->app);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+  }
+}
+
+static void
+vivi_vivi_docklet_set_property (GObject *object, guint param_id, const GValue *value,
+    GParamSpec *pspec)
+{
+  ViviViviDocklet *docklet = VIVI_VIVI_DOCKLET (object);
+  ViviViviDockletClass *klass;
+
+  switch (param_id) {
+    case PROP_APP:
+      docklet->app = g_value_dup_object (value);
+      klass = VIVI_VIVI_DOCKLET_GET_CLASS (docklet);
+      if (klass->set_app)
+	klass->set_app (docklet, docklet->app);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+  }
+}
+
+static void
+vivi_vivi_docklet_dispose (GObject *object)
+{
+  ViviViviDocklet *docklet = VIVI_VIVI_DOCKLET (object);
+  ViviViviDockletClass *klass;
+
+  klass = VIVI_VIVI_DOCKLET_GET_CLASS (docklet);
+  if (klass->unset_app)
+    klass->unset_app (docklet, docklet->app);
+  g_object_unref (docklet->app);
+
+  G_OBJECT_CLASS (vivi_vivi_docklet_parent_class)->dispose (object);
+}
+
+static void
+vivi_vivi_docklet_class_init (ViviViviDockletClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = vivi_vivi_docklet_dispose;
+  object_class->get_property = vivi_vivi_docklet_get_property;
+  object_class->set_property = vivi_vivi_docklet_set_property;
+
+  g_object_class_install_property (object_class, PROP_APP,
+      g_param_spec_object ("application", "application", "application used by this docklet",
+	  VIVI_TYPE_APPLICATION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+vivi_vivi_docklet_init (ViviViviDocklet *vivi_docklet)
+{
+}
+
diff --git a/vivified/ui/vivi_vivi_docklet.h b/vivified/ui/vivi_vivi_docklet.h
new file mode 100644
index 0000000..66b1b14
--- /dev/null
+++ b/vivified/ui/vivi_vivi_docklet.h
@@ -0,0 +1,59 @@
+/* Vivified
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * 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.1 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifndef _VIVI_VIVI_DOCKLET_H_
+#define _VIVI_VIVI_DOCKLET_H_
+
+#include <vivified/core/vivified-core.h>
+#include <vivified/dock/vivified-dock.h>
+
+G_BEGIN_DECLS
+
+
+typedef struct _ViviViviDocklet ViviViviDocklet;
+typedef struct _ViviViviDockletClass ViviViviDockletClass;
+
+#define VIVI_TYPE_VIVI_DOCKLET                    (vivi_vivi_docklet_get_type())
+#define VIVI_IS_VIVI_DOCKLET(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_VIVI_DOCKLET))
+#define VIVI_IS_VIVI_DOCKLET_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_VIVI_DOCKLET))
+#define VIVI_VIVI_DOCKLET(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_VIVI_DOCKLET, ViviViviDocklet))
+#define VIVI_VIVI_DOCKLET_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_VIVI_DOCKLET, ViviViviDockletClass))
+#define VIVI_VIVI_DOCKLET_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_VIVI_DOCKLET, ViviViviDockletClass))
+
+struct _ViviViviDocklet {
+  ViviDocklet		docklet;
+
+  ViviApplication *	app;			/* the application we connect to */
+};
+
+struct _ViviViviDockletClass
+{
+  ViviDockletClass    	docklet_class;
+
+  void			(* set_app)			(ViviViviDocklet *	docklet,
+							 ViviApplication *	app);
+  void			(* unset_app)			(ViviViviDocklet *	docklet,
+							 ViviApplication *	app);
+};
+
+GType			vivi_vivi_docklet_get_type   	(void);
+
+
+G_END_DECLS
+#endif
diff-tree d0b370d01cd37dcaac383206aade7d886cf8f423 (from 7adaaba7e86f29eb42b555bd61d46fb428cfe9d7)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:04:33 2007 +0200

    make this work with a ViviApplication

diff --git a/vivified/ui/vivi_movie_list.c b/vivified/ui/vivi_movie_list.c
index 7178a32..7a4ddef 100644
--- a/vivified/ui/vivi_movie_list.c
+++ b/vivified/ui/vivi_movie_list.c
@@ -22,7 +22,6 @@
 #endif
 
 #include <gtk/gtk.h>
-#include <libswfdec/swfdec.h>
 #include <libswfdec/swfdec_movie.h>
 #include <libswfdec/swfdec_player_internal.h>
 #include "vivi_movie_list.h"
@@ -273,14 +272,18 @@ vivi_movie_list_get_index (GNode *parent
   return i;
 }
 
-static void
-vivi_movie_list_added (SwfdecPlayer *player, SwfdecMovie *movie, ViviMovieList *movies)
+static gboolean
+vivi_movie_list_added (ViviDebugger *debugger, SwfdecAsObject *object, ViviMovieList *movies)
 {
+  SwfdecMovie *movie;
   GtkTreePath *path;
   GtkTreeIter iter;
   GNode *node, *new;
   int pos;
 
+  if (!SWFDEC_IS_MOVIE (object))
+    return FALSE;
+  movie = SWFDEC_MOVIE (object);
   if (movie->parent) {
     node = g_hash_table_lookup (movies->nodes, movie->parent);
     g_assert (node);
@@ -297,6 +300,7 @@ vivi_movie_list_added (SwfdecPlayer *pla
   path = vivi_movie_list_node_to_path (new);
   gtk_tree_model_row_inserted (GTK_TREE_MODEL (movies), path, &iter);
   gtk_tree_path_free (path);
+  return FALSE;
 }
 
 static void
@@ -318,30 +322,35 @@ vivi_movie_list_movie_notify (SwfdecMovi
   gtk_tree_path_free (path);
 }
 
-static void
-vivi_movie_list_removed (SwfdecPlayer *player, SwfdecMovie *movie, ViviMovieList *movies)
+static gboolean
+vivi_movie_list_removed (ViviDebugger *debugger, SwfdecAsObject *object, ViviMovieList *movies)
 {
   GNode *node;
   GtkTreePath *path;
 
-  node = g_hash_table_lookup (movies->nodes, movie);
-  g_hash_table_remove (movies->nodes, movie);
-  g_signal_handlers_disconnect_by_func (movie, vivi_movie_list_movie_notify, movies);
+  if (!SWFDEC_IS_MOVIE (object))
+    return FALSE;
+  node = g_hash_table_lookup (movies->nodes, object);
+  g_hash_table_remove (movies->nodes, object);
+  g_signal_handlers_disconnect_by_func (object, vivi_movie_list_movie_notify, movies);
   path = vivi_movie_list_node_to_path (node);
   g_assert (g_node_n_children (node) == 0);
   g_node_destroy (node);
   gtk_tree_model_row_deleted (GTK_TREE_MODEL (movies), path);
   gtk_tree_path_free (path);
+  return FALSE;
 }
 
 static void
 vivi_movie_list_dispose (GObject *object)
 {
   ViviMovieList *movies = VIVI_MOVIE_LIST (object);
+  ViviDebugger *debugger;
 
-  g_signal_handlers_disconnect_by_func (movies->player, vivi_movie_list_removed, movies);
-  g_signal_handlers_disconnect_by_func (movies->player, vivi_movie_list_added, movies);
-  g_object_unref (movies->player);
+  debugger = movies->app->debugger;
+  g_signal_handlers_disconnect_by_func (debugger, vivi_movie_list_removed, movies);
+  g_signal_handlers_disconnect_by_func (debugger, vivi_movie_list_added, movies);
+  g_object_unref (movies->app);
   g_assert (g_node_n_children (movies->root) == 0);
   g_node_destroy (movies->root);
   g_hash_table_destroy (movies->nodes);
@@ -365,15 +374,17 @@ vivi_movie_list_init (ViviMovieList *mov
 }
 
 ViviMovieList *
-vivi_movie_list_new (SwfdecPlayer *player)
+vivi_movie_list_new (ViviApplication *app)
 {
   ViviMovieList *movies;
+  ViviDebugger *debugger;
 
   movies = g_object_new (VIVI_TYPE_MOVIE_LIST, NULL);
-  movies->player = player;
-  g_object_ref (player);
-  g_signal_connect (player, "movie-added", G_CALLBACK (vivi_movie_list_added), movies);
-  g_signal_connect (player, "movie-removed", G_CALLBACK (vivi_movie_list_removed), movies);
+  g_object_ref (app);
+  movies->app = app;
+  debugger = app->debugger;
+  g_signal_connect (debugger, "add", G_CALLBACK (vivi_movie_list_added), movies);
+  g_signal_connect (debugger, "remove", G_CALLBACK (vivi_movie_list_removed), movies);
   return movies;
 }
 
diff --git a/vivified/ui/vivi_movie_list.h b/vivified/ui/vivi_movie_list.h
index eaa7eb6..ddd4a81 100644
--- a/vivified/ui/vivi_movie_list.h
+++ b/vivified/ui/vivi_movie_list.h
@@ -17,7 +17,7 @@
  * Boston, MA  02110-1301  USA
  */
 
-#include <libswfdec/swfdec.h>
+#include <vivified/core/vivified-core.h>
 
 #ifndef _VIVI_MOVIE_LIST_H_
 #define _VIVI_MOVIE_LIST_H_
@@ -46,7 +46,7 @@ struct _ViviMovieList
 {
   GObject		object;
 
-  SwfdecPlayer *	player;		/* the video we play */
+  ViviApplication *	app;		/* the application we watch */
   GNode *		root;		/* the root node containing all the movies */
   int			stamp;		/* to validate tree iters */
   GHashTable *		nodes;		/* movies => node fast lookup table */
@@ -59,7 +59,7 @@ struct _ViviMovieListClass
 
 GType		vivi_movie_list_get_type		(void);
 
-ViviMovieList *	vivi_movie_list_new			(SwfdecPlayer *		player);
+ViviMovieList *	vivi_movie_list_new			(ViviApplication *	app);
 
 
 G_END_DECLS
diff-tree 7adaaba7e86f29eb42b555bd61d46fb428cfe9d7 (from 04f4684b200ee8e3c102282b56040881d279a39c)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:03:59 2007 +0200

    implement add and remove vfuncs

diff --git a/vivified/core/vivi_debugger.c b/vivified/core/vivi_debugger.c
index a5ae2eb..68a7b89 100644
--- a/vivified/core/vivi_debugger.c
+++ b/vivified/core/vivi_debugger.c
@@ -28,6 +28,8 @@
 #include "libswfdec/swfdec_player_internal.h"
 
 enum {
+  ADD,
+  REMOVE,
   STEP,
   START_FRAME,
   FINISH_FRAME,
@@ -87,6 +89,30 @@ vivi_debugger_break (ViviDebugger *debug
 }
 
 static void
+vivi_debugger_add (SwfdecAsDebugger *debugger, SwfdecAsContext *context, 
+    SwfdecAsObject *object)
+{
+  gboolean retval = FALSE;
+
+  g_signal_emit (debugger, signals[ADD], 0, object, &retval);
+
+  if (retval)
+    vivi_debugger_break (VIVI_DEBUGGER (debugger));
+}
+
+static void
+vivi_debugger_remove (SwfdecAsDebugger *debugger, SwfdecAsContext *context, 
+    SwfdecAsObject *object)
+{
+  gboolean retval = FALSE;
+
+  g_signal_emit (debugger, signals[REMOVE], 0, object, &retval);
+
+  if (retval)
+    vivi_debugger_break (VIVI_DEBUGGER (debugger));
+}
+
+static void
 vivi_debugger_step (SwfdecAsDebugger *debugger, SwfdecAsContext *context)
 {
   gboolean retval = FALSE;
@@ -149,6 +175,12 @@ vivi_debugger_class_init (ViviDebuggerCl
 
   object_class->dispose = vivi_debugger_dispose;
 
+  signals[ADD] = g_signal_new ("add", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, vivi_accumulate_or, NULL, vivi_marshal_BOOLEAN__OBJECT,
+      G_TYPE_BOOLEAN, 1, SWFDEC_TYPE_AS_OBJECT);
+  signals[REMOVE] = g_signal_new ("remove", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, vivi_accumulate_or, NULL, vivi_marshal_BOOLEAN__OBJECT,
+      G_TYPE_BOOLEAN, 1, SWFDEC_TYPE_AS_OBJECT);
   signals[STEP] = g_signal_new ("step", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, 0, vivi_accumulate_or, NULL, vivi_marshal_BOOLEAN__VOID,
       G_TYPE_BOOLEAN, 0);
@@ -162,6 +194,8 @@ vivi_debugger_class_init (ViviDebuggerCl
       G_SIGNAL_RUN_LAST, 0, vivi_accumulate_or, NULL, vivi_marshal_BOOLEAN__OBJECT_STRING_POINTER,
       G_TYPE_BOOLEAN, 3, SWFDEC_TYPE_AS_OBJECT, G_TYPE_STRING, G_TYPE_POINTER);
 
+  debugger_class->add = vivi_debugger_add;
+  debugger_class->remove = vivi_debugger_remove;
   debugger_class->step = vivi_debugger_step;
   debugger_class->start_frame = vivi_debugger_start_frame;
   debugger_class->finish_frame = vivi_debugger_finish_frame;
diff-tree 04f4684b200ee8e3c102282b56040881d279a39c (from 10153690d1eafad2f3bdbedda1e00d2d6b1b16dc)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 10:03:29 2007 +0200

    emit remove debugger function before collecting the object
    
    Otherwise we end up with a freed object (nice!)

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index a135585..59df631 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -261,12 +261,12 @@ swfdec_as_context_remove_objects (gpoint
     return FALSE;
   } else {
     SWFDEC_LOG ("deleted: %s %p", G_OBJECT_TYPE_NAME (object), object);
-    swfdec_as_object_collect (object);
     if (debugger) {
       SwfdecAsDebuggerClass *klass = SWFDEC_AS_DEBUGGER_GET_CLASS (debugger);
       if (klass->remove)
 	klass->remove (debugger, object->context, object);
     }
+    swfdec_as_object_collect (object);
     return TRUE;
   }
 }
diff-tree 10153690d1eafad2f3bdbedda1e00d2d6b1b16dc (from a5468cc9ac5545c607021cc89a6f541df3d6c56e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Aug 20 21:49:21 2007 +0200

    ad functionality to get notified about object add/remove to GC

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 0cb0226..a135585 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -248,7 +248,7 @@ swfdec_as_context_remove_strings (gpoint
 }
 
 static gboolean
-swfdec_as_context_remove_objects (gpointer key, gpointer value, gpointer data)
+swfdec_as_context_remove_objects (gpointer key, gpointer value, gpointer debugger)
 {
   SwfdecAsObject *object;
 
@@ -262,6 +262,11 @@ swfdec_as_context_remove_objects (gpoint
   } else {
     SWFDEC_LOG ("deleted: %s %p", G_OBJECT_TYPE_NAME (object), object);
     swfdec_as_object_collect (object);
+    if (debugger) {
+      SwfdecAsDebuggerClass *klass = SWFDEC_AS_DEBUGGER_GET_CLASS (debugger);
+      if (klass->remove)
+	klass->remove (debugger, object->context, object);
+    }
     return TRUE;
   }
 }
@@ -274,7 +279,7 @@ swfdec_as_context_collect (SwfdecAsConte
   g_hash_table_foreach_remove (context->strings, 
     swfdec_as_context_remove_strings, context);
   g_hash_table_foreach_remove (context->objects, 
-    swfdec_as_context_remove_objects, context);
+    swfdec_as_context_remove_objects, context->debugger);
   SWFDEC_INFO (">> done collecting garbage");
 }
 
diff --git a/libswfdec/swfdec_as_debugger.h b/libswfdec/swfdec_as_debugger.h
index 4a0f952..61aaae6 100644
--- a/libswfdec/swfdec_as_debugger.h
+++ b/libswfdec/swfdec_as_debugger.h
@@ -43,6 +43,14 @@ struct _SwfdecAsDebugger {
 struct _SwfdecAsDebuggerClass {
   GObjectClass		object_class;
 
+  /* a new object was added to the GC */
+  void			(* add)		(SwfdecAsDebugger *	debugger,
+					 SwfdecAsContext *	context,
+					 SwfdecAsObject *	object);
+  /* an object was removed from the GC */
+  void			(* remove)    	(SwfdecAsDebugger *	debugger,
+					 SwfdecAsContext *	context,
+					 SwfdecAsObject *	object);
   /* called before executing a bytecode */
   void			(* step)	(SwfdecAsDebugger *	debugger,
 					 SwfdecAsContext *	context);
diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index d041803..bd2cf90 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -528,6 +528,11 @@ swfdec_as_object_add (SwfdecAsObject *ob
   klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
   g_return_if_fail (klass->add);
   klass->add (object);
+  if (context->debugger) {
+    SwfdecAsDebuggerClass *dklass = SWFDEC_AS_DEBUGGER_GET_CLASS (context->debugger);
+    if (dklass->add)
+      dklass->add (context->debugger, context, object);
+  }
 }
 
 void
diff-tree a5468cc9ac5545c607021cc89a6f541df3d6c56e (from 307c09bbe7611bf2b1dae7e59a98d32cf009f595)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Aug 20 21:36:19 2007 +0200

    remove last remains of SwfdecDebugger
    
    note: I didn't remove the source  files yet, they might be useful for reference
    while implementing Vivified

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index 198b805..1e5e8a5 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -60,7 +60,6 @@ libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES
 	swfdec_color.c \
 	swfdec_color_as.c \
 	swfdec_debug.c \
-	swfdec_debugger.c \
 	swfdec_decoder.c \
 	swfdec_edittext.c \
 	swfdec_edittext_movie.c \
@@ -179,7 +178,6 @@ noinst_HEADERS = \
 	swfdec_color.h \
 	swfdec_color_as.h \
 	swfdec_debug.h \
-	swfdec_debugger.h \
 	swfdec_decoder.h \
 	swfdec_edittext.h \
 	swfdec_edittext_movie.h \
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 221e25c..90f3e2a 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -26,7 +26,6 @@
 #include "swfdec_as_context.h"
 #include "swfdec_as_interpret.h"
 #include "swfdec_debug.h"
-#include "swfdec_debugger.h"
 
 /* Define this to get SWFDEC_WARN'd about missing properties of objects.
  * This can be useful to find out about unimplemented native properties,
diff --git a/libswfdec/swfdec_types.h b/libswfdec/swfdec_types.h
index 907ac87..b66ecd9 100644
--- a/libswfdec/swfdec_types.h
+++ b/libswfdec/swfdec_types.h
@@ -37,7 +37,6 @@ typedef struct _SwfdecCacheHandle Swfdec
 typedef struct _SwfdecCharacter SwfdecCharacter;
 typedef struct _SwfdecColorTransform SwfdecColorTransform;
 typedef struct _SwfdecContent SwfdecContent;
-typedef struct _SwfdecDebugger SwfdecDebugger;
 typedef struct _SwfdecDecoder SwfdecDecoder;
 typedef struct _SwfdecEventList SwfdecEventList;
 typedef struct _SwfdecFont SwfdecFont;
diff-tree 307c09bbe7611bf2b1dae7e59a98d32cf009f595 (from e04f9526fa8a613d88219ebcb47ac61addd5bcab)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Aug 20 21:34:07 2007 +0200

    get rid of debugger bits

diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 243dabc..420c508 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -32,7 +32,6 @@
 #include "swfdec_as_strings.h"
 #include "swfdec_button_movie.h"
 #include "swfdec_debug.h"
-#include "swfdec_debugger.h"
 #include "swfdec_event.h"
 #include "swfdec_graphic.h"
 #include "swfdec_loader_internal.h"
@@ -315,16 +314,8 @@ swfdec_movie_destroy (SwfdecMovie *movie
     swfdec_movie_destroy (movie->list->data);
   }
   if (movie->parent) {
-    if (SWFDEC_IS_DEBUGGER (player) &&
-	g_list_find (movie->parent->list, movie)) {
-      g_signal_emit_by_name (player, "movie-removed", movie);
-    }
     movie->parent->list = g_list_remove (movie->parent->list, movie);
   } else {
-    if (SWFDEC_IS_DEBUGGER (player) &&
-	g_list_find (player->roots, movie)) {
-      g_signal_emit_by_name (player, "movie-removed", movie);
-    }
     player->roots = g_list_remove (player->roots, movie);
   }
   /* FIXME: figure out how to handle destruction pre-init/construct.
@@ -1000,7 +991,6 @@ swfdec_movie_new (SwfdecPlayer *player, 
     size = 0;
   }
   g_object_ref (movie);
-  swfdec_as_object_add (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_CONTEXT (player), size);
   /* set essential properties */
   movie->parent = parent;
   if (parent) {
@@ -1030,9 +1020,8 @@ swfdec_movie_new (SwfdecPlayer *player, 
    * new movies to be created (and added to this list)
    */
   player->movies = g_list_prepend (player->movies, movie);
-  /* emit the new-movie signal */
-  if (SWFDEC_IS_DEBUGGER (player))
-    g_signal_emit_by_name (player, "movie-added", movie);
+  /* only add the movie here, because it needs to be setup for the debugger */
+  swfdec_as_object_add (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_CONTEXT (player), size);
   return movie;
 }
 


More information about the Swfdec mailing list