GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 8:46 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Event for 'gtk_widget_show_all' is done
PostPosted: Mon Dec 10, 2012 6:00 pm 
Offline

Joined: Mon Dec 10, 2012 12:44 pm
Posts: 2
Hi,

I've a problem to recognize the situation, gtk_widget_show_all has done the work.
I try to push some information’s in addition, after all windows are opened.
I think the best way is to get an event back and use the g_signal_connect function from GTK, but haven’t found any event if gtk_widget_show_all has done the work.
I’m using GTK+2.x from Ubuntu 12.04.
I’ve tried to use the ‘expose-event’, but this will generated to early.

Any indea?
Bernhard


Top
 Profile  
 
 Post subject: Re: Event for 'gtk_widget_show_all' is done
PostPosted: Tue Dec 11, 2012 5:18 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
What information could you possibly be after after all the widgets have been displayed but before the user has had a chance to supply any input?
All I can think of is the dimensions of all your widgets that the display manager has determined and these can be easily accessed through the gtk/gdk API.

It's very hard to tell what you want from what you have written. I think you have followed a certain mindset for program design in approaching your problem, have gotten stuck and are now asking the question "how do I..." from where you currently are at. Trouble is none of us know where you are, what line of reasoning you have followed to get there and also what it is that you want isn't presented too clearly either. Please step back a bit, give us some background of your bigger picture and what you want in broad terms, before giving as much detail and information about the specific problems you are facing. This will help us diagnose whether the problem is just what you are currently trying to do or if it could be fixed by changing your approach in design.

Events are either from user input or changes to the display state. Another option is to have a g_idle_add or g_timeout_add function. Gtk operates on a queue system so as long as you call gtk_widget_show_all before and at a equal or higher priority than your other gtk functions than the latter functions will be executed after show_all is processed. You can also do your signal connection as g_signal_connect_after.


Top
 Profile  
 
 Post subject: Re: Event for 'gtk_widget_show_all' is done
PostPosted: Wed Dec 12, 2012 3:35 pm 
Offline

Joined: Mon Dec 10, 2012 12:44 pm
Posts: 2
Hi Paul,

understand and thanks for your answer.
My program generates a full screen video using gstreamer. I want to generate an additional info screen after the vidoe screen is shown. But the problem is, if I generate this screen to early, the program crash (memory protection). If I try to use g_timeout_add, I think it's not the best way (because of slower or faster CPU on different systems). I thought that the best way could be to recognize the end of the gtk_widget_show_all process. A other way could be to recognize the IS_PLAYING status of gstreamer.


Top
 Profile  
 
 Post subject: Re: Event for 'gtk_widget_show_all' is done
PostPosted: Wed Dec 12, 2012 10:21 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I take it the info you are talking about is concerning the video. You should not get a crash based on not having shown all the widgets. Whether they are shown or not they are still in memory as a full fledged GObject. I imagine you would get a crash if you try to retrieve information about a video that hasn't been loaded into memory yet. So yes you would be best to do this primarily through gstreamer. You can still generate your bare info screen first, but fill the fields in when you have this information. Use the bus of your pipeline to set up signals, e.g.:
Code:
bus=gst_pipeline_get_bus(GST_PIPELINE(pipeline));
gst_bus_add_signal_watch(bus);
g_signal_connect(bus, "message::state_changed", G_CALLBACK (cb_state_change), NULL);

or scan for tags (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-metadata.html).

g_timeout_add works fine and is quite normal for keeping track of a running process, e.g. the time currently into the stream, and doesn't have to be done too regularly (200ms will update fast enough for most timing purposes). CPUs for the last two decades have been able to handle such time-sharing functions with ease. I even have a little credit card sized computer that can handle blu-ray playback.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group