Initial commit: control panel plugin skeleton
authorPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 24 Feb 2010 16:43:27 +0000 (17:43 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 24 Feb 2010 17:55:47 +0000 (18:55 +0100)
Makefile [new file with mode: 0644]
data/led-pattern-editor.desktop [new file with mode: 0644]
src/led-pattern-editor.vala [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..db4d954
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+.PHONY: all clean install
+
+pluginlibdir=`pkg-config hildon-control-panel --variable pluginlibdir`
+plugindesktopentrydir=`pkg-config hildon-control-panel --variable plugindesktopentrydir`
+
+HILDON_CFLAGS = `pkg-config --cflags hildon-1`
+OSSO_CFLAGS = `pkg-config --cflags libosso`
+
+HILDON_LIBS = `pkg-config --libs hildon-1`
+OSSO_LIBS = `pkg-config --libs libosso`
+
+pluginlib_LTLIBRARY = \
+       libled-pattern-editor.so
+
+plugindesktopentry_DATA = \
+       data/led-pattern-editor.desktop
+
+all: ${pluginlib_LTLIBRARY}
+
+led_pattern_editor_SOURCES = $(patsubst %.vala,%.c,${led_pattern_editor_VALASOURCES})
+
+led_pattern_editor_VALASOURCES = \
+       src/led-pattern-editor.vala
+
+led_pattern_editor_VALAFLAGS = --pkg hildon-1 --pkg libosso
+
+${pluginlib_LTLIBRARY}: ${led_pattern_editor_SOURCES}
+       gcc -shared ${HILDON_CFLAGS} ${OSSO_CFLAGS} -o $@ $^ ${HILDON_LIBS} ${OSSO_LIBS}
+
+src/led-pattern-editor.c: ${led_pattern_editor_VALASOURCES}
+       valac -C ${led_pattern_editor_VALAFLAGS} -o $@ $^
+
+clean:
+       rm ${pluginlib_LTLIBRARY} src/*.c
+
+install:
+       install -d ${DESTDIR}${pluginlibdir}
+       install libled-pattern-editor.so ${DESTDIR}${pluginlibdir}/libled-pattern-editor.so
+       install -d ${DESTDIR}${plugindesktopentrydir}
+       install ${plugindesktopentry_DATA} ${DESTDIR}${plugindesktopentrydir}/`basename ${plugindesktopentry_DATA}`
+
diff --git a/data/led-pattern-editor.desktop b/data/led-pattern-editor.desktop
new file mode 100644 (file)
index 0000000..966e5d5
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry] 
+Encoding=UTF-8
+Version=1.0
+Name=LED Patterns
+Comment=LED pattern editor
+Type=HildonControlPanelPlugin
+Icon=control_led
+X-control-panel-plugin=libled-pattern-editor.so
+Categories=personalisation
diff --git a/src/led-pattern-editor.vala b/src/led-pattern-editor.vala
new file mode 100644 (file)
index 0000000..249a311
--- /dev/null
@@ -0,0 +1,38 @@
+/* This file is part of LED Pattern Editor.
+ *
+ * Copyright (C) 2010 Philipp Zabel
+ *
+ * LED Pattern Editor is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LED Pattern Editor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LED Pattern Editor. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+public static Osso.Status execute (Osso.Context osso, void* data, bool user_activated) {
+       var window = data as Gtk.Window;
+
+       // Load mce.ini
+
+       var dialog = new Gtk.Dialog ();
+       dialog.set_transient_for (window);
+
+       int response = dialog.run ();
+       dialog.destroy ();
+       if (response == Gtk.ResponseType.OK) {
+               // Save mce.ini
+       }
+
+       return Osso.Status.OK;
+}
+
+public static Osso.Status save_state (Osso.Context osso, void* data) {
+       return Osso.Status.OK;
+}