[Xfce4-commits] <xfce4-panel:devel> * Import test plugin for testing the object code.

Nick Schermer nick at xfce.org
Tue Aug 11 20:24:23 CEST 2009


Updating branch refs/heads/devel
         to 876543067fb3562b0631fe8ef5d22beb19e8f64d (commit)
       from 804df52d003e2a054d3825fa3d4b6a3cd0581657 (commit)

commit 876543067fb3562b0631fe8ef5d22beb19e8f64d
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Oct 5 22:11:41 2008 +0200

    * Import test plugin for testing the object code.

 plugins/Makefile.am                                |   11 +-
 plugins/test/Makefile.am                           |   58 ++++++++
 .../test.desktop.in.in}                            |    8 +-
 plugins/test/xfce-test-plugin.c                    |  142 ++++++++++++++++++++
 plugins/test/xfce-test-plugin.h                    |   50 +++++++
 5 files changed, 260 insertions(+), 9 deletions(-)

diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index e424c33..fe4c586 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,9 +1,10 @@
 # $Id$
 
-SUBDIRS = 								\
-	clock								\
-	launcher							\
-	systray								\
-	tasklist
+SUBDIRS = \
+	clock \
+	launcher \
+	systray \
+	tasklist \
+	test
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/test/Makefile.am b/plugins/test/Makefile.am
new file mode 100644
index 0000000..8d7d762
--- /dev/null
+++ b/plugins/test/Makefile.am
@@ -0,0 +1,58 @@
+# $Id$
+
+INCLUDES = \
+	-I$(top_srcdir) \
+	-DG_LOG_DOMAIN=\"libtest\" \
+	-DLOCALEDIR=\"$(localedir)\" \
+	$(PLATFORM_CPPFLAGS)
+
+plugindir = \
+	$(libdir)/xfce4/panel-plugins
+
+plugin_LTLIBRARIES = \
+	libtest.la
+
+libtest_la_SOURCES = \
+	xfce-test-plugin.c \
+	xfce-test-plugin.h
+
+libtest_la_CFLAGS = \
+	$(GTK_CFLAGS) \
+	$(LIBXFCE4UTIL_CFLAGS) \
+	$(LIBXFCE4UI_CFLAGS) \
+	$(PLATFORM_CFLAGS)
+
+libtest_la_LDFLAGS = \
+	-avoid-version \
+	-module \
+	-no-undefined \
+	$(PLATFORM_LDFLAGS)
+
+libtest_la_LIBADD = \
+	$(top_builddir)/libxfce4panel/libxfce4panel.la \
+	$(GTK_LIBS) \
+	$(LIBXFCE4UTIL_LIBS) \
+	$(LIBXFCE4UI_LIBS)
+
+libtest_la_DEPENDENCIES = \
+	$(top_builddir)/libxfce4panel/libxfce4panel.la
+
+#
+# .desktop file
+#
+desktopdir = $(datadir)/xfce4/panel-plugins
+desktop_in_in_files = test.desktop.in.in
+desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+%.desktop.in: %.desktop.in.in
+	sed -e "s,\@libdir\@,$(libdir),g" < $< > $@
+ at INTLTOOL_DESKTOP_RULE@
+
+EXTRA_DIST = \
+	$(desktop_in_in_files)
+	
+DISTCLEANFILES = \
+	$(desktop_DATA) \
+	$(desktop_in_files)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/launcher/launcher.desktop.in.in b/plugins/test/test.desktop.in.in
similarity index 53%
copy from plugins/launcher/launcher.desktop.in.in
copy to plugins/test/test.desktop.in.in
index dc4f6c8..a03601a 100644
--- a/plugins/launcher/launcher.desktop.in.in
+++ b/plugins/test/test.desktop.in.in
@@ -1,9 +1,9 @@
 [Xfce Panel]
 Type=X-XFCE-PanelPlugin
 Encoding=UTF-8
-_Name=Launcher
-_Comment=Program launcher with optional menu
-Icon=gnome-fs-executable
-X-XFCE-Module=launcher
+_Name=Test Plugin
+_Comment=Plugin to test features in the panel
+Icon=applications-system
+X-XFCE-Module=test
 X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
 X-XFCE-External=FALSE
