Mercurial > pidgin.yaz
comparison libpurple/plugins/pluginpref_example.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Mon, 19 Mar 2007 07:01:17 +0000 |
| parents | 5fe8042783c1 |
| children | 4999bbc52881 |
comparison
equal
deleted
inserted
replaced
| 15822:84b0f9b23ede | 15823:32c366eeeb99 |
|---|---|
| 21 | 21 |
| 22 #ifdef HAVE_CONFIG_H | 22 #ifdef HAVE_CONFIG_H |
| 23 # include <config.h> | 23 # include <config.h> |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #ifndef GAIM_PLUGINS | 26 #ifndef PURPLE_PLUGINS |
| 27 # define GAIM_PLUGINS | 27 # define PURPLE_PLUGINS |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 #include "internal.h" | 30 #include "internal.h" |
| 31 | 31 |
| 32 #include "plugin.h" | 32 #include "plugin.h" |
| 33 #include "pluginpref.h" | 33 #include "pluginpref.h" |
| 34 #include "prefs.h" | 34 #include "prefs.h" |
| 35 #include "version.h" | 35 #include "version.h" |
| 36 | 36 |
| 37 static GaimPluginPrefFrame * | 37 static PurplePluginPrefFrame * |
| 38 get_plugin_pref_frame(GaimPlugin *plugin) { | 38 get_plugin_pref_frame(PurplePlugin *plugin) { |
| 39 GaimPluginPrefFrame *frame; | 39 PurplePluginPrefFrame *frame; |
| 40 GaimPluginPref *ppref; | 40 PurplePluginPref *ppref; |
| 41 | 41 |
| 42 frame = gaim_plugin_pref_frame_new(); | 42 frame = purple_plugin_pref_frame_new(); |
| 43 | 43 |
| 44 ppref = gaim_plugin_pref_new_with_label("boolean"); | 44 ppref = purple_plugin_pref_new_with_label("boolean"); |
| 45 gaim_plugin_pref_frame_add(frame, ppref); | 45 purple_plugin_pref_frame_add(frame, ppref); |
| 46 | 46 |
| 47 ppref = gaim_plugin_pref_new_with_name_and_label( | 47 ppref = purple_plugin_pref_new_with_name_and_label( |
| 48 "/plugins/core/pluginpref_example/bool", | 48 "/plugins/core/pluginpref_example/bool", |
| 49 "boolean pref"); | 49 "boolean pref"); |
| 50 gaim_plugin_pref_frame_add(frame, ppref); | 50 purple_plugin_pref_frame_add(frame, ppref); |
| 51 | 51 |
| 52 ppref = gaim_plugin_pref_new_with_label("integer"); | 52 ppref = purple_plugin_pref_new_with_label("integer"); |
| 53 gaim_plugin_pref_frame_add(frame, ppref); | 53 purple_plugin_pref_frame_add(frame, ppref); |
| 54 | 54 |
| 55 ppref = gaim_plugin_pref_new_with_name_and_label( | 55 ppref = purple_plugin_pref_new_with_name_and_label( |
| 56 "/plugins/core/pluginpref_example/int", | 56 "/plugins/core/pluginpref_example/int", |
| 57 "integer pref"); | 57 "integer pref"); |
| 58 gaim_plugin_pref_set_bounds(ppref, 0, 255); | 58 purple_plugin_pref_set_bounds(ppref, 0, 255); |
| 59 gaim_plugin_pref_frame_add(frame, ppref); | 59 purple_plugin_pref_frame_add(frame, ppref); |
| 60 | 60 |
| 61 ppref = gaim_plugin_pref_new_with_name_and_label( | 61 ppref = purple_plugin_pref_new_with_name_and_label( |
| 62 "/plugins/core/pluginpref_example/int_choice", | 62 "/plugins/core/pluginpref_example/int_choice", |
| 63 "integer choice"); | 63 "integer choice"); |
| 64 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE); | 64 purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 65 gaim_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); | 65 purple_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); |
| 66 gaim_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); | 66 purple_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); |
| 67 gaim_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); | 67 purple_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); |
| 68 gaim_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); | 68 purple_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); |
| 69 gaim_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); | 69 purple_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); |
| 70 gaim_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); | 70 purple_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); |
| 71 gaim_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); | 71 purple_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); |
| 72 gaim_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); | 72 purple_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); |
| 73 gaim_plugin_pref_frame_add(frame, ppref); | 73 purple_plugin_pref_frame_add(frame, ppref); |
| 74 | 74 |
| 75 ppref = gaim_plugin_pref_new_with_label("string"); | 75 ppref = purple_plugin_pref_new_with_label("string"); |
| 76 gaim_plugin_pref_frame_add(frame, ppref); | 76 purple_plugin_pref_frame_add(frame, ppref); |
| 77 | 77 |
| 78 ppref = gaim_plugin_pref_new_with_name_and_label( | 78 ppref = purple_plugin_pref_new_with_name_and_label( |
| 79 "/plugins/core/pluginpref_example/string", | 79 "/plugins/core/pluginpref_example/string", |
| 80 "string pref"); | 80 "string pref"); |
| 81 gaim_plugin_pref_frame_add(frame, ppref); | 81 purple_plugin_pref_frame_add(frame, ppref); |
| 82 | 82 |
| 83 ppref = gaim_plugin_pref_new_with_name_and_label( | 83 ppref = purple_plugin_pref_new_with_name_and_label( |
| 84 "/plugins/core/pluginpref_example/masked_string", | 84 "/plugins/core/pluginpref_example/masked_string", |
| 85 "masked string"); | 85 "masked string"); |
| 86 gaim_plugin_pref_set_masked(ppref, TRUE); | 86 purple_plugin_pref_set_masked(ppref, TRUE); |
| 87 gaim_plugin_pref_frame_add(frame, ppref); | 87 purple_plugin_pref_frame_add(frame, ppref); |
| 88 | 88 |
| 89 ppref = gaim_plugin_pref_new_with_name_and_label( | 89 ppref = purple_plugin_pref_new_with_name_and_label( |
| 90 "/plugins/core/pluginpref_example/max_string", | 90 "/plugins/core/pluginpref_example/max_string", |
| 91 "string pref\n(max length of 16)"); | 91 "string pref\n(max length of 16)"); |
| 92 gaim_plugin_pref_set_max_length(ppref, 16); | 92 purple_plugin_pref_set_max_length(ppref, 16); |
| 93 gaim_plugin_pref_frame_add(frame, ppref); | 93 purple_plugin_pref_frame_add(frame, ppref); |
| 94 | 94 |
| 95 ppref = gaim_plugin_pref_new_with_name_and_label( | 95 ppref = purple_plugin_pref_new_with_name_and_label( |
| 96 "/plugins/core/pluginpref_example/string_choice", | 96 "/plugins/core/pluginpref_example/string_choice", |
| 97 "string choice"); | 97 "string choice"); |
| 98 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE); | 98 purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 99 gaim_plugin_pref_add_choice(ppref, "red", "red"); | 99 purple_plugin_pref_add_choice(ppref, "red", "red"); |
| 100 gaim_plugin_pref_add_choice(ppref, "orange", "orange"); | 100 purple_plugin_pref_add_choice(ppref, "orange", "orange"); |
| 101 gaim_plugin_pref_add_choice(ppref, "yellow", "yellow"); | 101 purple_plugin_pref_add_choice(ppref, "yellow", "yellow"); |
| 102 gaim_plugin_pref_add_choice(ppref, "green", "green"); | 102 purple_plugin_pref_add_choice(ppref, "green", "green"); |
| 103 gaim_plugin_pref_add_choice(ppref, "blue", "blue"); | 103 purple_plugin_pref_add_choice(ppref, "blue", "blue"); |
| 104 gaim_plugin_pref_add_choice(ppref, "purple", "purple"); | 104 purple_plugin_pref_add_choice(ppref, "purple", "purple"); |
| 105 gaim_plugin_pref_frame_add(frame, ppref); | 105 purple_plugin_pref_frame_add(frame, ppref); |
| 106 | 106 |
| 107 return frame; | 107 return frame; |
| 108 } | 108 } |
| 109 | 109 |
| 110 static GaimPluginUiInfo prefs_info = { | 110 static PurplePluginUiInfo prefs_info = { |
| 111 get_plugin_pref_frame, | 111 get_plugin_pref_frame, |
| 112 0, /* page_num (Reserved) */ | 112 0, /* page_num (Reserved) */ |
| 113 NULL /* frame (Reserved) */ | 113 NULL /* frame (Reserved) */ |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 static GaimPluginInfo info = | 116 static PurplePluginInfo info = |
| 117 { | 117 { |
| 118 GAIM_PLUGIN_MAGIC, | 118 PURPLE_PLUGIN_MAGIC, |
| 119 GAIM_MAJOR_VERSION, | 119 PURPLE_MAJOR_VERSION, |
| 120 GAIM_MINOR_VERSION, | 120 PURPLE_MINOR_VERSION, |
| 121 GAIM_PLUGIN_STANDARD, /**< type */ | 121 PURPLE_PLUGIN_STANDARD, /**< type */ |
| 122 NULL, /**< ui_requirement */ | 122 NULL, /**< ui_requirement */ |
| 123 0, /**< flags */ | 123 0, /**< flags */ |
| 124 NULL, /**< dependencies */ | 124 NULL, /**< dependencies */ |
| 125 GAIM_PRIORITY_DEFAULT, /**< priority */ | 125 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 126 | 126 |
| 127 "core-pluginpref_example", /**< id */ | 127 "core-pluginpref_example", /**< id */ |
| 128 "Pluginpref Example", /**< name */ | 128 "Pluginpref Example", /**< name */ |
| 129 VERSION, /**< version */ | 129 VERSION, /**< version */ |
| 130 /** summary */ | 130 /** summary */ |
| 131 "An example of how to use pluginprefs", | 131 "An example of how to use pluginprefs", |
| 132 /** description */ | 132 /** description */ |
| 133 "An example of how to use pluginprefs", | 133 "An example of how to use pluginprefs", |
| 134 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | 134 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ |
| 135 GAIM_WEBSITE, /**< homepage */ | 135 PURPLE_WEBSITE, /**< homepage */ |
| 136 | 136 |
| 137 NULL, /**< load */ | 137 NULL, /**< load */ |
| 138 NULL, /**< unload */ | 138 NULL, /**< unload */ |
| 139 NULL, /**< destroy */ | 139 NULL, /**< destroy */ |
| 140 | 140 |
| 143 &prefs_info, /**< prefs_info */ | 143 &prefs_info, /**< prefs_info */ |
| 144 NULL | 144 NULL |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 static void | 147 static void |
| 148 init_plugin(GaimPlugin *plugin) | 148 init_plugin(PurplePlugin *plugin) |
| 149 { | 149 { |
| 150 gaim_prefs_add_none("/plugins/core/pluginpref_example"); | 150 purple_prefs_add_none("/plugins/core/pluginpref_example"); |
| 151 gaim_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); | 151 purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); |
| 152 gaim_prefs_add_int("/plugins/core/pluginpref_example/int", 0); | 152 purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); |
| 153 gaim_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); | 153 purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); |
| 154 gaim_prefs_add_string("/plugins/core/pluginpref_example/string", | 154 purple_prefs_add_string("/plugins/core/pluginpref_example/string", |
| 155 "string"); | 155 "string"); |
| 156 gaim_prefs_add_string("/plugins/core/pluginpref_example/max_string", | 156 purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", |
| 157 "max length string"); | 157 "max length string"); |
| 158 gaim_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); | 158 purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); |
| 159 gaim_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); | 159 purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); |
| 160 } | 160 } |
| 161 | 161 |
| 162 GAIM_INIT_PLUGIN(ppexample, init_plugin, info) | 162 PURPLE_INIT_PLUGIN(ppexample, init_plugin, info) |
