libpurple/plugins/pluginpref_example.c

branch
soc.2013.gobjectification.plugins
changeset 36741
c96edeed7ea7
parent 36367
891eea799578
child 36926
d2c0c68a9816
equal deleted inserted replaced
36740:569f0d81876a 36741:c96edeed7ea7
105 purple_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 PurplePluginUiInfo prefs_info = { 110 static PurplePluginInfo *
111 get_plugin_pref_frame, 111 plugin_query(GError **error)
112 0, /* page_num (Reserved) */ 112 {
113 NULL, /* frame (Reserved) */ 113 const gchar * const authors[] = {
114 /* Padding */ 114 "Gary Kramlich <amc_grim@users.sf.net>",
115 NULL, 115 NULL
116 NULL, 116 };
117 NULL,
118 NULL
119 };
120 117
121 static PurplePluginInfo info = 118 return purple_plugin_info_new(
122 { 119 "id", "core-pluginpref_example",
123 PURPLE_PLUGIN_MAGIC, 120 "name", "Pluginpref Example",
124 PURPLE_MAJOR_VERSION, 121 "version", DISPLAY_VERSION,
125 PURPLE_MINOR_VERSION, 122 "category", "Example",
126 PURPLE_PLUGIN_STANDARD, /**< type */ 123 "summary", "An example of how to use pluginprefs",
127 NULL, /**< ui_requirement */ 124 "description", "An example of how to use pluginprefs",
128 0, /**< flags */ 125 "authors", authors,
129 NULL, /**< dependencies */ 126 "website", PURPLE_WEBSITE,
130 PURPLE_PRIORITY_DEFAULT, /**< priority */ 127 "abi-version", PURPLE_ABI_VERSION,
128 "preferences-frame", get_plugin_pref_frame,
129 NULL
130 );
131 }
131 132
132 "core-pluginpref_example", /**< id */ 133 static gboolean
133 "Pluginpref Example", /**< name */ 134 plugin_load(PurplePlugin *plugin, GError **error)
134 DISPLAY_VERSION, /**< version */
135 /** summary */
136 "An example of how to use pluginprefs",
137 /** description */
138 "An example of how to use pluginprefs",
139 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */
140 PURPLE_WEBSITE, /**< homepage */
141
142 NULL, /**< load */
143 NULL, /**< unload */
144 NULL, /**< destroy */
145
146 NULL, /**< ui_info */
147 NULL, /**< extra_info */
148 &prefs_info, /**< prefs_info */
149 NULL, /**< actions */
150 /* padding */
151 NULL,
152 NULL,
153 NULL,
154 NULL
155 };
156
157 static void
158 init_plugin(PurplePlugin *plugin)
159 { 135 {
160 purple_prefs_add_none("/plugins/core/pluginpref_example"); 136 purple_prefs_add_none("/plugins/core/pluginpref_example");
161 purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); 137 purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE);
162 purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); 138 purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0);
163 purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); 139 purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1);
165 "string"); 141 "string");
166 purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", 142 purple_prefs_add_string("/plugins/core/pluginpref_example/max_string",
167 "max length string"); 143 "max length string");
168 purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); 144 purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked");
169 purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); 145 purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red");
146
147 return TRUE;
170 } 148 }
171 149
172 PURPLE_INIT_PLUGIN(ppexample, init_plugin, info) 150 static gboolean
151 plugin_unload(PurplePlugin *plugin, GError **error)
152 {
153 return TRUE;
154 }
155
156 PURPLE_PLUGIN_INIT(ppexample, plugin_query, plugin_load, plugin_unload);

mercurial