From ec6bbef28a889fc722fd7ec8e88403d7977318aa Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 12 Jan 2011 17:32:40 +0100 Subject: [PATCH] Initial commit. Creating the standard Autotools infrastructure and adding the first extensions (the Hello, World! provided by the wizard). --- .gitignore | 12 +++++++ HACKING | 11 +++++++ Makefile.am | 3 ++ README | 26 +++++++++++++++ autogen.sh | 20 ++++++++++++ configure.ac | 54 +++++++++++++++++++++++++++++++ extension.mk | 9 ++++++ extensions/Makefile.am | 3 ++ extensions/example/Makefile.am | 3 ++ extensions/example/extension.js | 19 +++++++++++ extensions/example/metadata.json | 1 + extensions/example/stylesheet.css | 8 +++++ po/POTFILES.in | 1 + 13 files changed, 170 insertions(+) create mode 100644 .gitignore create mode 100644 HACKING create mode 100644 Makefile.am create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 extension.mk create mode 100644 extensions/Makefile.am create mode 100644 extensions/example/Makefile.am create mode 100644 extensions/example/extension.js create mode 100644 extensions/example/metadata.json create mode 100644 extensions/example/stylesheet.css create mode 100644 po/POTFILES.in diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..523a48ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +Makefile +Makefile.in +Makefile.in.in +configure +config.log +config.status +config/ +aclocal.m4 +autom4te.cache/ +m4/ +po/POTFILES +po/stamp-it diff --git a/HACKING b/HACKING new file mode 100644 index 00000000..509416bf --- /dev/null +++ b/HACKING @@ -0,0 +1,11 @@ +To create a new extension, add a subdirectory in extensions. +Then create a Makefile.am like the one in example, replacing +the EXTENSION_ID with the basename of your extension, which +must match the UUID in metadata.json. +If you need additional files, add them to EXTENSION_EXTRA. + +Then modify extensions/Makefile.am and configure.ac. It should +be pretty self-explanatory. + +Don't forget to add any translatable file to po/POTFILES.in, and +then you're done. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..0f4ce132 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +SUBDIRS = extensions diff --git a/README b/README new file mode 100644 index 00000000..a502d6ef --- /dev/null +++ b/README @@ -0,0 +1,26 @@ +GNOME Shell Extensions is a collection of extensions providing additional +and optional functionality to GNOME Shell. +Since GNOME Shell is not API stable, extensions work only against a very +specific version of the shell, usually the same as this package (see +"configure --version"). Also, since extensions are built from many +individual contributors, we cannot guarantee stability or quality for any +specific extension. +For these reasons, distributions are advised to avoid installing or packaging +this module by defaul. + +For more information about GNOME Shell Extensions + http://live.gnome.org/GnomeShell/Extensions + +For general information about GNOME Shell + http://live.gnome.org/GnomeShell + +Bugs should be reported at http://bugzilla.gnome.org against the 'gnome-shell' +product, with the 'extensions' component. + +License +======= +GNOME Shell Extensions are distributed under the terms of the GNU General Public License, +version 2 or later. See the COPYING file for details. +Individual extensions may be licensed under different terms, see each source +file for details. + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..d9669c5d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="gnome-shell-extensions" + +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/configure.ac b/configure.ac new file mode 100644 index 00000000..7e38c091 --- /dev/null +++ b/configure.ac @@ -0,0 +1,54 @@ +AC_PREREQ(2.63) +AC_INIT([gnome-shell-extensions],[2.91.5],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&component=extensions]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([config]) + +AM_INIT_AUTOMAKE([1.10 dist-bzip2 no-dist-gzip foreign]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +GETTEXT_PACKAGE=gnome-shell-extensions +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The prefix for our gettext translation domains.]) +IT_PROG_INTLTOOL(0.26) + +PKG_PROG_PKG_CONFIG([0.22]) + +ADDITIONAL_PACKAGES= + +dnl keep this in sync with extensions/Makefile.am +ALL_EXTENSIONS=example +AC_ARG_ENABLE([extensions], + [AS_HELP_STRING([--enable-extensions],[Space separated list of extensions to enable. Default is that all extensions are built.])], + [], + [enable_extensions=$ALL_EXTENSIONS] +) +ENABLED_EXTENSIONS= +for e in $enable_extensions; do + case $e in + *example*) + ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS example" + ;; + *) + AC_MSG_ERROR([invalid extension $e]) + esac +done + +AC_SUBST(ENABLED_EXTENSIONS, [$ENABLED_EXTENSIONS]) + +dnl We don't really need cflags or libdirs, we just check +dnl to ensure we don't fail at runtime. + +if test "x$ADDITIONAL_PACKAGES" != x; then + PKG_CHECK_MODULES(ADDITIONAL, [$ADDITIONAL_PACKAGES]) +fi + +AC_CONFIG_FILES([ + Makefile + extensions/Makefile + extensions/example/Makefile + po/Makefile.in +]) +AC_OUTPUT diff --git a/extension.mk b/extension.mk new file mode 100644 index 00000000..e7d9787b --- /dev/null +++ b/extension.mk @@ -0,0 +1,9 @@ +# Change these to modify how installation is performed +# If you modify extensionbase, you also need to modify +# metadata.json of each extension +topextensiondir = $(datadir)/gnome-shell/extensions +extensionbase = @gnome-shell-extensions.gnome.org + +extensiondir = $(topextensiondir)/$(EXTENSION_ID)$(extensionbase) + +extension_DATA = metadata.json extension.js stylesheet.css $(EXTRA_EXTENSION) diff --git a/extensions/Makefile.am b/extensions/Makefile.am new file mode 100644 index 00000000..a0471ec1 --- /dev/null +++ b/extensions/Makefile.am @@ -0,0 +1,3 @@ +DIST_SUBDIRS = example + +SUBDIRS = $(ENABLED_EXTENSIONS) diff --git a/extensions/example/Makefile.am b/extensions/example/Makefile.am new file mode 100644 index 00000000..9f63ef64 --- /dev/null +++ b/extensions/example/Makefile.am @@ -0,0 +1,3 @@ +EXTENSION_ID = example + +include ../../extension.mk diff --git a/extensions/example/extension.js b/extensions/example/extension.js new file mode 100644 index 00000000..f137ea6b --- /dev/null +++ b/extensions/example/extension.js @@ -0,0 +1,19 @@ +// Sample extension code, makes clicking on the panel show a message +const St = imports.gi.St; +const Mainloop = imports.mainloop; + +const Main = imports.ui.main; + +function _showHello() { + let text = new St.Label({ style_class: 'helloworld-label', text: "Hello, world!" }); + let monitor = global.get_primary_monitor(); + global.stage.add_actor(text); + text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2)); + Mainloop.timeout_add(3000, function () { text.destroy(); }); +} + +// Put your extension initialization code here +function main() { + Main.panel.actor.reactive = true; + Main.panel.actor.connect('button-release-event', _showHello); +} diff --git a/extensions/example/metadata.json b/extensions/example/metadata.json new file mode 100644 index 00000000..ff70959a --- /dev/null +++ b/extensions/example/metadata.json @@ -0,0 +1 @@ +{"uuid": "example@gnome-shell-extensions.gnome.org", "name": "Hello, World!", "description": "An example extension to show how it works. Shows Hello, world when clicking on the top panel.", "shell-version": [ "2.91.5" ]} diff --git a/extensions/example/stylesheet.css b/extensions/example/stylesheet.css new file mode 100644 index 00000000..a8dc980f --- /dev/null +++ b/extensions/example/stylesheet.css @@ -0,0 +1,8 @@ +/* Example stylesheet */ +.helloworld-label { + font-size: 36px; + font-weight: bold; + color: #ffffff; + background-color: rgba(10,10,10,0.7); + border-radius: 5px; +} diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 00000000..0f896791 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1 @@ +extensions/example/extension.js