From: Andy W. <wi...@us...> - 2002-07-12 20:21:34
|
CVS Root: /cvsroot/gstreamer Module: gst-editor Changes by: wingo Date: Fri Jul 12 2002 13:21:33 PDT Log message: signal cleanup Modified files: libs/gst/editor : gsteditorbin.c gsteditorelement.c gsteditoritem.c libs/gst/element-ui: gst-element-ui-prop-view.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorbin.c.diff?r1=1.14&r2=1.15 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.c.diff?r1=1.20&r2=1.21 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/editor/gsteditoritem.c.diff?r1=1.7&r2=1.8 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-editor/libs/gst/element-ui/gst-element-ui-prop-view.c.diff?r1=1.9&r2=1.10 ====Begin Diffs==== Index: gsteditorbin.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorbin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- gsteditorbin.c 12 Jul 2002 19:14:01 -0000 1.14 +++ gsteditorbin.c 12 Jul 2002 20:21:21 -0000 1.15 @@ -309,6 +309,11 @@ GnomeCanvasItem *childitem; gdouble x, y, width, height; + if (gst_editor_item_get (child)) { + g_message ("child %s already rendered, ignoring"); + return; + } + if (editorbin->element_x > 0) { x = editorbin->element_x; y = editorbin->element_y; @@ -361,8 +366,6 @@ l = g_list_next (l); } } - - /* connections still need to be handled */ if (GST_EDITOR_ITEM_CLASS (parent_class)->object_changed) (GST_EDITOR_ITEM_CLASS (parent_class)->object_changed) (item, object); Index: gsteditorelement.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditorelement.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- gsteditorelement.c 12 Jul 2002 19:14:01 -0000 1.20 +++ gsteditorelement.c 12 Jul 2002 20:21:21 -0000 1.21 @@ -39,6 +39,7 @@ static void gst_editor_element_repack (GstEditorItem *item); static gint gst_editor_element_event (GnomeCanvasItem *citem, GdkEvent *event); +static void gst_editor_element_object_changed (GstEditorItem *bin, GstObject *object); /* events fired by items within self */ static gint gst_editor_element_resizebox_event (GnomeCanvasItem *citem, @@ -142,6 +143,7 @@ citem_class->realize = gst_editor_element_realize; citem_class->event = gst_editor_element_event; item_class->repack = gst_editor_element_repack; + item_class->object_changed = gst_editor_element_object_changed; } static void @@ -216,15 +218,6 @@ g_return_if_fail (element->resizebox != NULL); GST_EDITOR_SET_OBJECT (element->resizebox, item); - /* set the state signal of the actual element */ - g_signal_connect_swapped (G_OBJECT (item->object), "state_change", - G_CALLBACK (gst_editor_element_sync_state_wrapper), - G_OBJECT (element)); - - g_signal_connect_swapped (G_OBJECT (item->object), "new_pad", - G_CALLBACK (gst_editor_element_add_pad_wrapper), - G_OBJECT (element)); - /* it could be the root canvas */ if (GST_IS_EDITOR_ELEMENT (citem->parent)) g_signal_connect_swapped (G_OBJECT (citem->parent), "position_changed", @@ -846,4 +839,29 @@ { gnome_canvas_item_move (GNOME_CANVAS_ITEM (element), dx, dy); g_signal_emit (G_OBJECT (element), gst_editor_element_signals[POSITION_CHANGED], 0, element); +} + +static void +gst_editor_element_object_changed (GstEditorItem *item, GstObject *object) +{ + if (item->object) { + g_signal_handlers_disconnect_by_func (G_OBJECT (item->object), + gst_editor_element_sync_state_wrapper, + item); + g_signal_handlers_disconnect_by_func (G_OBJECT (item->object), + gst_editor_element_add_pad_wrapper, + item); + } + + if (object) { + g_signal_connect_swapped (G_OBJECT (object), "state_change", + G_CALLBACK (gst_editor_element_sync_state_wrapper), + G_OBJECT (item)); + g_signal_connect_swapped (G_OBJECT (object), "new_pad", + G_CALLBACK (gst_editor_element_add_pad_wrapper), + G_OBJECT (item)); + } + + if (GST_EDITOR_ITEM_CLASS (parent_class)->object_changed) + (GST_EDITOR_ITEM_CLASS (parent_class)->object_changed) (item, object); } Index: gsteditoritem.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/editor/gsteditoritem.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- gsteditoritem.c 12 Jul 2002 19:14:01 -0000 1.7 +++ gsteditoritem.c 12 Jul 2002 20:21:21 -0000 1.8 @@ -144,13 +144,14 @@ break; case ARG_OBJECT: /* FIXME: unref the old object, if that's safe */ + g_signal_emit (object, gst_editor_item_signals[OBJECT_CHANGED], 0, + g_value_get_object (value), NULL); item->object = GST_OBJECT (g_value_get_object (value)); if (item->title_text) g_free (item->title_text); item->title_text = g_strdup (GST_OBJECT_NAME (item->object)); if (item->title) gnome_canvas_item_set (item->title, "text", item->title_text, NULL); - g_signal_emit (object, gst_editor_item_signals[OBJECT_CHANGED], 0, item->object, NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); Index: gst-element-ui-prop-view.c =================================================================== RCS file: /cvsroot/gstreamer/gst-editor/libs/gst/element-ui/gst-element-ui-prop-view.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- gst-element-ui-prop-view.c 17 Jun 2002 04:28:12 -0000 1.9 +++ gst-element-ui-prop-view.c 12 Jul 2002 20:21:21 -0000 1.10 @@ -437,7 +437,7 @@ break; case G_TYPE_STRING: g_object_set (G_OBJECT (pview->element), param->name, - gtk_entry_get_text (GTK_ENTRY (pview->entry))); + gtk_entry_get_text (GTK_ENTRY (pview->entry)), NULL); break; #define CASE_NUMERIC(type_lower, type_upper) \ |