mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
app: use a hpane instead of the file-chooser preview widget
This allows the user to modify the size.
This commit is contained in:
parent
869499423c
commit
2855b1f24f
1 changed files with 13 additions and 10 deletions
|
@ -29,25 +29,28 @@ public class MediaInfo.App : Window
|
||||||
{
|
{
|
||||||
// configure the window
|
// configure the window
|
||||||
set_title (_("GStreamer Media Info"));
|
set_title (_("GStreamer Media Info"));
|
||||||
set_default_size (400, 300);
|
set_default_size (500, 350);
|
||||||
destroy.connect (Gtk.main_quit);
|
destroy.connect (Gtk.main_quit);
|
||||||
|
|
||||||
VBox vbox = new VBox(false, 0);
|
VBox vbox = new VBox( false, 0);
|
||||||
add (vbox);
|
add (vbox);
|
||||||
|
|
||||||
// add a menubar
|
// add a menubar
|
||||||
vbox.pack_start (create_menu(), false, false, 0);
|
vbox.pack_start (create_menu(), false, false, 0);
|
||||||
|
|
||||||
|
HPaned paned = new HPaned ();
|
||||||
|
vbox.pack_start (paned, true, true, 3);
|
||||||
|
|
||||||
// add a file-chooser with info pane as preview widget
|
// add a file-chooser with info pane as preview widget
|
||||||
chooser = new FileChooserWidget (FileChooserAction.OPEN);
|
chooser = new FileChooserWidget (FileChooserAction.OPEN);
|
||||||
vbox.pack_start (chooser, true, true, 3);
|
paned.pack1 (chooser, true, true);
|
||||||
|
|
||||||
info = new Info ();
|
|
||||||
chooser.set_preview_widget (info);
|
|
||||||
chooser.set_use_preview_label (false);
|
|
||||||
chooser.set_current_folder (GLib.Environment.get_home_dir ());
|
chooser.set_current_folder (GLib.Environment.get_home_dir ());
|
||||||
chooser.set_show_hidden (false);
|
chooser.set_show_hidden (false);
|
||||||
chooser.update_preview.connect (on_update_preview);
|
chooser.selection_changed.connect (on_update_preview);
|
||||||
|
|
||||||
|
info = new Info ();
|
||||||
|
paned.pack2 (info, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper
|
// helper
|
||||||
|
@ -79,11 +82,11 @@ public class MediaInfo.App : Window
|
||||||
|
|
||||||
private void on_update_preview ()
|
private void on_update_preview ()
|
||||||
{
|
{
|
||||||
File file = chooser.get_preview_file();
|
File file = chooser.get_file();
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (file.query_file_type (FileQueryInfoFlags.NONE, null) == FileType.REGULAR) {
|
if (file != null && file.query_file_type (FileQueryInfoFlags.NONE, null) == FileType.REGULAR) {
|
||||||
res = info.discover (chooser.get_preview_uri());
|
res = info.discover (chooser.get_uri());
|
||||||
}
|
}
|
||||||
chooser.set_preview_widget_active (res);
|
chooser.set_preview_widget_active (res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue