[anjuta] Add template for Gnome Shell extensions.



commit bcfbd03c1b33c6e0a36fd100ce814fa4a5746136
Author: Jason Siefken <siefkenj gmail com>
Date:   Tue Oct 11 22:05:51 2011 -0700

    Add template for Gnome Shell extensions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=661299

 .../templates/gnome-shell-extension.wiz.in         |   69 ++++++++++++++++++++
 .../gnome-shell-extension/Makefile.am.tpl          |   11 +++
 .../templates/gnome-shell-extension/autogen.sh     |   22 ++++++
 .../gnome-shell-extension/configure.ac.tpl         |   20 ++++++
 .../templates/gnome-shell-extension/project.anjuta |   37 +++++++++++
 .../gnome-shell-extension/src/Makefile.am.tpl      |   18 +++++
 .../gnome-shell-extension/src/extension.js         |   69 ++++++++++++++++++++
 .../gnome-shell-extension/src/metadata.json        |    9 +++
 .../gnome-shell-extension/src/stylesheet.css       |   10 +++
 9 files changed, 265 insertions(+), 0 deletions(-)
---
diff --git a/plugins/project-wizard/templates/gnome-shell-extension.wiz.in b/plugins/project-wizard/templates/gnome-shell-extension.wiz.in
new file mode 100644
index 0000000..2070986
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension.wiz.in
@@ -0,0 +1,69 @@
+<project-template>
+	<project-wizard>
+		<_name>Gnome Shell Extension</_name>
+		<_description>A minimal Gnome Shell extension</_description>
+		<icon>terminal-logo.png</icon>
+		<category>JS</category>
+		<required-program>automake</required-program>
+		<required-program>autoconf</required-program>
+		<required-program>make</required-program>
+	</project-wizard>
+	
+	<page name="basic" _label="Basic information" _description="General Project Information">
+		<property type="string" name="Name" _label="Project Name:" _description="project name" default="foobar-sample" summary="yes" restriction="filename" mandatory="yes"/>
+		<property type="string" name="Author" _label="Author:" _description="" default="[+UserName+]" mandatory="yes"/>
+		<property type="string" name="Email" _label="Email address:" _description="" default="[+EmailAddress+]" mandatory="no"/>
+		<property type="string" name="Version" _label="Version:" default="0.1" mandatory="yes"/>
+	</page>
+	
+	<page name="metadata" _label="Metadata" _description="Plugin Description and Metadata">
+		<property type="string" name="PluginName" _label="Plugin Name:" _description="Short but descriptive user-visible plugin name" default="[+Name+]" summary="yes" mandatory="yes"/>
+		<property type="string" name="Description" _label="Description:" _description="Long description of your plugin" default="[+Name+]" mandatory="yes"/>
+		<property type="string" name="UUID" _label="UUID:" _description="Uuid is a globally-unique identifier for your extension.
+This should be in the format of an email address (foo bar extensions example com), but
+need not be an actual email address, though it's a good idea to base the uuid on your
+email address." default="[+Name+]-[+EmailAddress+]" mandatory="yes"/>
+		<property type="string" name="URL" _label="URL:" _description="Extension URL" default='http://mydomain.org' mandatory="yes"/>
+		<property type="string" name="Compatibility" _label="Gnome Shell Compatibility:" _description="Comma-separated list of gnome-shell version your plugin is compatible with" default='["3.2.0"]' mandatory="yes"/>
+	</page>
+	
+	<page name="options" _label="Project options" _description="Options for project build system">
+		<property type="directory" name="Destination" _label="Destination:" _description="" default='[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]' mandatory="yes" exist="no" summary="yes"/>
+		<property type="list" name="License" _label="License" _description="Select code license" default="GPL" editable="no">
+			<item name="GPL" _label="General Public License (GPL)"/>
+			<item name="LGPL" _label="Lesser General Public License (LGPL)"/>
+			<item name="BSD" _label="Berkeley Software Distribution License (BSD)"/>
+			<item name="None" _label="No license"/>
+		</property>
+		<property type="hidden" name="NameUpper" default='[+(string-upcase (get "Name"))+]'/>
+		<property type="hidden" name="NameLower" default='[+(string-downcase (get "Name"))+]'/>
+		<property type="hidden" name="NameCamel" default='[+(string->c-name! (string-substitute (string-capitalize (get "Name")) " " ""))+]'/>
+		<property type="hidden" name="NameCUpper" default='[+(string->c-name! (string-substitute (string-upcase (get "Name")) " " "_"))+]'/>
+		<property type="hidden" name="NameCLower" default='[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]'/>
+		<property type="hidden" name="NameHLower" default='[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]'/>
+	</page>
+	
+	<content>
+		<directory source="gnome-shell-extension" destination="[+Destination+]">
+			<file source="Makefile.am.tpl" destination="Makefile.am"/>
+			<file source="autogen.sh" executable="yes"/>
+			<file source="configure.ac.tpl" destination="configure.ac"/>
+			<file source="project.anjuta" destination="[+NameHLower+].anjuta"/>
+		</directory>
+		<directory source="gnome-shell-extension" destination="[+Destination+]">
+			<directory source="src" destination="src">
+				<file source="extension.js" executable="yes"/>
+				<file source="metadata.json" />
+				<file source="stylesheet.css" />
+				<file source="Makefile.am.tpl" destination="Makefile.am"/>
+			</directory>
+		</directory>
+		<directory source="licenses" destination="[+Destination+]">
+			<file source="[+License+]" destination="COPYING"/>	
+		</directory>
+	</content>
+	
+	<action>
+		<open file="[+Destination+]/[+NameHLower+].anjuta"/>
+	</action>
+</project-template>
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/Makefile.am.tpl b/plugins/project-wizard/templates/gnome-shell-extension/Makefile.am.tpl
new file mode 100644
index 0000000..f73e5d1
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/Makefile.am.tpl
@@ -0,0 +1,11 @@
+[+ autogen5 template +]
+## Process this file with automake to produce Makefile.in
+## Created by Anjuta
+
+packagedir = gnome-shell/extensions
+
+SUBDIRS = src 
+
+# Remove doc directory on uninstall
+uninstall-local:
+
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/autogen.sh b/plugins/project-wizard/templates/gnome-shell-extension/autogen.sh
new file mode 100644
index 0000000..bfe197c
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/autogen.sh
@@ -0,0 +1,22 @@
+[+ autogen5 template +]
+#!/bin/bash
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="[+Name+]"
+
+test -f $srcdir/configure.ac || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level gnome-shell-extensions directory"
+    exit 1
+}
+
+which gnome-autogen.sh || {
+    echo "You need to install gnome-common from GNOME Git (or from"
+    echo "your OS vendor's package manager)."
+    exit 1
+}
+. gnome-autogen.sh
+
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/configure.ac.tpl b/plugins/project-wizard/templates/gnome-shell-extension/configure.ac.tpl
new file mode 100644
index 0000000..99a2d50
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/configure.ac.tpl
@@ -0,0 +1,20 @@
+[+ autogen5 template +]
+dnl Process this file with autoconf to produce a configure script.
+dnl Created by Anjuta application wizard.
+
+AC_INIT([+NameHLower+], [+Version+])
+
+AC_CONFIG_HEADERS([config.h])
+
+AC_PREFIX_DEFAULT(~/.local/share/gnome-shell/extensions)
+
+AM_INIT_AUTOMAKE([1.11 foreign])
+
+AM_SILENT_RULES([yes])
+
+LT_INIT
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+])
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/project.anjuta b/plugins/project-wizard/templates/gnome-shell-extension/project.anjuta
new file mode 100644
index 0000000..99cb0ef
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/project.anjuta
@@ -0,0 +1,37 @@
+<?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>
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/src/Makefile.am.tpl b/plugins/project-wizard/templates/gnome-shell-extension/src/Makefile.am.tpl
new file mode 100644
index 0000000..94535a9
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/src/Makefile.am.tpl
@@ -0,0 +1,18 @@
+[+ autogen5 template +]
+## Process this file with automake to produce Makefile.in
+
+## Created by Anjuta
+
+jsdir = $(prefix)/[+UUID+]
+js_DATA = \
+	metadata.json \
+	stylesheet.css
+
+js_SCRIPTS = extension.js
+
+EXTRA_DIST = $(js_DATA)
+
+uninstall-local:
+	-rm -r $(jsdir)
+
+
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js b/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js
new file mode 100755
index 0000000..df9d1ab
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js
@@ -0,0 +1,69 @@
+[+ autogen5 template +]
+/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * extension.js
+ * Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
+ * 
+[+CASE (get "License") +]
+[+ == "BSD"  +][+(bsd  (get "Name") (get "Author") " * ")+]
+[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
+[+ == "GPL"  +][+(gpl  (get "Name")                " * ")+]
+[+ESAC+] */
+
+const St = imports.gi.St;
+const Main = imports.ui.main;
+const Tweener = imports.ui.tweener;
+
+// Other javascript files in the [+UUID+] directory are accesible via Extension.<file name>
+const Extension = imports.ui.extensionSystem.extensions['[+UUID+]'];
+
+let text, button;
+
+function _hideHello() {
+    Main.uiGroup.remove_actor(text);
+    text = null;
+}
+
+function _showHello() {
+    if (!text) {
+        text = new St.Label({ style_class: '[+NameHLower+]-label', text: "Hello, world!" });
+        Main.uiGroup.add_actor(text);
+    }
+
+    text.opacity = 255;
+
+    let monitor = Main.layoutManager.primaryMonitor;
+
+    text.set_position(Math.floor(monitor.width / 2 - text.width / 2),
+                      Math.floor(monitor.height / 2 - text.height / 2));
+
+    Tweener.addTween(text,
+                     { opacity: 0,
+                       time: 2,
+                       transition: 'easeOutQuad',
+                       onComplete: _hideHello });
+}
+
+function init() {
+    button = new St.Bin({ style_class: 'panel-button',
+                          reactive: true,
+                          can_focus: true,
+                          x_fill: true,
+                          y_fill: false,
+                          track_hover: true });
+    let icon = new St.Icon({ icon_name: 'system-run',
+                             icon_type: St.IconType.SYMBOLIC,
+                             style_class: 'system-status-icon' });
+
+    button.set_child(icon);
+    button.connect('button-press-event', _showHello);
+}
+
+function enable() {
+    Main.panel._rightBox.insert_actor(button, 0);
+}
+
+function disable() {
+    Main.panel._rightBox.remove_actor(button);
+}
+
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/src/metadata.json b/plugins/project-wizard/templates/gnome-shell-extension/src/metadata.json
new file mode 100644
index 0000000..92ea5e5
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/src/metadata.json
@@ -0,0 +1,9 @@
+[+ autogen5 template +]
+{
+    "shell-version": [+Compatibility+], 
+    "uuid": "[+UUID+]", 
+    "name": "[+PluginName+]", 
+    "original-author": "[+Author+]",
+    "url": "[+URL+]", 
+    "description": "[+Description+]"
+}
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/src/stylesheet.css b/plugins/project-wizard/templates/gnome-shell-extension/src/stylesheet.css
new file mode 100644
index 0000000..7d72bdb
--- /dev/null
+++ b/plugins/project-wizard/templates/gnome-shell-extension/src/stylesheet.css
@@ -0,0 +1,10 @@
+[+ autogen5 template +]
+.[+NameHLower+]-label {
+    font-size: 36px;
+    font-weight: bold;
+    color: #ffffff;
+    background-color: rgba(10,10,10,0.7);
+    border-radius: 5px;
+    padding: .5em;
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]