summaryrefslogtreecommitdiff
path: root/src/mi.vala
blob: 12400c49c3474c8a93a702f7598d73c311c5a3df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* GStreamer media browser
 * Copyright (C) 2010 Stefan Kost <ensonic@user.sf.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Steet,
 * Boston, MA 02110-1301, USA.
 */

using MediaInfo;
using GLib;

bool version;
const OptionEntry[] options = {
{ "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
  { null }
};

int
main(string[] args)
{
    
  Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
  Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
  Intl.textdomain (Config.GETTEXT_PACKAGE);

  OptionContext opt_context = new OptionContext (_("<directory>"));
  opt_context.set_help_enabled (true);
  opt_context.add_main_entries (options, null);
  opt_context.add_group (Gst.init_get_option_group ());
  opt_context.add_group (Gtk.get_option_group (true));
  try {
    opt_context.parse (ref args);
  } catch (Error e) {
    stdout.printf ("%s", opt_context.get_help(true, null));
    return (0);  
  }

  if (version) {
	  stdout.printf ("%s\n", Config.PACKAGE_STRING);
    return (0);
  }

  // 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 ();

  return (0);
}