Mercurial > pidgin
annotate plugins/pluginpref_example.c @ 9841:1ae82c0c24ee
[gaim-migrate @ 10718]
"adds a masked string type to plugin prefs" from Gary Kramlich
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 23 Aug 2004 22:06:19 +0000 |
parents | 294ae6548d4e |
children | a9fb4493ae22 |
rev | line source |
---|---|
8713 | 1 /* |
2 * Release Notification Plugin | |
3 * | |
4 * Copyright (C) 2004, Gary Kramlich <amc_grim@users.sf.net> | |
5 * | |
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. | |
10 * | |
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. | |
15 * | |
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., 59 Temple Place - Suite 330, Boston, MA | |
19 * 02111-1307, USA. | |
20 */ | |
21 | |
22 #ifdef HAVE_CONFIG_H | |
23 # include <config.h> | |
24 #endif | |
25 | |
26 #ifndef GAIM_PLUGINS | |
27 # define GAIM_PLUGINS | |
28 #endif | |
29 | |
30 #include "internal.h" | |
31 | |
32 #include "plugin.h" | |
33 #include "pluginpref.h" | |
34 #include "prefs.h" | |
35 | |
8745 | 36 static GaimPluginPrefFrame * |
8713 | 37 get_plugin_pref_frame(GaimPlugin *plugin) { |
38 GaimPluginPrefFrame *frame; | |
39 GaimPluginPref *ppref; | |
40 | |
41 frame = gaim_plugin_pref_frame_new(); | |
42 | |
43 ppref = gaim_plugin_pref_new_with_label("boolean"); | |
44 gaim_plugin_pref_frame_add(frame, ppref); | |
45 | |
46 ppref = gaim_plugin_pref_new_with_name_and_label( | |
47 "/plugins/core/pluginpref_example/bool", | |
48 "boolean pref"); | |
49 gaim_plugin_pref_frame_add(frame, ppref); | |
50 | |
51 ppref = gaim_plugin_pref_new_with_label("integer"); | |
52 gaim_plugin_pref_frame_add(frame, ppref); | |
53 | |
54 ppref = gaim_plugin_pref_new_with_name_and_label( | |
55 "/plugins/core/pluginpref_example/int", | |
56 "integer pref"); | |
57 gaim_plugin_pref_set_bounds(ppref, 0, 255); | |
58 gaim_plugin_pref_frame_add(frame, ppref); | |
59 | |
60 ppref = gaim_plugin_pref_new_with_name_and_label( | |
61 "/plugins/core/pluginpref_example/int_choice", | |
62 "integer choice"); | |
63 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE); | |
64 gaim_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); | |
65 gaim_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); | |
66 gaim_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); | |
67 gaim_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); | |
68 gaim_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); | |
69 gaim_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); | |
70 gaim_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); | |
71 gaim_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); | |
72 gaim_plugin_pref_frame_add(frame, ppref); | |
73 | |
74 ppref = gaim_plugin_pref_new_with_label("string"); | |
75 gaim_plugin_pref_frame_add(frame, ppref); | |
76 | |
77 ppref = gaim_plugin_pref_new_with_name_and_label( | |
78 "/plugins/core/pluginpref_example/string", | |
79 "string pref"); | |
80 gaim_plugin_pref_frame_add(frame, ppref); | |
81 | |
82 ppref = gaim_plugin_pref_new_with_name_and_label( | |
9841 | 83 "/plugins/core/pluginpref_example/masked_string", |
84 "masked string"); | |
85 gaim_plugin_pref_set_masked(ppref, TRUE); | |
86 gaim_plugin_pref_frame_add(frame, ppref); | |
87 | |
88 ppref = gaim_plugin_pref_new_with_name_and_label( | |
8713 | 89 "/plugins/core/pluginpref_example/max_string", |
90 "string pref\n(max length of 16)"); | |
91 gaim_plugin_pref_set_max_length(ppref, 16); | |
92 gaim_plugin_pref_frame_add(frame, ppref); | |
93 | |
94 ppref = gaim_plugin_pref_new_with_name_and_label( | |
95 "/plugins/core/pluginpref_example/string_choice", | |
96 "string choice"); | |
97 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE); | |
98 gaim_plugin_pref_add_choice(ppref, "red", "red"); | |
99 gaim_plugin_pref_add_choice(ppref, "orange", "orange"); | |
100 gaim_plugin_pref_add_choice(ppref, "yellow", "yellow"); | |
101 gaim_plugin_pref_add_choice(ppref, "green", "green"); | |
102 gaim_plugin_pref_add_choice(ppref, "blue", "blue"); | |
103 gaim_plugin_pref_add_choice(ppref, "purple", "purple"); | |
104 gaim_plugin_pref_frame_add(frame, ppref); | |
105 | |
106 return frame; | |
107 } | |
108 | |
109 static GaimPluginUiInfo prefs_info = { | |
110 get_plugin_pref_frame | |
111 }; | |
112 | |
113 static GaimPluginInfo info = | |
114 { | |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8745
diff
changeset
|
115 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
8713 | 116 GAIM_PLUGIN_STANDARD, /**< type */ |
117 NULL, /**< ui_requirement */ | |
118 0, /**< flags */ | |
119 NULL, /**< dependencies */ | |
120 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
121 | |
122 "core-pluginpref_example", /**< id */ | |
123 "Pluginpref Example", /**< name */ | |
124 VERSION, /**< version */ | |
125 /** summary */ | |
126 "An example of how to use pluginprefs", | |
127 /** description */ | |
128 "An example of how to use pluginprefs", | |
129 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
130 GAIM_WEBSITE, /**< homepage */ | |
131 | |
132 NULL, /**< load */ | |
133 NULL, /**< unload */ | |
134 NULL, /**< destroy */ | |
135 | |
136 NULL, /**< ui_info */ | |
137 NULL, /**< extra_info */ | |
8993 | 138 &prefs_info, /**< prefs_info */ |
139 NULL | |
8713 | 140 }; |
141 | |
142 static void | |
143 init_plugin(GaimPlugin *plugin) | |
144 { | |
145 gaim_prefs_add_none("/plugins/core/pluginpref_example"); | |
146 gaim_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | |
147 gaim_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | |
148 gaim_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | |
149 gaim_prefs_add_string("/plugins/core/pluginpref_example/string", | |
150 "string"); | |
151 gaim_prefs_add_string("/plugins/core/pluginpref_example/max_string", | |
152 "max length string"); | |
9841 | 153 gaim_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); |
8713 | 154 gaim_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); |
155 } | |
156 | |
8745 | 157 GAIM_INIT_PLUGIN(ppexample, init_plugin, info) |