├── .gitignore
├── data
├── buildsystems
│ ├── autotools
│ │ ├── buildsystem
│ │ │ ├── AUTHORS
│ │ │ ├── COPYING
│ │ │ ├── NEWS
│ │ │ ├── ChangeLog
│ │ │ ├── README
│ │ │ └── autogen.sh
│ │ └── autotools.info
│ └── cmake
│ │ ├── cmake.info
│ │ └── buildsystem
│ │ ├── cmake
│ │ ├── GlibCompileSchema.cmake.in
│ │ ├── GlibCompileSchema_verify.cmake.in
│ │ ├── vala
│ │ │ ├── FindValadoc.cmake
│ │ │ ├── ValaDocs.cmake
│ │ │ └── FindVala.cmake
│ │ ├── FindIntltool.cmake
│ │ └── SimpleUninstall.cmake
│ │ └── CMakeLists.txt
├── templates
│ ├── plain_lib
│ │ ├── plain_lib.png
│ │ ├── template
│ │ │ ├── src
│ │ │ │ └── lib.vala
│ │ │ └── template.vlp
│ │ └── plain_lib.info
│ ├── elementary
│ │ ├── elementary.png
│ │ ├── template
│ │ │ ├── data
│ │ │ │ ├── 48
│ │ │ │ │ └── hello.png
│ │ │ │ └── hello.desktop
│ │ │ ├── vapi
│ │ │ │ └── config.vapi
│ │ │ ├── template.vlp
│ │ │ └── src
│ │ │ │ └── main.vala
│ │ └── elementary.info
│ ├── plain_vala
│ │ ├── plain_vala.png
│ │ ├── template
│ │ │ ├── src
│ │ │ │ └── main.vala
│ │ │ ├── vapi
│ │ │ │ └── config.vapi
│ │ │ └── template.vlp
│ │ └── plain_vala.info
│ ├── clutter
│ │ ├── template
│ │ │ ├── vapi
│ │ │ │ └── config.vapi
│ │ │ ├── template.vlp
│ │ │ └── src
│ │ │ │ └── main.vala
│ │ └── clutter.info
│ ├── simple_gtk
│ │ ├── template
│ │ │ ├── vapi
│ │ │ │ └── config.vapi
│ │ │ ├── template.vlp
│ │ │ └── src
│ │ │ │ └── main.vala
│ │ └── simple_gtk.info
│ ├── simple_gst_audio
│ │ ├── template
│ │ │ ├── vapi
│ │ │ │ └── config.vapi
│ │ │ ├── src
│ │ │ │ └── main.vala
│ │ │ └── template.vlp
│ │ └── simple_gst_audio.info
│ └── simple_gst_video
│ │ ├── template
│ │ ├── vapi
│ │ │ └── config.vapi
│ │ ├── template.vlp
│ │ └── src
│ │ │ └── main.vala
│ │ └── simple_gst_video.info
├── valama.desktop.in
├── valama.xml
├── org.valama.gschema.xml
├── layout.xml
└── valama.1.in
├── guanako
├── guanako.deps.in
├── guanako.pc.in
├── config.vapi
├── guanako_auto_indent.vala
├── guanako_vapi_discoverer.vala
├── guanako_refactoring.vala
├── data
│ └── guanako.lang
└── reporter.vala
├── vapi
├── gladeui-2.0.deps
└── config.vapi
├── extravapi
├── gdl-3.0
│ └── gdl-3.0.deps
├── webkit2gtk-3.0
│ └── webkit2gtk-3.0.deps
├── gtk+-3.0
│ └── gtk+-3.0.deps
└── gtksourceview-3.0
│ └── gtksourceview-3.0.deps
├── tests
├── projectfile
│ ├── invalid_empty.vlp
│ ├── version_none.vlp
│ ├── pathtest.vlp
│ ├── version_exact.vlp
│ ├── version_high.vlp
│ ├── version_low.vlp
│ └── invalid_garbage.vlp
├── testmain.vala
├── testcompversion.vala
├── testcase.vala
├── CMakeLists.txt
├── testpathsplit.vala
└── testprojectfile.vala
├── AUTHORS
├── pixmaps
├── element-enum-16.png
├── element-class-16.png
├── element-field-16.png
├── element-method-16.png
├── element-signal-16.png
├── element-struct-16.png
├── element-constant-16.png
├── element-delegate-16.png
├── element-interface-16.png
├── element-namespace-16.png
├── element-property-16.png
├── element-enum-public-16.png
├── element-enum_value-16.png
├── element-error_code-16.png
├── element-class-private-16.png
├── element-class-public-16.png
├── element-enum-private-16.png
├── element-error_domain-16.png
├── element-field-private-16.png
├── element-field-public-16.png
├── element-method-private-16.png
├── element-method-public-16.png
├── element-struct-private-16.png
├── element-struct-public-16.png
├── element-constant-private-16.png
├── element-constant-public-16.png
├── element-delegate-private-16.png
├── element-delegate-public-16.png
├── element-interface-public-16.png
├── element-method-protected-16.png
├── element-property-private-16.png
├── element-property-public-16.png
├── element-delegate-protected-16.png
├── element-error_code-private-16.png
├── element-error_code-public-16.png
├── element-error_domain-public-16.png
├── element-interface-private-16.png
├── element-interface-protected-16.png
├── element-property-protected-16.png
└── element-error_domain-private-16.png
├── .tx
└── config
├── cmake
├── guanako.cmake
├── GlibCompileSchema.cmake.in
├── GlibCompileSchema_verify.cmake.in
├── vala
│ ├── FindValadoc.cmake
│ ├── ValaDocs.cmake
│ └── FindVala.cmake
├── FindIntltool.cmake
├── SimpleUninstall.cmake
└── project.cmake
├── .travis.yml
├── src
├── ui
│ ├── widgets
│ │ └── browser_path.vala
│ ├── valadoc_browser.vala
│ ├── disabled
│ │ └── stylechecker.vala
│ ├── welcome_screen
│ │ ├── load_project.vala
│ │ ├── create_project_packages.vala
│ │ ├── create_project_buildsystem.vala
│ │ ├── create_project_location.vala
│ │ └── main_screen.vala
│ ├── app_output.vala
│ ├── glade_viewer.vala
│ ├── build_output.vala
│ └── welcome_screen.vala
├── settings.vala
├── dialogs
│ ├── missing_packages.vala
│ ├── about.vala
│ └── create_file.vala
├── common
│ └── args.vala
└── buildsystem
│ └── plain.vala
├── po
└── CMakeLists.txt
├── icons
├── CMakeLists.txt
└── V4_logo.svg
├── README.md
└── valama.vlp
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/AUTHORS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/COPYING:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/NEWS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/guanako/guanako.deps.in:
--------------------------------------------------------------------------------
1 | @deps_requirements@
2 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/ChangeLog:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/README:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/vapi/gladeui-2.0.deps:
--------------------------------------------------------------------------------
1 | gtk+-3.0
2 | gmodule-2.0
3 |
--------------------------------------------------------------------------------
/extravapi/gdl-3.0/gdl-3.0.deps:
--------------------------------------------------------------------------------
1 | gtk+-3.0
2 | gio-2.0
3 |
--------------------------------------------------------------------------------
/tests/projectfile/invalid_empty.vlp:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/projectfile/version_none.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/extravapi/webkit2gtk-3.0/webkit2gtk-3.0.deps:
--------------------------------------------------------------------------------
1 | gtk+-3.0
2 | libsoup-2.4
3 |
--------------------------------------------------------------------------------
/tests/projectfile/pathtest.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/projectfile/version_exact.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/projectfile/version_high.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/projectfile/version_low.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Linus Seelinger
2 | Dominique Lasserre
3 |
--------------------------------------------------------------------------------
/pixmaps/element-enum-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-enum-16.png
--------------------------------------------------------------------------------
/pixmaps/element-class-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-class-16.png
--------------------------------------------------------------------------------
/pixmaps/element-field-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-field-16.png
--------------------------------------------------------------------------------
/pixmaps/element-method-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-method-16.png
--------------------------------------------------------------------------------
/pixmaps/element-signal-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-signal-16.png
--------------------------------------------------------------------------------
/pixmaps/element-struct-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-struct-16.png
--------------------------------------------------------------------------------
/extravapi/gtk+-3.0/gtk+-3.0.deps:
--------------------------------------------------------------------------------
1 | gio-2.0
2 | atk
3 | cairo
4 | gdk-pixbuf-2.0
5 | gdk-3.0
6 | pango
7 | x11
8 |
--------------------------------------------------------------------------------
/pixmaps/element-constant-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-constant-16.png
--------------------------------------------------------------------------------
/pixmaps/element-delegate-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-delegate-16.png
--------------------------------------------------------------------------------
/pixmaps/element-interface-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-interface-16.png
--------------------------------------------------------------------------------
/pixmaps/element-namespace-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-namespace-16.png
--------------------------------------------------------------------------------
/pixmaps/element-property-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-property-16.png
--------------------------------------------------------------------------------
/pixmaps/element-enum-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-enum-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-enum_value-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-enum_value-16.png
--------------------------------------------------------------------------------
/pixmaps/element-error_code-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_code-16.png
--------------------------------------------------------------------------------
/pixmaps/element-class-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-class-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-class-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-class-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-enum-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-enum-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-error_domain-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_domain-16.png
--------------------------------------------------------------------------------
/pixmaps/element-field-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-field-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-field-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-field-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-method-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-method-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-method-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-method-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-struct-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-struct-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-struct-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-struct-public-16.png
--------------------------------------------------------------------------------
/data/templates/plain_lib/plain_lib.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/data/templates/plain_lib/plain_lib.png
--------------------------------------------------------------------------------
/pixmaps/element-constant-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-constant-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-constant-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-constant-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-delegate-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-delegate-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-delegate-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-delegate-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-interface-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-interface-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-method-protected-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-method-protected-16.png
--------------------------------------------------------------------------------
/pixmaps/element-property-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-property-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-property-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-property-public-16.png
--------------------------------------------------------------------------------
/data/buildsystems/autotools/buildsystem/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -ex
3 |
4 | autoreconf -f -i -Wall,error
5 | ./configure
6 |
--------------------------------------------------------------------------------
/data/templates/elementary/elementary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/data/templates/elementary/elementary.png
--------------------------------------------------------------------------------
/data/templates/plain_vala/plain_vala.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/data/templates/plain_vala/plain_vala.png
--------------------------------------------------------------------------------
/pixmaps/element-delegate-protected-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-delegate-protected-16.png
--------------------------------------------------------------------------------
/pixmaps/element-error_code-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_code-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-error_code-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_code-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-error_domain-public-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_domain-public-16.png
--------------------------------------------------------------------------------
/pixmaps/element-interface-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-interface-private-16.png
--------------------------------------------------------------------------------
/pixmaps/element-interface-protected-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-interface-protected-16.png
--------------------------------------------------------------------------------
/pixmaps/element-property-protected-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-property-protected-16.png
--------------------------------------------------------------------------------
/extravapi/gtksourceview-3.0/gtksourceview-3.0.deps:
--------------------------------------------------------------------------------
1 | atk
2 | gdk-3.0
3 | gdk-pixbuf-2.0
4 | gio-2.0
5 | gtk+-3.0
6 | pango
7 | cairo
8 |
--------------------------------------------------------------------------------
/pixmaps/element-error_domain-private-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/pixmaps/element-error_domain-private-16.png
--------------------------------------------------------------------------------
/data/templates/elementary/template/data/48/hello.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Valama/valama/HEAD/data/templates/elementary/template/data/48/hello.png
--------------------------------------------------------------------------------
/data/templates/plain_vala/template/src/main.vala:
--------------------------------------------------------------------------------
1 | using GLib;
2 |
3 | static void main (string[] args) {
4 | stdout.printf ("Hello world!\n");
5 | }
6 |
--------------------------------------------------------------------------------
/data/templates/clutter/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/data/templates/elementary/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/data/templates/plain_vala/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/data/templates/simple_gtk/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_audio/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_video/template/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string VALA_VERSION;
4 | }
5 |
--------------------------------------------------------------------------------
/.tx/config:
--------------------------------------------------------------------------------
1 | [main]
2 | host = https://www.transifex.com
3 | type = PO
4 | minimum_perc = 80
5 |
6 | [valama.valama]
7 | file_filter = po/.po
8 | source_file = po/valama.pot
9 | source_lang = en
10 |
11 |
--------------------------------------------------------------------------------
/tests/projectfile/invalid_garbage.vlp:
--------------------------------------------------------------------------------
1 |
2 | InvalidGarbage
3 | autotools
4 |
5 | 2
6 | 4
7 | <1
8 |
9 |
10 |
--------------------------------------------------------------------------------
/data/templates/elementary/template/data/hello.desktop:
--------------------------------------------------------------------------------
1 |
2 | [Desktop Entry]
3 | Version=0.1
4 | Type=Application
5 | Name=Hello
6 | _GenericName=Helo_test
7 | _Comment=TEST
8 | Categories=GTK;Office;
9 | Exec=hello
10 | Icon=hello
11 | Terminal=false
12 | Name[de_DE]=hello
13 |
--------------------------------------------------------------------------------
/data/valama.desktop.in:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | _Name=Valama
4 | _GenericName=IDE
5 | _Comment=Create Vala projects.
6 | Icon=valama
7 | Exec=valama
8 | MimeType=application/x-valama;
9 | Categories=GNOME;GTK;Development;IDE;
10 | _Keywords=Vala;IDE;Development;
11 |
--------------------------------------------------------------------------------
/data/templates/plain_lib/template/src/lib.vala:
--------------------------------------------------------------------------------
1 | using GLib;
2 |
3 | namespace MyNS {
4 | public class Lib : Object {
5 |
6 | public signal void sample_signal(int a, int b);
7 |
8 | public int calc (int a, int b) {
9 | sample_signal (a, b);
10 | return a + b;
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/cmake.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Dominique Lasserre
4 | lasserre.d@gmail.com
5 |
6 |
7 | CMake
8 |
9 |
10 | CMake buildsystem.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/guanako/guanako.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@pc_prefix@
2 | exec_prefix=@pc_exec_prefix@
3 | libdir=@pc_libdir@
4 | includedir=@pc_includedir@
5 | datarootdir=@pc_datarootdir@
6 | vapidir=@pc_vapidir@
7 |
8 | Name: Guanako
9 | Description: Guanako library
10 | Version: @pc_version@
11 | Requires: @pc_requirements@
12 | Libs: -L${libdir} -lguanako
13 | Cflags: -I${includedir}/
14 |
--------------------------------------------------------------------------------
/data/buildsystems/autotools/autotools.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Yannick Inizan
4 | inizan.yannick@gmail.com
5 |
6 |
7 | Autotools
8 |
9 |
10 | Autotools buildsystem.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/guanako/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string PACKAGE_NAME;
4 | public const string PACKAGE_VERSION;
5 | public const string GETTEXT_PACKAGE;
6 | public const string PACKAGE_DATA_DIR;
7 |
8 | public const string LOCALE_DIR;
9 |
10 | public const string VALA_VERSION;
11 | }
12 |
--------------------------------------------------------------------------------
/data/templates/elementary/elementary.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Marcec Mario
4 | mario.marce42@googlmail.com
5 |
6 |
7 | Simple elemantary GTK
8 |
9 |
10 | Simple elemantary GTK+ 3 project
11 |
12 |
13 |
--------------------------------------------------------------------------------
/vapi/config.vapi:
--------------------------------------------------------------------------------
1 | [CCode (cprefix = "", lower_case_cprefix = "")]
2 | namespace Config {
3 | public const string PACKAGE_NAME;
4 | public const string PACKAGE_VERSION;
5 | public const string GETTEXT_PACKAGE;
6 | public const string PACKAGE_DATA_DIR;
7 | public const string PACKAGE_UI_DIR;
8 |
9 | public const string LOCALE_DIR;
10 | public const string PIXMAP_DIR;
11 |
12 | public const string VALA_VERSION;
13 | }
14 |
--------------------------------------------------------------------------------
/data/valama.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Valama project file
5 | Valama Projektdatei
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/data/templates/plain_vala/plain_vala.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Linus Seelinger
4 | S.Linus@quantentunnel.de
5 |
6 |
7 | Plain vala
8 | Vala-Hello-World>
9 | Hello World Vala>
10 |
11 |
12 | Simple vala project
13 | Einfaches Vala-Projekt.>
14 | Projet Vala simple.>
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/templates/simple_gtk/simple_gtk.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Linus Seelinger
4 | S.Linus@quantentunnel.de
5 |
6 |
7 | Simple GTK+ 3
8 | GTK+ 3 Beispiel
9 | Exemple GTK+ 3
10 |
11 |
12 | Simple GTK+ 3 project
13 | Einfaches GTK+ 3-Projekt
14 | Projet GTK+ 3 simple
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/templates/clutter/clutter.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Linus Seelinger
4 | S.Linus@quantentunnel.de
5 |
6 |
7 | Clutter
8 | Clutter
9 | Clutter
10 |
11 |
12 | Simple Clutter animation example
13 | Einfaches Clutter-Animationsbeispiel
14 | Exemple simple d'animation Clutter
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/org.valama.gschema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 950
6 | Horizontal window size
7 |
8 |
9 |
10 |
11 |
12 | 700
13 | Vertical window size
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/data/templates/plain_lib/plain_lib.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Yannick Inizan
4 | inizan.yannick@gmail.com
5 |
6 |
7 | Plain Vala Library
8 | Vala-Library-Hello-World>
9 | Bibliothèque Hello World Vala>
10 |
11 |
12 | Simple Vala library project
13 | Einfaches Vala-Library-Projekt.>
14 | Projet bibliothèque Vala simple.>
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_audio/simple_gst_audio.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Yannick Inizan
4 | inizan.yannick@gmail.com
5 |
6 |
7 | Simple audio GStreamer
8 | Audio-GStreamer Beispiel
9 | Exemple GStreamer audio
10 |
11 |
12 | Simple GStreamer audio project
13 | Einfaches Audio-GStreamer-Projekt
14 | Projet GStreamer audio simple
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_video/simple_gst_video.info:
--------------------------------------------------------------------------------
1 |
2 |
3 | Yannick Inizan
4 | inizan.yannick@gmail.com
5 |
6 |
7 | Simple video GStreamer
8 | Video-GStreamer Beispiel
9 | Exemple GStreamer vidéo
10 |
11 |
12 | Simple GStreamer video project
13 | Einfaches Video-GStreamer-Projekt
14 | Projet GStreamer vidéo simple
15 |
16 |
17 |
--------------------------------------------------------------------------------
/data/templates/plain_lib/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | autotools
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | src
16 |
17 |
18 |
19 |
20 |
21 | src/lib.vala
22 |
23 |
24 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_audio/template/src/main.vala:
--------------------------------------------------------------------------------
1 | void main (string[] args)
2 | {
3 | if (args.length < 2)
4 | {
5 | print ("usage: main file://path/to/file or main http://radio:8080");
6 | return;
7 | }
8 | Gst.init (ref args);
9 | var loop = new MainLoop();
10 | dynamic Gst.Element playbin = Gst.ElementFactory.make ("playbin","playbin");
11 | playbin.bus.add_watch (0, (bus, message) => {
12 | switch (message.type)
13 | {
14 | case Gst.MessageType.ERROR:
15 | print ("error occured !");
16 | loop.quit();
17 | break;
18 | case Gst.MessageType.EOS:
19 | loop.quit();
20 | break;
21 | }
22 | return false;
23 | });
24 | playbin.uri = args[1];
25 | playbin.set_state (Gst.State.PLAYING);
26 | loop.run();
27 | }
28 |
--------------------------------------------------------------------------------
/data/templates/plain_vala/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | src
16 | vapi
17 |
18 |
19 | ui
20 |
21 |
22 |
23 | cmake
24 |
25 |
26 | src/main.vala
27 |
28 |
29 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_audio/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | src
16 | vapi
17 |
18 |
19 | ui
20 |
21 |
22 |
23 | cmake
24 |
25 |
26 | src/main.vala
27 |
28 |
29 |
--------------------------------------------------------------------------------
/cmake/guanako.cmake:
--------------------------------------------------------------------------------
1 | set(project_name "Guanako")
2 | set(Guanako_VERSION "1.0")
3 | set(soversion "1")
4 | set(required_pkgs
5 | "config {nocheck,nolink}"
6 | "gobject-2.0"
7 | "glib-2.0"
8 | "gio-2.0"
9 | "gee-0.8 >= 0.10.5"
10 | "libvala-0.20"
11 | "libvala-0.22"
12 | "libvala-0.24"
13 | "libvala-0.26"
14 | "libvala-0.28"
15 | "libvala-0.30"
16 | "libxml-2.0"
17 | "posix {nocheck,nolink}"
18 | )
19 | set(srcfiles
20 | "guanako.vala"
21 | "guanako_auto_indent.vala"
22 | "guanako_frankenstein.vala"
23 | "guanako_helpers.vala"
24 | "guanako_iterators.vala"
25 | "guanako_refactoring.vala"
26 | "guanako_vapi_discoverer.vala"
27 | "reporter.vala"
28 | "scanner/valascanner.vala"
29 | "scanner/valaparser.vala"
30 | )
31 | set(vapifiles
32 | "config.vapi"
33 | )
34 |
--------------------------------------------------------------------------------
/data/templates/clutter/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | src
17 | vapi
18 |
19 |
20 | ui
21 |
22 |
23 |
24 | cmake
25 |
26 |
27 | src/main.vala
28 |
29 |
30 |
--------------------------------------------------------------------------------
/data/templates/simple_gtk/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | src
17 | vapi
18 |
19 |
20 | ui
21 |
22 |
23 |
24 | cmake
25 |
26 |
27 | src/main.vala
28 |
29 |
30 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_video/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | src
19 | vapi
20 |
21 |
22 | ui
23 |
24 |
25 |
26 | cmake
27 |
28 |
29 | src/main.vala
30 |
31 |
32 |
--------------------------------------------------------------------------------
/data/templates/simple_gtk/template/src/main.vala:
--------------------------------------------------------------------------------
1 | using GLib;
2 | using Gtk;
3 |
4 | static Label lbl_hello;
5 |
6 | static void main (string[] args) {
7 | Gtk.init (ref args);
8 |
9 | var window_main = new Window();
10 | window_main.title = "Hello world!";
11 | window_main.set_default_size (200, 200);
12 | window_main.destroy.connect (Gtk.main_quit);
13 |
14 | var vbox_main = new Box (Orientation.VERTICAL, 0);
15 |
16 | lbl_hello = new Label ("Hello!");
17 | var btn_bye = new Button.with_label ("Magic!");
18 |
19 | btn_bye.clicked.connect (on_btn_bye_clicked);
20 |
21 | vbox_main.pack_start (lbl_hello, true, true);
22 | vbox_main.pack_start (btn_bye, false, true);
23 |
24 | window_main.add (vbox_main);
25 |
26 | window_main.show_all();
27 |
28 | Gtk.main();
29 | }
30 |
31 | static void on_btn_bye_clicked() {
32 | lbl_hello.label = "Bye!";
33 | }
34 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 | compiler:
3 | - gcc
4 | - clang
5 | branches:
6 | except:
7 | - artwork
8 | - debian
9 | - gh-pages
10 | - packaging
11 | - valamang
12 | before_install:
13 | - sudo apt-get update -qq
14 | - sudo apt-get install update-manager-core software-properties-common
15 | - sudo sed -i 's/^\(Prompt=\).*/\1lts/' /etc/update-manager/release-upgrades
16 | - sudo do-release-upgrade -d -f DistUpgradeViewNonInteractive
17 | - sudo add-apt-repository -y ppa:vala-team/ppa
18 | - sudo apt-get update -qq
19 | - eval $(sed -n '/^On Debian based systems install/{n;n;p}' README.md) valadoc
20 | script: mkdir build && cd build && cmake -DVALADOC_VERBOSE=ON .. && make && make docs-valama
21 | notifications:
22 | irc:
23 | channels:
24 | - "irc.freenode.org#valama"
25 | on_success: change
26 | on_failure: always
27 | use_notice: true
28 | skip_join: true
29 |
--------------------------------------------------------------------------------
/data/templates/clutter/template/src/main.vala:
--------------------------------------------------------------------------------
1 | using GLib;
2 | using Clutter;
3 |
4 | static Stage stage;
5 | static Rectangle r;
6 |
7 | static void main (string[] args) {
8 | Clutter.init (ref args);
9 |
10 | stage = new Stage();
11 |
12 | r = new Rectangle();
13 | r.width = 100;
14 | r.height = 100;
15 | r.color = Color.from_string ("Green");
16 | r.reactive = true;
17 | r.button_press_event.connect (() => {
18 | animate_it();
19 | return false;
20 | });
21 |
22 | stage.add_child (r);
23 | stage.show();
24 |
25 | animate_it();
26 |
27 | Clutter.main();
28 | }
29 |
30 | static void animate_it() {
31 | r.x = 0;
32 | r.y = 0;
33 | r.animate (AnimationMode.EASE_OUT_BOUNCE, 3000,
34 | x: stage.width - r.width,
35 | y: stage.height - r.height,
36 | rotation_angle_z: r.rotation_angle_z + 90);
37 | }
38 |
--------------------------------------------------------------------------------
/data/templates/elementary/template/template.vlp:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake
4 |
5 | 0
6 | 0
7 | 0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | src
20 | data
21 | data
22 | vapi
23 |
24 |
25 | ui
26 |
27 |
28 |
29 | cmake
30 |
31 |
32 | src/main.vala
33 |
34 |
35 |
--------------------------------------------------------------------------------
/cmake/GlibCompileSchema.cmake.in:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/GlibCompileSchema.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | find_program(GLIBCOMPILESCHEMA "glib-compile-schemas")
20 | if(GLIBCOMPILESCHEMA)
21 | execute_process(
22 | COMMAND
23 | "${GLIBCOMPILESCHEMA}" @GSETTINGSDIR@
24 | )
25 | endif()
26 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/GlibCompileSchema.cmake.in:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/GlibCompileSchema.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | find_program(GLIBCOMPILESCHEMA "glib-compile-schemas")
20 | if(GLIBCOMPILESCHEMA)
21 | execute_process(
22 | COMMAND
23 | "${GLIBCOMPILESCHEMA}" @GSETTINGSDIR@
24 | )
25 | endif()
26 |
--------------------------------------------------------------------------------
/tests/testmain.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * tests/testmain.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | void main (string[] args) {
23 | Test.init (ref args);
24 |
25 | TestSuite.get_root().add_suite (new TestCompVersion().get_suite());
26 | TestSuite.get_root().add_suite (new TestPathSplit().get_suite());
27 | TestSuite.get_root().add_suite (new TestProjectfile().get_suite());
28 |
29 | Test.run();
30 | }
31 |
32 | // vim: set ai ts=4 sts=4 et sw=4
33 |
--------------------------------------------------------------------------------
/src/ui/widgets/browser_path.vala:
--------------------------------------------------------------------------------
1 | using Gtk;
2 |
3 | public class BrowserPath {
4 | TreePath path;
5 |
6 | public BrowserPath (TreePath path) {
7 | this.path = path;
8 | }
9 |
10 | public string to_string() {
11 | return path.to_string();
12 | }
13 |
14 | public int get (int index) {
15 | return path.get_indices()[index];
16 | }
17 |
18 | public BrowserPathType path_type {
19 | get {
20 | if (this[0] == 0 && this[1] == 0)
21 | return BrowserPathType.SOURCE;
22 | if (this[0] == 0 && this[1] == 1)
23 | return BrowserPathType.PACKAGE;
24 | if (this[0] == 1)
25 | return BrowserPathType.UI;
26 | if (this[0] == 2)
27 | return BrowserPathType.BUILDSYSTEM;
28 | if (this[0] == 2)
29 | return BrowserPathType.DATA;
30 | return BrowserPathType.NONE;
31 | }
32 | }
33 |
34 | public int size {
35 | get {
36 | return path.get_depth();
37 | }
38 | }
39 | }
40 |
41 | public enum BrowserPathType {
42 | NONE, SOURCE, PACKAGE, UI, BUILDSYSTEM, DATA
43 | }
44 |
--------------------------------------------------------------------------------
/cmake/GlibCompileSchema_verify.cmake.in:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/GlibCompileSchema.cmake.in
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | execute_process(
20 | COMMAND
21 | "${GLIBCOMPILESCHEMA}" "--dry-run" "--schema-file=${GLIB_SCHEMAFILE}"
22 | ERROR_VARIABLE
23 | stderr
24 | OUTPUT_VARIABLE
25 | stderr
26 | OUTPUT_STRIP_TRAILING_WHITESPACE
27 | ERROR_STRIP_TRAILING_WHITESPACE
28 | )
29 | if(NOT "${stderr}" STREQUAL "")
30 | message(FATAL_ERROR "Schema validation error: ${stderr}")
31 | endif()
32 |
33 | # vim: set ai ts=2 sts=2 et sw=2
34 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/GlibCompileSchema_verify.cmake.in:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/GlibCompileSchema.cmake.in
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | execute_process(
20 | COMMAND
21 | "${GLIBCOMPILESCHEMA}" "--dry-run" "--schema-file=${GLIB_SCHEMAFILE}"
22 | ERROR_VARIABLE
23 | stderr
24 | OUTPUT_VARIABLE
25 | stderr
26 | OUTPUT_STRIP_TRAILING_WHITESPACE
27 | ERROR_STRIP_TRAILING_WHITESPACE
28 | )
29 | if(NOT "${stderr}" STREQUAL "")
30 | message(FATAL_ERROR "Schema validation error: ${stderr}")
31 | endif()
32 |
33 | # vim: set ai ts=2 sts=2 et sw=2
34 |
--------------------------------------------------------------------------------
/src/settings.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/settings.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | class ValamaSettings {
21 |
22 | public ValamaSettings() {
23 | settings = new Settings ("org.valama");
24 | }
25 | Settings settings;
26 |
27 | public int window_size_x {
28 | get { return settings.get_int ("window-size-x"); }
29 | set { settings.set_int ("window-size-x", value); }
30 | }
31 | public int window_size_y {
32 | get { return settings.get_int ("window-size-y"); }
33 | set { settings.set_int ("window-size-y", value); }
34 | }
35 |
36 | }
37 |
38 | // vim: set ai ts=4 sts=4 et sw=4
39 |
--------------------------------------------------------------------------------
/data/templates/simple_gst_video/template/src/main.vala:
--------------------------------------------------------------------------------
1 | using Gst;
2 | using Gtk;
3 |
4 | static void main (string[] args) {
5 | if (args.length < 2)
6 | {
7 | // Note: playbin handle uris, no paths.
8 | print ("usage: test file:///path/to/file\n");
9 | return;
10 | }
11 |
12 | Gtk.init (ref args);
13 | Gst.init (ref args);
14 |
15 | dynamic Element playbin = ElementFactory.make ("playbin", "playbin");
16 | playbin.uri = args[1];
17 |
18 | Window window = new Window();
19 |
20 | playbin.bus.add_watch (0, (bus, message) => {
21 | // get the window id of current GtkWindow for inlay the video.
22 | if (Gst.Video.is_video_overlay_prepare_window_handle_message (message))
23 | (message.src as Gst.Video.Overlay).set_window_handle ((uint*)Gdk.X11Window.get_xid (window.get_window()));
24 |
25 | switch (message.type)
26 | {
27 | case Gst.MessageType.ERROR:
28 | print ("an error was occured !\n");
29 | Gtk.main_quit();
30 | break;
31 | case Gst.MessageType.EOS:
32 | print ("end of current stream. quit ..\n");
33 | Gtk.main_quit();
34 | break;
35 | }
36 | return true;
37 | });
38 |
39 | window.realize.connect(() => {
40 | // when the GtkWindow is shown, set the playbin state at PLAYING.
41 | playbin.set_state (State.PLAYING);
42 | });
43 | window.show_all();
44 | Gtk.main();
45 | }
46 |
--------------------------------------------------------------------------------
/cmake/vala/FindValadoc.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/FindValadocs.cmake
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | # Add find_package handler for valadoc.
20 | ##
21 |
22 | # Search for the valac executable in the usual system paths.
23 | find_program(VALADOC_EXECUTABLE "valadoc")
24 | mark_as_advanced(VALADOC_EXECUTABLE)
25 |
26 | # Determine the valadoc version
27 | if(VALADOC_EXECUTABLE)
28 | execute_process(
29 | COMMAND
30 | "${VALADOC_EXECUTABLE}" "--version"
31 | OUTPUT_VARIABLE
32 | VALADOC_VERSION
33 | OUTPUT_STRIP_TRAILING_WHITESPACE
34 | )
35 | string(REPLACE "Valadoc " "" VALADOC_VERSION "${VALADOC_VERSION}")
36 | endif()
37 |
38 | # Add find_package handler for valadoc.
39 | include(FindPackageHandleStandardArgs)
40 | find_package_handle_standard_args(Valadoc
41 | REQUIRED_VARS
42 | VALADOC_EXECUTABLE
43 | VERSION_VAR
44 | VALADOC_VERSION
45 | )
46 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/vala/FindValadoc.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/FindValadocs.cmake
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | # Add find_package handler for valadoc.
20 | ##
21 |
22 | # Search for the valac executable in the usual system paths.
23 | find_program(VALADOC_EXECUTABLE "valadoc")
24 | mark_as_advanced(VALADOC_EXECUTABLE)
25 |
26 | # Determine the valadoc version
27 | if(VALADOC_EXECUTABLE)
28 | execute_process(
29 | COMMAND
30 | "${VALADOC_EXECUTABLE}" "--version"
31 | OUTPUT_VARIABLE
32 | VALADOC_VERSION
33 | OUTPUT_STRIP_TRAILING_WHITESPACE
34 | )
35 | string(REPLACE "Valadoc " "" VALADOC_VERSION "${VALADOC_VERSION}")
36 | endif()
37 |
38 | # Add find_package handler for valadoc.
39 | include(FindPackageHandleStandardArgs)
40 | find_package_handle_standard_args(Valadoc
41 | REQUIRED_VARS
42 | VALADOC_EXECUTABLE
43 | VERSION_VAR
44 | VALADOC_VERSION
45 | )
46 |
--------------------------------------------------------------------------------
/po/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # po/CMakeLists.txt
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | include(Gettext)
20 | if(XGETTEXT_FOUND)
21 | set(potfile "${CMAKE_CURRENT_SOURCE_DIR}/${project_name_lower}.pot")
22 | gettext_create_pot("${potfile}"
23 | SRCFILES
24 | ${srcfiles}
25 | "guanako/*.vala"
26 | DESKTOPFILES
27 | "data/valama.desktop.in"
28 | GSETTINGSFILES
29 | "data/org.valama.gschema.xml"
30 | )
31 | option(UPDATE_PO "Update .po files." ON)
32 | if(UPDATE_PO)
33 | set(NOUPDATE)
34 | else()
35 | set(NOUPDATE "NOUPDATE")
36 | endif()
37 | option(INSTALL_INTLTOOL_MERGED "Copy intltoolized files into source tree." OFF)
38 | if(INSTALL_INTLTOOL_MERGED)
39 | set(DESKTOPFILES_INSTALL "DESKTOPFILES_INSTALL")
40 | else()
41 | set(DESKTOPFILES_INSTALL)
42 | endif()
43 | gettext_create_translations("${potfile}" ALL ${NOUPDATE} ${DESKTOPFILES_INSTALL})
44 | endif()
45 |
46 | # vim: set ai ts=2 sts=2 et sw=2
47 |
--------------------------------------------------------------------------------
/cmake/FindIntltool.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/Intltool.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | find_program(INTLTOOL_EXTRACT_EXECUTABLE intltool-extract)
20 | find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
21 | mark_as_advanced(INTLTOOL_EXTRACT_EXECUTABLE)
22 | mark_as_advanced(INTLTOOL_MERGE_EXECUTABLE)
23 |
24 | if(INTLTOOL_EXTRACT_EXECUTABLE)
25 | execute_process(
26 | COMMAND
27 | "${INTLTOOL_EXTRACT_EXECUTABLE}" "--version"
28 | OUTPUT_VARIABLE
29 | intltool_version
30 | ERROR_QUIET
31 | OUTPUT_STRIP_TRAILING_WHITESPACE
32 | )
33 | if(intltool_version MATCHES "^intltool-extract \\(.*\\) [0-9]")
34 | string(REGEX REPLACE "^intltool-extract \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" INTLTOOL_VERSION_STRING "${intltool_version}")
35 | endif()
36 | unset(intltool_version)
37 | endif()
38 |
39 | include(FindPackageHandleStandardArgs)
40 | find_package_handle_standard_args(Intltool
41 | REQUIRED_VARS
42 | INTLTOOL_EXTRACT_EXECUTABLE
43 | INTLTOOL_MERGE_EXECUTABLE
44 | VERSION_VAR
45 | INTLTOOL_VERSION_STRING
46 | )
47 |
48 | set(INTLTOOL_OPTIONS_DEFAULT
49 | "--quiet"
50 | )
51 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/FindIntltool.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/Intltool.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | find_program(INTLTOOL_EXTRACT_EXECUTABLE intltool-extract)
20 | find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
21 | mark_as_advanced(INTLTOOL_EXTRACT_EXECUTABLE)
22 | mark_as_advanced(INTLTOOL_MERGE_EXECUTABLE)
23 |
24 | if(INTLTOOL_EXTRACT_EXECUTABLE)
25 | execute_process(
26 | COMMAND
27 | "${INTLTOOL_EXTRACT_EXECUTABLE}" "--version"
28 | OUTPUT_VARIABLE
29 | intltool_version
30 | ERROR_QUIET
31 | OUTPUT_STRIP_TRAILING_WHITESPACE
32 | )
33 | if(intltool_version MATCHES "^intltool-extract \\(.*\\) [0-9]")
34 | string(REGEX REPLACE "^intltool-extract \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" INTLTOOL_VERSION_STRING "${intltool_version}")
35 | endif()
36 | unset(intltool_version)
37 | endif()
38 |
39 | include(FindPackageHandleStandardArgs)
40 | find_package_handle_standard_args(Intltool
41 | REQUIRED_VARS
42 | INTLTOOL_EXTRACT_EXECUTABLE
43 | INTLTOOL_MERGE_EXECUTABLE
44 | VERSION_VAR
45 | INTLTOOL_VERSION_STRING
46 | )
47 |
48 | set(INTLTOOL_OPTIONS_DEFAULT
49 | "--quiet"
50 | )
51 |
--------------------------------------------------------------------------------
/src/ui/valadoc_browser.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/structure_view.vala
3 | * Copyright (C) 2014, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 | using Gtk;
22 | using WebKit;
23 |
24 | public class UiValadocBrowser : UiElement {
25 | public UiValadocBrowser() {
26 | var vbox = new Box (Orientation.VERTICAL, 0);
27 |
28 | var sw = new ScrolledWindow (null, null);
29 | vbox.pack_start (sw, true, true);
30 |
31 | var webview = new WebView();
32 | webview.load_changed.connect ((event) => {
33 | if (event == LoadEvent.STARTED && !webview.get_uri().has_prefix ("http://www.valadoc.org/")) {
34 | webview.stop_loading();
35 | //TODO: Show visible message.
36 | debug_msg ("Tried to access content outside of documentation domain: %s\n",
37 | webview.get_uri());
38 | }
39 | });
40 | //TODO: Make this configurable.
41 | webview.load_uri ("http://www.valadoc.org");
42 | sw.add (webview);
43 |
44 | widget = vbox;
45 | widget.show_all();
46 | }
47 |
48 | protected override void build() {}
49 | }
50 |
51 | // vim: set ai ts=4 sts=4 et sw=4
52 |
--------------------------------------------------------------------------------
/icons/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # icons/CMakeLists.txt
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | include("${CMAKE_SOURCE_DIR}/cmake/Common.cmake")
20 |
21 | # Generate usable application icons.
22 | set(sizeslist "24" "32" "48" "64" "72" "96" "128" "256")
23 | convert_svg_to_png(png_list
24 | ICON
25 | "${CMAKE_CURRENT_SOURCE_DIR}/V4_logo.svg"
26 | SIZES
27 | ${sizeslist}
28 | PNG_NAME
29 | "valama"
30 | )
31 | add_custom_target(icons
32 | ALL
33 | DEPENDS
34 | ${png_list}
35 | COMMENT
36 | "Generate application icons." VERBATIM
37 | )
38 |
39 | # Generate logo with text.
40 | set(sizeslist "128")
41 | convert_svg_to_png(textlogo
42 | ICON
43 | "${CMAKE_CURRENT_SOURCE_DIR}/V4.svg"
44 | SIZES
45 | ${sizeslist}
46 | PNG_NAME
47 | "valama-text"
48 | DESTINATION
49 | "${datadir}"
50 | )
51 | add_custom_target(icons_text
52 | ALL
53 | DEPENDS
54 | ${textlogo}
55 | COMMENT
56 | "Generate text logo." VERBATIM
57 | )
58 |
59 |
60 | # Install application icon.
61 | if(CONVERT)
62 | install(
63 | FILES
64 | "${CMAKE_CURRENT_BINARY_DIR}/icons/hicolor/32x32/apps/valama.png"
65 | DESTINATION
66 | "${pixrootdir}"
67 | )
68 | endif()
69 |
70 | # vim: set ai ts=2 sts=2 et sw=2
71 |
--------------------------------------------------------------------------------
/src/dialogs/missing_packages.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/dialogs/missing_packages.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gtk;
21 | using GLib;
22 |
23 | /**
24 | * Show dialog with missing packages.
25 | */
26 | public void ui_missing_packages_dialog (string[] missing_packages) {
27 | var dlg_missing_packages = new Dialog.with_buttons (_("Missing packages"),
28 | window_main,
29 | DialogFlags.MODAL,
30 | _("_Ok"),
31 | ResponseType.OK,
32 | null);
33 | dlg_missing_packages.resizable = false;
34 |
35 | var box_main = new Box (Orientation.VERTICAL, 0);
36 | string dlg = _("The following vala packages are not available on your system:\n");
37 | foreach (string pkg in missing_packages)
38 | dlg += pkg + "\n";
39 | dlg += _("Compiling and auto completion might fail!");
40 | var lbl_packages = new Label (dlg);
41 | box_main.pack_start (lbl_packages, true, true);
42 | box_main.show_all();
43 |
44 | dlg_missing_packages.get_content_area().pack_start (box_main);
45 | dlg_missing_packages.run();
46 | dlg_missing_packages.destroy();
47 | }
48 |
49 | // vim: set ai ts=4 sts=4 et sw=4
50 |
--------------------------------------------------------------------------------
/data/layout.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/guanako/guanako_auto_indent.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * guanako/guanako_auto_indent.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 | using Vala;
22 |
23 | namespace Guanako {
24 | public static string auto_indent_buffer (Project project, SourceFile file) {
25 | string[] lines = file.content.split ("\n");
26 | for (int q = 0; q < lines.length; q++)
27 | lines[q] = lines[q].strip();
28 |
29 | foreach (var node in file.get_nodes()) {
30 | if (node is Symbol) {
31 | var cls = node as Symbol;
32 | iter_symbol (cls, (smb, depth) => {
33 | if (smb is Subroutine) {
34 | var sr = smb as Subroutine;
35 | iter_subroutine (sr, (s, depth2) => {
36 | for (int q = s.source_reference.begin.line - 1; q <= s.source_reference.end.line - 1; q++)
37 | for (int i = 0; i < 1 + depth2; i++)
38 | lines[q] = " " + lines[q];
39 | return IterCallbackReturns.CONTINUE;
40 | });
41 | }
42 | return IterCallbackReturns.CONTINUE;
43 | });
44 | }
45 | }
46 |
47 | string new_content = "";
48 | for (int q = 0; q < lines.length; q++) {
49 | new_content += lines[q];
50 | if (q < lines.length - 1)
51 | new_content += "\n";
52 | }
53 | return new_content;
54 | }
55 | }
56 |
57 | // vim: set ai ts=4 sts=4 et sw=4
58 |
--------------------------------------------------------------------------------
/data/valama.1.in:
--------------------------------------------------------------------------------
1 | .TH VALAMA "1" "@MONTH_DATE@" "Valama @Valama_VERSION@" "User Commands"
2 | .SH NAME
3 | Valama \- Next generation Vala IDE
4 | .SH SYNOPSIS
5 | \fBvalama\fR
6 | [\fB-h\fR|\fB--help\fR]
7 | [\fB-v\fR|\fB--version\fR]
8 | [\fB--syntax\fR \fIfile\fR]
9 | [\fB--templates\fR \fIdirectory\fR]
10 | [\fB--buildsystems\fR \fIdirectory\fR]
11 | [{\fB-d\fR|\fB--debug\fR} [\fIlevel\fR]]
12 | [\fB--force\-old\fR]
13 | [\fB--layout\fR \fIfile\fR]
14 | [\fB--reset\-layout\fR]
15 | [\fIfile\fR ...]
16 | .SH DESCRIPTION
17 | \fBValama\fR is an integrated development environment (IDE) to support
18 | creation of Vala applications. Some features:
19 | .IP
20 | \(bu intelligent code completion (easily extendible syntax definition file)
21 | .IP
22 | \(bu live error checking
23 | .IP
24 | \(bu project templates
25 | .SH OPTIONS
26 | .TP
27 | \fB\-h\fR, \fB\-\-help\fR
28 | Show help.
29 | .TP
30 | \fB\-v\fR, \fB\-\-version\fR
31 | Display version number.
32 | .TP
33 | \fB\-\-syntax\fR \fIfile\fR
34 | Guanako syntax file (used for code completion).
35 | .TP
36 | \fB\-\-templates\fR \fIdirectory\fR
37 | Templates directory.
38 | .TP
39 | \fB\-\-buildsystems\fR \fIdirectory\fR
40 | Build systems directory.
41 | .TP
42 | \fB\-d\fR, \fB\-\-debug\fR \fI[debuglevel]\fR
43 | Output debug information. Be more verbose on higher debug level.
44 | .TP
45 | \fB\-\-force\-old\fR
46 | Force loading of possibly incompatible template or project files.
47 | .TP
48 | \fB\-\-layout\fR \fIfile\fR
49 | Path to GUI layout file.
50 | .TP
51 | \fB\-\-reset\-layout\fR
52 | Load default layout.
53 | .SH FILES
54 | .TP
55 | \fI@DATADIR@syntax\fR
56 | Default Guanako syntax definition file.
57 | .TP
58 | \fI@DATADIR@templates\fR
59 | Default templates directory. Each template has its own subdirectory with a
60 | \fItesttemplate.info\fR file for meta information like supported Vala
61 | versions, package dependencies, etc. In the sub-subdirectory \fItemplate\fR is
62 | the actual template source code.
63 | .TP
64 | \fI@DATADIR@buildsystems\fR
65 | Default build system plug-in directory. Each build system plug-in has its own
66 | subdirectory with a \fItestbuildsystem.info\fR file for meta information. In
67 | the sub-subdirectory \fIbuildsystem\fR is the actual buildsystem template
68 | code.
69 | .TP
70 | \fI@DATADIR@layout.xml\fR
71 | Default GUI layout file to place widgets like the project browser, reporter,
72 | etc.
--------------------------------------------------------------------------------
/guanako/guanako_vapi_discoverer.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * guanako/guanako_vapi_discoverer.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | namespace Guanako {
23 | public static string? discover_vapi_file (string needle_namespace) {
24 | foreach (string vapipath in get_vapi_dirs()) {
25 | var directory = File.new_for_path (vapipath);
26 |
27 | try {
28 | var enumerator = directory.enumerate_children (FileAttribute.STANDARD_NAME, 0);
29 |
30 | FileInfo file_info;
31 | while ((file_info = enumerator.next_file()) != null) {
32 | if (file_info.get_name().has_suffix (".vapi")) {
33 | var file = File.new_for_path (vapipath + file_info.get_name());
34 | var dis = new DataInputStream (file.read());
35 | string line;
36 | /*
37 | * Read lines until end of file (null) is reached.
38 | */
39 | while ((line = dis.read_line (null)) != null)
40 | if (line.contains ("namespace " + needle_namespace + " "))
41 | return file_info.get_name().substring (0, file_info.get_name().length - 5);
42 | }
43 | }
44 | } catch (GLib.IOError e) {
45 | errmsg (_("Could not read file: %s"), e.message);
46 | } catch (GLib.Error e) {
47 | errmsg (_("Could not operate on directory: %s"), e.message);
48 | }
49 | }
50 | return null;
51 | }
52 | }
53 |
54 | // vim: set ai ts=4 sts=4 et sw=4
55 |
--------------------------------------------------------------------------------
/src/ui/disabled/stylechecker.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/stylechecker.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 | using Gtk;
22 |
23 | /**
24 | * Code style checker widget.
25 | */
26 | public class UiStyleChecker : UiElement {
27 | TreeView tree_view;
28 |
29 | public UiStyleChecker() {
30 | tree_view = new TreeView();
31 | var line_renderer = new CellRendererText();
32 | line_renderer.yalign = 0;
33 | tree_view.cursor_changed.connect (on_tree_view_cursor_changed);
34 | tree_view.insert_column_with_attributes (-1,
35 | _("Line"),
36 | line_renderer,
37 | "text",
38 | 0,
39 | null);
40 |
41 | tree_view.insert_column_with_attributes (-1,
42 | "",
43 | new CellRendererText(),
44 | "markup",
45 | 1,
46 | null);
47 |
48 |
49 | var box_main = new Box (Orientation.VERTICAL, 0);
50 |
51 | var scrw = new ScrolledWindow (null, null);
52 | scrw.add (tree_view);
53 | box_main.pack_start (scrw, true, true);
54 |
55 | build();
56 |
57 | widget = box_main;
58 | }
59 |
60 | public override void build() {
61 | debug_msg (_("Checker loaded.\n"));
62 | }
63 |
64 | public void on_tree_view_cursor_changed() {}
65 | }
66 |
67 | // vim: set ai ts=4 sts=4 et sw=4
68 |
--------------------------------------------------------------------------------
/tests/testcompversion.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * tests/testcompversion.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | public class TestCompVersion : TestCase {
23 | public TestCompVersion() {
24 | base ("TestCompVersion");
25 | add_test ("standard", test_normal);
26 | add_test ("epoch", test_epoch);
27 | }
28 |
29 | public override void set_up() {}
30 | public override void tear_down() {}
31 |
32 | public void test_normal() {
33 | assert (comp_version ("14", "3") == 1);
34 | assert (comp_version ("14", "3.5") == 1);
35 | assert (comp_version ("14", "3.9.8") == 1);
36 | assert (comp_version ("14.1", "3.5") == 1);
37 |
38 | assert (comp_version ("3", "14") == -1);
39 | assert (comp_version ("3.5", "14") == -1);
40 | assert (comp_version ("3.9.8", "14") == -1);
41 | assert (comp_version ("3.5", "14.1") == -1);
42 |
43 | assert (comp_version ("4.1.2", "4.1.3") == -1);
44 | assert (comp_version ("4.10.2", "4.2.0") == 1);
45 | assert (comp_version ("4.1.2.3.6.4.12", "4.1.2.3.6.4.3") == 1);
46 |
47 | assert (comp_version ("4.1.2.3.6.4.2", "4.1.2.3.6.4.2") == 0);
48 | assert (comp_version ("4", "4") == 0);
49 | }
50 |
51 | public void test_epoch() {
52 | assert (comp_version ("1:3.0.0", "4.0") == 1);
53 | assert (comp_version ("1:3.0.0", "3.0.0") == 1);
54 | assert (comp_version ("1:3.0.0", "3.0.1") == 1);
55 |
56 | assert (comp_version ("1:3.0.0", "2:2.0") == -1);
57 | assert (comp_version ("1:3.0.0", "1:3.0.1") == -1);
58 | assert (comp_version ("1:3.0.0", "1:3.1") == -1);
59 |
60 | assert (comp_version ("15:3.0.0", "2:6.1") == 1);
61 |
62 | assert (comp_version ("1:3", "1:3") == 0);
63 | }
64 | }
65 |
66 | // vim: set ai ts=4 sts=4 et sw=4
67 |
--------------------------------------------------------------------------------
/cmake/SimpleUninstall.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/SimpleUninstall.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | #
20 | # Slightly modified version from: http://www.cmake.org/Wiki/CMake_FAQ
21 | #
22 |
23 | if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt")
24 | message(FATAL_ERROR "Cannot find install manifest: "
25 | "\"${CMAKE_BINARY_DIR}/install_manifest.txt\"")
26 | endif()
27 |
28 | file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files)
29 | string(REGEX REPLACE "\n" ";" files "${files}")
30 |
31 | cmake_policy(PUSH)
32 | # Ignore empty list elements.
33 | cmake_policy(SET CMP0007 OLD)
34 | list(REVERSE files)
35 | cmake_policy(POP)
36 |
37 | foreach(file ${files})
38 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
39 | if(EXISTS "$ENV{DESTDIR}${file}")
40 | execute_process(
41 | COMMAND
42 | "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}"
43 | OUTPUT_VARIABLE
44 | rm_out
45 | RESULT_VARIABLE
46 | rm_retval
47 | )
48 | if(NOT ${rm_retval} EQUAL 0)
49 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
50 | endif()
51 | else()
52 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
53 | endif()
54 | endforeach()
55 |
56 | if(NOT "$ENV{DESTDIR}" AND POSTREMOVE_HOOK)
57 | if (GSETTINGSDIR)
58 | set(compile_schema_file "${CMAKE_BINARY_DIR}/GlibCompileSchema_uninstall.cmake")
59 | if(NOT EXISTS "${compile_schema_file}")
60 | if(NOT CUSTOM_SOURCE_DIR)
61 | set(CUSTOM_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
62 | endif()
63 | configure_file(
64 | "${CUSTOM_SOURCE_DIR}/cmake/GlibCompileSchema.cmake.in"
65 | "${compile_schema_file}"
66 | @ONLY
67 | )
68 | endif()
69 | endif()
70 | execute_process(
71 | COMMAND
72 | "${CMAKE_COMMAND}" -P "${compile_schema_file}"
73 | )
74 | endif()
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/SimpleUninstall.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/SimpleUninstall.cmake
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | #
20 | # Slightly modified version from: http://www.cmake.org/Wiki/CMake_FAQ
21 | #
22 |
23 | if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt")
24 | message(FATAL_ERROR "Cannot find install manifest: "
25 | "\"${CMAKE_BINARY_DIR}/install_manifest.txt\"")
26 | endif()
27 |
28 | file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files)
29 | string(REGEX REPLACE "\n" ";" files "${files}")
30 |
31 | cmake_policy(PUSH)
32 | # Ignore empty list elements.
33 | cmake_policy(SET CMP0007 OLD)
34 | list(REVERSE files)
35 | cmake_policy(POP)
36 |
37 | foreach(file ${files})
38 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
39 | if(EXISTS "$ENV{DESTDIR}${file}")
40 | execute_process(
41 | COMMAND
42 | "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}"
43 | OUTPUT_VARIABLE
44 | rm_out
45 | RESULT_VARIABLE
46 | rm_retval
47 | )
48 | if(NOT ${rm_retval} EQUAL 0)
49 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
50 | endif()
51 | else()
52 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
53 | endif()
54 | endforeach()
55 |
56 | if(NOT "$ENV{DESTDIR}" AND POSTREMOVE_HOOK)
57 | if (GSETTINGSDIR)
58 | set(compile_schema_file "${CMAKE_BINARY_DIR}/GlibCompileSchema_uninstall.cmake")
59 | if(NOT EXISTS "${compile_schema_file}")
60 | if(NOT CUSTOM_SOURCE_DIR)
61 | set(CUSTOM_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
62 | endif()
63 | configure_file(
64 | "${CUSTOM_SOURCE_DIR}/cmake/GlibCompileSchema.cmake.in"
65 | "${compile_schema_file}"
66 | @ONLY
67 | )
68 | endif()
69 | endif()
70 | execute_process(
71 | COMMAND
72 | "${CMAKE_COMMAND}" -P "${compile_schema_file}"
73 | )
74 | endif()
--------------------------------------------------------------------------------
/src/ui/welcome_screen/load_project.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/welcome_screen/create_project_location.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 |
21 | // Open existing project (using a file chooser widget)
22 |
23 | using GLib;
24 | using Gtk;
25 | namespace WelcomeScreen {
26 | public class OpenProject : TemplatePageWithHeader {
27 |
28 | public string? project_filename = "";
29 |
30 | public OpenProject () {
31 | heading = _("Open project");
32 | description = _("Select Valama project file");
33 | }
34 |
35 | protected override void clean_up() {
36 | }
37 |
38 | protected override Gtk.Widget build_inner_widget() {
39 | var chooser_open = new FileChooserWidget (FileChooserAction.OPEN);
40 | chooser_open.expand = true;
41 |
42 | // Only allow .vlp files
43 | var filter_vlp = new FileFilter();
44 | filter_vlp.set_filter_name (_("Valama project files (*.vlp)"));
45 | filter_vlp.add_pattern ("*.vlp");
46 | chooser_open.add_filter (filter_vlp);
47 | chooser_open.set_filter (filter_vlp); // set default filter
48 |
49 | chooser_open.selection_changed.connect (() => {
50 | project_filename = chooser_open.get_filename();
51 | btn_next.sensitive = project_filename != null &&
52 | File.new_for_path (project_filename).query_file_type (
53 | FileQueryInfoFlags.NONE) == FileType.REGULAR;
54 | });
55 | chooser_open.file_activated.connect (() => {
56 | if (btn_next.sensitive) //Only procede if valid file is selected
57 | go_to_next_clicked();
58 | });
59 | return chooser_open;
60 | }
61 | }
62 | }
63 |
64 | // vim: set ai ts=4 sts=4 et sw=4
--------------------------------------------------------------------------------
/cmake/project.cmake:
--------------------------------------------------------------------------------
1 | # This file was auto generated by Valama 0.1.2. Do not modify it.
2 | set(project_name "Valama")
3 | set(Valama_VERSION "0.1.2")
4 | set(required_pkgs
5 | "atk {nolink}"
6 | "cairo {nolink}"
7 | "clutter-1.0 {nolink}"
8 | "clutter-gtk-1.0"
9 | "cogl-1.0 {nolink}"
10 | "config {nocheck,nolink}"
11 | "gdk-3.0"
12 | "gdk-pixbuf-2.0 {nolink}"
13 | "gdl-3.0 >= 3.8"
14 | "gee-0.8 >= 0.10.5"
15 | "gio-2.0"
16 | "gladeui-2.0"
17 | "glib-2.0 >= 2.32"
18 | "gmodule-2.0 {nolink}"
19 | "gobject-2.0"
20 | "gtk+-3.0 >= 3.9"
21 | "gtksourceview-3.0 >= 3.9"
22 | "guanako"
23 | "json-glib-1.0 {nolink}"
24 | "libsoup-2.4 {nolink}"
25 | "libvala-0.20"
26 | "libvala-0.22"
27 | "libvala-0.24"
28 | "libvala-0.26"
29 | "libvala-0.28"
30 | "libvala-0.30"
31 | "libxml-2.0"
32 | "pango {nolink}"
33 | "pangocairo {nolink}"
34 | "posix {nocheck,nolink}"
35 | "webkit2gtk-3.0"
36 | "x11 {nolink}"
37 | )
38 | set(srcfiles
39 | "src/buildsystem/autotools.vala"
40 | "src/buildsystem/base.vala"
41 | "src/buildsystem/buildsystem_template.vala"
42 | "src/buildsystem/cmake.vala"
43 | "src/buildsystem/plain.vala"
44 | "src/common/args.vala"
45 | "src/common/common.vala"
46 | "src/common/ui_helpers.vala"
47 | "src/completion_provider.vala"
48 | "src/dialogs/about.vala"
49 | "src/dialogs/create_file.vala"
50 | "src/dialogs/missing_packages.vala"
51 | "src/dialogs/project_settings.vala"
52 | "src/main.vala"
53 | "src/project/build_project.vala"
54 | "src/project/package_management.vala"
55 | "src/project/project.vala"
56 | "src/project/project_file.vala"
57 | "src/project/project_templates.vala"
58 | "src/settings.vala"
59 | "src/ui/app_output.vala"
60 | "src/ui/breakpoints.vala"
61 | "src/ui/build_output.vala"
62 | "src/ui/current_file_structure.vala"
63 | "src/ui/glade_viewer.vala"
64 | "src/ui/project_browser.vala"
65 | "src/ui/reports.vala"
66 | "src/ui/search.vala"
67 | "src/ui/source_viewer.vala"
68 | "src/ui/structure_view.vala"
69 | "src/ui/super_source_view.vala"
70 | "src/ui/symbol_browser.vala"
71 | "src/ui/ui_elements.vala"
72 | "src/ui/valadoc_browser.vala"
73 | "src/ui/welcome_screen.vala"
74 | "src/ui/welcome_screen/create_project_buildsystem.vala"
75 | "src/ui/welcome_screen/create_project_location.vala"
76 | "src/ui/welcome_screen/create_project_packages.vala"
77 | "src/ui/welcome_screen/create_project_template.vala"
78 | "src/ui/welcome_screen/load_project.vala"
79 | "src/ui/welcome_screen/main_screen.vala"
80 | "src/ui/widgets/browser_path.vala"
81 | "src/ui_main.vala"
82 | )
83 | set(vapifiles
84 | "vapi/config.vapi"
85 | )
86 | set(uifiles
87 | )
88 |
--------------------------------------------------------------------------------
/src/dialogs/about.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/dialogs/about.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gtk;
21 | using Gdk;
22 | using GLib;
23 |
24 | /**
25 | * Show about dialog.
26 | */
27 | public void ui_about_dialog() {
28 | var dlg = new AboutDialog();
29 | dlg.resizable = false;
30 |
31 | try {
32 | dlg.logo = new Pixbuf.from_file (Path.build_path (Path.DIR_SEPARATOR_S,
33 | Config.PACKAGE_DATA_DIR,
34 | "valama-text.png"));
35 | } catch (GLib.Error e) {
36 | errmsg ("Could not load pixmap: %s\n", e.message);
37 | }
38 |
39 | //TODO: Generate this automatically from AUTHORS file.
40 | dlg.artists = null;
41 | dlg.authors = {"Linus Seelinger ",
42 | "Dominique Lasserre "};
43 | dlg.documenters = null;
44 | dlg.translator_credits =
45 | "Overscore (%s)".printf (_("French")) + "\n" +
46 | "Dominique Lasserre (%s)".printf (_("German"));
47 |
48 | dlg.program_name = Config.PACKAGE_NAME;
49 | dlg.comments = _("Next generation Vala IDE");
50 | dlg.copyright = _("Copyright © 2012, 2013 Valama development team");
51 | dlg.version = Config.PACKAGE_VERSION;
52 |
53 | dlg.license_type = License.GPL_3_0;
54 | dlg.wrap_license = true;
55 |
56 | dlg.website = "https://github.com/Valama/valama";
57 | dlg.website_label = _("Github project page");
58 |
59 | dlg.response.connect ((response_id) => {
60 | switch (response_id) {
61 | case ResponseType.CANCEL:
62 | case ResponseType.DELETE_EVENT:
63 | dlg.destroy();
64 | break;
65 | default:
66 | bug_msg (_("Unexpected enum value: %s: %u\n"),
67 | "about_dialog - dlg.response.connect", response_id);
68 | break;
69 | }
70 | });
71 |
72 | dlg.run();
73 | }
74 |
75 | // vim: set ai ts=4 sts=4 et sw=4
76 |
--------------------------------------------------------------------------------
/tests/testcase.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * tests/testcase.vala
3 | *
4 | * Copyright (C) 2009 Julien Peeters
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 |
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 |
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | * Author:
21 | * Julien Peeters
22 | */
23 |
24 | public abstract class TestCase : Object {
25 |
26 | private GLib.TestSuite suite;
27 | private Adaptor[] adaptors = new Adaptor[0];
28 |
29 | public delegate void TestMethod();
30 |
31 | public TestCase (string name) {
32 | this.suite = new GLib.TestSuite (name);
33 | }
34 |
35 | public void add_test (string name, owned TestMethod test) {
36 | var adaptor = new Adaptor (name, (owned) test, this);
37 | this.adaptors += adaptor;
38 |
39 | this.suite.add (new GLib.TestCase (adaptor.name,
40 | adaptor.set_up,
41 | adaptor.run,
42 | adaptor.tear_down));
43 | }
44 |
45 | public virtual void set_up() {
46 | }
47 |
48 | public virtual void tear_down() {
49 | }
50 |
51 | public GLib.TestSuite get_suite() {
52 | return this.suite;
53 | }
54 |
55 | private class Adaptor {
56 | [CCode (notify = false)]
57 | public string name { get; private set; }
58 | private TestMethod test;
59 | private TestCase test_case;
60 |
61 | public Adaptor (string name,
62 | owned TestMethod test,
63 | TestCase test_case) {
64 | this.name = name;
65 | this.test = (owned) test;
66 | this.test_case = test_case;
67 | }
68 |
69 | public void set_up (void* fixture) {
70 | this.test_case.set_up();
71 | }
72 |
73 | public void run (void* fixture) {
74 | this.test();
75 | }
76 |
77 | public void tear_down (void* fixture) {
78 | this.test_case.tear_down();
79 | }
80 | }
81 | }
82 |
83 | // vim: set ai ts=4 sts=4 et sw=4
84 |
--------------------------------------------------------------------------------
/src/ui/app_output.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/build_output.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gtk;
21 | using GLib;
22 |
23 | public class AppOutput : UiElement {
24 | private TextView textview;
25 | private bool focused;
26 |
27 | public AppOutput() {
28 | focused = false;
29 |
30 | var vbox = new Box (Orientation.VERTICAL, 0);
31 |
32 | var toolbar_title = new Toolbar ();
33 | toolbar_title.get_style_context().add_class (STYLE_CLASS_PRIMARY_TOOLBAR);
34 | var ti_title = new ToolItem();
35 | var plabel = new Label (_("Application output"));
36 | ti_title.add (plabel);
37 | toolbar_title.add(ti_title);
38 |
39 | var separator_stretch = new SeparatorToolItem();
40 | separator_stretch.set_expand (true);
41 | separator_stretch.draw = false;
42 | toolbar_title.add (separator_stretch);
43 |
44 | var btn_clear = new Gtk.ToolButton (null, null);
45 | btn_clear.icon_name = "edit-clear-all-symbolic";
46 | toolbar_title.add (btn_clear);
47 | btn_clear.set_tooltip_text (_("Clear output"));
48 | btn_clear.clicked.connect (() => {
49 | textview.buffer.text = "";
50 | });
51 | vbox.pack_start (toolbar_title, false, true);
52 |
53 | textview = new TextView();
54 | textview.override_font (Pango.FontDescription.from_string ("Monospace 10"));
55 | textview.editable = false;
56 | textview.wrap_mode = WrapMode.NONE;
57 |
58 | var scrw = new ScrolledWindow (null, null);
59 | scrw.add (textview);
60 | vbox.pack_start (scrw, true, true);
61 |
62 | widget = vbox;
63 | widget.show_all();
64 |
65 | project_builder.notify["app-running"].connect (() => {
66 | if (project_builder.app_running) {
67 | if (!focused) {
68 | focused = true;
69 | widget_main.focus_dock_item (this.dock_item);
70 | }
71 | textview.buffer.text = "";
72 | } else
73 | focused = false;
74 | });
75 | project_builder.app_output.connect (show_output);
76 | }
77 |
78 | private inline void show_output (string output) {
79 | textview.buffer.insert_at_cursor (output, -1);
80 | }
81 |
82 | protected override void build() {}
83 | }
84 |
85 | // vim: set ai ts=4 sts=4 et sw=4
86 |
--------------------------------------------------------------------------------
/data/templates/elementary/template/src/main.vala:
--------------------------------------------------------------------------------
1 | using Gtk;
2 |
3 | namespace Hello{
4 | public class Hello : Granite.Application{
5 |
6 | public Window main_window;
7 | private Gtk.Toolbar toolbar;
8 | private Gtk.Box content;
9 |
10 | construct{
11 | // the name of your program
12 | program_name = "Hello";
13 | // the name of the executable, usually the name in lower case
14 | exec_name = "Hello";
15 |
16 |
17 | app_years = "2014";
18 | /* the icon for your app. you normally ship it with your project
19 | in the data directory and copy it to the icon directory.
20 | You don't include file endings here
21 | (you can also use one of the default icons as I'm doing here)
22 | */
23 | app_icon = "hello.png";
24 | // the .desktop file for your app, also in data directory
25 | app_launcher = "hello.desktop";
26 | // an unique id which will identify your application
27 | application_id = "org.elementary.hello";
28 |
29 | // those urls will be shown in the automatically
30 | // generated about dialog
31 | main_url = "https://github.com/august0815/valama";
32 | bug_url = "";
33 | help_url = "https://github.com/august0815/valama/issues/new";
34 | translate_url = "https://github.com/august0815/valama/issues/new";
35 |
36 | // here you can proudly list your own name and the names of
37 | // those who helped you
38 | about_authors = {""};
39 | about_documenters = {"Mario Marcec "};
40 | // if you got an icon or a nice mockup from someone
41 | // you can list him here
42 | about_artists = {"Mario Marcec"};
43 | // a short comment on the app
44 | about_comments = "A simple Hello to you";
45 | about_translators = "NOBODY YET";
46 | // this should be one of :
47 | // http://unstable.valadoc.org/#!api=gtk+-3.0/Gtk.License;
48 | // For elementary GPL3 is the default one,
49 | // it’s a good idea to use it
50 | about_license_type = License.GPL_3_0;
51 | }
52 |
53 | public Hello (){
54 | Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
55 | }
56 |
57 | public override void activate (){
58 | if (this.main_window == null)
59 | build_and_run ();
60 | }
61 |
62 | public void build_and_run (){
63 | this.main_window = new Window ();
64 | this.main_window.set_default_size (320, 75);
65 | this.main_window.set_application (this);
66 | this.main_window.window_position = WindowPosition.CENTER;
67 | Gtk.Box container = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
68 |
69 | this.toolbar = new Gtk.Toolbar();
70 | var menu = new Gtk.Menu();
71 | var appmenu = this.create_appmenu (menu);
72 | this.toolbar.add(appmenu);
73 | container.add(this.toolbar);
74 |
75 | var button = new Button.with_label ("Click me!");
76 | button.clicked.connect (() => {
77 | button.label = "Thank you";
78 | });
79 |
80 | this.content = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
81 | container.add(content);
82 | container.add(button);
83 | this.main_window.add(container);
84 | this.main_window.show_all ();
85 | }
86 |
87 | }
88 |
89 | }
90 |
91 | public static int main (string [] args){
92 | Gtk.init (ref args);
93 | var hello = new Hello.Hello ();
94 | return hello.run (args);
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/src/ui/welcome_screen/create_project_packages.vala:
--------------------------------------------------------------------------------
1 | using Gtk;
2 |
3 | namespace WelcomeScreen {
4 | protected class CreateProjectPackages : TemplatePageWithHeader {
5 | public CreateProjectPackages (ref ProjectCreationInfo info)
6 | {
7 | this.info = info;
8 | listmodel = new Gtk.ListStore (3, typeof (bool), typeof (string), typeof (string));
9 | go_to_next_clicked.connect (() => {
10 | var pkgs = new string[0];
11 | listmodel.foreach((m,p,i) => {
12 | Value v1, v2;
13 | m.get_value(i, 0, out v1);
14 | m.get_value(i, 1, out v2);
15 | if((bool)v1)
16 | pkgs += (string)v2;
17 | return false;
18 | });
19 | this.info.packages = pkgs;
20 | });
21 | }
22 |
23 | private ProjectCreationInfo info;
24 | Gtk.ListStore listmodel;
25 |
26 | protected override void clean_up(){}
27 |
28 |
29 |
30 | protected override Gtk.Widget build_inner_widget() {
31 | heading = _("Choose packages");
32 | description = _("packages for current project");
33 |
34 | var frame = new Frame (null);
35 | var sw = new ScrolledWindow (null, null);
36 | frame.add (sw);
37 | var tree_view = new TreeView();
38 | tree_view.set_model (listmodel);
39 | CellRendererToggle toggle = new CellRendererToggle();
40 | toggle.toggled.connect ((toggle, path) => {
41 | TreePath tree_path = new TreePath.from_string (path);
42 | TreeIter iter;
43 | listmodel.get_iter (out iter, tree_path);
44 | listmodel.set (iter, 0, !toggle.active);
45 | });
46 | TreeViewColumn column = new TreeViewColumn();
47 | column.pack_start (toggle, false);
48 | column.add_attribute (toggle, "active", 0);
49 | tree_view.append_column (column);
50 |
51 | CellRendererText text = new CellRendererText();
52 | column = new TreeViewColumn();
53 | column.title = "Package";
54 | column.pack_start (text, true);
55 | column.add_attribute (text, "text", 1);
56 | tree_view.append_column (column);
57 |
58 | CellRendererText desc_text = new CellRendererText();
59 | column = new TreeViewColumn();
60 | column.title = "Description";
61 | column.pack_start (desc_text, true);
62 | column.add_attribute (desc_text, "text", 2);
63 | tree_view.append_column (column);
64 |
65 | var pkg_infos = list_all_pkg_config();
66 |
67 | pkg_infos.foreach (entry => {
68 | if (info.template.vproject.packages.has_key (entry.key))
69 | return true;
70 | TreeIter iter;
71 | listmodel.append (out iter);
72 | listmodel.set (iter, 0, false, 1, entry.key, 2, entry.value);
73 | return true;
74 | });
75 | sw.add (tree_view);
76 | return frame;
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/guanako/guanako_refactoring.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * guanako/guanako_refactoring.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 | using Vala;
20 |
21 | namespace Guanako.Refactoring {
22 | public static Symbol? find_declaration (Project project, SourceFile sf, int line, int col) {
23 |
24 | var smb = project.get_symbol_at_pos(sf, line, col);
25 | if (smb is Vala.Subroutine) {
26 | var sr = smb as Vala.Subroutine;
27 | Vala.Statement st = null;
28 | int old_depth = -1;
29 | Guanako.iter_subroutine (sr, (stmt, depth)=>{
30 | if (!Guanako.inside_source_ref (sf, line, col, stmt.source_reference))
31 | return Guanako.IterCallbackReturns.CONTINUE; //TODO: abort here?
32 | if (depth > old_depth) {
33 | old_depth = depth;
34 | st = stmt;
35 | }
36 | return Guanako.IterCallbackReturns.CONTINUE;
37 | });
38 | if (st != null) {
39 | Vala.Expression expression = null;
40 | old_depth = 0;
41 | Guanako.iter_expressions (st, (expr, depth)=>{
42 | if (!Guanako.inside_source_ref (sf, line, col, expr.source_reference))
43 | return Guanako.IterCallbackReturns.CONTINUE;
44 | if (depth >= old_depth) {
45 | old_depth = depth;
46 | expression = expr;
47 | }
48 | return Guanako.IterCallbackReturns.CONTINUE;
49 | });
50 | if (expression != null)
51 | return expression.symbol_reference;
52 | }
53 | }
54 | return null;
55 | }
56 | public static SourceReference[] find_references (Project project, SourceFile sf, Symbol symbol) {
57 | var ret = new SourceReference[0];
58 | foreach (SourceFile file in project.sourcefiles)
59 | foreach (CodeNode node in file.get_nodes())
60 | Guanako.iter_symbol ((Symbol)node, (smb, depth) => {
61 | if (smb is Subroutine) {
62 | //stdout.printf("Checking subroutine:" + smb.name + "\n");
63 | Guanako.iter_subroutine ((Subroutine)smb, (stmt, depth)=>{
64 |
65 | Guanako.iter_expressions (stmt, (expr, depth)=>{
66 | if (expr.symbol_reference == symbol)
67 | if (expr.source_reference != null)
68 | ret += expr.source_reference;
69 | return Guanako.IterCallbackReturns.CONTINUE;
70 | });
71 |
72 | return Guanako.IterCallbackReturns.CONTINUE;
73 | });
74 | }
75 | return Guanako.IterCallbackReturns.CONTINUE;
76 | });
77 |
78 | return ret;
79 | }
80 | }
81 |
82 | // vim: set ai ts=4 sts=4 et sw=4
83 |
--------------------------------------------------------------------------------
/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # tests/CMakeLists.txt
3 | # Copyright (C) 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 |
20 | cmake_minimum_required(VERSION "2.8.4")
21 |
22 | set(extra_srcfiles
23 | "../src/project/package_management.vala"
24 | "../src/project/project_file.vala"
25 | "../src/common/args.vala"
26 | "../src/common/common.vala"
27 | )
28 | set(required_pkgs
29 | "gee-0.8"
30 | "gio-2.0"
31 | "libxml-2.0"
32 | "guanako"
33 | "posix {nocheck}"
34 | )
35 | set(vapifiles
36 | "../vapi/config.vapi"
37 | )
38 | set(datadirs
39 | "projectfile"
40 | )
41 |
42 | if(GUANAKO)
43 | list(REMOVE_ITEM required_pkgs "guanako")
44 | list(APPEND vapifiles "${CMAKE_BINARY_DIR}/guanako/guanako.vapi")
45 | list(APPEND required_pkgs "libvala-${VALA_SHORTVER}")
46 | endif()
47 |
48 | # Custom library version checks.
49 | set(valac_cond)
50 | find_package(PkgConfig)
51 | # Unix or Windows
52 | if(WIN32)
53 | list(APPEND valac_cond "-D;WIN32")
54 | elseif(UNIX)
55 | list(APPEND valac_cond "-D;UNIX")
56 | else()
57 | list(APPEND valac_cond "-D;NOT_UNIX")
58 | list(APPEND valac_cond "-D;NOT_WIN32")
59 | endif()
60 | # glib-2.0
61 | pkg_check_modules(GLIB2.0 REQUIRED "glib-2.0")
62 |
63 | set(default_vala_flags
64 | "--thread"
65 | "--target-glib" "${GLIB2.0_VERSION}"
66 | "--enable-experimental"
67 | "--fatal-warnings"
68 | ${valac_cond}
69 | )
70 |
71 | include(ValaPkgs)
72 | vala_pkgs(VALA_C
73 | PACKAGES
74 | ${required_pkgs}
75 | SRCFILES
76 | "*.vala"
77 | ${extra_srcfiles}
78 | VAPIS
79 | ${vapifiles}
80 | OPTIONS
81 | ${default_vala_flags}
82 | )
83 |
84 | # Set common C-macros.
85 | add_definitions(-DPACKAGE_NAME="${project_name}")
86 | add_definitions(-DPACKAGE_VERSION="${${project_name}_VERSION}")
87 | add_definitions(-DGETTEXT_PACKAGE="${project_name_lower}")
88 | add_definitions(-DPACKAGE_DATA_DIR="${install_prefix}${datadir}")
89 | add_definitions(-DLOCALE_DIR="${install_prefix}${localedir}")
90 | add_definitions(-DPIXMAP_DIR="${install_prefix}${pixdir}")
91 | add_definitions(-DVALA_VERSION="${VALA_SHORTVER}")
92 |
93 | add_executable("tests" ${VALA_C})
94 | target_link_libraries("tests" ${PROJECT_LDFLAGS})
95 | add_definitions(${PROJECT_C_FLAGS})
96 | if(GUANAKO)
97 | include_directories("${PROJECT_BINARY_DIR}/guanako")
98 | target_link_libraries("tests" "guanako")
99 | endif()
100 | add_dependencies("tests" "guanako" "valama")
101 |
102 | copy_dirs(
103 | TARGET
104 | "copy_datafiles"
105 | DIRS
106 | ${datadirs}
107 | )
108 |
109 | add_custom_command(
110 | OUTPUT
111 | "tests.stamp"
112 | COMMAND
113 | "tests"
114 | COMMAND
115 | "${CMAKE_COMMAND}" -E touch "tests.stamp"
116 | DEPENDS
117 | "tests"
118 | "copy_datafiles"
119 | COMMENT
120 | "Run tests"
121 | VERBATIM
122 | )
123 |
124 | add_custom_target("run_tests"
125 | ALL
126 | DEPENDS
127 | "tests.stamp"
128 | )
129 |
130 | # enable_testing()
131 | # add_test(
132 | # NAME
133 | # "Run\\ all\\ tests"
134 | # COMMAND
135 | # "tests"
136 | # )
137 |
138 | # vim: set ai ts=2 sts=2 et sw=2
139 |
--------------------------------------------------------------------------------
/src/common/args.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/common/args.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | namespace Args {
23 | public bool version = false;
24 | public string? syntaxfile = null;
25 | [CCode (array_length = false, array_null_terminated = true)]
26 | public string[]? templatesdirs = null;
27 | [CCode (array_length = false, array_null_terminated = true)]
28 | public string[]? buildsystemsdirs = null;
29 | public int debuglevel = 0;
30 | public bool forceold = false;
31 | public string? layoutfile = null;
32 | public bool reset_layout = false;
33 | [CCode (array_length = false, array_null_terminated = true)]
34 | public string[]? projectfiles = null;
35 |
36 | private const OptionEntry[] options = {
37 | {"version", 'v', 0, OptionArg.NONE, ref version, N_("Display version number."), null},
38 | {"syntax", 0, 0, OptionArg.FILENAME, ref syntaxfile, N_("Guanako syntax file."), N_("FILE")},
39 | {"templates", 0, 0, OptionArg.FILENAME_ARRAY, ref templatesdirs, N_("Templates directory."),
40 | // TRANSLATORS: Uppercase for variables in command line options.
41 | N_("DIRECTORY")},
42 | {"buildsystems", 0, 0, OptionArg.FILENAME_ARRAY, ref buildsystemsdirs, N_("Build systems directory."), N_("DIRECTORY")},
43 | {"debug", 'd', OptionFlags.OPTIONAL_ARG, OptionArg.CALLBACK, (void*) debuglevel_parse, N_("Output debug information."), N_("[DEBUGLEVEL]")},
44 | {"force-old", 0, 0, OptionArg.NONE, ref forceold, N_("Force loading of possibly incompatible template or project files."), null},
45 | {"layout", 0, 0, OptionArg.FILENAME, ref layoutfile, N_("Path to layout file."), N_("FILE")},
46 | {"reset-layout", 0, 0, OptionArg.NONE, ref reset_layout, N_("Load default layout."), null},
47 | {"", 0, 0, OptionArg.FILENAME_ARRAY, ref projectfiles, N_("Load project from file."), N_("[FILE...]")},
48 | {null}
49 | };
50 |
51 | public int parse (string[] args) {
52 | int ret = 0;
53 |
54 | var opt_context = new OptionContext (_("- Valama: next generation Vala IDE"));
55 | opt_context.set_help_enabled (true);
56 | opt_context.add_main_entries (options, null);
57 | try {
58 | opt_context.parse (ref args);
59 | } catch (OptionError e) {
60 | errmsg (_("Error: %s\n"), e.message);
61 | errmsg (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
62 | return 1;
63 | }
64 |
65 | if (version) {
66 | msg ("%s: %s\n", Config.PACKAGE_NAME, Config.PACKAGE_VERSION);
67 | ret = -1;
68 | }
69 |
70 | return ret;
71 | }
72 |
73 | internal bool debuglevel_parse (string name, string? val, ref OptionError error) throws OptionError {
74 | if (val == null) {
75 | debuglevel = 1;
76 | return true;
77 | }
78 | var re = /^[+]?[0-9]+$/;
79 | if (!re.match (val, 0, null))
80 | throw new OptionError.BAD_VALUE (_("'%s' not a positive number"), val);
81 | debuglevel = int.parse (val);
82 | return true;
83 | }
84 | }
85 |
86 | // vim: set ai ts=4 sts=4 et sw=4
87 |
--------------------------------------------------------------------------------
/guanako/data/guanako.lang:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 | #
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
49 |
50 |
51 | \b^init_[a-zA-Z_]+[ \t]*$
52 |
53 |
54 |
55 | \b^[A-Z][a-zA-Z_]+[ \t]*(:[ \t]*[a-zA-Z_]+[ \t]*)?$
56 |
57 |
58 |
59 |
60 | [\|]
61 |
62 |
63 |
64 | \??[_]+
65 |
66 |
67 |
68 | \{\}\>?
69 |
70 |
71 |
72 | \??\$[a-zA-Z0-9_]+
73 |
74 |
75 |
76 | \*word
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/src/ui/glade_viewer.vala:
--------------------------------------------------------------------------------
1 | using Gtk;
2 | using Glade;
3 | using Gdl;
4 |
5 | public class GladeViewer : UiElement
6 | {
7 | Box vbox;
8 |
9 | Project glade_project;
10 | Inspector inspector;
11 | DesignView design_view;
12 | Palette palette;
13 | Editor editor;
14 | SignalEditor signals;
15 | DockItem dv_item;
16 | string project_path;
17 |
18 | public GladeViewer()
19 | {
20 | vbox = new Box (Orientation.VERTICAL, 0);
21 | App.set_window (vbox);
22 | glade_project = new Project();
23 | App.add_project (glade_project);
24 | inspector = new Inspector();
25 | palette = new Palette();
26 | editor = new Editor();
27 | signals = new SignalEditor();
28 | inspector.selection_changed.connect (() => {
29 | var w = inspector.get_selected_items().nth_data (0);
30 | w.show();
31 | editor.load_widget (w);
32 | });
33 | inspector.item_activated.connect (() => {
34 | var w = inspector.get_selected_items().nth_data (0);
35 | w.show();
36 | editor.load_widget (w);
37 | signals.load_widget (w);
38 | });
39 | var dock = new Dock();
40 | var bar = new DockBar (dock);
41 | var toolbar = new Toolbar ();
42 | toolbar.get_style_context().add_class (STYLE_CLASS_PRIMARY_TOOLBAR);
43 | var btn_save = new ToolButton (null, null);
44 | btn_save.icon_name = "document-save";
45 | btn_save.tooltip_text = "save this UI";
46 | btn_save.clicked.connect (() => {
47 | try {
48 | glade_project.save (project_path);
49 | } catch {
50 |
51 | }
52 | });
53 | toolbar.add (btn_save);
54 | vbox.pack_start (toolbar, false, true, 0);
55 | var box = new Box (Orientation.HORIZONTAL, 0);
56 | box.pack_start (bar, false, false, 0);
57 | box.pack_end (dock, true, true, 0);
58 | vbox.pack_start (box);
59 | var item1 = new DockItem ("palette", "Palette", DockItemBehavior.NORMAL);
60 | var item2 = new DockItem ("editor", "Editor", DockItemBehavior.NORMAL);
61 | dv_item = new DockItem ("designview", "Design View", DockItemBehavior.NORMAL);
62 | var item4 = new DockItem.with_stock ("inspector", "Inspector", "gtk-find", DockItemBehavior.NORMAL);
63 | var item5 = new DockItem.with_stock ("Signals", "Signals", "gtk-find", DockItemBehavior.NORMAL);
64 | item1.add (palette);
65 | item2.add (editor);
66 | item4.add (inspector);
67 | item5.add (signals);
68 | dock.add_item (item1, DockPlacement.TOP);
69 | dock.add_item (item2, DockPlacement.BOTTOM);
70 | dock.add_item (dv_item, DockPlacement.RIGHT);
71 | dock.add_item (item4, DockPlacement.LEFT);
72 | dock.add_item (item5, DockPlacement.LEFT);
73 | dv_item.dock_to (item1, DockPlacement.TOP, -1);
74 | item1.show();
75 | item2.show();
76 | item4.show();
77 | item5.show();
78 | palette.show();
79 | editor.show();
80 | inspector.show();
81 | signals.show();
82 | project.guanako_update_finished.connect (build);
83 | widget = vbox;
84 | }
85 |
86 | public void load (string path)
87 | {
88 | if (glade_project != null)
89 | App.remove_project (glade_project);
90 | project_path = path;
91 | glade_project = Project.load (path);
92 | App.add_project (glade_project);
93 | inspector.project = glade_project;
94 | palette.project = glade_project;
95 | design_view = new DesignView (glade_project);
96 | dv_item.set_child (design_view);
97 | dv_item.show();
98 | design_view.show();
99 | vbox.show_all();
100 | }
101 |
102 | protected override void build ()
103 | {
104 |
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/ui/welcome_screen/create_project_buildsystem.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/welcome_screen/create_project_buildsystem.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | // Project creation: Name and location
21 |
22 | using Gtk;
23 |
24 | namespace WelcomeScreen {
25 |
26 | protected class CreateProjectBuildsystem : TemplatePageWithHeader {
27 | public CreateProjectBuildsystem (ref ProjectCreationInfo info) {
28 | this.info = info;
29 | check_btn = new Gtk.CheckButton.with_label (_("make library"));
30 | go_to_next_clicked.connect (() => {
31 | switch (bs) {
32 | case "plain":
33 | this.info.template.vproject.builder = new BuilderPlain (check_btn.active);
34 | break;
35 | case "cmake":
36 | this.info.template.vproject.builder = new BuilderCMake(check_btn.active);
37 | break;
38 | case "autotools":
39 | this.info.template.vproject.builder = new BuilderAutotools(check_btn.active);
40 | break;
41 | default:
42 | this.info.template.vproject.builder = new BuilderPlain (check_btn.active);
43 | bug_msg (_("Buildsystem '%s' not recognized."), bs);
44 | break;
45 | }
46 | this.info.buildsystem = this.info.template.vproject.builder.get_name_id();
47 | this.info.make_library = check_btn.active;
48 | });
49 | }
50 | private ProjectCreationInfo info;
51 | private string bs;
52 | Gtk.CheckButton check_btn;
53 |
54 | protected override void clean_up() {
55 |
56 | }
57 | protected override Gtk.Widget build_inner_widget() {
58 | heading = _("Choose Buildsystem");
59 | description = _("Choose a buildsystem for current project.");
60 | BuildSystemTemplate.load_buildsystems (true);
61 | var frame = new Frame(null);
62 | var box = new Gtk.Box (Orientation.VERTICAL, 20);
63 | var list = new Gtk.ListBox ();
64 | list.row_activated.connect (row => {
65 | bs = (row.get_child() as Gtk.Label).label;
66 | });
67 | var row = new ListBoxRow();
68 | var lbl = new Label ("plain");
69 | row.add (lbl);
70 | list.add (row);
71 | ListBoxRow? row_selected = null;
72 | buildsystems.foreach (entry => {
73 | row = new Gtk.ListBoxRow();
74 | lbl = new Gtk.Label (entry.key);
75 | row.add (lbl);
76 | list.add (row);
77 | if (row_selected == null && entry.key == info.template.vproject.buildsystem) {
78 | row_selected = row;
79 | bs = entry.key;
80 | }
81 | return true;
82 | });
83 | list.select_row (row_selected);
84 | box.pack_start (list);
85 | box.pack_start (check_btn);
86 | check_btn.active = info.template.vproject.library;
87 | frame.add(box);
88 | var align = new Alignment (0.5f, 0.1f, 1.0f, 0.0f);
89 | align.add (frame);
90 | return align;
91 | }
92 | }
93 | }
94 |
95 | // vim: set ai ts=4 sts=4 et sw=4
96 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Valama #
2 |
3 | [](https://gitter.im/Valama/valama?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4 |
5 | #### *The next gen Vala IDE.* ####
6 |
7 | Discussion and support on IRC channel [#valama](http://webchat.freenode.net/?channels=#valama) (freenode).
8 |
9 | 
10 |
11 | [](https://travis-ci.org/Valama/valama)
12 |
13 | ## Manual installation ##
14 |
15 | ### Requirements
16 | * cmake (>= 2.8.4)
17 | * valac (>= 0.20), valac-0.24 or valac-0.26 is recommended
18 | * pkg-config
19 | * gobject-2.0
20 | * glib-2.0
21 | * gio-2.0
22 | * gladeui-2.0 (for glade files)
23 | * gee-0.8 (>= 0.10.5)
24 | * at least libvala-0.20, libvala-0.24 or libvala-0.26 is recommended
25 | * gdk-3.0
26 | * gdl-3.0 (>= 3.8), 3.10 or newer is recommended
27 | * gtk+-3.0 (>= 3.10)
28 | * gtksourceview-3.0 (>= 3.10), 3.12 or newer is recommended
29 | * clutter-gtk-1.0
30 | * libxml-2.0
31 | * gthread-2.0
32 | * webkit2gtk-3.0
33 | * Intltool (required to generate .desktop and .xml files with localization)
34 | * GNOME desktop icon theme (symbolic icons) (only required to display icons properly) (recommended)
35 | * rsvg-convert/imagemagick (only required to generate application icons from svg template) (recommended)
36 |
37 | On Debian based systems install following packages:
38 |
39 | sudo apt-get install build-essential valac-0.24 libvala-0.24-dev cmake pkg-config libgtksourceview-3.0-dev libgee-0.8-dev libxml2-dev libgdl-3-dev libgladeui-dev libclutter-gtk-1.0-dev libwebkit2gtk-3.0-dev intltool gnome-icon-theme-symbolic librsvg2-bin
40 |
41 | For a newer Vala version on Ubuntu based systems, you have to include the [Vala Team PPA](https://launchpad.net/~vala-team/+archive/ppa) first.
42 |
43 | On Fedora based systems install following packages:
44 |
45 | sudo yum install vala-devel cmake gtksourceview3-devel glade3-libgladeui-devel glade-devel libgee-devel libxml2-devel libgdl-devel clutter-gtk-devel webkitgtk-devel webkitgtk3-devel intltool gnome-icon-theme-symbolic librsvg2 librsvg2-tools
46 |
47 | #### Ubuntu PPA ####
48 |
49 | Activate [Valama daily PPA ](https://launchpad.net/~valama-dev/+archive/valama-daily) and install `valama` package.
50 |
51 |
52 | ### Building ###
53 | 1. `mkdir build && cd build`
54 | 1. `cmake ..`
55 | 1. `make -j2`
56 |
57 | ### Installation ###
58 | 1. `sudo make install`
59 | 1. `sudo ldconfig` (to update linker cache for the shared Guanako helper library)
60 |
61 | This will automatically install and compile gsettings schemas. (You can
62 | disable installtion/removal hooks during compile time with
63 | `-DPOSTINSTALL_HOOK=OFF` option.)
64 |
65 | #### Local installation ####
66 | Build Valama then run with following options directly from build directory:
67 |
68 | XDG_DATA_DIRS=".:$XDG_DATA_DIRS" LD_LIBRARY_PATH=guanako ./valama --syntax ../guanako/data/syntax --templates ../data/templates --buildsystems ../data/buildsystems [FILE]
69 |
70 | Optionally use `--layout ../data/layout.xml` to use standard layout.
71 |
72 |
73 | ## Packaging files for distributions ##
74 | To build and install Valama for your distribution look at the [packaging](https://github.com/Valama/valama/tree/packaging) branch. If you don't find your distribution there, you are welcome to contribute your packaging files to this branch (and put you work under GPL-3+).
75 |
76 |
77 | ## Contribution ##
78 | See the wiki page for some information [Wiki](https://github.com/Valama/valama/wiki) or drop in on [#valama](http://webchat.freenode.net/?channels=#valama) (irc.freenode.net).
79 |
80 | ## License ##
81 | Valama is distributed under the terms of the GNU General Public License version 3 or later and published by:
82 | * Linus Seelinger
83 | * Dominique Lasserre
84 |
85 | For a full list of all contributors see [here](https://github.com/Valama/valama/graphs/contributors) and take a look at [AUTHORS](https://github.com/Valama/valama/blob/master/AUTHORS) file.
86 |
87 | ## Credits ##
88 | element-\* icons from [Anjuta IDE](https://projects.gnome.org/anjuta/) (GPL2 licensed)
89 |
--------------------------------------------------------------------------------
/valama.vlp:
--------------------------------------------------------------------------------
1 |
2 | Valama
3 | cmake
4 |
5 | 0
6 | 1
7 | 2
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 | src
57 | src/buildsystem
58 | src/common
59 | src/dialogs
60 | src/project
61 | src/ui
62 | src/ui/welcome_screen
63 | vapi
64 |
65 |
66 | ui
67 |
68 |
69 |
70 | cmake
71 | cmake/vala
72 | po
73 |
74 |
75 | data
76 | data/buildsystems/cmake
77 | data/buildsystems/cmake/buildsystem
78 | data/buildsystems/cmake/buildsystem/cmake
79 | data/buildsystems/cmake/buildsystem/cmake/vala
80 | data/templates/clutter
81 | data/templates/clutter/template
82 | data/templates/clutter/template/src
83 | data/templates/clutter/template/vapi
84 | data/templates/plain_vala
85 | data/templates/plain_vala/template
86 | data/templates/plain_vala/template/src
87 | data/templates/plain_vala/template/vapi
88 | data/templates/simple_gtk
89 | data/templates/simple_gtk/template
90 | data/templates/simple_gtk/template/src
91 | data/templates/simple_gtk/template/vapi
92 | extravapi
93 | extravapi/gdl-3.0
94 | extravapi/gtk+-3.0
95 | extravapi/gtksourceview-3.0
96 | extravapi/webkit2gtk-3.0
97 | guanako
98 | guanako/data
99 | guanako/scanner
100 | icons
101 |
102 |
103 | AUTHORS
104 | COPYING
105 | README.md
106 | po/de.po
107 | po/fr.po
108 |
109 |
110 |
--------------------------------------------------------------------------------
/src/ui/welcome_screen/create_project_location.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/welcome_screen/create_project_location.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 |
21 | // Project creation: Name and location
22 |
23 | using Gtk;
24 |
25 | namespace WelcomeScreen {
26 |
27 | // Class to hold all information on the new project across pages
28 | protected class ProjectCreationInfo {
29 | public string name = "";
30 | public string buildsystem = "";
31 | public bool make_library = false;
32 | public string directory = "";
33 | public string[] packages = new string[0];
34 | public ProjectTemplate template;
35 | }
36 |
37 | protected class CreateProjectLocation : TemplatePageWithHeader {
38 | public CreateProjectLocation (ref ProjectCreationInfo info) {
39 | this.info = info;
40 | }
41 | private ProjectCreationInfo info;
42 | private Entry ent_pname;
43 | private FileChooserButton chooser_location;
44 | protected override void clean_up() {
45 | info.name = ent_pname.text;
46 | info.directory = Path.build_path (Path.DIR_SEPARATOR_S,
47 | chooser_location.get_filename(),
48 | ent_pname.text);
49 | }
50 | protected override Gtk.Widget build_inner_widget() {
51 | heading = _("Create project");
52 | description = _("Project settings");
53 | btn_next.sensitive = false;
54 |
55 | var frame = new Frame(null);
56 | var list = new Gtk.ListBox ();
57 | list.selection_mode = SelectionMode.NONE;
58 | list.row_selected.connect((row)=>{row.activate();}); //TODO: Possibly unnecessary in future GTK versions
59 |
60 | // Project name row
61 | var row = new ListBoxRow();
62 | var box = new Box(Orientation.HORIZONTAL, 0);
63 | var lbl_pname = new Label (_("Project name"));
64 | lbl_pname.halign = Align.START;
65 | box.pack_start (lbl_pname, true, true);
66 |
67 | var valid_chars = /^[a-z0-9.:_-]+$/i; // keep "-" at the end!
68 | ent_pname = new Entry.with_inputcheck (null, valid_chars);
69 | ent_pname.set_placeholder_text (_("project name"));
70 | ent_pname.valid_input.connect (() => {
71 | btn_next.sensitive = true;
72 | });
73 | ent_pname.invalid_input.connect (() => {
74 | btn_next.sensitive = false;
75 | });
76 | box.pack_start (ent_pname, true, true);
77 |
78 | row.add (box);
79 | standardize_listbox_row (row);
80 | list.add (row);
81 |
82 |
83 | // Project location row
84 | row = new ListBoxRow();
85 | box = new Box(Orientation.HORIZONTAL, 0);
86 | var lbl_plocation = new Label (_("Location"));
87 | lbl_plocation.halign = Align.START;
88 | box.pack_start (lbl_plocation, true, true);
89 | //TODO: Use in place dialog (FileChooserWidget).
90 | chooser_location = new FileChooserButton (_("New project location"),
91 | Gtk.FileChooserAction.SELECT_FOLDER);
92 | chooser_location.set_current_folder (Environment.get_current_dir());
93 |
94 | box.pack_start (chooser_location, true, true);
95 | row.add (box);
96 | standardize_listbox_row (row);
97 | list.add (row);
98 |
99 |
100 | frame.add(list);
101 | var align = new Alignment (0.5f, 0.1f, 1.0f, 0.0f);
102 | align.add (frame);
103 | return align;
104 | }
105 | }
106 | }
107 |
108 | // vim: set ai ts=4 sts=4 et sw=4
--------------------------------------------------------------------------------
/src/ui/build_output.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/build_output.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gtk;
21 | using Vala;
22 | using GLib;
23 |
24 | /**
25 | * Browse source code.
26 | */
27 | public class BuildOutput : UiElement {
28 | private TextView textview;
29 | private ProgressBar progressbar;
30 | private bool focused;
31 | private InfoBar info_bar;
32 | private Label info_label;
33 | private Image info_icon;
34 |
35 | public BuildOutput() {
36 | focused = false;
37 |
38 | var vbox = new Box (Orientation.VERTICAL, 0);
39 |
40 | info_bar = new InfoBar();
41 | info_bar.no_show_all = true;
42 | var content_area = (Container)info_bar.get_content_area();
43 | var info_box = new Box(Orientation.HORIZONTAL, 5);
44 | info_label = new Label("");
45 | info_icon = new Image();
46 | info_icon.icon_size = Gtk.IconSize.LARGE_TOOLBAR;
47 | info_box.pack_start (info_icon, false, true);
48 | info_box.pack_start (info_label, true, true);
49 | content_area.add (info_box);
50 | vbox.pack_start (info_bar, false, true);
51 |
52 | textview = new TextView();
53 | textview.override_font (Pango.FontDescription.from_string ("Monospace 10"));
54 | textview.editable = false;
55 | textview.wrap_mode = WrapMode.NONE;
56 |
57 | var scrw = new ScrolledWindow (null, null);
58 | scrw.add (textview);
59 | vbox.pack_start (scrw, true, true);
60 |
61 | double? prev_pos = null;
62 | textview.size_allocate.connect (() => {
63 | var adj = scrw.vadjustment;
64 | if (prev_pos == null || adj.get_value() == prev_pos)
65 | adj.set_value (adj.upper - adj.page_size);
66 | prev_pos = adj.upper - adj.page_size;
67 | });
68 |
69 | progressbar = new ProgressBar();
70 | vbox.pack_start (progressbar, false, true);
71 | progressbar.visible = false;
72 | progressbar.no_show_all = true;
73 |
74 | widget = vbox;
75 | widget.show_all();
76 |
77 | project_builder.build_started.connect ((clear) => {
78 | info_bar.no_show_all = false;
79 | info_bar.show_all();
80 | info_label.label = _("Running...");
81 | info_icon.icon_name = "system-run";
82 | info_bar.set_message_type (MessageType.INFO);
83 |
84 | if (clear) {
85 | textview.buffer.text = "";
86 | prev_pos = null;
87 | }
88 | focused = false;
89 | progressbar.visible = true;
90 | });
91 | project_builder.build_finished.connect ((success)=> {
92 | info_bar.no_show_all = false;
93 | info_bar.show_all();
94 | focused = false;
95 | progressbar.visible = false;
96 |
97 | if (success) {
98 | info_label.label = _("Succeeded");
99 | info_icon.icon_name = "gtk-ok";
100 | info_bar.set_message_type (MessageType.INFO);
101 | } else {
102 | info_label.label = _("Failed");
103 | info_icon.icon_name = "dialog-error";
104 | info_bar.set_message_type (MessageType.ERROR);
105 | }
106 | });
107 | project_builder.build_progress.connect (show_progress);
108 | project_builder.build_output.connect (show_output);
109 | }
110 |
111 | private inline void show_progress (int percent) {
112 | progressbar.fraction = percent / 100f;
113 | }
114 |
115 | private void show_output (string output) {
116 | if (!focused) {
117 | focused = true;
118 | widget_main.focus_dock_item (this.dock_item);
119 | }
120 | textview.buffer.insert_at_cursor (output, -1);
121 | }
122 |
123 | protected override void build() {}
124 | }
125 |
126 | // vim: set ai ts=4 sts=4 et sw=4
127 |
--------------------------------------------------------------------------------
/cmake/vala/ValaDocs.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/ValaDocs.cmake
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | # The valadoc_gen function generates Vala documentation from .vala and .vapi
20 | # source files. The first parameter is the project name.
21 | # Provide target 'docs' to build documentation.
22 | #
23 | # Supported sections:
24 | #
25 | # ALL (optional)
26 | # Include this target in all builds.
27 | #
28 | # INSTALLDIR (optional)
29 | # Directory where to install documentation to.
30 | # Default: ${datadir}
31 | # If ${datadir} not defined: share/${package_name_lower}
32 | # (where ${package_name_lower} is ${package_name} with letters)
33 | # If ${package_name} is not defined raise error.
34 | #
35 | # DOCDIR (optional)
36 | # Directory where to build documentation to.
37 | # Default: ${CMAKE_CURRENT_BINARY_DIR}/docs
38 | #
39 | # PACKAGES (in general mandatory)
40 | # List of all Vala packages the project depends on.
41 | #
42 | # DEFINITIONS (optional)
43 | # A list of symbols for conditional compilation.
44 | #
45 | # SRCFILES
46 | # List of all project files. Globbing is supported.
47 | #
48 | # OPTIONS (optional)
49 | # List of additional valadoc options.
50 |
51 | if(VALADOC_FOUND)
52 | function(valadoc_gen package_name)
53 | cmake_parse_arguments(ARGS "ALL" "INSTALLDIR;DOCDIR" "PACKAGES;DEFINITIONS;SRCFILES;OPTIONS" ${ARGN})
54 |
55 | if(ARGS_SRCFILES)
56 | if(ARGS_ALL)
57 | set(make_all "ALL")
58 | else()
59 | set(make_all)
60 | endif()
61 |
62 | string(TOLOWER "${package_name}" package_name_lower)
63 | if(ARGS_INSTALLDIR)
64 | set(installdir "${ARGS_DOCDIR}")
65 | elseif(datadir)
66 | set(installdir "${datadir}")
67 | elseif(package_name)
68 | set(installdir "share/${package_name_lower}")
69 | else()
70 | message(SEND_ERROR "No installation directory given.")
71 | endif()
72 |
73 | if(ARGS_DOCDIR)
74 | set(docdir "${ARGS_DOCDIR}")
75 | else()
76 | set(docdir "${CMAKE_CURRENT_BINARY_DIR}/docs")
77 | endif()
78 |
79 | set(srcfiles)
80 | set(srcfiles_abs)
81 | foreach(globexpr ${ARGS_SRCFILES})
82 | file(GLOB tmpsrcfiles ${globexpr})
83 | if(tmpsrcfiles)
84 | foreach(tmpsrcfile ${tmpsrcfiles})
85 | file(RELATIVE_PATH srcfile "${CMAKE_CURRENT_BINARY_DIR}" "${tmpsrcfile}")
86 | list(APPEND srcfiles "${srcfile}")
87 | get_filename_component(srcfile_abs "${tmpsrcfile}" ABSOLUTE)
88 | list(APPEND srcfiles_abs "${srcfile_abs}")
89 | endforeach()
90 | else()
91 | file(RELATIVE_PATH srcfile "${CMAKE_CURRENT_BINARY_DIR}" "${globexpr}")
92 | list(APPEND srcfiles "${srcfile}")
93 | get_filename_component(srcfile_abs "${globexpr}" ABSOLUTE)
94 | list(APPEND srcfiles_abs "${srcfile_abs}")
95 | endif()
96 | endforeach()
97 |
98 | set(pkg_opts)
99 | foreach(pkg ${ARGS_PACKAGES})
100 | list(APPEND pkg_opts "--pkg=${pkg}")
101 | endforeach()
102 |
103 | set(valadoc_options
104 | "-o" "${docdir}"
105 | "--package-name" "${package_name}"
106 | )
107 | foreach(def ${ARGS_DEFINITIONS})
108 | list(APPEND valadoc_options "--define=${def}")
109 | endforeach()
110 | if(ARGS_OPTIONS)
111 | list(APPEND valadoc_options ${ARGS_OPTIONS})
112 | endif()
113 |
114 | add_custom_command(
115 | OUTPUT
116 | "${docdir}/index.html"
117 | COMMAND
118 | "${CMAKE_COMMAND}" -E remove_directory "${docdir}"
119 | COMMAND
120 | "${VALADOC_EXECUTABLE}" ${srcfiles} ${pkg_opts} ${valadoc_options}
121 | DEPENDS
122 | ${srcfiles_abs}
123 | VERBATIM
124 | )
125 |
126 | add_custom_target("docs-${package_name_lower}"
127 | ${make_all}
128 | DEPENDS
129 | "${docdir}/index.html"
130 | COMMENT
131 | "Generating documentation with valadoc."
132 | )
133 |
134 | install(
135 | DIRECTORY
136 | "${docdir}"
137 | DESTINATION
138 | "${installdir}"
139 | OPTIONAL
140 | )
141 | endif()
142 | endfunction()
143 | endif()
144 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/vala/ValaDocs.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/ValaDocs.cmake
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 | ##
19 | # The valadoc_gen function generates Vala documentation from .vala and .vapi
20 | # source files. The first parameter is the project name.
21 | # Provide target 'docs' to build documentation.
22 | #
23 | # Supported sections:
24 | #
25 | # ALL (optional)
26 | # Include this target in all builds.
27 | #
28 | # INSTALLDIR (optional)
29 | # Directory where to install documentation to.
30 | # Default: ${datadir}
31 | # If ${datadir} not defined: share/${package_name_lower}
32 | # (where ${package_name_lower} is ${package_name} with letters)
33 | # If ${package_name} is not defined raise error.
34 | #
35 | # DOCDIR (optional)
36 | # Directory where to build documentation to.
37 | # Default: ${CMAKE_CURRENT_BINARY_DIR}/docs
38 | #
39 | # PACKAGES (in general mandatory)
40 | # List of all Vala packages the project depends on.
41 | #
42 | # DEFINITIONS (optional)
43 | # A list of symbols for conditional compilation.
44 | #
45 | # SRCFILES
46 | # List of all project files. Globbing is supported.
47 | #
48 | # OPTIONS (optional)
49 | # List of additional valadoc options.
50 |
51 | if(VALADOC_FOUND)
52 | function(valadoc_gen package_name)
53 | cmake_parse_arguments(ARGS "ALL" "INSTALLDIR;DOCDIR" "PACKAGES;DEFINITIONS;SRCFILES;OPTIONS" ${ARGN})
54 |
55 | if(ARGS_SRCFILES)
56 | if(ARGS_ALL)
57 | set(make_all "ALL")
58 | else()
59 | set(make_all)
60 | endif()
61 |
62 | string(TOLOWER "${package_name}" package_name_lower)
63 | if(ARGS_INSTALLDIR)
64 | set(installdir "${ARGS_DOCDIR}")
65 | elseif(datadir)
66 | set(installdir "${datadir}")
67 | elseif(package_name)
68 | set(installdir "share/${package_name_lower}")
69 | else()
70 | message(SEND_ERROR "No installation directory given.")
71 | endif()
72 |
73 | if(ARGS_DOCDIR)
74 | set(docdir "${ARGS_DOCDIR}")
75 | else()
76 | set(docdir "${CMAKE_CURRENT_BINARY_DIR}/docs")
77 | endif()
78 |
79 | set(srcfiles)
80 | set(srcfiles_abs)
81 | foreach(globexpr ${ARGS_SRCFILES})
82 | file(GLOB tmpsrcfiles ${globexpr})
83 | if(tmpsrcfiles)
84 | foreach(tmpsrcfile ${tmpsrcfiles})
85 | file(RELATIVE_PATH srcfile "${CMAKE_CURRENT_BINARY_DIR}" "${tmpsrcfile}")
86 | list(APPEND srcfiles "${srcfile}")
87 | get_filename_component(srcfile_abs "${tmpsrcfile}" ABSOLUTE)
88 | list(APPEND srcfiles_abs "${srcfile_abs}")
89 | endforeach()
90 | else()
91 | file(RELATIVE_PATH srcfile "${CMAKE_CURRENT_BINARY_DIR}" "${globexpr}")
92 | list(APPEND srcfiles "${srcfile}")
93 | get_filename_component(srcfile_abs "${globexpr}" ABSOLUTE)
94 | list(APPEND srcfiles_abs "${srcfile_abs}")
95 | endif()
96 | endforeach()
97 |
98 | set(pkg_opts)
99 | foreach(pkg ${ARGS_PACKAGES})
100 | list(APPEND pkg_opts "--pkg=${pkg}")
101 | endforeach()
102 |
103 | set(valadoc_options
104 | "-o" "${docdir}"
105 | "--package-name" "${package_name}"
106 | )
107 | foreach(def ${ARGS_DEFINITIONS})
108 | list(APPEND valadoc_options "--define=${def}")
109 | endforeach()
110 | if(ARGS_OPTIONS)
111 | list(APPEND valadoc_options ${ARGS_OPTIONS})
112 | endif()
113 |
114 | add_custom_command(
115 | OUTPUT
116 | "${docdir}/index.html"
117 | COMMAND
118 | "${CMAKE_COMMAND}" -E remove_directory "${docdir}"
119 | COMMAND
120 | "${VALADOC_EXECUTABLE}" ${srcfiles} ${pkg_opts} ${valadoc_options}
121 | DEPENDS
122 | ${srcfiles_abs}
123 | VERBATIM
124 | )
125 |
126 | add_custom_target("docs-${package_name_lower}"
127 | ${make_all}
128 | DEPENDS
129 | "${docdir}/index.html"
130 | COMMENT
131 | "Generating documentation with valadoc."
132 | )
133 |
134 | install(
135 | DIRECTORY
136 | "${docdir}"
137 | DESTINATION
138 | "${installdir}"
139 | OPTIONAL
140 | )
141 | endif()
142 | endfunction()
143 | endif()
144 |
--------------------------------------------------------------------------------
/guanako/reporter.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * guanako/reporter.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 | using Vala;
22 |
23 | namespace Guanako {
24 | [Flags]
25 | public enum ReportType {
26 | ERROR,
27 | WARNING,
28 | DEPRECATED,
29 | EXPERIMENTAL,
30 | NOTE;
31 |
32 | public const ReportType ALL = ERROR | WARNING | DEPRECATED | EXPERIMENTAL | NOTE;
33 |
34 | public string? to_string() {
35 | switch (this) {
36 | case ERROR:
37 | return _("Error");
38 | case WARNING:
39 | return _("Warning");
40 | case DEPRECATED:
41 | return _("Deprecated");
42 | case EXPERIMENTAL:
43 | return _("Experimental");
44 | case NOTE:
45 | return _("Note");
46 | default:
47 | assert_not_reached();
48 | }
49 | }
50 | }
51 |
52 | public class Reporter : Report {
53 | public virtual Gee.ArrayList errlist { get; protected set; }
54 | private bool general_error = false;
55 |
56 | public class Error : Object {
57 | public SourceReference source;
58 | public string message;
59 | public ReportType type;
60 |
61 | public Error (SourceReference source, string message, ReportType type) {
62 | this.source = source;
63 | this.message = message;
64 | this.type = type;
65 | }
66 | }
67 |
68 | construct {
69 | errlist = new Gee.ArrayList();
70 | errors = 0;
71 | warnings = 0;
72 | }
73 |
74 | public void reset_file (string filename) {
75 | var errlist_new = new Gee.ArrayList();;
76 | foreach (var err in errlist)
77 | if (err.source.file.filename == filename) {
78 | switch (err.type) {
79 | case ReportType.DEPRECATED:
80 | case ReportType.EXPERIMENTAL:
81 | case ReportType.WARNING:
82 | --warnings;
83 | break;
84 | case ReportType.ERROR:
85 | --errors;
86 | break;
87 | case ReportType.NOTE:
88 | break;
89 | default:
90 | assert_not_reached();
91 | }
92 | } else
93 | errlist_new.add (err);
94 | errlist = errlist_new;
95 | }
96 |
97 | protected virtual inline void show_note (SourceReference? source, string message) {}
98 | protected override void note (SourceReference? source, string message) {
99 | show_note (source, message);
100 | if (source == null)
101 | return;
102 | errlist.add (new Error (source, message, ReportType.NOTE));
103 | }
104 |
105 | protected virtual inline void show_deprecated (SourceReference? source, string message) {}
106 | protected override void depr (SourceReference? source, string message) {
107 | show_deprecated (source, message);
108 | if (source == null)
109 | return;
110 | ++warnings;
111 | errlist.add (new Error (source, message, ReportType.DEPRECATED));
112 | }
113 |
114 | protected virtual inline void show_experimental (SourceReference? source, string message) {}
115 | protected virtual inline void show_warning (SourceReference? source, string message) {}
116 | protected override void warn (SourceReference? source, string message) {
117 | ReportType type;
118 | if (message.has_suffix ("are experimental")) {
119 | show_experimental (source, message);
120 | type = ReportType.EXPERIMENTAL;
121 | } else {
122 | show_warning (source, message);
123 | type = ReportType.WARNING;
124 | }
125 | if (source == null)
126 | return;
127 | ++warnings;
128 | errlist.add (new Error (source, message, type));
129 | }
130 |
131 | protected virtual inline void show_error (SourceReference? source, string message) {}
132 | protected override void err (SourceReference? source, string message) {
133 | show_error (source, message);
134 | if (source == null) {
135 | general_error = true;
136 | return;
137 | }
138 | ++errors;
139 | errlist.add (new Error (source, message, ReportType.ERROR));
140 | }
141 | }
142 | }
143 |
144 | // vim: set ai ts=4 sts=4 et sw=4
145 |
--------------------------------------------------------------------------------
/cmake/vala/FindVala.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/FindVala.cmake
3 | #
4 | ##
5 | # Find module for the Vala compiler (valac)
6 | #
7 | # This module determines whether a Vala compiler is installed on the current
8 | # system and where its executable is.
9 | #
10 | # Call the module using "find_package(Vala) from within your CMakeLists.txt.
11 | #
12 | # The following variables will be set after an invocation:
13 | #
14 | # VALA_FOUND Whether the vala compiler has been found or not
15 | # VALA_EXECUTABLE Full path to the valac executable if it has been found
16 | # VALA_VERSION Version number of the available valac
17 | #
18 | # VALA_SHORTVER Short version of valac (major.minor). Round up development
19 | # versions. E.g. 0.19.1 -> 0.20, 0.20.1 -> 0.20
20 | # VALA_LIBPKG Name of libvala library (libvala-${VALA_SHORTVER}).
21 | # VALA_VAPIDIR Vapi directory path.
22 | # VALA_DATADIR Path to libvala data directory. E.g. /usr/share/libvala-0.20
23 | # VALA_VAPIGEN Path to vapigen executable.
24 | # VALA_GEN_INTROSPECT Path to version specific gen-introspect executable.
25 | # VALA_VALA_GEN_INTROSPECT Path to version independent gen-introspect
26 | # executable.
27 | #
28 | ##
29 |
30 | # Copyright (C) 2013, Valama development team
31 | #
32 | # Valama is free software: you can redistribute it and/or modify it
33 | # under the terms of the GNU General Public License as published by the
34 | # Free Software Foundation, either version 3 of the License, or
35 | # (at your option) any later version.
36 | #
37 | # Valama is distributed in the hope that it will be useful, but
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
40 | # See the GNU General Public License for more details.
41 | #
42 | # You should have received a copy of the GNU General Public License along
43 | # with this program. If not, see .
44 | #
45 | ##
46 | # Copyright 2009-2010 Jakob Westhoff. All rights reserved.
47 | # Copyright 2010-2011 Daniel Pfeifer
48 | #
49 | # Redistribution and use in source and binary forms, with or without
50 | # modification, are permitted provided that the following conditions are met:
51 | #
52 | # 1. Redistributions of source code must retain the above copyright notice,
53 | # this list of conditions and the following disclaimer.
54 | #
55 | # 2. Redistributions in binary form must reproduce the above copyright notice,
56 | # this list of conditions and the following disclaimer in the documentation
57 | # and/or other materials provided with the distribution.
58 | #
59 | # THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
60 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
61 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
62 | # EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
63 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
64 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
65 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
66 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
67 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
68 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 | #
70 | # The views and conclusions contained in the software and documentation are those
71 | # of the authors and should not be interpreted as representing official policies,
72 | # either expressed or implied, of Jakob Westhoff
73 | ##
74 |
75 | # Search for the valac executable in the usual system paths.
76 | find_program(VALA_EXECUTABLE NAMES "valac" "valac-0.30" "valac-0.28" "valac-0.26" "valac-0.24" "valac-0.22" "valac-0.20")
77 | mark_as_advanced(VALA_EXECUTABLE)
78 |
79 | # Determine the valac version
80 | if(VALA_EXECUTABLE)
81 | execute_process(
82 | COMMAND
83 | "${VALA_EXECUTABLE}" "--version"
84 | OUTPUT_VARIABLE
85 | VALA_VERSION
86 | OUTPUT_STRIP_TRAILING_WHITESPACE
87 | )
88 | string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
89 | string(REPLACE "." ";" VALA_LIST "${VALA_VERSION}")
90 | list(GET VALA_LIST 0 maj_ver)
91 | list(GET VALA_LIST 1 min_ver)
92 | list(GET VALA_LIST 2 rev_ver)
93 | math(EXPR is_odd "${min_ver} % 2")
94 | list(LENGTH VALA_LIST len)
95 | if((${is_odd} EQUAL 1))
96 | math(EXPR min_ver "${min_ver} + 1")
97 | elseif(len GREATER 3)
98 | math(EXPR min_ver "${min_ver} + 2")
99 | endif()
100 | set(VALA_SHORTVER "${maj_ver}.${min_ver}" CACHE INTERNAL "")
101 | if(NOT "${maj_ver}" STREQUAL "" AND NOT "${min_ver}" STREQUAL "")
102 | set(VALA_LIBPKG "libvala-${VALA_SHORTVER}" CACHE INTERNAL "")
103 |
104 | find_package(PkgConfig)
105 | pkg_check_modules("VALA" REQUIRED "${VALA_LIBPKG}")
106 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VAPIDIR "" "--variable=vapidir")
107 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" DATADIR "" "--variable=datadir")
108 | set(VALA_DATADIR "${VALA_DATADIR}/vala" CACHE INTERNAL "")
109 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VAPIGEN "" "--variable=vapigen")
110 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" GEN_INTROSPECT "" "--variable=gen_introspect")
111 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VALA_GEN_INTROSPECT "" "--variable=vala_gen_introspect")
112 | endif()
113 | endif()
114 |
115 | # Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
116 | # Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
117 | # VALA_EXECUTABLE etc. are set)
118 |
119 | include(FindPackageHandleStandardArgs)
120 | find_package_handle_standard_args(Vala
121 | REQUIRED_VARS
122 | VALA_EXECUTABLE
123 | VALA_SHORTVER
124 | VALA_LIBPKG
125 | VALA_VAPIDIR
126 | VALA_DATADIR
127 | VALA_VAPIGEN
128 | VALA_GEN_INTROSPECT
129 | VALA_VALA_GEN_INTROSPECT
130 | VERSION_VAR
131 | VALA_VERSION
132 | )
133 |
134 | # vim: set ai ts=2 sts=2 et sw=2
135 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/cmake/vala/FindVala.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # cmake/vala/FindVala.cmake
3 | #
4 | ##
5 | # Find module for the Vala compiler (valac)
6 | #
7 | # This module determines whether a Vala compiler is installed on the current
8 | # system and where its executable is.
9 | #
10 | # Call the module using "find_package(Vala) from within your CMakeLists.txt.
11 | #
12 | # The following variables will be set after an invocation:
13 | #
14 | # VALA_FOUND Whether the vala compiler has been found or not
15 | # VALA_EXECUTABLE Full path to the valac executable if it has been found
16 | # VALA_VERSION Version number of the available valac
17 | #
18 | # VALA_SHORTVER Short version of valac (major.minor). Round up development
19 | # versions. E.g. 0.19.1 -> 0.20, 0.20.1 -> 0.20
20 | # VALA_LIBPKG Name of libvala library (libvala-${VALA_SHORTVER}).
21 | # VALA_VAPIDIR Vapi directory path.
22 | # VALA_DATADIR Path to libvala data directory. E.g. /usr/share/libvala-0.20
23 | # VALA_VAPIGEN Path to vapigen executable.
24 | # VALA_GEN_INTROSPECT Path to version specific gen-introspect executable.
25 | # VALA_VALA_GEN_INTROSPECT Path to version independent gen-introspect
26 | # executable.
27 | #
28 | ##
29 |
30 | # Copyright (C) 2013, Valama development team
31 | #
32 | # Valama is free software: you can redistribute it and/or modify it
33 | # under the terms of the GNU General Public License as published by the
34 | # Free Software Foundation, either version 3 of the License, or
35 | # (at your option) any later version.
36 | #
37 | # Valama is distributed in the hope that it will be useful, but
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
40 | # See the GNU General Public License for more details.
41 | #
42 | # You should have received a copy of the GNU General Public License along
43 | # with this program. If not, see .
44 | #
45 | ##
46 | # Copyright 2009-2010 Jakob Westhoff. All rights reserved.
47 | # Copyright 2010-2011 Daniel Pfeifer
48 | #
49 | # Redistribution and use in source and binary forms, with or without
50 | # modification, are permitted provided that the following conditions are met:
51 | #
52 | # 1. Redistributions of source code must retain the above copyright notice,
53 | # this list of conditions and the following disclaimer.
54 | #
55 | # 2. Redistributions in binary form must reproduce the above copyright notice,
56 | # this list of conditions and the following disclaimer in the documentation
57 | # and/or other materials provided with the distribution.
58 | #
59 | # THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
60 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
61 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
62 | # EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
63 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
64 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
65 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
66 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
67 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
68 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 | #
70 | # The views and conclusions contained in the software and documentation are those
71 | # of the authors and should not be interpreted as representing official policies,
72 | # either expressed or implied, of Jakob Westhoff
73 | ##
74 |
75 | # Search for the valac executable in the usual system paths.
76 | find_program(VALA_EXECUTABLE NAMES "valac" "valac-0.26" "valac-0.24" "valac-0.22" "valac-0.20")
77 | mark_as_advanced(VALA_EXECUTABLE)
78 |
79 | # Determine the valac version
80 | if(VALA_EXECUTABLE)
81 | execute_process(
82 | COMMAND
83 | "${VALA_EXECUTABLE}" "--version"
84 | OUTPUT_VARIABLE
85 | VALA_VERSION
86 | OUTPUT_STRIP_TRAILING_WHITESPACE
87 | )
88 | string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
89 | string(REPLACE "." ";" VALA_LIST "${VALA_VERSION}")
90 | list(GET VALA_LIST 0 maj_ver)
91 | list(GET VALA_LIST 1 min_ver)
92 | list(GET VALA_LIST 2 rev_ver)
93 | math(EXPR is_odd "${min_ver} % 2")
94 | list(LENGTH VALA_LIST len)
95 | if((${is_odd} EQUAL 1))
96 | math(EXPR min_ver "${min_ver} + 1")
97 | elseif(len GREATER 3)
98 | math(EXPR min_ver "${min_ver} + 2")
99 | endif()
100 | set(VALA_SHORTVER "${maj_ver}.${min_ver}" CACHE INTERNAL "")
101 | if(NOT "${maj_ver}" STREQUAL "" AND NOT "${min_ver}" STREQUAL "")
102 | set(VALA_LIBPKG "libvala-${VALA_SHORTVER}" CACHE INTERNAL "")
103 |
104 | find_package(PkgConfig)
105 | pkg_check_modules("VALA" REQUIRED "${VALA_LIBPKG}")
106 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VAPIDIR "" "--variable=vapidir")
107 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" DATADIR "" "--variable=datadir")
108 | set(VALA_DATADIR "${VALA_DATADIR}/vala" CACHE INTERNAL "")
109 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VAPIGEN "" "--variable=vapigen")
110 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" GEN_INTROSPECT "" "--variable=gen_introspect")
111 | _pkgconfig_invoke("${VALA_LIBPKG}" "VALA" VALA_GEN_INTROSPECT "" "--variable=vala_gen_introspect")
112 | endif()
113 | endif()
114 |
115 | # Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
116 | # Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
117 | # VALA_EXECUTABLE etc. are set)
118 |
119 | include(FindPackageHandleStandardArgs)
120 | find_package_handle_standard_args(Vala
121 | REQUIRED_VARS
122 | VALA_EXECUTABLE
123 | VALA_SHORTVER
124 | VALA_LIBPKG
125 | VALA_VAPIDIR
126 | VALA_DATADIR
127 | VALA_VAPIGEN
128 | VALA_GEN_INTROSPECT
129 | VALA_VALA_GEN_INTROSPECT
130 | VERSION_VAR
131 | VALA_VERSION
132 | )
133 |
134 | # vim: set ai ts=2 sts=2 et sw=2
135 |
--------------------------------------------------------------------------------
/tests/testpathsplit.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * tests/testpathsplit.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | public class TestPathSplit : TestCase {
23 | public TestPathSplit() {
24 | base ("TestPathSplit");
25 | add_test ("standard", test_normal);
26 | add_test ("relative_paths", test_relative_paths);
27 | add_test ("relative_paths_special", test_relative_paths_special);
28 | add_test ("utf8_paths", test_utf8);
29 | add_test ("bytecharindex", test_bytetoindex);
30 | }
31 |
32 | public override void set_up() {}
33 | public override void tear_down() {}
34 |
35 | public void test_normal() {
36 | string[] splitpaths;
37 |
38 | var baseparts = new string[] {"/", "usr", "share", "valama", "templates"};
39 | splitpaths = split_path ("/usr/share/valama/templates", true, true);
40 | assert (baseparts.length == splitpaths.length);
41 | for (int i = 0; i < baseparts.length; ++i)
42 | assert (splitpaths[i] == baseparts[i]);
43 | var baseparts_d = baseparts;
44 | splitpaths = split_path ("/usr/share/valama/templates/", true, true);
45 | assert (baseparts_d.length == splitpaths.length);
46 | for (int i = 0; i < baseparts_d.length + 1; ++i)
47 | assert (splitpaths[i] == baseparts_d[i]);
48 |
49 | var baseparts_noroot = new string[] {"usr", "share", "valama", "templates"};
50 | splitpaths = split_path ("/usr/share/valama/templates", true, false);
51 | assert (baseparts_noroot.length == splitpaths.length);
52 | for (int i = 0; i < baseparts_noroot.length; ++i)
53 | assert (splitpaths[i] == baseparts_noroot[i]);
54 |
55 | var absoluteparts = new string[] {"/", "/usr", "/usr/share", "/usr/share/valama", "/usr/share/valama/templates"};
56 | splitpaths = split_path ("/usr/share/valama/templates", false, true);
57 | assert (absoluteparts.length == splitpaths.length);
58 | for (int i = 0; i < absoluteparts.length; ++i)
59 | assert (splitpaths[i] == absoluteparts[i]);
60 |
61 | var absoluteparts_noroot = new string[] {"usr", "usr/share", "usr/share/valama", "usr/share/valama/templates"};
62 | splitpaths = split_path ("/usr/share/valama/templates", false, false);
63 | assert (absoluteparts_noroot.length == splitpaths.length);
64 | for (int i = 0; i < absoluteparts_noroot.length; ++i)
65 | assert (splitpaths[i] == absoluteparts_noroot[i]);
66 | }
67 |
68 | public void test_relative_paths() {
69 | string[] splitpaths;
70 |
71 | var baseparts = new string[] {"usr", "share", "valama", "templates"};
72 | splitpaths = split_path ("usr/share/valama/templates", true, true);
73 | assert (baseparts.length == splitpaths.length);
74 | for (int i = 0; i < baseparts.length; ++i)
75 | assert (splitpaths[i] == baseparts[i]);
76 |
77 | var baseparts_noroot = new string[] {"usr", "share", "valama", "templates"};
78 | splitpaths = split_path ("usr/share/valama/templates", true, false);
79 | assert (baseparts_noroot.length == splitpaths.length);
80 | for (int i = 0; i < baseparts_noroot.length; ++i)
81 | assert (splitpaths[i] == baseparts_noroot[i]);
82 |
83 | var absoluteparts = new string[] {"usr", "usr/share", "usr/share/valama", "usr/share/valama/templates"};
84 | splitpaths = split_path ("usr/share/valama/templates", false, true);
85 | assert (absoluteparts.length == splitpaths.length);
86 | for (int i = 0; i < absoluteparts.length; ++i)
87 | assert (splitpaths[i] == absoluteparts[i]);
88 |
89 | var absoluteparts_noroot = new string[] {"usr", "usr/share", "usr/share/valama", "usr/share/valama/templates"};
90 | splitpaths = split_path ("usr/share/valama/templates", false, false);
91 | assert (absoluteparts_noroot.length == splitpaths.length);
92 | for (int i = 0; i < absoluteparts_noroot.length; ++i)
93 | assert (splitpaths[i] == absoluteparts_noroot[i]);
94 | }
95 |
96 | public void test_relative_paths_special() {
97 | assert (split_path (".", true, true).length == 0);
98 | assert (split_path (".", true, false).length == 0);
99 | assert (split_path (".", false, true).length == 0);
100 | assert (split_path (".", false, false).length == 0);
101 |
102 | assert (split_path ("", true, true).length == 0);
103 | assert (split_path ("", true, false).length == 0);
104 | assert (split_path ("", false, true).length == 0);
105 | assert (split_path ("", false, false).length == 0);
106 | }
107 |
108 | public void test_utf8() {
109 | var baseparts = new string[] {"/", "𤭢水は方円の器に従い", "asdf", "人は善悪の友による。"};
110 | var splitpaths = split_path ("/𤭢水は方円の器に従い/asdf/人は善悪の友による。", true, true);
111 | assert (baseparts.length == splitpaths.length);
112 | for (int i = 0; i < baseparts.length; ++i)
113 | assert (splitpaths[i] == baseparts[i]);
114 | }
115 |
116 | public void test_bytetoindex() {
117 | var mbytestr = "楽あれば苦あり。"; // 3 byte characters
118 | for (var i = 0; i < mbytestr.length; ++i)
119 | assert (byte_index_to_character_index (mbytestr, i, true) == ((i%3 == 0) ? i/3 : -1));
120 | }
121 | }
122 |
123 | // vim: set ai ts=4 sts=4 et sw=4
124 |
--------------------------------------------------------------------------------
/src/ui/welcome_screen/main_screen.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/ui/welcome_screen/main_screen.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gdk;
21 | using Gee;
22 | using Gtk;
23 |
24 | namespace WelcomeScreen {
25 |
26 | protected class MainScreen : TemplatePage {
27 |
28 | public signal void create_button_clicked ();
29 | public signal void open_button_clicked ();
30 | public signal void recent_project_selected (string path);
31 |
32 | protected override void clean_up() {
33 | }
34 |
35 | protected override void build() {
36 |
37 | // Sort recent projects
38 | var recent_items = new TreeSet (cmp_recent_info);
39 | foreach (var info in recentmgr.get_items())
40 | recent_items.add (info);
41 |
42 | var box_main = new Box(Orientation.VERTICAL, 20);
43 | box_main.set_size_request (600,400);
44 |
45 | var list = new Gtk.ListBox ();
46 | list.row_selected.connect((row)=>{row.activate();}); //TODO: Possibly unnecessary in future GTK versions
47 |
48 | int cnt_added_items = 0;
49 | foreach (var info in recent_items) {
50 | // Limit number of shown recent projects
51 | cnt_added_items ++;
52 | if (cnt_added_items > 5)
53 | break;
54 |
55 | // Grid containing all information about one project
56 | var grid_project = new Gtk.Grid();
57 |
58 | Label lbl_proj_name = new Label(Markup.escape_text (info.get_display_name()));
59 | lbl_proj_name.expand = true;
60 | lbl_proj_name.ellipsize = Pango.EllipsizeMode.END;
61 | lbl_proj_name.halign = Align.START;
62 | grid_project.attach (lbl_proj_name, 0,0,1,1);
63 |
64 | // Get project path, ellipsize home directory
65 | Label lbl_proj_path = new Label(null);
66 | var uri = info.get_uri_display();
67 | var home = Environment.get_home_dir();
68 | if (uri.has_prefix (home))
69 | lbl_proj_path.label += "" + Markup.escape_text ("~" + uri[home.length:uri.length]) + "";
70 | else
71 | lbl_proj_path.label += "" + Markup.escape_text (uri) + "";
72 | lbl_proj_path.use_markup = true;
73 | lbl_proj_path.expand = true;
74 | lbl_proj_path.ellipsize = Pango.EllipsizeMode.END;
75 | lbl_proj_path.halign = Align.START;
76 | lbl_proj_path.sensitive = false;
77 | grid_project.attach (lbl_proj_path, 0,1,1,1);
78 |
79 | // Show last used date
80 | var now = new DateTime.now_local();
81 | var modif_time = new DateTime.now_local ().add_days(-info.get_age());
82 | var lbl_last_modified = new Label(null);
83 | if (modif_time.get_year() == now.get_year())
84 | lbl_last_modified.label = modif_time.format("%e. %b");
85 | else
86 | lbl_last_modified.label = modif_time.format("%e. %b %Y");
87 | lbl_last_modified.sensitive = false;
88 |
89 | grid_project.attach (lbl_last_modified, 1,0,1,1);
90 |
91 | var row = new ListBoxRow();
92 | row.activate.connect (()=>{
93 | recent_project_selected (info.get_uri_display());
94 | });
95 | row.add (grid_project);
96 | standardize_listbox_row (row);
97 | list.add (row);
98 | list.add (new Separator(Orientation.HORIZONTAL));
99 | }
100 | var frame = new Frame(null);
101 | frame.add (list);
102 | box_main.pack_start (frame, false, true);
103 | // Other projects button
104 | var row = new ListBoxRow();
105 | row.activate.connect (()=>{
106 | open_button_clicked();
107 | });
108 | var lbl = new Label(_("Other project..."));
109 | lbl.halign = Align.START;
110 | row.add (lbl);
111 | standardize_listbox_row (row);
112 | list.add (row);
113 |
114 |
115 | // Create project button
116 | frame = new Frame(null);
117 | list = new Gtk.ListBox ();
118 | list.row_selected.connect((row)=>{row.activate();}); //TODO: Possibly unnecessary in future GTK versions
119 |
120 | row = new ListBoxRow();
121 | row.activate.connect (()=>{
122 | create_button_clicked();
123 | });
124 | lbl = new Label(_("Create project"));
125 | lbl.halign = Align.START;
126 | row.add (lbl);
127 | standardize_listbox_row (row);
128 | list.add (row);
129 |
130 | frame.add(list);
131 | box_main.pack_start (frame, false, true);
132 |
133 | widget = box_main;
134 | }
135 |
136 | // Compares two recent projects entries
137 | private int cmp_recent_info (RecentInfo a, RecentInfo b) {
138 | if (a.get_modified() == b.get_modified())
139 | return 0;
140 | return (a.get_modified() < b.get_modified()) ? 1 : -1;
141 | }
142 |
143 | }
144 | }
145 |
146 | // vim: set ai ts=4 sts=4 et sw=4
--------------------------------------------------------------------------------
/tests/testprojectfile.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * tests/testprofile.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | public class TestProjectfile : TestCase {
23 | public TestProjectfile() {
24 | base ("TestProjectfile");
25 | add_test ("paths", test_paths);
26 | add_test ("invalid", test_invalid);
27 | add_test ("version", test_version);
28 | }
29 |
30 | public override void set_up() {}
31 | public override void tear_down() {}
32 |
33 | //TODO: Compute project files on runtime?
34 | public void test_paths() {
35 | ProjectFile p = null;
36 | try {
37 | //NOTE: Execution in tests/ directory is mandatory.
38 | p = new ProjectFile ("projectfile/pathtest.vlp");
39 | } catch (LoadingError e) {
40 | error (_("LoadingError: %s\n"), e.message);
41 | }
42 | assert (p as ProjectFile != null);
43 |
44 | assert (p.get_absolute_path ("/foo/bar/foo") == "/foo/bar/foo");
45 | assert (p.get_absolute_path ("foo/bar/foo") == Path.build_path (Path.DIR_SEPARATOR_S,
46 | Environment.get_current_dir(),
47 | "projectfile", "foo", "bar", "foo"));
48 | assert (p.get_relative_path ("foo/bar/foo") == "foo/bar/foo");
49 | assert (p.get_relative_path ("/foo/bar/foo") == "/foo/bar/foo");
50 | assert (p.get_relative_path (Path.build_path (Path.DIR_SEPARATOR_S,
51 | Environment.get_current_dir(),
52 | "projectfile", "foo", "bar", "foo")) == "foo/bar/foo");
53 | assert (p.get_relative_path (Path.build_path (Path.DIR_SEPARATOR_S,
54 | Environment.get_current_dir(),
55 | "projectfile")) == "");
56 | }
57 |
58 | public void test_invalid() {
59 | int fd;
60 | int err = Posix.stderr.fileno();
61 | var bak2 = Posix.dup (err);
62 |
63 | ProjectFile p_invalid_notexistant = null;
64 | try {
65 | Posix.stderr.flush();
66 | fd = Posix.open ("/dev/null", Posix.O_WRONLY);
67 | Posix.dup2 (fd, err);
68 | p_invalid_notexistant = new ProjectFile ("projectfile/invalid_notexistant.vlp");
69 | } catch (LoadingError e) {
70 | }
71 | Posix.stderr.flush();
72 | Posix.dup2 (bak2, err);
73 | assert (p_invalid_notexistant as ProjectFile == null);
74 |
75 | ProjectFile p_invalid_garbage = null;
76 | try {
77 | Posix.stderr.flush();
78 | fd = Posix.open ("/dev/null", Posix.O_WRONLY);
79 | Posix.dup2 (fd, err);
80 | p_invalid_garbage = new ProjectFile ("projectfile/invalid_garbage.vlp");
81 | } catch (LoadingError e) {
82 | }
83 | Posix.stderr.flush();
84 | Posix.dup2 (bak2, err);
85 | assert (p_invalid_garbage as ProjectFile == null);
86 |
87 | ProjectFile p_invalid_empty = null;
88 | try {
89 | p_invalid_garbage = new ProjectFile ("projectfile/invalid_empty.vlp");
90 | } catch (LoadingError e) {
91 | }
92 | assert (p_invalid_empty as ProjectFile == null);
93 | }
94 |
95 | public void test_version() {
96 | int fd;
97 | var @out = Posix.stdout.fileno();
98 | var bak1 = Posix.dup (@out);
99 | var swpforceold = Args.forceold;
100 | Args.forceold = false;
101 |
102 | ProjectFile p_version_none = null;
103 | try {
104 | //NOTE: Execution in tests/ directory is mandatory.
105 | p_version_none = new ProjectFile ("projectfile/version_none.vlp");
106 | } catch (LoadingError e) {
107 | }
108 | assert (p_version_none as ProjectFile == null);
109 |
110 | ProjectFile p_version_low = null;
111 | try {
112 | p_version_low = new ProjectFile ("projectfile/version_low.vlp");
113 | } catch (LoadingError e) {
114 | }
115 | assert (p_version_low as ProjectFile == null);
116 |
117 | Args.forceold = true;
118 | ProjectFile p_version_lowforce = null;
119 | try {
120 | Posix.stdout.flush();
121 | fd = Posix.open ("/dev/null", Posix.O_WRONLY);
122 | Posix.dup2 (fd, @out);
123 | p_version_lowforce = new ProjectFile ("projectfile/version_low.vlp");
124 | } catch (LoadingError e) {
125 | }
126 | Posix.stdout.flush();
127 | Posix.dup2 (bak1, @out);
128 | assert (p_version_lowforce as ProjectFile != null);
129 |
130 | Args.forceold = false;
131 | ProjectFile p_version_exact = null;
132 | try {
133 | p_version_exact = new ProjectFile ("projectfile/version_exact.vlp");
134 | } catch (LoadingError e) {
135 | error (_("LoadingError: %s\n"), e.message);
136 | }
137 | assert (p_version_exact as ProjectFile != null);
138 |
139 | ProjectFile p_version_high = null;
140 | try {
141 | p_version_high = new ProjectFile ("projectfile/version_high.vlp");
142 | } catch (LoadingError e) {
143 | error (_("LoadingError: %s\n"), e.message);
144 | }
145 | assert (p_version_high as ProjectFile != null);
146 |
147 | Args.forceold = swpforceold;
148 | }
149 | }
150 |
151 | // vim: set ai ts=4 sts=4 et sw=4
152 |
--------------------------------------------------------------------------------
/src/dialogs/create_file.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/dialogs/create_file.vala
3 | * Copyright (C) 2012, 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using Gtk;
21 | using GLib;
22 | using Vala;
23 |
24 | /**
25 | * Create new file (you need to add it to project manually). If file already
26 | * exists, open it.
27 | *
28 | * @param path Root path of new file.
29 | * @param extension File extension.
30 | * @param directory Create directory.
31 | * @return Filename or `null`.
32 | */
33 | public string? ui_create_file_dialog (string? path = null, string? extension = null,
34 | bool directory = false) {
35 | var dlg = new Dialog.with_buttons ((!directory) ? _("Choose filename")
36 | : _("Choose directory name"),
37 | window_main,
38 | DialogFlags.MODAL,
39 | _("_Cancel"),
40 | ResponseType.CANCEL,
41 | (!directory) ? _("_Open") : _("_Add"),
42 | ResponseType.ACCEPT,
43 | null);
44 |
45 | dlg.set_size_request (420, 100);
46 | dlg.resizable = false;
47 |
48 | var box_main = new Box (Orientation.VERTICAL, 0);
49 | // TRANSLATORS:
50 | // E.g.: "Add new file to project (inside 'src/' directory)"
51 | var desc = ((!directory) ? _("Add new file to project (%s)")
52 | // TRANSLATORS:
53 | // E.g.: "Create new subdirectory (inside 'src/' directory)"
54 | : _("Create new subdirectory (%s)")).printf (
55 | // TRANSLATORS:
56 | // Context: Add new file to project (inside `foobar' directory)
57 | (path != null) ? _("inside '%s' directory").printf (path)
58 | : _("inside project root directory"));
59 | var frame_filename = new Frame (desc);
60 | var box_filename = new Box (Orientation.VERTICAL, 0);
61 | frame_filename.add (box_filename);
62 |
63 | var ent_filename_err = new Label ("");
64 | ent_filename_err.sensitive = false;
65 |
66 | Regex valid_chars = /^[a-z0-9.:_\\\/+-]+$/i; // keep "-" at the end!
67 | var ent_filename = new Entry.with_inputcheck (ent_filename_err, valid_chars);
68 | ent_filename.set_placeholder_text (_("filename")); // this is e.g. not visible
69 |
70 | box_filename.pack_start (ent_filename, false, false);
71 | box_filename.pack_start (ent_filename_err, false, false);
72 | box_main.pack_start (frame_filename, true, true);
73 | box_main.show_all();
74 | dlg.get_content_area().pack_start (box_main);
75 |
76 | string basepath;
77 | if (path == null)
78 | basepath = project.project_path;
79 | else
80 | basepath = project.get_absolute_path (path);
81 |
82 | string? filename = null;
83 | dlg.response.connect ((response_id) => {
84 | if (response_id == ResponseType.ACCEPT) {
85 | if (ent_filename.text == "") {
86 | ent_filename.set_label_timer (_("Don't let this field empty. Name a file."), 10);
87 | return;
88 | }
89 | filename = Path.build_path (Path.DIR_SEPARATOR_S,
90 | basepath,
91 | ent_filename.text);
92 | if (!directory) {
93 | if (extension != null)
94 | if (!filename.has_suffix (@".$extension"))
95 | filename += @".$extension";
96 | var f = File.new_for_path (filename);
97 | if (!f.query_exists()) {
98 | if (f.get_parent() != null && !f.get_parent().query_exists())
99 | try {
100 | f.get_parent().make_directory_with_parents();
101 | } catch (GLib.Error e) {
102 | errmsg (_("Could not create parent directory: %s\n"), e.message);
103 | }
104 | try {
105 | var output_stream = f.create (FileCreateFlags.NONE);
106 | // add minimal xml data to ui file, otherwise libgladeui throws critical errors !
107 | if (extension == "ui")
108 | output_stream.write ("""
109 |
110 |
111 |
112 | """.data);
113 | output_stream.close();
114 |
115 | } catch (GLib.IOError e) {
116 | errmsg (_("Could not write to new file: %s\n"), e.message);
117 | filename = null;
118 | } catch (GLib.Error e) {
119 | errmsg (_("Could not create new file: %s\n"), e.message);
120 | filename = null;
121 | }
122 | }
123 | } else {
124 | var f = File.new_for_path (filename);
125 | if (!f.query_exists())
126 | try {
127 | f.make_directory_with_parents();
128 | } catch (GLib.Error e) {
129 | errmsg (_("Could not create new directory: %s\n"), e.message);
130 | filename = null;
131 | }
132 | }
133 | }
134 | dlg.destroy();
135 | });
136 | dlg.run();
137 |
138 | return filename;
139 | }
140 |
141 | // vim: set ai ts=4 sts=4 et sw=4
142 |
--------------------------------------------------------------------------------
/data/buildsystems/cmake/buildsystem/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # CMakeLists.txt
3 | # Copyright (C) 2012, 2013, Valama development team
4 | #
5 | # Valama is free software: you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the
7 | # Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # Valama is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License along
16 | # with this program. If not, see .
17 | #
18 |
19 | cmake_minimum_required(VERSION "2.8.4")
20 |
21 | include("${CMAKE_SOURCE_DIR}/cmake/project.cmake")
22 | include("${CMAKE_SOURCE_DIR}/cmake/Common.cmake")
23 |
24 | if(CMAKE_MAJOR_VERSION GREATER "2")
25 | cmake_policy(SET CMP0048 NEW)
26 | project("${project_name}" VERSION "${${project_name}_VERSION}" LANGUAGES "C")
27 | else()
28 | project("${project_name}" "C")
29 | endif()
30 | string(TOLOWER "${project_name}" project_name_lower)
31 |
32 | set(bindir "bin")
33 | set(datarootdir "share")
34 | set(libdir "lib")
35 | set(includedir "include")
36 | set(datadir "${datarootdir}/${project_name_lower}")
37 | set(uidir "${datadir}/ui")
38 | set(localedir "${datarootdir}/locale")
39 | set(appdir "${datarootdir}/applications")
40 | set(gsettingsdir "${datarootdir}/glib-2.0/schemas")
41 | set(pixrootdir "${datarootdir}/pixmaps")
42 | set(pixdir "${pixrootdir}/${project_name_lower}")
43 | set(docdir "${datadir}/doc")
44 | set(mandir "${datarootdir}/man")
45 | set(mimedir "${datarootdir}/mime/packages")
46 | if(CMAKE_INSTALL_PREFIX)
47 | set(install_prefix "${CMAKE_INSTALL_PREFIX}/")
48 | else()
49 | set(install_prefix)
50 | endif()
51 |
52 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/vala")
53 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
54 |
55 |
56 | find_package(Vala "0.20" REQUIRED)
57 |
58 | # Custom library version checks.
59 | set(definitions)
60 | set(vapidirs)
61 | find_package(PkgConfig)
62 | # config
63 | list(REMOVE_ITEM required_pkgs "config {nocheck,nolink}")
64 | # glib-2.0
65 | pkg_check_modules(GLIB2.0 REQUIRED "glib-2.0")
66 |
67 |
68 | set(default_vala_flags
69 | "--thread"
70 | "--target-glib" "${GLIB2.0_VERSION}"
71 | #"--enable-experimental"
72 | #"--fatal-warnings"
73 | )
74 |
75 | include(ValaPkgs)
76 | vala_pkgs(VALA_C
77 | PACKAGES
78 | ${required_pkgs}
79 | DEFINITIONS
80 | ${definitions}
81 | OPTIONAL
82 | ${optional_pkgs}
83 | SRCFILES
84 | ${srcfiles}
85 | VAPIS
86 | ${vapifiles}
87 | OPTIONS
88 | ${default_vala_flags}
89 | ${vapidirs}
90 | )
91 |
92 |
93 | # Set common C-macros.
94 | add_definitions(-DPACKAGE_NAME="${project_name}")
95 | add_definitions(-DPACKAGE_VERSION="${${project_name}_VERSION}")
96 | if(project_root)
97 | add_definitions(-DGETTEXT_PACKAGE="${project_root}")
98 | else()
99 | add_definitions(-DGETTEXT_PACKAGE="${project_name_lower}")
100 | endif()
101 | add_definitions(-DPACKAGE_DATA_DIR="${install_prefix}${datadir}")
102 | add_definitions(-DPACKAGE_UI_DIR="${install_prefix}${uidir}")
103 | add_definitions(-DLOCALE_DIR="${install_prefix}${localedir}")
104 | add_definitions(-DPIXMAP_DIR="${install_prefix}${pixdir}")
105 | add_definitions(-DVALA_VERSION="${VALA_SHORTVER}")
106 |
107 | add_executable("${project_name_lower}" ${VALA_C})
108 | target_link_libraries("${project_name_lower}"
109 | ${PROJECT_LDFLAGS}
110 | )
111 | add_definitions(
112 | ${PROJECT_C_FLAGS}
113 | )
114 | install(TARGETS ${project_name_lower} DESTINATION "${bindir}")
115 |
116 | # Install user interface files if used and copy them to build directory.
117 | set(uifiles_build)
118 | foreach(uifile ${uifiles})
119 | add_custom_command(
120 | OUTPUT
121 | "${CMAKE_CURRENT_BINARY_DIR}/${uifile}"
122 | COMMAND
123 | "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${uifile}" "${CMAKE_CURRENT_BINARY_DIR}/${uifile}"
124 | DEPENDS
125 | "${CMAKE_CURRENT_SOURCE_DIR}/${uifile}"
126 | COMMENT ""
127 | )
128 | list(APPEND uifiles_build "${CMAKE_CURRENT_BINARY_DIR}/${uifile}")
129 | install(FILES ${uifile} DESTINATION "${uidir}")
130 | endforeach()
131 | add_custom_target("ui_copy_${project_name_lower}" DEPENDS ${uifiles_build})
132 | add_dependencies("${project_name_lower}" "ui_copy_${project_name_lower}")
133 |
134 | # Uninstall target
135 | add_custom_target(uninstall
136 | COMMAND
137 | "${CMAKE_COMMAND}" -D "CUSTOM_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR}"
138 | -D "POSTREMOVE_HOOK:BOOL=${POSTINSTALL_HOOK}"
139 | -D "GSETTINGSDIR:FILEPATH=${install_prefix}${gsettingsdir}"
140 | -P "${CMAKE_SOURCE_DIR}/cmake/SimpleUninstall.cmake"
141 | )
142 |
143 |
144 | # Print some information about build.
145 | datestring(current_date "%F %T")
146 | message("")
147 | message("---------------------------------------------")
148 | message(" ${current_date}")
149 | message("${project_name} ${${project_name}_VERSION}")
150 | message("")
151 | if(CMAKE_BUILD_TYPE)
152 | message("Build type: ${CMAKE_BUILD_TYPE}")
153 | string(TOUPPER "${CMAKE_BUILD_TYPE}" release_upper)
154 | set(c_flags "${CMAKE_C_FLAGS_${release_upper}}")
155 | else()
156 | message("Build type: Default")
157 | set(c_flags "${CMAKE_C_FLAGS}")
158 | endif()
159 | message("")
160 | message("Installation prefix: ${CMAKE_INSTALL_PREFIX}")
161 | foreach(def ${definitions})
162 | list(APPEND default_vala_flags "-D;${def}")
163 | endforeach()
164 | base_list_to_delimited_string(vala_flags
165 | DELIM " "
166 | BASE_LIST "${default_vala_flags}"
167 | )
168 | message("C compiler: ${CMAKE_C_COMPILER}")
169 | message("C compiler version ${CMAKE_C_COMPILER_VERSION}")
170 | if("${c_flags}" STREQUAL "")
171 | set(c_flags "(none)")
172 | endif()
173 | message("C flags: ${c_flags}")
174 | message("Vala compiler: ${VALA_EXECUTABLE}")
175 | message("Vala compiler version: ${VALA_VERSION}")
176 | if("${vala_flags}" STREQUAL "")
177 | set(vala_flags "(none)")
178 | endif()
179 | message("Vala flags: ${vala_flags}")
180 | message("GLib version: ${GLIB2.0_VERSION}")
181 | message("")
182 | if(GETTEXT_PACKAGE_NAME)
183 | if(GETTEXT_PACKAGE_VERSION)
184 | message("Gettext package: ${GETTEXT_PACKAGE_NAME} (${GETTEXT_PACKAGE_VERSION})")
185 | else()
186 | message("Gettext package: ${GETTEXT_PACKAGE_NAME}")
187 | endif()
188 | endif()
189 | if(CMAKE_VERBOSE_MAKEFILE)
190 | message("Verbose build: yes")
191 | else()
192 | message("Verbose build: no")
193 | endif()
194 | message("")
195 | message("---------------------------------------------")
196 | message("")
197 |
198 | # vim: set ai ts=2 sts=2 et sw=2
199 |
--------------------------------------------------------------------------------
/icons/V4_logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
158 |
--------------------------------------------------------------------------------
/src/buildsystem/plain.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/buildsystem/plain.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 |
22 | public class BuilderPlain : BuildSystem {
23 | private string[]? cmdline = null;
24 |
25 | public BuilderPlain (bool make_lib = false) {
26 | Object (library: make_lib);
27 | }
28 |
29 | public override string get_executable() {
30 | return project.project_name.casefold();
31 | }
32 |
33 | public override inline string get_name() {
34 | return "Plain build system";
35 | }
36 |
37 | public override inline string get_name_id() {
38 | return "valama";
39 | }
40 |
41 | public override bool check_buildsystem_file (string filename) {
42 | return false;
43 | }
44 |
45 | public override bool initialize (out int? exit_status = null)
46 | throws BuildError.INITIALIZATION_FAILED {
47 | exit_status = null;
48 | initialized = false;
49 | if (!preparate())
50 | return false;
51 | initialize_started();
52 | cmdline = null;
53 |
54 | string[] valacargs = new string[] {"valac"};
55 | string? target_glib_version;
56 | if (!package_exists ("glib-2.0", out target_glib_version)) {
57 | //TRANSLATORS: E.g.: No `glib-2.0' package found.
58 | build_output (_("No '%s' package found.\n").printf ("glib-2.0"));
59 | return false;
60 | }
61 | valacargs += @"--target-glib=$(target_glib_version)";
62 | valacargs += "--thread";
63 | valacargs += @"--output=$(get_executable())";
64 |
65 | foreach (var pkg in project.packages.values) {
66 | build_output (_("Add package: %s\n").printf (pkg.name));
67 | if (pkg.custom_vapi == null)
68 | valacargs += @"--pkg=$(pkg.name)";
69 | else {
70 | valacargs += project.get_absolute_path (pkg.custom_vapi);
71 | string? pkgflags;
72 | if (package_flags (pkg.name, out pkgflags))
73 | try {
74 | string[] pkgflags_args;
75 | Shell.parse_argv (pkgflags, out pkgflags_args);
76 | foreach (var ccpart in pkgflags_args)
77 | valacargs += @"--Xcc=$ccpart";
78 | } catch (GLib.ShellError e) {
79 | warning_msg (_("Could not parse package flags '%s': %s\n"),
80 | pkgflags, e.message);
81 | }
82 | }
83 | }
84 |
85 | if (project.idemode != IdeModes.DEBUG) {
86 | foreach (var file in project.guanako_project.get_source_files())
87 | valacargs += file.filename;
88 | } else {
89 | var mainblock = false;
90 | foreach (var src_file_path in project.files){
91 | if (src_file_path.has_suffix (".vapi")) {
92 | valacargs += src_file_path;
93 | continue;
94 | }
95 |
96 | string content;
97 | try {
98 | FileUtils.get_contents (src_file_path, out content);
99 | } catch (GLib.FileError e) {
100 | throw new BuildError.INITIALIZATION_FAILED (_("Could not read file content of '%s': %s\n"),
101 | src_file_path, e.message);
102 | }
103 | var srcfile = project.guanako_project.get_source_file_by_name (src_file_path);
104 | srcfile.content = content; //TODO: Find out why SourceFile.content is empty at the beginning (??)
105 | var fname = project.get_relative_path (src_file_path);
106 | var tmppath = Path.build_path (Path.DIR_SEPARATOR_S,
107 | buildpath,
108 | fname.replace (Path.DIR_SEPARATOR_S, "=+"));
109 | var tmpfile = File.new_for_path (tmppath);
110 |
111 | try {
112 | build_output (_("Prepare file for FrankenStein: %s\n").printf (fname));
113 | var dos = new DataOutputStream (tmpfile.replace (null,
114 | false,
115 | FileCreateFlags.REPLACE_DESTINATION));
116 | dos.put_string (frankenstein.frankensteinify_sourcefile (srcfile));
117 | if (!mainblock) {
118 | dos.put_string (frankenstein.frankenstein_mainblock);
119 | mainblock = true;
120 | }
121 | } catch (GLib.IOError e) {
122 | throw new BuildError.INITIALIZATION_FAILED (_("Could not update file: %s\n"),
123 | e.message);
124 | } catch (GLib.Error e) {
125 | throw new BuildError.INITIALIZATION_FAILED (_("Could not open file writable: %s\n"),
126 | e.message);
127 | }
128 | valacargs += tmppath;
129 | }
130 | }
131 |
132 | foreach (var define in project.defines)
133 | valacargs += @"--define=$define";
134 |
135 | cmdline = valacargs;
136 |
137 | exit_status = 0;
138 | initialized = true;
139 | initialize_finished();
140 | return true;
141 | }
142 |
143 | public override bool build (out int? exit_status = null)
144 | throws BuildError.INITIALIZATION_FAILED,
145 | BuildError.CONFIGURATION_FAILED,
146 | BuildError.BUILD_FAILED {
147 | exit_status = null;
148 | if (!configured && !configure (out exit_status))
149 | return false;
150 |
151 | exit_status = null;
152 | built = false;
153 | build_started();
154 |
155 | Pid? pid;
156 | if (!call_cmd (cmdline, out pid)) {
157 | build_finished();
158 | throw new BuildError.BUILD_FAILED ("build command failed");
159 | }
160 |
161 | int? exit = null;
162 | ChildWatch.add (pid, (intpid, status) => {
163 | exit = get_exit (status);
164 | Process.close_pid (intpid);
165 | builder_loop.quit();
166 | });
167 |
168 | builder_loop.run();
169 | exit_status = exit;
170 | built = true;
171 | build_finished();
172 | return exit_status == 0;
173 | }
174 | }
175 |
176 | // vim: set ai ts=4 sts=4 et sw=4
177 |
--------------------------------------------------------------------------------
/src/ui/welcome_screen.vala:
--------------------------------------------------------------------------------
1 | /*
2 | * src/welcome_screen.vala
3 | * Copyright (C) 2013, Valama development team
4 | *
5 | * Valama is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * Valama is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | *
18 | */
19 |
20 | using GLib;
21 | using Gtk;
22 | using Gdk;
23 | using Gee;
24 |
25 | namespace WelcomeScreen {
26 |
27 | // Templates for building pages. Pages are created and destroyed on the fly
28 |
29 | protected abstract class TemplatePage : Object {
30 | public Widget? widget = null;
31 |
32 | public abstract void build();
33 | public abstract void clean_up();
34 | }
35 | // Includes header with prev / next buttons
36 | protected abstract class TemplatePageWithHeader : TemplatePage {
37 |
38 | public signal void go_to_prev_clicked();
39 | public signal void go_to_next_clicked();
40 |
41 | protected string heading = "";
42 | protected string description = "";
43 |
44 | protected ToolButton btn_next;
45 | protected ToolButton btn_prev;
46 |
47 | public override void build () {
48 |
49 | var box = new Gtk.Box (Orientation.VERTICAL, 0);
50 | var toolbar = new Toolbar();
51 | btn_prev = new ToolButton (new Image.from_icon_name ("go-previous-symbolic",
52 | IconSize.BUTTON),
53 | _("Back"));
54 | btn_prev.clicked.connect(()=>{go_to_prev_clicked();});
55 | btn_next = new ToolButton (new Image.from_icon_name ("go-next-symbolic",
56 | IconSize.BUTTON),
57 | _("Next"));
58 | btn_next.clicked.connect(()=>{go_to_next_clicked();});
59 |
60 | var lbl_heading_item = new ToolItem();
61 | var lbl_heading = new Label (null);
62 | lbl_heading.use_markup = true;
63 | lbl_heading.justify = Justification.CENTER;
64 | lbl_heading_item.set_expand (true);
65 | lbl_heading_item.add (lbl_heading);
66 |
67 | toolbar.add (btn_prev);
68 | toolbar.add (lbl_heading_item);
69 | toolbar.add (btn_next);
70 | box.pack_start (toolbar, false, true);
71 |
72 | box.pack_start (build_inner_widget(), true, true);
73 |
74 | // Set text after build_inner_widget call, so it can be specified there
75 | lbl_heading.label = "" + Markup.escape_text (heading) + "\n" + Markup.escape_text (description);
76 |
77 | box.set_size_request (600, 400);
78 | widget = box;
79 | }
80 |
81 | // Build the actual content (below the header)
82 | protected abstract Gtk.Widget build_inner_widget();
83 |
84 | }
85 |
86 | /*
87 | * The actual welcome screen widget, handles showing and linking pages pages.
88 | * It also, creates the ValamaProject to be passed to main
89 | */
90 |
91 | public class WelcomeScreen : Alignment{
92 | public WelcomeScreen() {
93 | // Center me
94 | this.xalign = 0.5f;
95 | this.yalign = 0.5f;
96 | this.xscale = 0.0f;
97 | this.yscale = 0.0f;
98 |
99 | this.add(box_main);
100 | this.show_all();
101 | show_main_screen();
102 | }
103 | // Put pages in a separate container to allow different background color
104 | //Gtk.Box box_main = new Gtk.Box(Orientation.VERTICAL, 0);
105 | Gtk.EventBox box_main = new Gtk.EventBox();
106 |
107 | // Methods showing the pages and linking them
108 | ProjectCreationInfo info;
109 | private void show_main_screen() {
110 | var msc = new MainScreen();
111 | msc.create_button_clicked.connect (()=>{
112 | show_create_project_template();
113 | });
114 | msc.recent_project_selected.connect((project_path)=>{
115 | try {
116 | project_loaded (new ValamaProject (project_path, Args.syntaxfile));
117 | } catch {}
118 | });
119 | msc.open_button_clicked.connect(()=>{
120 | show_open_project();
121 | });
122 | switch_to_page(msc);
123 | }
124 | private void show_create_project_location() {
125 | var page = new CreateProjectLocation(ref info);
126 | page.go_to_prev_clicked.connect(()=>{show_create_project_template();});
127 | page.go_to_next_clicked.connect(()=>{show_create_project_packages();});
128 | switch_to_page(page);
129 | }
130 | private void show_create_project_template() {
131 | info = new ProjectCreationInfo();
132 | var page = new CreateProjectTemplate(ref info);
133 | page.go_to_prev_clicked.connect(show_main_screen);
134 | page.go_to_next_clicked.connect(()=>{show_create_project_location();});
135 | switch_to_page(page);
136 | }
137 | private void show_create_project_packages() {
138 | var page = new CreateProjectPackages(ref info);
139 | page.go_to_prev_clicked.connect(()=>{ show_create_project_location(); });
140 | page.go_to_next_clicked.connect(()=>{ show_create_project_buildsystem(); });
141 | switch_to_page(page);
142 | }
143 | private void show_create_project_buildsystem() {
144 | var page = new CreateProjectBuildsystem(ref info);
145 | page.go_to_prev_clicked.connect(()=>{show_create_project_packages();});
146 | page.go_to_next_clicked.connect(()=>{project_loaded (create_project_from_template (info));});
147 | switch_to_page(page);
148 | }
149 | private void show_open_project() {
150 | var page = new OpenProject();
151 | page.go_to_prev_clicked.connect(()=>{show_main_screen();});
152 | page.go_to_next_clicked.connect(()=>{
153 | try {
154 | project_loaded (new ValamaProject (page.project_filename, Args.syntaxfile));
155 | } catch {}
156 | });
157 | switch_to_page(page);
158 | }
159 |
160 | //project_loaded (create_project_from_template (info));
161 | // Abstracts replacing pages
162 | private TemplatePage? current_page = null;
163 | private void switch_to_page (TemplatePage new_page) {
164 | if (current_page != null) {
165 | current_page.clean_up();
166 | box_main.remove (current_page.widget);
167 | }
168 | current_page = new_page;
169 | current_page.build();
170 | box_main.add (current_page.widget);
171 | current_page.widget.show_all();
172 | }
173 |
174 | public signal void project_loaded (ValamaProject? project);
175 |
176 | }
177 |
178 | }
179 | // vim: set ai ts=4 sts=4 et sw=4
180 |
--------------------------------------------------------------------------------