Mercurial > pidgin
annotate plugins/pluginpref_example.c @ 9650:780a8fbeb85b
[gaim-migrate @ 10498]
updated
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 03 Aug 2004 17:30:40 +0000 |
parents | 294ae6548d4e |
children | 1ae82c0c24ee |
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( | |
83 "/plugins/core/pluginpref_example/max_string", | |
84 "string pref\n(max length of 16)"); | |
85 gaim_plugin_pref_set_max_length(ppref, 16); | |
86 gaim_plugin_pref_frame_add(frame, ppref); | |
87 | |
88 ppref = gaim_plugin_pref_new_with_name_and_label( | |
89 "/plugins/core/pluginpref_example/string_choice", | |
90 "string choice"); | |
91 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE); | |
92 gaim_plugin_pref_add_choice(ppref, "red", "red"); | |
93 gaim_plugin_pref_add_choice(ppref, "orange", "orange"); | |
94 gaim_plugin_pref_add_choice(ppref, "yellow", "yellow"); | |
95 gaim_plugin_pref_add_choice(ppref, "green", "green"); | |
96 gaim_plugin_pref_add_choice(ppref, "blue", "blue"); | |
97 gaim_plugin_pref_add_choice(ppref, "purple", "purple"); | |
98 gaim_plugin_pref_frame_add(frame, ppref); | |
99 | |
100 return frame; | |
101 } | |
102 | |
103 static GaimPluginUiInfo prefs_info = { | |
104 get_plugin_pref_frame | |
105 }; | |
106 | |
107 static GaimPluginInfo info = | |
108 { | |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8745
diff
changeset
|
109 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
8713 | 110 GAIM_PLUGIN_STANDARD, /**< type */ |
111 NULL, /**< ui_requirement */ | |
112 0, /**< flags */ | |
113 NULL, /**< dependencies */ | |
114 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
115 | |
116 "core-pluginpref_example", /**< id */ | |
117 "Pluginpref Example", /**< name */ | |
118 VERSION, /**< version */ | |
119 /** summary */ | |
120 "An example of how to use pluginprefs", | |
121 /** description */ | |
122 "An example of how to use pluginprefs", | |
123 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
124 GAIM_WEBSITE, /**< homepage */ | |
125 | |
126 NULL, /**< load */ | |
127 NULL, /**< unload */ | |
128 NULL, /**< destroy */ | |
129 | |
130 NULL, /**< ui_info */ | |
131 NULL, /**< extra_info */ | |
8993 | 132 &prefs_info, /**< prefs_info */ |
133 NULL | |
8713 | 134 }; |
135 | |
136 static void | |
137 init_plugin(GaimPlugin *plugin) | |
138 { | |
139 gaim_prefs_add_none("/plugins/core/pluginpref_example"); | |
140 gaim_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | |
141 gaim_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | |
142 gaim_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | |
143 gaim_prefs_add_string("/plugins/core/pluginpref_example/string", | |
144 "string"); | |
145 gaim_prefs_add_string("/plugins/core/pluginpref_example/max_string", | |
146 "max length string"); | |
147 gaim_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); | |
148 } | |
149 | |
8745 | 150 GAIM_INIT_PLUGIN(ppexample, init_plugin, info) |