Mercurial > pidgin.yaz
comparison plugins/pluginpref_example.c @ 8713:7024b595b6ae
[gaim-migrate @ 9467]
" Expansion from my original protocol prefs to plugin prefs.
Things are handled a bit different in this iteration of
it, but I have already modified msn and jabber to use
it, and included an example plugin to show how to use
it. It will also generate pages with doxygen. The
example plugin doesn't not contain any translatable
strings seeing as we're in the string freeze. And it's
an example, whats the point of translating it..?
Also, I tweaked the documentation for 2 functions in
gtkprefs, gaim_gtk_prefs_dropdown and
gaim_gtk_prefs_dropdown_from_list. Nothing major in
that, just made it say that the list should be a list
of pairs label/value.
Also there's 5 new files that will need to be added to cvs:
src/pluginpref.h
src/pluginpref.c
src/gtkpluginpref.h
src/gtkpluginpref.c
plugins/pluginpref_example.c
the tarball already has them structured correctly and
contains the diff" --Gary Kramlich - amc_grim
and the german translator pointed out that sean missed the novell file for POTFILES.in
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 19 Apr 2004 21:12:45 +0000 |
parents | |
children | 6c0fae7a4f1a |
comparison
equal
deleted
inserted
replaced
8712:a4ff6e79c5fc | 8713:7024b595b6ae |
---|---|
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 | |
36 GaimPluginPrefFrame * | |
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 { | |
109 2, /**< api_version */ | |
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 */ | |
132 &prefs_info /**< prefs_info */ | |
133 }; | |
134 | |
135 static void | |
136 init_plugin(GaimPlugin *plugin) | |
137 { | |
138 gaim_prefs_add_none("/plugins/core/pluginpref_example"); | |
139 gaim_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | |
140 gaim_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | |
141 gaim_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | |
142 gaim_prefs_add_string("/plugins/core/pluginpref_example/string", | |
143 "string"); | |
144 gaim_prefs_add_string("/plugins/core/pluginpref_example/max_string", | |
145 "max length string"); | |
146 gaim_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); | |
147 } | |
148 | |
149 GAIM_INIT_PLUGIN(relnot, init_plugin, info) |