Commit cc6a0db6 authored by Meg Ford's avatar Meg Ford

initial commits

parent fabe69d3
......@@ -9,7 +9,7 @@ ACLOCAL_FLAGS="-I libgd $ACLOCAL_FLAGS"
test -f $srcdir/configure.ac || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level my-js-app directory"
echo " top-level gnome-sound-recorder directory"
exit 1
}
......
AC_INIT([my-js-app], [0.1])
AC_INIT([gnome-sound-recorder], [0.1])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
......@@ -19,9 +19,9 @@ AC_PATH_PROG(GJS, [gjs])
AC_OUTPUT([
Makefile
data/Makefile
data/my-js-app.desktop.in
data/gnome-sound-recorder.desktop.in
libgd/Makefile
src/Makefile
src/my-js-app
src/gnome-sound-recorder
po/Makefile.in
])
......@@ -7,11 +7,11 @@ cssdir = $(pkgdatadir)
css_DATA = application.css
appsdir = $(datadir)/applications
apps_DATA = my-js-app.desktop
apps_DATA = gnome-sound-recorder.desktop
@INTLTOOL_DESKTOP_RULE@
CLEANFILES = my-js-app.desktop
DISTCLEANFILES = my-js-app.desktop.in
CLEANFILES = gnome-sound-recorder.desktop
DISTCLEANFILES = gnome-sound-recorder.desktop.in
include $(top_srcdir)/git.mk
......@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkApplicationWindow" id="main-window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">My JS Application</property>
<property name="title" translatable="yes">Sound Recorder</property>
<child>
<object class="GtkLabel" id="content">
<property name="label" translatable="yes">Placeholder for real content</property>
......
[Desktop Entry]
Type=Application
_Name=My JS Application
_GenericName=Application Demo
_Keywords=js;demo;app
Exec=@GJS@ -c 'imports.package.start({ name: "@PACKAGE_NAME@", version: "@PACKAGE_VERSION@", prefix: "@prefix@" })'
Icon=face-smile
<?xml version="1.0"?>
<anjuta>
<plugin name="GBF Project Manager"
url="http://anjuta.org/plugins/"
mandatory="yes">
<require group="Anjuta Plugin"
attribute="Interfaces"
value="IAnjutaProjectManager"/>
<require group="Project"
attribute="Supported-Project-Types"
value="automake"/>
</plugin>
<plugin name="Symbol Browser"
url="http://anjuta.org/plugins/"
mandatory="yes">
<require group="Anjuta Plugin"
attribute="Interfaces"
value="IAnjutaSymbolManager"/>
</plugin>
<plugin name="Make Build System"
url="http://anjuta.org/plugins/"
mandatory="yes">
<require group="Anjuta Plugin"
attribute="Interfaces"
value="IAnjutaBuildable"/>
<require group="Build"
attribute="Supported-Build-Types"
value="make"/>
</plugin>
<plugin name="Debug Manager"
url="http://anjuta.org/plugins/"
mandatory="no">
<require group="Anjuta Plugin"
attribute="Interfaces"
value="IAnjutaDebugManager"/>
</plugin>
</anjuta>
......@@ -6,15 +6,15 @@ jsdir = $(pkgdatadir)
dist_js_DATA = \
main.js \
util.js \
window.js
application.js
nodist_bin_SCRIPTS = my-js-app
nodist_bin_SCRIPTS = gnome-sound-recorder
EXTRA_DIST = my-js-app.in
EXTRA_DIST = gnome-sound-recorder.in
uninstall-local:
-rm -r $(jsdir)
DISTCLEANFILES = my-js-app
DISTCLEANFILES = gnome-sound-recorder
include $(top_srcdir)/git.mk
......@@ -35,26 +35,26 @@ pkg.require({ 'Gd': '1.0',
'Params': '1.0' });
const Util = imports.util;
const Window = imports.window;
const Application = imports.application;
const MyApplication = new Lang.Class({
Name: 'MyApplication',
Extends: Gtk.Application,
_init: function() {
this.parent({ application_id: 'org.example.MyJSApp' });
GLib.set_application_name(_("My JS Application"));
this.parent({ application_id: 'org.gnome.sound-recorder' });
GLib.set_application_name(_("Sound Recorder"));
},
vfunc_startup: function() {
this.parent();
Util.loadStyleSheet();
log(_("My JS Application started"));
log(_("Sound Recorder started"));
},
vfunc_activate: function() {
(new Window.MainWindow({ application: this })).show();
(new Application.Application({ application: this })).show();
},
});
......
#!/bin/sh
exec @GJS@ -c 'imports.package.start({ name: "@PACKAGE_NAME@", version: "@PACKAGE_VERSION@", prefix: "@prefix@" })'
// -*- Mode: js; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*-
//
// Copyright (c) 2013 Giovanni Campagna <scampa.giovanni@gmail.com>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the GNOME Foundation nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Look ma, no imports!
const MainWindow = new Lang.Class({
Name: 'MainWindow',
Extends: Gtk.ApplicationWindow,
_init: function(params) {
params = Params.fill(params, { title: GLib.get_application_name(),
default_width: 640,
default_height: 480 });
this.parent(params);
let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL });
let header = new Gd.HeaderBar({ title: _("Current page"),
hexpand: true });
this._search = new Gd.HeaderToggleButton({ symbolic_icon_name: 'edit-find-symbolic' });
header.pack_end(this._search);
grid.add(header);
let searchbar = new SearchBar();
this._searchEntry = searchbar.entry;
let revealer = new Gd.Revealer({ child: searchbar,
reveal_child: false,
hexpand: true });
this._search.bind_property('active',
revealer, 'reveal-child',
GObject.BindingFlags.DEFAULT);
grid.add(revealer);
this._view = new MainView();
this._view.visible_child_name = (Math.random() <= 0.5) ? 'one' : 'two';
grid.add(this._view);
this.add(grid);
grid.show_all();
}
});
const SearchBar = new Lang.Class({
Name: 'SearchBar',
Extends: Gtk.Toolbar,
_init: function(params) {
this.parent(params);
this.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);
this.entry = new Gd.TaggedEntry({ width_request: 500,
halign: Gtk.Align.CENTER });
let item = new Gtk.ToolItem();
item.set_expand(true);
item.add(this.entry);
this.insert(item, 0);
}
});
const MainView = new Lang.Class({
Name: 'MainView',
Extends: Gd.Stack,
_init: function(params) {
params = Params.fill(params, { hexpand: true,
vexpand: true });
this.parent(params);
let one = this._addPage('one', _("First page"), _("Nothing here"));
one.connect('clicked', Lang.bind(this, function() {
this.visible_child_name = 'two';
}));
let two = this._addPage('two', _("Second page"), _("What did you expect?"));
two.connect('clicked', Lang.bind(this, function() {
this.visible_child_name = 'one';
}));
},
_addPage: function(name, label, button) {
let labelWidget = new Gtk.Label({ label: label });
labelWidget.get_style_context().add_class('big-label');
let buttonWidget = new Gtk.Button({ label: button });
let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
halign: Gtk.Align.CENTER,
valign: Gtk.Align.CENTER });
grid.add(labelWidget);
grid.add(buttonWidget);
this.add_named(grid, name);
return buttonWidget;
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment