{
private FileChooserWidget chooser;
private Info info;
+ private string directory = null;
+ private string uri = null;
public App (string? directory_or_uri) {
GLib.Object (type : WindowType.TOPLEVEL);
- string directory = null;
- string uri = null;
if (directory_or_uri != null) {
if (FileUtils.test (directory_or_uri, FileTest.IS_DIR)) {
directory = directory_or_uri;
paned.pack1 (chooser, false, false);
chooser.set_show_hidden (false);
+
+ info = new Info ();
+ paned.pack2 (info, true, true);
- if (uri != null) {
- chooser.set_sensitive (false);
- Idle.add ( () => {
+ realize.connect ( () => {
+ debug ("realized");
+ if (uri != null) {
+ chooser.set_sensitive (false);
info.discover (uri);
- return false;
- });
- } else {
- if (directory != null) {
- //chooser.set_current_folder (GLib.Environment.get_home_dir ());
- Idle.add ( () => {
+ } else {
+ if (directory != null) {
+ //chooser.set_current_folder (GLib.Environment.get_home_dir ());
chooser.set_current_folder (directory);
- return false;
- });
+ }
+ chooser.selection_changed.connect (on_update_preview);
}
- chooser.selection_changed.connect (on_update_preview);
- }
-
- info = new Info ();
- paned.pack2 (info, true, true);
+ });
}
// helper
// gstreamer objects
private Discoverer dc;
private Pipeline pb;
+ private Video.Overlay overlay;
private bool have_video = false;
private uint num_video_streams;
private uint num_audio_streams;
// add widgets
preview = new Preview ();
+ preview.add_events (Gdk.EventMask.STRUCTURE_MASK);
+ preview.configure_event.connect (on_preview_configured);
pack_start (preview, false, false, 0);
info_area = new ScrolledWindow (null, null);
// TODO: add message list widget
- show_all ();
-
// set up the gstreamer components
try {
dc = new Discoverer ((ClockTime)(Gst.SECOND * 10));
}
// signal handlers
+
+ private bool on_preview_configured (Gdk.EventConfigure event) {
+ if (overlay != null)
+ overlay.expose();
+ return false;
+ }
private void on_element_sync_message (Gst.Bus bus, Message message) {
if (Gst.Video.is_video_overlay_prepare_window_handle_message (message)) {
- Gst.Video.Overlay overlay = message.src as Gst.Video.Overlay;
+ overlay = message.src as Gst.Video.Overlay;
overlay.set_window_handle ((uint *)Gdk.X11Window.get_xid (preview.get_window ()));
}
}
public override void size_allocate (Gtk.Allocation alloc) {
base.size_allocate (alloc);
-
+
alloc_width = alloc.width;
alloc_height = alloc.height;
- debug ("alloc w,h: %d,%d", alloc_width, alloc_height);
+ debug ("alloc x,y: %d,%d w,h: %d,%d",
+ alloc.x, alloc.y, alloc_width, alloc_height);
}
public override bool draw (Cairo.Context cr) {