mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
app: add directory property and use it as default location for browsing
Allow passing a directory as a commandline arg. If given use that as the default location, otherwise use current working dir.
This commit is contained in:
parent
03f32a222c
commit
d3a0351bd2
2 changed files with 17 additions and 3 deletions
|
@ -25,8 +25,13 @@ public class MediaInfo.App : Window
|
||||||
private FileChooserWidget chooser;
|
private FileChooserWidget chooser;
|
||||||
private Info info;
|
private Info info;
|
||||||
|
|
||||||
public App()
|
public string directory { get; set; }
|
||||||
|
|
||||||
|
public App(string? directory)
|
||||||
{
|
{
|
||||||
|
GLib.Object (type : WindowType.TOPLEVEL);
|
||||||
|
this.directory = directory;
|
||||||
|
|
||||||
// configure the window
|
// configure the window
|
||||||
set_title (_("GStreamer Media Info"));
|
set_title (_("GStreamer Media Info"));
|
||||||
set_default_size (500, 350);
|
set_default_size (500, 350);
|
||||||
|
@ -45,7 +50,10 @@ public class MediaInfo.App : Window
|
||||||
chooser = new FileChooserWidget (FileChooserAction.OPEN);
|
chooser = new FileChooserWidget (FileChooserAction.OPEN);
|
||||||
paned.pack1 (chooser, true, true);
|
paned.pack1 (chooser, true, true);
|
||||||
|
|
||||||
chooser.set_current_folder (GLib.Environment.get_home_dir ());
|
if (directory != null) {
|
||||||
|
//chooser.set_current_folder (GLib.Environment.get_home_dir ());
|
||||||
|
chooser.set_current_folder (directory);
|
||||||
|
}
|
||||||
chooser.set_show_hidden (false);
|
chooser.set_show_hidden (false);
|
||||||
chooser.selection_changed.connect (on_update_preview);
|
chooser.selection_changed.connect (on_update_preview);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,13 @@ main(string[] args)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
App app = new App ();
|
// take remaining arg and use as default dir
|
||||||
|
string directory = null;
|
||||||
|
if (args.length > 1) {
|
||||||
|
directory=args[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
App app = new App (directory);
|
||||||
app.show_all ();
|
app.show_all ();
|
||||||
|
|
||||||
Gtk.main ();
|
Gtk.main ();
|
||||||
|
|
Loading…
Reference in a new issue