Browse Source

Import test plugin for testing the object code.

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
bc3e0f3742
  1. 11
      plugins/Makefile.am
  2. 58
      plugins/test/Makefile.am
  3. 9
      plugins/test/test.desktop.in.in
  4. 142
      plugins/test/xfce-test-plugin.c
  5. 50
      plugins/test/xfce-test-plugin.h

11
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:

58
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" < $< > $@
@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:

9
plugins/test/test.desktop.in.in

@ -0,0 +1,9 @@
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_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

142
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);
}

50
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__ */
Loading…
Cancel
Save