Sat, 08 Dec 2018 21:34:48 -0600
Remove/edit comments which mention PURPLE_PLUGINS define
Now that GPlugin and libpurple plugin support are both required,
this patch removes mentions of PURPLE_PLUGINS from documentation
and comments in example plugins/code.
| 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 | ||
|
39413
f45e8a9c6fc1
Remove/edit comments which mention PURPLE_PLUGINS define
Mike Ruprecht <cmaiku@gmail.com>
parents:
39227
diff
changeset
|
27 | /* This file includes all the libpurple headers */ |
|
35072
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( |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
89 | "/plugins/core/pluginpref_example/multiline", |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
90 | "multiline string pref"); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
91 | purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_STRING_FORMAT); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
92 | purple_plugin_pref_set_format_type(ppref, PURPLE_STRING_FORMAT_TYPE_MULTILINE); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
93 | purple_plugin_pref_frame_add(frame, ppref); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
94 | |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
95 | ppref = purple_plugin_pref_new_with_name_and_label( |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
96 | "/plugins/core/pluginpref_example/html", |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
97 | "html string pref"); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
98 | purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_STRING_FORMAT); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
99 | purple_plugin_pref_set_format_type(ppref, PURPLE_STRING_FORMAT_TYPE_HTML); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
100 | purple_plugin_pref_frame_add(frame, ppref); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
101 | |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
102 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 16481 | 103 | "/plugins/core/pluginpref_example/string_choice", |
| 8713 | 104 | "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
|
105 | purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 15884 | 106 | purple_plugin_pref_add_choice(ppref, "red", "red"); |
| 107 | purple_plugin_pref_add_choice(ppref, "orange", "orange"); | |
| 108 | purple_plugin_pref_add_choice(ppref, "yellow", "yellow"); | |
| 109 | purple_plugin_pref_add_choice(ppref, "green", "green"); | |
| 110 | purple_plugin_pref_add_choice(ppref, "blue", "blue"); | |
| 111 | purple_plugin_pref_add_choice(ppref, "purple", "purple"); | |
| 112 | purple_plugin_pref_frame_add(frame, ppref); | |
| 8713 | 113 | |
| 114 | return frame; | |
| 115 | } | |
| 116 | ||
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
117 | static PurplePluginInfo * |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
118 | plugin_query(GError **error) |
| 8713 | 119 | { |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
120 | const gchar * const authors[] = { |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
121 | "Gary Kramlich <amc_grim@users.sf.net>", |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
122 | NULL |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
123 | }; |
| 8713 | 124 | |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
125 | return purple_plugin_info_new( |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
126 | "id", "core-pluginpref_example", |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
127 | "name", "Pluginpref Example", |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
128 | "version", DISPLAY_VERSION, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
129 | "category", "Example", |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
130 | "summary", "An example of how to use pluginprefs", |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
131 | "description", "An example of how to use pluginprefs", |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
132 | "authors", authors, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
133 | "website", PURPLE_WEBSITE, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
134 | "abi-version", PURPLE_ABI_VERSION, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36929
diff
changeset
|
135 | "pref-frame-cb", get_plugin_pref_frame, |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
136 | NULL |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
137 | ); |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
138 | } |
| 8713 | 139 | |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
140 | static gboolean |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
141 | plugin_load(PurplePlugin *plugin, GError **error) |
| 8713 | 142 | { |
| 16481 | 143 | purple_prefs_add_none("/plugins/core/pluginpref_example"); |
| 144 | purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | |
| 145 | purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | |
| 146 | purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | |
| 147 | purple_prefs_add_string("/plugins/core/pluginpref_example/string", | |
| 8713 | 148 | "string"); |
| 16481 | 149 | purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", |
| 8713 | 150 | "max length string"); |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
151 | purple_prefs_add_string("/plugins/core/pluginpref_example/multiline", |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
152 | "line1\nline2"); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
153 | purple_prefs_add_string("/plugins/core/pluginpref_example/html", |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
37075
diff
changeset
|
154 | "foo <b>bar</b> baz"); |
| 16481 | 155 | purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); |
| 156 | purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); | |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
157 | |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
158 | return TRUE; |
| 8713 | 159 | } |
| 160 | ||
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
161 | static gboolean |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
162 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
163 | { |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
164 | return TRUE; |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
165 | } |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
166 | |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
167 | PURPLE_PLUGIN_INIT(ppexample, plugin_query, plugin_load, plugin_unload); |