summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-11-04 09:48:55 +0200
committerStefan Kost <ensonic@users.sf.net>2010-11-04 09:48:55 +0200
commit8aea420d8453d7c0107fb59fb88f5bf35d72390d (patch)
tree592e83caa57d0f61f445974d11dd95af7a50cb0e
parentacbab4d3a4be127a027db96a1cef16538bca055a (diff)
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.
-rw-r--r--src/mi-app.vala12
-rw-r--r--src/mi.vala8
2 files changed, 17 insertions, 3 deletions
diff --git a/src/mi-app.vala b/src/mi-app.vala
index 1522113..4bb9f1c 100644
--- a/src/mi-app.vala
+++ b/src/mi-app.vala
@@ -25,8 +25,13 @@ public class MediaInfo.App : Window
private FileChooserWidget chooser;
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
set_title (_("GStreamer Media Info"));
set_default_size (500, 350);
@@ -45,7 +50,10 @@ public class MediaInfo.App : Window
chooser = new FileChooserWidget (FileChooserAction.OPEN);
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.selection_changed.connect (on_update_preview);
diff --git a/src/mi.vala b/src/mi.vala
index 12f0645..12400c4 100644
--- a/src/mi.vala
+++ b/src/mi.vala
@@ -51,7 +51,13 @@ main(string[] args)
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 ();
Gtk.main ();