From ca06cd994b09cbb500b35af30c8bd75dc3e0e5b7 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 10 Jun 2009 08:11:08 +0000 Subject: merged plugin-test branch into trunk. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2164 ee746299-78ed-0310-b773-934348b2243d --- plugin/Makefile.am | 1 + plugin/test/Makefile.am | 18 +++++++++ plugin/test/test.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ plugin/test/test.h | 23 ++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 plugin/Makefile.am create mode 100644 plugin/test/Makefile.am create mode 100644 plugin/test/test.c create mode 100644 plugin/test/test.h (limited to 'plugin') diff --git a/plugin/Makefile.am b/plugin/Makefile.am new file mode 100644 index 00000000..02af5b3e --- /dev/null +++ b/plugin/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = test diff --git a/plugin/test/Makefile.am b/plugin/test/Makefile.am new file mode 100644 index 00000000..f7ec8ef7 --- /dev/null +++ b/plugin/test/Makefile.am @@ -0,0 +1,18 @@ +libdir = $(plugindir) + +lib_LTLIBRARIES = test.la + +test_la_SOURCES = test.c test.h +test_la_LDFLAGS = -module -no-undefined -avoid-version + +INCLUDES = \ + $(GTK_CFLAGS) \ + -I$(includedir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libsylph \ + -I$(top_srcdir)/src + +test_la_LIBADD = \ + $(GTK_LIBS) \ + $(top_srcdir)/src/libsylpheed-plugin-0.la \ + $(top_srcdir)/libsylph/libsylph-0.la diff --git a/plugin/test/test.c b/plugin/test/test.c new file mode 100644 index 00000000..3de6ee62 --- /dev/null +++ b/plugin/test/test.c @@ -0,0 +1,99 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * + * 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. + */ + +#include +#include + +#include "plugin.h" +#include "test.h" +#include "folder.h" + +static SylPluginInfo info = { + "Test Plugin", + "1.0.0", + "Hiroyuki Yamamoto", + "Test plug-in for Sylpheed plug-in system" +}; + +static void create_window(void); + +void plugin_load(void) +{ + GList *list, *cur; + const gchar *ver; + gpointer mainwin; + + g_print("test plug-in loaded!\n"); + list = folder_get_list(); + g_print("list = %p\n", list); + for (cur = list; cur != NULL; cur = cur->next) { + Folder *folder = FOLDER(cur->data); + gchar *id = folder_get_identifier(folder); + g_print("id = %s\n", id); + } + + ver = syl_plugin_get_prog_version(); + g_print("ver: %s\n", ver); + + mainwin = syl_plugin_main_window_get(); + g_print("mainwin: %p\n", mainwin); + syl_plugin_main_window_popup(mainwin); + + syl_plugin_add_menuitem("/Tools", NULL, NULL, NULL); + syl_plugin_add_menuitem("/Tools", "Plugin test", create_window, NULL); + + g_print("test plug-in loading done\n"); +} + +void plugin_unload(void) +{ + g_print("test plug-in unloaded!\n"); +} + +SylPluginInfo *plugin_info(void) +{ + return &info; +} + +gint plugin_interface_version(void) +{ + return SYL_PLUGIN_INTERFACE_VERSION; +} + +static void button_clicked(GtkWidget *widget, gpointer data) +{ + g_print("button_clicked\n"); + syl_plugin_app_will_exit(TRUE); +} + +static void create_window(void) +{ + GtkWidget *window; + GtkWidget *button; + + g_print("creating window\n"); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + button = gtk_button_new_with_label("Click this to quit"); + gtk_window_set_default_size(GTK_WINDOW(window), 400, 200); + gtk_container_add(GTK_CONTAINER(window), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(button_clicked), NULL); + gtk_widget_show_all(window); +} diff --git a/plugin/test/test.h b/plugin/test/test.h new file mode 100644 index 00000000..9a559b3a --- /dev/null +++ b/plugin/test/test.h @@ -0,0 +1,23 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * + * 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 __TEST_H__ +#define __TEST_H__ + +#endif /* __TEST_H__ */ -- cgit v1.2.3