summaryrefslogtreecommitdiff
path: root/peas-demo
diff options
context:
space:
mode:
authorSteve Frécinaux <code@istique.net>2010-01-03 00:18:53 +0100
committerSteve Frécinaux <code@istique.net>2010-01-03 00:18:53 +0100
commit52ae4da09a15cd3c1fae6cdd050ba4c25307d45f (patch)
treecada63f3fb96ed9f7682e0e5da2f6a20e53cc78a /peas-demo
parentfa545a688668cc1502a3f7cc13ce2406ce3dc85b (diff)
parentb80b935502fb0ad2731a4565efacd2b446cd1386 (diff)
downloadlibpeas-52ae4da09a15cd3c1fae6cdd050ba4c25307d45f.tar.gz
Merge branch 'configurable-iface'
Conflicts: libpeasui/Makefile.am
Diffstat (limited to 'peas-demo')
-rw-r--r--peas-demo/Makefile.am4
-rw-r--r--peas-demo/plugins/helloworld/Makefile.am5
-rw-r--r--peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c58
-rw-r--r--peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h12
4 files changed, 69 insertions, 10 deletions
diff --git a/peas-demo/Makefile.am b/peas-demo/Makefile.am
index c53a0d6..abf4d28 100644
--- a/peas-demo/Makefile.am
+++ b/peas-demo/Makefile.am
@@ -6,6 +6,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
$(PEAS_CFLAGS) \
+ $(PEASUI_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS)
@@ -14,7 +15,8 @@ peas_demo_SOURCES = \
peas_demo_LDADD = \
$(PEAS_LIBS) \
- ../libpeas/libpeas-2.0.la \
+ $(PEASUI_LIBS) \
+ ../libpeas/libpeas-2.0.la \
../libpeasui/libpeasui-2.0.la
peas_demo_CFLAGS = \
diff --git a/peas-demo/plugins/helloworld/Makefile.am b/peas-demo/plugins/helloworld/Makefile.am
index 604d633..7f44913 100644
--- a/peas-demo/plugins/helloworld/Makefile.am
+++ b/peas-demo/plugins/helloworld/Makefile.am
@@ -2,7 +2,8 @@ plugindir = $(prefix)/lib/peas-demo/plugins/helloworld
INCLUDES = \
-I$(top_srcdir) \
- $(PEAS_CFLAGS)
+ $(PEAS_CFLAGS) \
+ $(PEASUI_CFLAGS)
plugin_LTLIBRARIES = libhelloworld.la
@@ -11,7 +12,7 @@ libhelloworld_la_SOURCES = \
peasdemo-hello-world-plugin.c
libhelloworld_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
-libhelloworld_la_LIBADD = $(PEAS_LIBS)
+libhelloworld_la_LIBADD = $(PEAS_LIBS) $(PEASUI_LIBS)
plugin_DATA = helloworld.peasdemo-plugin
diff --git a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
index 44ee0b3..aacddb3 100644
--- a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
+++ b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
@@ -1,11 +1,22 @@
#include <glib.h>
+#include <glib-object.h>
#include <gmodule.h>
+#include <gtk/gtk.h>
+
+#include <libpeasui/peas-ui-configurable.h>
#include "peasdemo-hello-world-plugin.h"
#define WINDOW_DATA_KEY "PeasDemoHelloWorldPluginWindowData"
-PEAS_REGISTER_TYPE(PEAS_TYPE_PLUGIN, PeasDemoHelloWorldPlugin, peasdemo_hello_world_plugin)
+static void peas_ui_configurable_iface_init (PeasUIConfigurableIface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PeasDemoHelloWorldPlugin,
+ peasdemo_hello_world_plugin,
+ PEAS_TYPE_PLUGIN,
+ 0,
+ G_IMPLEMENT_INTERFACE (PEAS_UI_TYPE_CONFIGURABLE,
+ peas_ui_configurable_iface_init))
typedef struct {
GtkWidget *label;
@@ -91,6 +102,32 @@ peasdemo_hello_world_plugin_deactivate (PeasPlugin *plugin,
}
static void
+on_configure_dialog_response (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static GtkWidget *
+peasdemo_hello_world_plugin_create_configure_dialog (PeasUIConfigurable *configurable)
+{
+ GtkWidget *dialog;
+
+ g_debug (G_STRFUNC);
+
+ dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "This is a configuration dialog for the HelloWorld plugin.");
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (on_configure_dialog_response), NULL);
+
+ return dialog;
+}
+
+static void
peasdemo_hello_world_plugin_class_init (PeasDemoHelloWorldPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -101,3 +138,22 @@ peasdemo_hello_world_plugin_class_init (PeasDemoHelloWorldPluginClass *klass)
plugin_class->activate = peasdemo_hello_world_plugin_activate;
plugin_class->deactivate = peasdemo_hello_world_plugin_deactivate;
}
+
+static void
+peas_ui_configurable_iface_init (PeasUIConfigurableIface *iface)
+{
+ iface->create_configure_dialog = peasdemo_hello_world_plugin_create_configure_dialog;
+}
+
+static void
+peasdemo_hello_world_plugin_class_finalize (PeasDemoHelloWorldPluginClass *klass)
+{
+}
+
+G_MODULE_EXPORT GType
+register_peas_plugin (GTypeModule *type_module)
+{
+ peasdemo_hello_world_plugin_register_type (type_module);
+
+ return PEASDEMO_TYPE_HELLO_WORLD_PLUGIN;
+}
diff --git a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
index f8ca9e6..89b8b3b 100644
--- a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
+++ b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
@@ -7,12 +7,12 @@
G_BEGIN_DECLS
-#define PeasDEMO_TYPE_HELLO_WORLD_PLUGIN (peasdemo_hello_world_plugin_get_type ())
-#define PeasDEMO_HELLO_WORLD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPlugin))
-#define PeasDEMO_HELLO_WORLD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPlugin))
-#define PeasDEMO_IS_HELLO_WORLD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN))
-#define PeasDEMO_IS_HELLO_WORLD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN))
-#define PeasDEMO_HELLO_WORLD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPluginClass))
+#define PEASDEMO_TYPE_HELLO_WORLD_PLUGIN (peasdemo_hello_world_plugin_get_type ())
+#define PEASDEMO_HELLO_WORLD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPlugin))
+#define PEASDEMO_HELLO_WORLD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPlugin))
+#define PEASDEMO_IS_HELLO_WORLD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN))
+#define PEASDEMO_IS_HELLO_WORLD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN))
+#define PEASDEMO_HELLO_WORLD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PeasDEMO_TYPE_HELLO_WORLD_PLUGIN, PeasDemoHelloWorldPluginClass))
typedef struct _PeasDemoHelloWorldPlugin PeasDemoHelloWorldPlugin;
typedef struct _PeasDemoHelloWorldPluginClass PeasDemoHelloWorldPluginClass;