summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/Makefile.am44
-rw-r--r--src/ui/main.vala24
2 files changed, 59 insertions, 9 deletions
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index e66cfe6..623b66d 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -32,19 +32,59 @@ libexec_PROGRAMS += %reldir%/disfluid-gui
AM_VALAFLAGS += --pkg=gio-2.0
-%canon_reldir%_disfluid_gui_SOURCES = \
+%canon_reldir%_disfluid_gui_VALASOURCES = \
%reldir%/main.vala \
%reldir%/settings.vala
+%canon_reldir%_disfluid_gui_SOURCES = \
+ $(%canon_reldir%_disfluid_gui_VALASOURCES:.vala=.c)
+
%canon_reldir%_disfluid_gui_CFLAGS = \
$(AM_CFLAGS) \
$(GLIB_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(GIO_CFLAGS) \
- -include config.h
+ -DGETTEXT_PACKAGE=PACKAGE
%canon_reldir%_disfluid_gui_LDADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GIO_LIBS) \
$(lib_LTLIBRARIES)
+
+EXTRA_DIST += \
+ $(%canon_reldir%_disfluid_gui_VALASOURCES) \
+ %reldir%/disfluid-gui-valasources.stamp
+
+$(srcdir)/%reldir%/disfluid-gui-valasources.stamp: $(%canon_reldir%_disfluid_gui_VALASOURCES) $(dist_vapi_DATA)
+ $(AM_V_at)rm -f $@ && echo stamp > $@-t
+ $(AM_V_VALAC)$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS) -C $^
+ $(AM_V_at)for source in $^; do case $$source in *.vala) generated=$$(echo "$$source" | sed 's/\.vala$$/.c/'); (echo '#ifdef HAVE_CONFIG_H' ; echo '#include <config.h>' echo '#endif' ; cat $$generated) > $$generated-t ; mv $$generated-t $$generated ;; esac done
+ $(AM_V_at)mv -f $@-t $@
+
+## This rule is adapted from the Automake FAQ:
+$(%canon_reldir%_disfluid_gui_VALASOURCES:.vala=.c): %reldir%/disfluid-gui-valasources.stamp
+## Recover from the removal of $(srcdir)/$@
+ @dry=; for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=*|--*);; \
+ *n*) dry=:;; \
+ esac; \
+ done; \
+ if test -f $(srcdir)/$@; then :; else \
+ $$dry trap 'rm -rf $(srcdir)/%reldir%/disfluid-gui-valasources.lock $<' 1 2 13 15; \
+ if $$dry mkdir $(srcdir)/%reldir%/disfluid-gui-valasources.lock 2>/dev/null; then \
+## This code is being executed by the first process.
+ $$dry rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ $$dry rmdir $(srcdir)/%reldir%/disfluid-gui-valasources.lock; \
+ else \
+## This code is being executed by the follower processes.
+## Wait until the first process is done.
+ while test -d $(srcdir)/%reldir%/disfluid-gui-valasources.lock && test -z "$$dry"; do \
+ sleep 1; \
+ done; \
+## Succeed if and only if the first process succeeded.
+ $$dry test -f $<; exit $$?; \
+ fi; \
+ fi
diff --git a/src/ui/main.vala b/src/ui/main.vala
index a0acd6d..82dc9d1 100644
--- a/src/ui/main.vala
+++ b/src/ui/main.vala
@@ -14,18 +14,28 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
+[CCode (cname="PACKAGE")]
+extern const string PACKAGE;
+
+[CCode (cname="LOCALEDIR")]
+extern const string LOCALEDIR;
+
namespace Disfluid {
class Main: GLib.Object {
public static int main (string[] args) {
+ GLib.Intl.setlocale (GLib.LocaleCategory.ALL, "");
+ GLib.Intl.bindtextdomain (PACKAGE, LOCALEDIR);
+ GLib.Intl.textdomain (PACKAGE);
int return_code = 1;
Disfluid.Api.init ((api) => {
- var settings = new Disfluid.Settings (api);
- foreach (var arg in args) {
- stdout.printf ("%s\n", arg);
- }
- return_code = 0;
- return null;
- });
+ var settings = new Disfluid.Settings (api);
+ stdout.printf (_ ("Hello, world!\n"));
+ foreach (var arg in args) {
+ stdout.printf ("%s\n", arg);
+ }
+ return_code = 0;
+ return null;
+ });
return return_code;
}
}