|
28.
|
|
|
Create a project in Anjuta
|
|
|
(itstool) path: section/title
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/guitar-tuner.c.page:48
C/guitar-tuner.cpp.page:46
C/guitar-tuner.py.page:53
C/image-viewer.c.page:42
C/image-viewer.cpp.page:40
C/image-viewer.js.page:50
C/image-viewer.py.page:49
C/image-viewer.vala.page:57
C/magic-mirror.vala.page:50
C/message-board.c.page:46
C/photo-wall.c.page:52
C/record-collection.js.page:53
|
|
29.
|
|
|
Before you start coding, you'll need to set up a new project in Anjuta. This will create all of the files you need to build and run the code later on. It's also useful for keeping everything together.
|
|
|
(itstool) path: section/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/guitar-tuner.c.page:49
C/guitar-tuner.cpp.page:47
C/guitar-tuner.py.page:54
C/guitar-tuner.vala.page:52
C/image-viewer.c.page:43
C/image-viewer.cpp.page:41
C/image-viewer.js.page:51
C/image-viewer.py.page:50
C/image-viewer.vala.page:58
C/magic-mirror.vala.page:51
C/photo-wall.c.page:53
C/record-collection.js.page:54
|
|
30.
|
|
|
Start Anjuta and click <guiseq><gui>File</gui><gui>New</gui><gui>Project</gui></guiseq> to open the project wizard.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/guitar-tuner.c.page:52
C/guitar-tuner.cpp.page:50
C/guitar-tuner.py.page:57
C/image-viewer.c.page:46
C/image-viewer.cpp.page:44
C/image-viewer.js.page:54
C/image-viewer.py.page:53
C/magic-mirror.vala.page:54
C/photo-wall.c.page:56
C/record-collection.js.page:57
|
|
31.
|
|
|
Choose <gui>Generic Javascript</gui> from the <gui>JS</gui> tab, click <gui>Forward</gui>, and fill-out your details on the next few pages. Use <file>record-collection</file> as project name and directory.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:60
|
|
32.
|
|
|
Click <gui>Finished</gui> and the project will be created for you. Open <file>src/main.js</file> from the <gui>Project</gui> or <gui>File</gui> tabs. It contains very basic example code.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:63
|
|
33.
|
|
|
Program Structure
|
|
|
(itstool) path: section/title
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:69
|
|
34.
|
|
|
This demo is a simple GTK application (with a single window) capable of inserting records into a database table as well as browsing all records of the table. The table has two fields: <code>id</code>, an integer, and <code>name</code>, a varchar. The first section (on the top) of the application allows you to insert a record into the table. The last section (bottom) allows you to see all the records of that table. Its content is refreshed every time a new record is inserted and on the application startup.
|
|
|
(itstool) path: section/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:71
|
|
35.
|
|
|
Starting the fun
|
|
|
(itstool) path: section/title
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:76
|
|
36.
|
|
|
Let's start by examining the skeleton of the program:
|
|
|
(itstool) path: section/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:77
|
|
37.
|
|
|
Lines 1‒4: Initial imports. Pay special attention to line 3, which tells Javascript to import the GDA library, our focus in this tutorial.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:103
|