[cheese] Initial vala build
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Initial vala build
- Date: Sun, 30 May 2010 18:59:58 +0000 (UTC)
commit fd50f4b87c39e7b8005034042408818d0ad8c9f8
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Thu May 27 15:16:02 2010 +0530
Initial vala build
Makefile.am | 2 +-
configure.ac | 2 +-
valasrc/Makefile.am | 34 +++++++++++++++++++++++++++++++
valasrc/cheese.vala | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e5af844..da49445 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = libcheese src tests po data help docs
+SUBDIRS = libcheese valasrc tests po data help docs
EXTRA_DIST = \
$(cheesedoc_DATA) \
diff --git a/configure.ac b/configure.ac
index 80f283e..8badc20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,7 +184,7 @@ data/icons/scalable/actions/Makefile
data/pixmaps/Makefile
help/Makefile
libcheese/Makefile
-src/Makefile
+valasrc/Makefile
tests/Makefile
po/Makefile.in
])
diff --git a/valasrc/Makefile.am b/valasrc/Makefile.am
new file mode 100644
index 0000000..ac5280c
--- /dev/null
+++ b/valasrc/Makefile.am
@@ -0,0 +1,34 @@
+VALA_CFLAGS = \
+ --thread \
+ --vapidir vapi \
+ --pkg config \
+ --pkg gtk+-2.0
+
+AM_CPPFLAGS = \
+ -DBINDIR=\"$(bindir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ -DPACKAGE_DATADIR=\""$(datadir)/cheese"\" \
+ -DPACKAGE_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(CHEESE_CFLAGS) \
+ -include $(CONFIG_HEADER)
+
+BUILT_SOURCES = cheese.vala.stamp
+
+bin_PROGRAMS = cheese
+
+cheese_VALASOURCES = \
+ cheese.vala
+
+cheese_SOURCES = \
+ $(cheese_VALASOURCES:.vala=.c) \
+ $(cheese_VALASOURCES:.vala=.h)
+
+cheese.vala.stamp: $(cheese_VALASOURCES)
+ $(VALAC) -C $(VALA_CFLAGS) $^
+ touch $@
+
+cheese_LDADD = \
+ $(CHEESE_LIBS)
diff --git a/valasrc/cheese.vala b/valasrc/cheese.vala
new file mode 100644
index 0000000..f3e7fed
--- /dev/null
+++ b/valasrc/cheese.vala
@@ -0,0 +1,55 @@
+using GLib, Gtk;
+
+public class Cheese.Cheese {
+ static bool verbose;
+ static bool wide;
+ static bool version_only;
+ static FileStream log_file;
+
+ const OptionEntry[] options = {
+ { "verbose", 'v', 0, OptionArg.NONE, ref verbose, N_("Be verbose"), null},
+ { "wide", 'w', 0, OptionArg.NONE, ref wide, N_("Enable wide mode"), null},
+ { "version", 0, 0, OptionArg.NONE, ref version_only, N_("Output version information and exit"), null},
+ { null }
+ };
+
+ static void print_handler (string text) {
+ log_file.puts (text);
+ if (verbose) {
+ stdout.puts (text);
+ }
+ }
+
+ public static int main (string[] args) {
+
+ Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.PACKAGE_LOCALEDIR);
+ Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
+ Intl.textdomain (Config.GETTEXT_PACKAGE);
+
+ Gtk.init(ref args);
+
+ try {
+ var context = new OptionContext (_("- Take photos and videos from your webcam"));
+ context.set_help_enabled (true);
+ context.add_main_entries (options, null);
+ context.add_group (Gtk.get_option_group (true));
+ context.parse (ref args);
+ } catch (OptionError e) {
+ stdout.printf ("%s\n", e.message);
+ stdout.printf (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
+ return 1;
+ }
+
+ Environment.set_application_name (_("Cheese"));
+ Window.set_default_icon_name ("cheese");
+
+ string log_file_dir = Path.build_filename (Environment.get_home_dir(), ".config", "cheese");
+ DirUtils.create_with_parents (log_file_dir, 0775);
+ log_file = FileStream.open (Path.build_filename (log_file_dir, "cheese.log"), "w");
+ set_print_handler (print_handler);
+
+ Gtk.main ();
+
+ return 0;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]