diff --git a/plugins/test/xfce-test-plugin.c b/plugins/test/xfce-test-plugin.c
new file mode 100644
index 0000000..a358f4e
--- /dev/null
+++ b/plugins/test/xfce-test-plugin.c
@@ -0,0 +1,142 @@
+/* $Id$ */
+/*
+ * This library 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 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This library 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 Library General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/libxfce4panel.h>
+
+#include "xfce-test-plugin.h"
+
+
+
+static void xfce_test_plugin_class_init (XfceTestPluginClass *klass);
+static void xfce_test_plugin_init (XfceTestPlugin *plugin);
+static void xfce_test_plugin_finalize (GObject *object);
+static void xfce_test_plugin_construct (XfcePanelPlugin *plugin);
+static void xfce_test_plugin_free_data (XfcePanelPlugin *plugin);
+static void xfce_test_plugin_orientation_changed (XfcePanelPlugin *plugin, GtkOrientation orientation);
+static gboolean xfce_test_plugin_size_changed (XfcePanelPlugin *plugin, gint size);
+static void xfce_test_plugin_save (XfcePanelPlugin *plugin);
+static void xfce_test_plugin_configure_plugin (XfcePanelPlugin *plugin);
+static void xfce_test_plugin_screen_position_changed (XfcePanelPlugin *plugin, gint position);
+
+XFCE_PANEL_PLUGIN_REGISTER_OBJECT (XFCE_TYPE_TEST_PLUGIN);
+
+G_DEFINE_TYPE (XfceTestPlugin, xfce_test_plugin, XFCE_TYPE_PANEL_PLUGIN);
+
+
+
+static void
+xfce_test_plugin_class_init (XfceTestPluginClass *klass)
+{
+  GObjectClass *gobject_class;
+  XfcePanelPluginClass *plugin_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->finalize = xfce_test_plugin_finalize;
+  
+  plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
+  plugin_class->construct = xfce_test_plugin_construct;
+  plugin_class->free_data = xfce_test_plugin_free_data;
+  plugin_class->orientation_changed = xfce_test_plugin_orientation_changed;
+  plugin_class->size_changed = xfce_test_plugin_size_changed;
+  plugin_class->save = xfce_test_plugin_save;
+  plugin_class->configure_plugin = xfce_test_plugin_configure_plugin;
+  plugin_class->screen_position_changed = xfce_test_plugin_screen_position_changed;
+}
+
+
+
+static void
+xfce_test_plugin_init (XfceTestPlugin *plugin)
+{
+  g_message ("init plugin %s", xfce_panel_plugin_get_name (XFCE_PANEL_PLUGIN (plugin)));
+}
+
+
+
+static void 
+xfce_test_plugin_finalize (GObject *object)
+{
+  g_message ("plugin %s finalized", xfce_panel_plugin_get_name (XFCE_PANEL_PLUGIN (object)));
+  
+  (*G_OBJECT_CLASS (xfce_test_plugin_parent_class)->finalize) (object);
+}
+
+
+
+static void
+xfce_test_plugin_construct (XfcePanelPlugin *plugin)
+{
+  g_message ("construct plugin %s", xfce_panel_plugin_get_name (plugin));
+}
+
+
+
+static void
+xfce_test_plugin_free_data (XfcePanelPlugin *plugin)
+{
+  g_message ("free data");
+}
+
+
+
+static void
+xfce_test_plugin_orientation_changed (XfcePanelPlugin *plugin,
+                                      GtkOrientation   orientation)
+{
+  g_message ("orientation changed");
+}
+
+
+
+static gboolean
+xfce_test_plugin_size_changed (XfcePanelPlugin *plugin,
+                               gint             size)
+{
+  g_message ("size changed: %d px", size);
+
+  return TRUE;
+}
+
+
+
+static void
+xfce_test_plugin_save (XfcePanelPlugin *plugin)
+{
+  g_message ("save the plugin");
+}
+
+
+
+static void
+xfce_test_plugin_configure_plugin (XfcePanelPlugin *plugin)
+{
+  g_message ("configure the plugin");
+}
+
+
+
+static void
+xfce_test_plugin_screen_position_changed (XfcePanelPlugin *plugin,
+                                          gint             position)
+{
+  g_message ("screen position changed: %d", position);
+}
diff --git a/plugins/test/xfce-test-plugin.h b/plugins/test/xfce-test-plugin.h
new file mode 100644
index 0000000..f721765
--- /dev/null
+++ b/plugins/test/xfce-test-plugin.h
@@ -0,0 +1,50 @@
+/* $Id$ */
+/*
+ * This program 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 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program 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
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __XFCE_TEST_PLUGIN_H__
+#define __XFCE_TEST_PLUGIN_H__
+
+#include <gtk/gtk.h>
+#include <libxfce4panel/libxfce4panel.h>
+
+G_BEGIN_DECLS
+
+typedef struct _XfceTestPluginClass XfceTestPluginClass;
+typedef struct _XfceTestPlugin      XfceTestPlugin;
+
+#define XFCE_TYPE_TEST_PLUGIN            (xfce_test_plugin_get_type ())
+#define XFCE_TEST_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TEST_PLUGIN, XfceTestPlugin))
+#define XFCE_TEST_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_TEST_PLUGIN, XfceTestPluginClass))
+#define XFCE_IS_TEST_PLUGIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TEST_PLUGIN))
+#define XFCE_IS_TEST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_TEST_PLUGIN))
+#define XFCE_TEST_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_TEST_PLUGIN, XfceTestPluginClass))
+
+struct _XfceTestPluginClass
+{
+  XfcePanelPluginClass __parent__;
+};
+
+struct _XfceTestPlugin
+{
+  XfcePanelPlugin __parent__;
+};
+
+GType xfce_test_plugin_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* !__XFCE_TEST_PLUGIN_H__ */



More information about the Xfce4-commits mailing list