2 * PluginPref Example Plugin
4 * Copyright (C) 2004, Gary Kramlich <amc_grim@users.sf.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #ifndef PURPLE_PLUGINS
27 # define PURPLE_PLUGINS
33 #include "pluginpref.h"
37 static PurplePluginPrefFrame
*
38 get_plugin_pref_frame(PurplePlugin
*plugin
) {
39 PurplePluginPrefFrame
*frame
;
40 PurplePluginPref
*ppref
;
42 frame
= purple_plugin_pref_frame_new();
44 ppref
= purple_plugin_pref_new_with_label("boolean");
45 purple_plugin_pref_frame_add(frame
, ppref
);
47 ppref
= purple_plugin_pref_new_with_name_and_label(
48 "/plugins/core/pluginpref_example/bool",
50 purple_plugin_pref_frame_add(frame
, ppref
);
52 ppref
= purple_plugin_pref_new_with_label("integer");
53 purple_plugin_pref_frame_add(frame
, ppref
);
55 ppref
= purple_plugin_pref_new_with_name_and_label(
56 "/plugins/core/pluginpref_example/int",
58 purple_plugin_pref_set_bounds(ppref
, 0, 255);
59 purple_plugin_pref_frame_add(frame
, ppref
);
61 ppref
= purple_plugin_pref_new_with_name_and_label(
62 "/plugins/core/pluginpref_example/int_choice",
64 purple_plugin_pref_set_type(ppref
, PURPLE_PLUGIN_PREF_CHOICE
);
65 purple_plugin_pref_add_choice(ppref
, "One", GINT_TO_POINTER(1));
66 purple_plugin_pref_add_choice(ppref
, "Two", GINT_TO_POINTER(2));
67 purple_plugin_pref_add_choice(ppref
, "Four", GINT_TO_POINTER(4));
68 purple_plugin_pref_add_choice(ppref
, "Eight", GINT_TO_POINTER(8));
69 purple_plugin_pref_add_choice(ppref
, "Sixteen", GINT_TO_POINTER(16));
70 purple_plugin_pref_add_choice(ppref
, "Thirty Two", GINT_TO_POINTER(32));
71 purple_plugin_pref_add_choice(ppref
, "Sixty Four", GINT_TO_POINTER(64));
72 purple_plugin_pref_add_choice(ppref
, "One Hundred Twenty Eight", GINT_TO_POINTER(128));
73 purple_plugin_pref_frame_add(frame
, ppref
);
75 ppref
= purple_plugin_pref_new_with_label("string");
76 purple_plugin_pref_frame_add(frame
, ppref
);
78 ppref
= purple_plugin_pref_new_with_name_and_label(
79 "/plugins/core/pluginpref_example/string",
81 purple_plugin_pref_frame_add(frame
, ppref
);
83 ppref
= purple_plugin_pref_new_with_name_and_label(
84 "/plugins/core/pluginpref_example/masked_string",
86 purple_plugin_pref_set_masked(ppref
, TRUE
);
87 purple_plugin_pref_frame_add(frame
, ppref
);
89 ppref
= purple_plugin_pref_new_with_name_and_label(
90 "/plugins/core/pluginpref_example/max_string",
91 "string pref\n(max length of 16)");
92 purple_plugin_pref_set_max_length(ppref
, 16);
93 purple_plugin_pref_frame_add(frame
, ppref
);
95 ppref
= purple_plugin_pref_new_with_name_and_label(
96 "/plugins/core/pluginpref_example/string_choice",
98 purple_plugin_pref_set_type(ppref
, PURPLE_PLUGIN_PREF_CHOICE
);
99 purple_plugin_pref_add_choice(ppref
, "red", "red");
100 purple_plugin_pref_add_choice(ppref
, "orange", "orange");
101 purple_plugin_pref_add_choice(ppref
, "yellow", "yellow");
102 purple_plugin_pref_add_choice(ppref
, "green", "green");
103 purple_plugin_pref_add_choice(ppref
, "blue", "blue");
104 purple_plugin_pref_add_choice(ppref
, "purple", "purple");
105 purple_plugin_pref_frame_add(frame
, ppref
);
110 static PurplePluginUiInfo prefs_info
= {
111 get_plugin_pref_frame
,
112 0, /* page_num (Reserved) */
113 NULL
, /* frame (Reserved) */
121 static PurplePluginInfo info
=
124 PURPLE_MAJOR_VERSION
,
125 PURPLE_MINOR_VERSION
,
126 PURPLE_PLUGIN_STANDARD
, /**< type */
127 NULL
, /**< ui_requirement */
129 NULL
, /**< dependencies */
130 PURPLE_PRIORITY_DEFAULT
, /**< priority */
132 "core-pluginpref_example", /**< id */
133 "Pluginpref Example", /**< name */
134 DISPLAY_VERSION
, /**< version */
136 "An example of how to use pluginprefs",
138 "An example of how to use pluginprefs",
139 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */
140 PURPLE_WEBSITE
, /**< homepage */
144 NULL
, /**< destroy */
146 NULL
, /**< ui_info */
147 NULL
, /**< extra_info */
148 &prefs_info
, /**< prefs_info */
149 NULL
, /**< actions */
158 init_plugin(PurplePlugin
*plugin
)
160 purple_prefs_add_none("/plugins/core/pluginpref_example");
161 purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE
);
162 purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0);
163 purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1);
164 purple_prefs_add_string("/plugins/core/pluginpref_example/string",
166 purple_prefs_add_string("/plugins/core/pluginpref_example/max_string",
167 "max length string");
168 purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked");
169 purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red");
172 PURPLE_INIT_PLUGIN(ppexample
, init_plugin
, info
)