ComboBox and TreeView issues

2007-10-04 Thread omar . crea
Hi everybody.
I obtain the following errors when launching my application that contains a
notebook, and in one of its page there are three combobox with the associated
treeviews:

(when opening the tab)
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter-user_data != NULL' failed
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter-user_data != NULL' failed
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter-user_data != NULL' failed

(when closing the tab)
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_unref: assertion
`G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_get_data:
assertion `G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB WARNING ** Gtk - gtktreemodel.c:1949: bad row
reference, proxy has no outstanding row references
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_get_data:
assertion `G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB WARNING ** Gtk - gtktreemodel.c:1949: bad row
reference, proxy has no outstanding row references

What they means?

I use the following code to create a model for the tree:

GtkTreeModel *
190create_model ( void ) {
191
192GtkTreeIter iter;
193GtkTreeStore *store = NULL;
194GtkTreeSelection *select = NULL;
195GtkWidget *treeview = NULL;
196ll *tmp = top-ref-first;
197
198store = gtk_tree_store_new(NUM_COL, G_TYPE_STRING);
199
200gtk_tree_store_append(store, iter, NULL);
201gtk_tree_store_set(store, iter,
202  STRING_COL, Nothing,
203  -1);
204
205while (tmp != NULL) {
206   gtk_tree_store_append(store, iter, NULL);
207   gtk_tree_store_set(store, iter,
208 STRING_COL, tmp-contenuto,
209 -1);
210   tmp = tmp-next;
211   }
212
213treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
214select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
215gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
216
217return GTK_TREE_MODEL(store);
218 }

and this one to create a text renderer:

void add_renderer ( GtkComboBox *combo ) {
273
274GtkCellRenderer *render = NULL;
275GtkTreePath *path = NULL;
276GtkTreeModel *mod = NULL;
277GtkTreeIter iter;
278
279render = gtk_cell_renderer_text_new();
280gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), render, TRUE);
281gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), render,
282  text, STRING_COL,
283  NULL);
284
285path = gtk_tree_path_new_from_indices(0, 1, -1);
286mod = gtk_combo_box_get_model(combo);
287gtk_tree_model_get_iter(mod, iter, path);
288gtk_tree_path_free(path);
289gtk_combo_box_set_active_iter(combo, iter);
290
291 }

then I use this code to get data from the combobox:

369result = gtk_combo_box_get_active_iter(GTK_COMBO_BOX(c.dataCombo),
iter);
370model = gtk_combo_box_get_model(GTK_COMBO_BOX(c.dataCombo));
371gtk_tree_model_get(model, iter,
372  STRING_COL, tf.data,
373  -1);
374printf(Getted data: %s\n, tf.data);
375g_object_unref(model);

Thanks in advance,

Omar


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Switch contents in the same window

2007-10-01 Thread omar . crea
Hi everybody.
How can I switch two contents in the same main window?
I have a tabbed application, and I want to create a searching page where, when I
click the find button, it switches and showes the search results, and when I
click the Back button it returns to the searching page again (for a new
search).
Thanks in advance.

Omar


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fwd: Reading row from a ComboBox

2007-10-01 Thread omar . crea
Thanks Damien, it works fine!

- Forwarded message from [EMAIL PROTECTED] -
Date: Fri, 28 Sep 2007 16:05:46 +0200
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
 Subject: Reading row from a ComboBox
  To: GTK+ mailing list gtk-app-devel-list@gnome.org

Hi everybody.
I have a problem on reading the actually displayed content of a combobox. I
created a combobox that contains some strings and I want to recover the
actually displayed string when i press the Find button (that is a button in
the same window of the combobox).
The problem is that the 'gtk_tree_model_get_iter' function always returns FALSE
('getted' is FALSE when running app).
I tried also with the following code:

gint row;
  row = gtk_combo_box_get_active (combo);
  path = gtk_tree_path_new_from_indices (row, -1);

but without success. :-(

Here are my questions:
1) how can I get a valid iter from the tree model? Is there something wrong with
 the path?
2) when I obtain the current iter, how can I get the selected entry of the
combobox? I need to save it to a string for subsequent processing.
Thanks in advance.

Omar


enum {
STRING_COL,
NUM_COL
};


/* main function */
...
model = create_model();
c.Combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
add_renderer(GTK_COMBO_BOX(c.Combo));
g_object_unref(model);
...

/* create_model function */
static GtkTreeModel *
create_model ( void ) {

 GtkTreeIter iter;
 GtkTreeStore *store = NULL;
 GtkTreeSelection *select = NULL;
 GtkWidget *treeview = NULL;
 ll *tmp = top-ref-first;

 store = gtk_tree_store_new(NUM_COL, G_TYPE_STRING);
 gtk_tree_store_append(store, iter, NULL);
 gtk_tree_store_set(store, iter,
 STRING_COL, Nothing,
 -1);

 while (tmp != NULL) {
 gtk_tree_store_append(store, iter, NULL);
 gtk_tree_store_set(store, iter,
 STRING_COL, tmp-content,
 -1);
 tmp = tmp-next;
 }

 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
 return GTK_TREE_MODEL(store);
 }

/* add_renderer function */
static void add_renderer ( GtkComboBox *combo ) {

 GtkCellRenderer *render = NULL;
 GtkTreePath *path = NULL;
 GtkTreeModel *mod = NULL;
 GtkTreeIter iter;
 gboolean getted;
 gint row;

 render = gtk_cell_renderer_text_new();
 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), render, TRUE);
 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), render,
 text, STRING_COL,
 NULL);

 path = gtk_tree_path_new_from_indices(0, 8, -1);
 mod = gtk_combo_box_get_model(combo);
 getted = gtk_tree_model_get_iter(mod, iter, path);
 printf(getted is %s\n, (getted) ? TRUE : FALSE);
 gtk_tree_path_free(path);
 gtk_combo_box_set_active_iter(combo, iter);
}


This message was sent using IMP, the Internet Messaging Program.

- End forwarded message -





This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Switch contents in the same window

2007-10-01 Thread omar . crea
Sorry Yeti, but it's not what I'm searching for: I cannot implement GtkAssistant
because I'm working on GTK+ 2.6 on an embedded system...
Is there another way to obtain what I deserve?
Thanks in advance,

Omar

Quoting [EMAIL PROTECTED]:

 Hi everybody.
 How can I switch two contents in the same main window?
 I have a tabbed application, and I want to create a searching page where,
 when I
 click the find button, it switches and showes the search results, and when
 I
 click the Back button it returns to the searching page again (for a new
 search).
 Thanks in advance.

 Omar

 
 This message was sent using IMP, the Internet Messaging Program.






This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[no subject]

2007-09-28 Thread omar . crea
Hi everybody.
How can I switch two contents in the same main window?
I have a tabbed application, and I want to create a searching page where, when I
click the find button, it switches and showes the search results, and when I
click the Back button it returns to the searching page again (for a new
search).
Thanks in advance.

Omar


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Reading row from a ComboBox

2007-09-28 Thread omar . crea
Hi everybody.
I have a problem on reading the actually displayed content of a combobox. I
created a combobox that contains some strings and I want to recover the
actually displayed string when i press the Find button (that is a button in
the same window of the combobox).
The problem is that the 'gtk_tree_model_get_iter' function always returns FALSE
('getted' is FALSE when running app).
I tried also with the following code:

gint row;
  row = gtk_combo_box_get_active (combo);
  path = gtk_tree_path_new_from_indices (row, -1);

but without success. :-(

Here are my questions:
1) how can I get a valid iter from the tree model? Is there something wrong with
 the path?
2) when I obtain the current iter, how can I get the selected entry of the
combobox? I need to save it to a string for subsequent processing.
Thanks in advance.

Omar


enum {
STRING_COL,
NUM_COL
};


/* main function */
...
model = create_model();
c.Combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
add_renderer(GTK_COMBO_BOX(c.Combo));
g_object_unref(model);
...

/* create_model function */
static GtkTreeModel *
create_model ( void ) {

 GtkTreeIter iter;
 GtkTreeStore *store = NULL;
 GtkTreeSelection *select = NULL;
 GtkWidget *treeview = NULL;
 ll *tmp = top-ref-first;

 store = gtk_tree_store_new(NUM_COL, G_TYPE_STRING);
 gtk_tree_store_append(store, iter, NULL);
 gtk_tree_store_set(store, iter,
 STRING_COL, Nothing,
 -1);

 while (tmp != NULL) {
 gtk_tree_store_append(store, iter, NULL);
 gtk_tree_store_set(store, iter,
 STRING_COL, tmp-content,
 -1);
 tmp = tmp-next;
 }

 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
 return GTK_TREE_MODEL(store);
 }

/* add_renderer function */
static void add_renderer ( GtkComboBox *combo ) {

 GtkCellRenderer *render = NULL;
 GtkTreePath *path = NULL;
 GtkTreeModel *mod = NULL;
 GtkTreeIter iter;
 gboolean getted;
 gint row;

 render = gtk_cell_renderer_text_new();
 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), render, TRUE);
 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), render,
 text, STRING_COL,
 NULL);

 path = gtk_tree_path_new_from_indices(0, 8, -1);
 mod = gtk_combo_box_get_model(combo);
 getted = gtk_tree_model_get_iter(mod, iter, path);
 printf(getted is %s\n, (getted) ? TRUE : FALSE);
 gtk_tree_path_free(path);
 gtk_combo_box_set_active_iter(combo, iter);
}


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkDialog problems again

2007-08-29 Thread omar . crea
Thanks a lot, Jim! Now it works!!!

Quoting Jim George [EMAIL PROTECTED]:

 On 8/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi everybody.
  I need a dialog in my application that simply show a label (so without any
  button) and then hide itself after some processing occurred.
  The problem is that I can't send any :response signal to the dialog, so it
  remains blocked in the loop after gtk_dialog_run has been called.
  I tried to use the example posted in the GTK+ reference manual, but without
  success.
 

 Just in case Yeti's comment didn't make it clear, it's still important
 to yield control of the program back to GTK once the progress window
 is shown, otherwise nothing appears to happen. So your code might look
 like this:

 do_long_task_step_1(struct task_params *p)
 {
   gtk_widget_show(p-progress_window);
   g_idle_add(do_long_task_step_2, p);
 }

 do_long_task_step_2(struct task_params *p)
 {
   /* do part of the task here */
   g_idle_add(do_long_task_step_3, p);
 }

 do_long_task_step_3(struct task_params *p)
 {
   /* finish up the task here */

   gtk_widget_hide(p-progress_window);
 }

 For file/device I/O, you would use something like g_io_channel, so you
 wouldn't need to rely on g_idle_add.

 -Jim







This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkDialog problems again

2007-08-27 Thread omar . crea
Hi everybody.
I need a dialog in my application that simply show a label (so without any
button) and then hide itself after some processing occurred.
The problem is that I can't send any :response signal to the dialog, so it
remains blocked in the loop after gtk_dialog_run has been called.
I tried to use the example posted in the GTK+ reference manual, but without
success.


Here is the code snippet:

appdata-dialogLabel = gtk_label_new(NULL);
gtk_label_set_text(GTK_LABEL(appdata-dialogLabel),
  Opening camera...);

appdata-dialog = gtk_dialog_new_with_buttons(Open Camera,
  GTK_WINDOW(appdata-window),
  GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
  NULL);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(appdata-dialog)-vbox),
appdata-dialogLabel);

gtk_widget_show_all(appdata-dialog);
// program stops here
gint result = gtk_dialog_run(GTK_DIALOG(appdata-dialog));
switch (result) {
   case GTK_RESPONSE_ACCEPT:
  gtk_widget_hide_all(appdata-dialog);
  break;
   default:
  gtk_dialog_response(GTK_DIALOG(appdata-dialog),
GTK_RESPONSE_DELETE_EVENT);
  start_pipeline(appdata);
  add_camera_tab(appdata);
  break;
}
gtk_widget_destroy(appdata-dialog);




I need that the dialog hides itself after start_pipeline() and add_camera_tab()
is called.
Thanks in advance.

Omar


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Running external program inside a widget

2007-07-13 Thread omar . crea
Thanks a lot Kumar!
It seems not quite simple, also because I haven't the browser source, but I'll
try with another browser.


Quoting Kumar Siddharth [EMAIL PROTECTED]:


 Hi,

 You can place the call in any appropriate event handler. Also, you will have
 to create a socket in your GTK program. Now in your browser app, you need
 modification so that you can create a plug and attach it to the socket
 created in GTK App. Now the browser (May be its rendering area widget)
 should be attached to this plug, and should not be as main window. Meaning
 you need source for browser or may be a method so that the browser output is
 redirected to GtkDrawingArea (which can be connected to plug).

 Regards,
 Siddharth
 TATA Elxsi, India

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 [EMAIL PROTECTED]
 Sent: Friday, July 06, 2007 9:24 PM
 To: GTK+ mailing list
 Subject: RE: Running external program inside a widget


 Excuse me but I'm new to GTK+: at which moment I have to call the system()
 function to run the external program I need (a web browser, in this case)?
 Do I
 have to use two different source files to implement this mechanism (run the
 app
 as a GtkPlug, give it the ID of the GtkSocket, ecc.)? If not, which are the
 steps to implement this on a single source file?
 Thank in advance for answers.
 Omar


 Quoting Kumar Siddharth [EMAIL PROTECTED]:

 
  Hi,
 
  You may use GtkSocket(in Host App) and GtkPlug(in Embedded App) for this.
 
  Regards,
  Siddharth
  TATA Elxsi
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of
  [EMAIL PROTECTED]
  Sent: Friday, July 06, 2007 7:24 PM
  To: GTK+ mailing list
  Subject: Running external program inside a widget
 
 
  Hi everybody.
  Do anyone know how to include an external program to a widget of the main
  window?
  I have a main window containing a notebook, and in one of the notebook's
 tab
  I
  want to show an instance of a browser (Opera) inside a GtkDrawingArea(),
 and
  not to show the external program in its own new window (not associated to
 my
  application). My hardware is a Nokia N800 (tablet PC).
  Can anyone help me? Thanks in advance.
  Omar
 
 
  
  This message was sent using IMP, the Internet Messaging Program.
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 




 
 This message was sent using IMP, the Internet Messaging Program.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Running external program inside a widget

2007-07-06 Thread omar . crea
Hi everybody.
Do anyone know how to include an external program to a widget of the main
window?
I have a main window containing a notebook, and in one of the notebook's tab I
want to show an instance of a browser (Opera) inside a GtkDrawingArea(), and
not to show the external program in its own new window (not associated to my
application). My hardware is a Nokia N800 (tablet PC).
Can anyone help me? Thanks in advance.
Omar



This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Running external program inside a widget

2007-07-06 Thread omar . crea
Excuse me but I'm new to GTK+: at which moment I have to call the system()
function to run the external program I need (a web browser, in this case)? Do I
have to use two different source files to implement this mechanism (run the app
as a GtkPlug, give it the ID of the GtkSocket, ecc.)? If not, which are the
steps to implement this on a single source file?
Thank in advance for answers.
Omar


Quoting Kumar Siddharth [EMAIL PROTECTED]:


 Hi,

 You may use GtkSocket(in Host App) and GtkPlug(in Embedded App) for this.

 Regards,
 Siddharth
 TATA Elxsi

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 [EMAIL PROTECTED]
 Sent: Friday, July 06, 2007 7:24 PM
 To: GTK+ mailing list
 Subject: Running external program inside a widget


 Hi everybody.
 Do anyone know how to include an external program to a widget of the main
 window?
 I have a main window containing a notebook, and in one of the notebook's tab
 I
 want to show an instance of a browser (Opera) inside a GtkDrawingArea(), and
 not to show the external program in its own new window (not associated to my
 application). My hardware is a Nokia N800 (tablet PC).
 Can anyone help me? Thanks in advance.
 Omar


 
 This message was sent using IMP, the Internet Messaging Program.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Main window refreshing

2007-06-25 Thread omar . crea
I write a little application for an embedded system (Nokia N800)
using GTK+ and GStreamer and I need refreshing of the window.
When I iconize the application window and then put it in foreground again,
the gstreamer flow disappears.
I implemented this flow in a drawing area inside the main window.
How can I refresh my application after putting it in foreground again?

Thanks for the answer. Best regards.


This message was sent using IMP, the Internet Messaging Program.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: BadDrawable or BadWindow error

2007-06-13 Thread omar . crea
Fixed...
The problem is that the GStreamer pipeline don't free properly when the
window's exit button was pressed: it can be fixed using a quit function
that frees the pipeline prior to close the GTK main loop.

GstElement *pipeline;  // global now

// prototype
void destroy (GtkWidget *, gpointer);
{
void
destroy (GtkWidget *widget, gpointer data) {
gst_element_set_state(pipeline, GST_STATE_NULL);
gst_object_unref(pipeline);
gtk_main_quit();
}

// adding action to window's events
gtk_signal_connect(GTK_OBJECT(window),
delete_event,
GTK_SIGNAL_FUNC(destroy), // previous: gtk_main_quit
NULL);



Quoting [EMAIL PROTECTED]:

 Hi everybody. I wrote a little application combining GTK and GStreamer
 functions to view the camera input on the window's screen and
 to take photo (not yet implemented, this is experimental code...).
 When I launch the application I obtain the following error:

 The program 'test2' received an X Window System error.
 This probably reflects a bug in the program.
 The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
   (Details: serial 1362 error_code 9 request_code 140 minor_code 9)

 Sometimes BadDrawable is substituted with BadWindow or others... I really
 don't know why this occur: the application runs properly, I also manage
 the delete and destroy event on the main window, but... Can anyone
 help me?

 Here is the launching command line to compile:

 gcc base.c `pkg-config --cflags --libs gtk+-2.0 gstreamer-0.10 \
 gstreamer-interfaces-0.8 gdk-2.0` -o test2


 And here is the source code:

 #include gtk/gtk.h
 #include gst/gst.h
 #include gst/interfaces/xoverlay.h
 #include gdk/gdkx.h
 #include gdk/gdk.h

 static gboolean expose( GtkWidget * widget, GdkEventExpose * event,
   gpointer data );

 int main( int argc, char *argv[] )
 {
 GtkWidget *window, *screen;

GstElement *pipeline, *src, *sink, *csp;
GstElement *tee, *csp2, *fakesink;
GstElement *queue;
GstCaps *filter;
gboolean link_ok;



gtk_init (argc, argv);

gst_init(argc, argv);


 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

 gtk_signal_connect(GTK_OBJECT(window),
   delete_event,
   GTK_SIGNAL_FUNC(gtk_main_quit),
   NULL);

 gtk_signal_connect(GTK_OBJECT(window),
   destroy,
   GTK_SIGNAL_FUNC(gtk_main_quit),
   NULL);

 screen = gtk_drawing_area_new();

 gtk_window_set_title(GTK_WINDOW(window), Camera app);
 gtk_container_set_border_width (GTK_CONTAINER (window), 5);
 gtk_widget_set_size_request(window, 640, 480);

 gtk_widget_set_size_request(screen, 320, 240);
 gtk_widget_show(screen);


 gtk_container_add(GTK_CONTAINER(window), screen);


pipeline = gst_pipeline_new(camera);
src = gst_element_factory_make(videotestsrc, src);
 //   src = gst_element_factory_make(gconfv4l2src, src);

sink = gst_element_factory_make(xvimagesink, sink);
csp = gst_element_factory_make(ffmpegcolorspace, csp);
tee = gst_element_factory_make(tee, tee);
fakesink = gst_element_factory_make(fakesink, fakesink);
csp2 = gst_element_factory_make(ffmpegcolorspace, csp2);
queue = gst_element_factory_make(queue, queue);


gst_bin_add(GST_BIN(pipeline), src);
gst_bin_add(GST_BIN(pipeline), csp);
gst_bin_add(GST_BIN(pipeline), tee);
gst_bin_add(GST_BIN(pipeline), csp2);
gst_bin_add(GST_BIN(pipeline), sink);
gst_bin_add(GST_BIN(pipeline), queue);
gst_bin_add(GST_BIN(pipeline), fakesink);


filter = gst_caps_new_simple(video/x-raw-yuv,
   width, G_TYPE_INT, 320,
   height,  G_TYPE_INT, 240,
   framerate, GST_TYPE_FRACTION, 11, 1,
   NULL);


link_ok = gst_element_link_filtered(src, tee, filter);
if (!link_ok)
   g_warning(Failed to link elements\n);
gst_element_link(tee, csp);
gst_element_link(csp, sink);
gst_element_link(tee, queue);
gst_element_link(queue, csp2);
gst_element_link(csp2, fakesink);

 /* now connect the video source to the desired widget */
g_signal_connect(screen, expose-event, G_CALLBACK(expose), sink);


 /* set current pipeline state to PLAY */
gst_element_set_state(pipeline, GST_STATE_PLAYING);


gtk_widget_show(window);

 /* entering main loop */
 gtk_main ();

 /* stop the pipeline */
gst_element_set_state(pipeline, GST_STATE_NULL);
 /* frees the pipeline */
gst_object_unref(pipeline);

 return 0;
 }


 static gboolean expose
   ( GtkWidget * widget, GdkEventExpose * event, gpointer data )
 {

 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),
  GDK_WINDOW_XWINDOW(widget-window));
 return FALSE;
 }


 
 This message was sent using