Thu, 13 Feb 2014 20:11:13 +0100
Fix the build again
| 8713 | 1 | /* |
| 12362 | 2 | * PluginPref Example Plugin |
| 8713 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16786
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16786
diff
changeset
|
19 | * 02111-1301, USA. |
| 8713 | 20 | */ |
| 21 | ||
|
35072
cb3673616d90
Added a note regarding internal.h for example plugins
Ankit Vani <a@nevitus.org>
parents:
34479
diff
changeset
|
22 | /* When writing a third-party plugin, do not include libpurple's internal.h |
|
cb3673616d90
Added a note regarding internal.h for example plugins
Ankit Vani <a@nevitus.org>
parents:
34479
diff
changeset
|
23 | * included below. This file is for internal libpurple use only. We're including |
|
cb3673616d90
Added a note regarding internal.h for example plugins
Ankit Vani <a@nevitus.org>
parents:
34479
diff
changeset
|
24 | * it here for our own convenience. */ |
| 8713 | 25 | #include "internal.h" |
| 26 | ||
|
35072
cb3673616d90
Added a note regarding internal.h for example plugins
Ankit Vani <a@nevitus.org>
parents:
34479
diff
changeset
|
27 | /* This file defines PURPLE_PLUGINS and includes all the libpurple headers */ |
|
cb3673616d90
Added a note regarding internal.h for example plugins
Ankit Vani <a@nevitus.org>
parents:
34479
diff
changeset
|
28 | #include <purple.h> |
| 8713 | 29 | |
| 15884 | 30 | static PurplePluginPrefFrame * |
| 31 | get_plugin_pref_frame(PurplePlugin *plugin) { | |
| 32 | PurplePluginPrefFrame *frame; | |
| 33 | PurplePluginPref *ppref; | |
| 8713 | 34 | |
| 15884 | 35 | frame = purple_plugin_pref_frame_new(); |
| 8713 | 36 | |
| 15884 | 37 | ppref = purple_plugin_pref_new_with_label("boolean"); |
| 38 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 39 | |
| 15884 | 40 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 41 | "/plugins/core/pluginpref_example/bool", |
| 8713 | 42 | "boolean pref"); |
| 15884 | 43 | purple_plugin_pref_frame_add(frame, ppref); |
| 8713 | 44 | |
| 15884 | 45 | ppref = purple_plugin_pref_new_with_label("integer"); |
| 46 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 47 | |
| 15884 | 48 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 49 | "/plugins/core/pluginpref_example/int", |
| 8713 | 50 | "integer pref"); |
| 15884 | 51 | purple_plugin_pref_set_bounds(ppref, 0, 255); |
| 52 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 53 | |
| 15884 | 54 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 55 | "/plugins/core/pluginpref_example/int_choice", |
| 8713 | 56 | "integer choice"); |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35072
diff
changeset
|
57 | purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 15884 | 58 | purple_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); |
| 59 | purple_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); | |
| 60 | purple_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); | |
| 61 | purple_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); | |
| 62 | purple_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); | |
| 63 | purple_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); | |
| 64 | purple_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); | |
| 65 | purple_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); | |
| 66 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 67 | |
| 15884 | 68 | ppref = purple_plugin_pref_new_with_label("string"); |
| 69 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 70 | |
| 15884 | 71 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 72 | "/plugins/core/pluginpref_example/string", |
| 8713 | 73 | "string pref"); |
| 15884 | 74 | purple_plugin_pref_frame_add(frame, ppref); |
| 8713 | 75 | |
| 15884 | 76 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 77 | "/plugins/core/pluginpref_example/masked_string", |
| 9841 | 78 | "masked string"); |
| 15884 | 79 | purple_plugin_pref_set_masked(ppref, TRUE); |
| 80 | purple_plugin_pref_frame_add(frame, ppref); | |
| 9841 | 81 | |
| 15884 | 82 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 83 | "/plugins/core/pluginpref_example/max_string", |
| 8713 | 84 | "string pref\n(max length of 16)"); |
| 15884 | 85 | purple_plugin_pref_set_max_length(ppref, 16); |
| 86 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 87 | |
| 15884 | 88 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 89 | "/plugins/core/pluginpref_example/string_choice", |
| 8713 | 90 | "string choice"); |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35072
diff
changeset
|
91 | purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 15884 | 92 | purple_plugin_pref_add_choice(ppref, "red", "red"); |
| 93 | purple_plugin_pref_add_choice(ppref, "orange", "orange"); | |
| 94 | purple_plugin_pref_add_choice(ppref, "yellow", "yellow"); | |
| 95 | purple_plugin_pref_add_choice(ppref, "green", "green"); | |
| 96 | purple_plugin_pref_add_choice(ppref, "blue", "blue"); | |
| 97 | purple_plugin_pref_add_choice(ppref, "purple", "purple"); | |
| 98 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 99 | |
| 100 | return frame; | |
| 101 | } | |
| 102 | ||
| 15884 | 103 | static PurplePluginUiInfo prefs_info = { |
| 13212 | 104 | get_plugin_pref_frame, |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
105 | NULL, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
106 | |
|
16786
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
107 | /* Padding */ |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
108 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
109 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
110 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
111 | NULL |
| 8713 | 112 | }; |
| 113 | ||
| 15884 | 114 | static PurplePluginInfo info = |
| 8713 | 115 | { |
| 15884 | 116 | PURPLE_PLUGIN_MAGIC, |
| 117 | PURPLE_MAJOR_VERSION, | |
| 118 | PURPLE_MINOR_VERSION, | |
| 119 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
| 8713 | 120 | NULL, /**< ui_requirement */ |
| 121 | 0, /**< flags */ | |
| 122 | NULL, /**< dependencies */ | |
| 15884 | 123 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 8713 | 124 | |
| 125 | "core-pluginpref_example", /**< id */ | |
| 126 | "Pluginpref Example", /**< name */ | |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
127 | DISPLAY_VERSION, /**< version */ |
| 8713 | 128 | /** summary */ |
| 129 | "An example of how to use pluginprefs", | |
| 130 | /** description */ | |
| 131 | "An example of how to use pluginprefs", | |
| 132 | "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
| 15884 | 133 | PURPLE_WEBSITE, /**< homepage */ |
| 8713 | 134 | |
| 135 | NULL, /**< load */ | |
| 136 | NULL, /**< unload */ | |
| 137 | NULL, /**< destroy */ | |
| 138 | ||
| 139 | NULL, /**< ui_info */ | |
| 140 | NULL, /**< extra_info */ | |
| 8993 | 141 | &prefs_info, /**< prefs_info */ |
|
16786
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
142 | NULL, /**< actions */ |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
143 | /* padding */ |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
144 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
145 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16481
diff
changeset
|
146 | NULL, |
| 8993 | 147 | NULL |
| 8713 | 148 | }; |
| 149 | ||
| 150 | static void | |
| 15884 | 151 | init_plugin(PurplePlugin *plugin) |
| 8713 | 152 | { |
| 16481 | 153 | purple_prefs_add_none("/plugins/core/pluginpref_example"); |
| 154 | purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | |
| 155 | purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | |
| 156 | purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | |
| 157 | purple_prefs_add_string("/plugins/core/pluginpref_example/string", | |
| 8713 | 158 | "string"); |
| 16481 | 159 | purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", |
| 8713 | 160 | "max length string"); |
| 16481 | 161 | purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); |
| 162 | purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); | |
| 8713 | 163 | } |
| 164 | ||
| 15884 | 165 | PURPLE_INIT_PLUGIN(ppexample, init_plugin, info) |