summaryrefslogtreecommitdiff
path: root/pidgin/plugins/widget-test.c
blob: b46ff11c576bacbcd0eafcb951017207d6522b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* pidgin
 *
 * Pidgin is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 */
#include <glib.h>
#include <gmodule.h>
#include <gplugin.h>

#include <purple.h>

#include "gtkplugin.h"
#include "pidginprotocolstore.h"

/* make the compiler happy... */
G_MODULE_EXPORT GPluginPluginInfo *gplugin_query(GError **error);
G_MODULE_EXPORT gboolean gplugin_load(GPluginPlugin *plugin, GError **error);
G_MODULE_EXPORT gboolean gplugin_unload(GPluginPlugin *plugin, GError **error);

/******************************************************************************
 * Config Frame
 *****************************************************************************/
static GtkWidget *
pidgin_widget_test_config_frame(G_GNUC_UNUSED PurplePlugin *plugin) {
	GtkWidget *vbox = NULL, *hbox = NULL;
	GtkWidget *label = NULL, *combo = NULL;
	GtkListStore *store = NULL;

	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);

	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

	label = gtk_label_new("Protocols:");
	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);

	store = pidgin_protocol_store_new();
	combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
	gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0);

	gtk_widget_show_all(vbox);

	return vbox;
}

/******************************************************************************
 * Plugin Exports
 *****************************************************************************/
G_MODULE_EXPORT GPluginPluginInfo *
gplugin_query(GError **error) {
	PidginPluginInfo *info = NULL;

	const gchar * const authors[] = {
		"Gary Kramlich <grim@reaperworld.com>",
		NULL
	};

	info = pidgin_plugin_info_new(
		"id", "pidgin/widget-test",
		"abi-version", PURPLE_ABI_VERSION,
		"name", "Pidgin Widget Test",
		"version", "0.0.1",
		"authors", authors,
		"gtk-config-frame-cb", pidgin_widget_test_config_frame,
		NULL
	);

	return GPLUGIN_PLUGIN_INFO(info);
}

G_MODULE_EXPORT gboolean
gplugin_load(GPluginPlugin *plugin, GError **error) {
	return TRUE;
}

G_MODULE_EXPORT gboolean
gplugin_unload(GPluginPlugin *plugin, GError **error) {
	return TRUE;
}