diff --git a/.gitignore b/.gitignore index 949ecaf..5315878 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,14 @@ autom4te.cache compile config.* configure +data/spek.desktop +data/spek.desktop.in depcomp .deps install-sh +intltool-extract.in +intltool-merge.in +intltool-update.in libtool ltmain.sh Makefile @@ -15,9 +20,12 @@ Makefile.in.in missing mkinstalldirs omf.make +po/.intltool-merge-cache po/POTFILES po/stamp-it +src/*.c src/*.o +src/*.stamp src/spek stamp-h1 xmldocs.make diff --git a/Makefile.am b/Makefile.am index 97f444d..0ae2edb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,17 @@ -SUBDIRS = src po +# Makefile.am + +SUBDIRS = \ + data \ + src \ + vapi \ + po EXTRA_DIST = \ - HACKING - autogen.sh + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in -CLEANFILES = *~ \ No newline at end of file +DISTCLEANFILES = \ + intltool-extract \ + intltool-merge \ + intltool-update diff --git a/autogen.sh b/autogen.sh index 5fe2f77..e240e9f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,7 +7,7 @@ test -z "$srcdir" && srcdir=. PKG_NAME="spek" REQUIRED_AUTOMAKE_VERSION=1.7 -(test -f $srcdir/configure.ac \ +(test -f $srcdir/src/spek.vala \ && test -d $srcdir/src) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level spek directory" @@ -18,4 +18,4 @@ which gnome-autogen.sh || { echo "You need to install gnome-common from the GNOME Git" exit 1 } -USE_GNOME2_MACROS=1 . gnome-autogen.sh +. gnome-autogen.sh diff --git a/configure.ac b/configure.ac index eaeefc0..82b57d1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,27 +1,49 @@ -AC_INIT(spek, 0.1) -AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) +# configure.ac + +AC_INIT([spek], [0.1]) +AC_CONFIG_SRCDIR([src/spek.vala]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2]) + +# Enable silent rules is available +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + AM_MAINTAINER_MODE AC_PROG_CC -AM_PROG_CC_C_O +AC_PROG_CC_STDC +AM_PROG_VALAC([0.7.0]) AC_PROG_INSTALL -AC_PROG_LIBTOOL +AC_PROG_INTLTOOL([0.35]) + +pkg_modules="gtk+-2.0 >= 2.14.0" +SPEK_PACKAGES="--pkg gtk+-2.0" +PKG_CHECK_MODULES(SPEK, [$pkg_modules]) +AC_SUBST(SPEK_CFLAGS) +AC_SUBST(SPEK_LIBS) +AC_SUBST(SPEK_PACKAGES) -dnl *************************************************************************** -dnl Internatinalization -dnl *************************************************************************** GETTEXT_PACKAGE=spek +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package]) AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name]) AM_GLIB_GNU_GETTEXT -IT_PROG_INTLTOOL([0.35.0]) -AM_PATH_GTK_2_0([2.10.0],,AC_MSG_ERROR([Gtk+ 2.10.0 or higher required.])) +AM_GLIB_GNU_GETTEXT -AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ - Makefile - src/Makefile - po/Makefile.in + Makefile + data/spek.desktop.in + data/Makefile + data/icons/Makefile + data/icons/16x16/Makefile + data/icons/22x22/Makefile + data/icons/24x24/Makefile + data/icons/32x32/Makefile + data/icons/48x48/Makefile + data/icons/scalable/Makefile + po/Makefile.in + src/Makefile + vapi/Makefile ]) AC_OUTPUT \ No newline at end of file diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..cdd7212 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +SUBDIRS = icons + +desktopdir = $(datadir)/applications +desktop_in_files = spek.desktop.in +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ + +EXTRA_DIST = \ + $(desktop_in_files) + +CLEANFILES = \ + $(desktop_DATA) diff --git a/data/icons/16x16/Makefile.am b/data/icons/16x16/Makefile.am new file mode 100644 index 0000000..354cc24 --- /dev/null +++ b/data/icons/16x16/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = 16x16 +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.png + +EXTRA_DIST = \ + $(icons_DATA) + diff --git a/data/icons/16x16/spek.png b/data/icons/16x16/spek.png new file mode 100644 index 0000000..07f2097 Binary files /dev/null and b/data/icons/16x16/spek.png differ diff --git a/data/icons/22x22/Makefile.am b/data/icons/22x22/Makefile.am new file mode 100644 index 0000000..83aa2d6 --- /dev/null +++ b/data/icons/22x22/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = 22x22 +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.png + +EXTRA_DIST = \ + $(icons_DATA) + diff --git a/data/icons/22x22/spek.png b/data/icons/22x22/spek.png new file mode 100644 index 0000000..8ed11ff Binary files /dev/null and b/data/icons/22x22/spek.png differ diff --git a/data/icons/24x24/Makefile.am b/data/icons/24x24/Makefile.am new file mode 100644 index 0000000..92768a4 --- /dev/null +++ b/data/icons/24x24/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = 24x24 +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.png + +EXTRA_DIST = \ + $(icons_DATA) + diff --git a/data/icons/24x24/spek.png b/data/icons/24x24/spek.png new file mode 100644 index 0000000..1cf92eb Binary files /dev/null and b/data/icons/24x24/spek.png differ diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am new file mode 100644 index 0000000..b9c65d2 --- /dev/null +++ b/data/icons/32x32/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = 32x32 +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.png + +EXTRA_DIST = \ + $(icons_DATA) + diff --git a/data/icons/32x32/spek.png b/data/icons/32x32/spek.png new file mode 100644 index 0000000..91c32da Binary files /dev/null and b/data/icons/32x32/spek.png differ diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am new file mode 100644 index 0000000..7d45e92 --- /dev/null +++ b/data/icons/48x48/Makefile.am @@ -0,0 +1,14 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = 48x48 +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.png + +EXTRA_DIST = \ + $(icons_DATA) + diff --git a/data/icons/48x48/spek.png b/data/icons/48x48/spek.png new file mode 100644 index 0000000..e1b996a Binary files /dev/null and b/data/icons/48x48/spek.png differ diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am new file mode 100644 index 0000000..9c9b160 --- /dev/null +++ b/data/icons/Makefile.am @@ -0,0 +1,16 @@ +# Makefile.am + +SUBDIRS = 16x16 22x22 24x24 32x32 48x48 scalable + +gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor + +install-data-hook: update-icon-cache +uninstall-hook: update-icon-cache +update-icon-cache: + @-if test -z "$(DESTDIR)"; then \ + echo "Updating GTK+ icon cache."; \ + $(gtk_update_icon_cache); \ + else \ + echo "*** Icon cache not updated. After (un)install, run this:"; \ + echo "*** $(gtk_update_icon_cache)"; \ + fi diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am new file mode 100644 index 0000000..7ed0d8c --- /dev/null +++ b/data/icons/scalable/Makefile.am @@ -0,0 +1,13 @@ +# Makefile.am + +themedir = $(datadir)/icons/hicolor +size = scalable +context = apps + +iconsdir = $(themedir)/$(size)/$(context) + +icons_DATA = \ + spek.svg + +EXTRA_DIST = \ + $(icons_DATA) diff --git a/data/icons/scalable/spek.svg b/data/icons/scalable/spek.svg new file mode 100644 index 0000000..a38768c --- /dev/null +++ b/data/icons/scalable/spek.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + Vala + + diff --git a/data/spek.desktop.in.in b/data/spek.desktop.in.in new file mode 100644 index 0000000..f9f1b90 --- /dev/null +++ b/data/spek.desktop.in.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Version=1.0 +_Name=Spek +_GenericName=Spectrogram Viewer +_Comment=Spectrogram viewer +Exec=sampala +Icon=sampala +Terminal=false +Categories=Audio +StartupNotify=true diff --git a/po/POTFILES.in b/po/POTFILES.in index a0b3c55..0b642a9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,3 +1,3 @@ -# List of source files containing translatable strings. - -src/main.c +[encoding: UTF-8] +data/spek.desktop.in.in +src/spek.vala diff --git a/po/POTFILES.skip b/po/POTFILES.skip new file mode 100644 index 0000000..dbe2d10 --- /dev/null +++ b/po/POTFILES.skip @@ -0,0 +1 @@ +data/spek.desktop.in diff --git a/src/Makefile.am b/src/Makefile.am index 6ef0d91..f8bbf00 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,18 @@ bin_PROGRAMS = spek spek_SOURCES = \ - main.c + spek.vala -spek_CPPFLAGS = @GTK_CFLAGS@ -spek_LDADD = @GTK_LIBS@ +INCLUDES = \ + -include config.h \ + $(SPEK_CFLAGS) \ + -DLOCALEDIR=\""$(localedir)"\" \ + -DPKGDATADIR=\""$(pkgdatadir)"\" \ + -DPKGLIBDIR=\""$(pkglibdir)"\" -CLEANFILES = *~ +VALAFLAGS = \ + --vapidir=$(srcdir)/../vapi --pkg config \ + @SPEK_PACKAGES@ + +spek_LDADD = \ + $(SPEK_LIBS) diff --git a/src/main.c b/src/main.c deleted file mode 100644 index b0bc002..0000000 --- a/src/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -gint -main (gint argc, gchar *argv[]) -{ - GtkWidget *window = NULL; - gtk_init (&argc, &argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_size_request (window, 400, 300); - gtk_container_set_border_width (GTK_CONTAINER (window), 10); - g_signal_connect (G_OBJECT (window), "delete_event", - G_CALLBACK (gtk_main_quit), NULL); - gtk_widget_show (window); - gtk_main (); - return 0; -} diff --git a/src/spek.vala b/src/spek.vala new file mode 100644 index 0000000..4ae1495 --- /dev/null +++ b/src/spek.vala @@ -0,0 +1,19 @@ +public class Main { + public static 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 ); + + Gtk.init (ref args); + + var window = new Gtk.Window (Gtk.WindowType.TOPLEVEL); + window.set_default_size (300, 200); + window.destroy += Gtk.main_quit; + window.add (new Gtk.Label ("Hello World!")); + window.show_all (); + + Gtk.main (); + return 0; + } +} + diff --git a/vapi/Makefile.am b/vapi/Makefile.am new file mode 100644 index 0000000..29cd822 --- /dev/null +++ b/vapi/Makefile.am @@ -0,0 +1,5 @@ +noinst_DATA = \ + config.vapi + +EXTRA_DIST = \ + $(noinst_DATA) diff --git a/vapi/config.vapi b/vapi/config.vapi new file mode 100644 index 0000000..99e42c3 --- /dev/null +++ b/vapi/config.vapi @@ -0,0 +1,17 @@ +[CCode (prefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] +namespace Config +{ + /* Package information */ + public const string PACKAGE_NAME; + public const string PACKAGE_STRING; + public const string PACKAGE_VERSION; + + /* Gettext package */ + public const string GETTEXT_PACKAGE; + + /* Configured paths - these variables are not present in config.h, they are + * passed to underlying C code as cmd line macros. */ + public const string LOCALEDIR; /* /usr/local/share/locale */ + public const string PKGDATADIR; /* /usr/local/share/sampala */ + public const string PKGLIBDIR; /* /usr/local/lib/sampala */ +}