comparison plugins/ticker/ticker.c @ 5205:fefad67de2c7

[gaim-migrate @ 5573] I had a damn good commit message, but it was eaten. Let's try it again. Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short. There are lots'a cool thingies here. Okay now, this isn't as cool as the previous message, but: 1) There's now a single entry function for all plugin types. It returns a detailed information structure on the plugin. This removes a lot of the ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so if you use it, well, you shouldn't have used it anyway, but now you can't! bwahahaha. Use AIM/ICQ. 2) There are now 3 types of plugins: Standard, Loader, and Protocol plugins. Standard plugins are, well, standard, compiled plugins. Loader plugins load other plugins. For example, the perl support is now a loader plugin. It loads perl scripts. In the future, we'll have Ruby and Python loader plugins. Protocol plugins are, well, protocol plugins... yeah... 3) Plugins have unique IDs, so they can be referred to or automatically updated from a plugin database in the future. Neat, huh? 4) Plugins will have dependency support in the future, and can be hidden, so if you have, say, a logging core plugin, it won't have to show up, but then you load the GTK+ logging plugin and it'll auto-load the core plugin. Core/UI split plugins! 5) There will eventually be custom plugin signals and RPC of some sort, for the core/ui split plugins. So, okay, back up .gaimrc. I'd like to thank my parents for their support, javabsp for helping convert a bunch of protocol plugins, and Etan for helping convert a bunch of standard plugins. Have fun. If you have any problems, please let me know, but you probably won't have anything major happen. You will have to convert your plugins, though, and I'm not guaranteeing that all perl scripts will still work. I'll end up changing the perl script API eventually, so I know they won't down the road. Don't worry, though. It'll be mass cool. faceprint wants me to just commit the damn code already. So, here we go!!! .. .. I need a massage. From a young, cute girl. Are there any young, cute girls in the audience? IM me plz k thx. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 25 Apr 2003 06:47:33 +0000
parents a107115a13ae
children 890b29f00b68
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
26 #include <gtk/gtk.h> 26 #include <gtk/gtk.h>
27 #include "gtkticker.h" 27 #include "gtkticker.h"
28 #include <string.h> 28 #include <string.h>
29 #include <stdlib.h> 29 #include <stdlib.h>
30 #include "gaim.h" 30 #include "gaim.h"
31 #include "prpl.h"
32 #include "gtkplugin.h"
31 #include "list.h" 33 #include "list.h"
32 #include "gtklist.h" 34 #include "gtklist.h"
33 #ifdef _WIN32 35 #ifdef _WIN32
34 #include "win32dep.h" 36 #include "win32dep.h"
35 #endif 37 #endif
36 38
37 #ifndef GAIM_PLUGINS 39 #define TICKER_PLUGIN_ID "gtk-ticker"
38 #define GAIM_PLUGINS
39 #endif
40 40
41 static GtkWidget *tickerwindow = NULL; 41 static GtkWidget *tickerwindow = NULL;
42 static GtkWidget *ticker; 42 static GtkWidget *ticker;
43 static GModule *handle;
44 43
45 typedef struct { 44 typedef struct {
46 struct buddy *buddy; 45 struct buddy *buddy;
47 GtkWidget *ebox; 46 GtkWidget *ebox;
48 GtkWidget *label; 47 GtkWidget *label;
234 233
235 /* 234 /*
236 * EXPORTED FUNCTIONS 235 * EXPORTED FUNCTIONS
237 */ 236 */
238 237
239 G_MODULE_EXPORT char *name() { 238 static gboolean
240 return _("Buddy Ticker"); 239 plugin_load(GaimPlugin *plugin)
241 } 240 {
242 241 gaim_signal_connect(plugin, event_buddy_signon, signon_cb, NULL);
243 G_MODULE_EXPORT char *description() { 242 gaim_signal_connect(plugin, event_signoff, signoff_cb, NULL);
244 return _("A horizontal scrolling version of the buddy list."); 243 gaim_signal_connect(plugin, event_buddy_signoff, buddy_signoff_cb, NULL);
245 } 244 gaim_signal_connect(plugin, event_buddy_away, away_cb, NULL);
246 245 gaim_signal_connect(plugin, event_buddy_back, away_cb, NULL);
247 G_MODULE_EXPORT char *gaim_plugin_init(GModule *h) {
248 handle = h;
249
250 gaim_signal_connect(h, event_buddy_signon, signon_cb, NULL);
251 gaim_signal_connect(h, event_signoff, signoff_cb, NULL);
252 gaim_signal_connect(h, event_buddy_signoff, buddy_signoff_cb, NULL);
253 gaim_signal_connect(h, event_buddy_away, away_cb, NULL);
254 gaim_signal_connect(h, event_buddy_back, away_cb, NULL);
255 246
256 if (connections) 247 if (connections)
257 buddy_ticker_show(); 248 buddy_ticker_show();
258 return NULL; 249
259 } 250 return TRUE;
260 251 }
261 G_MODULE_EXPORT void gaim_plugin_remove() { 252
253 static gboolean
254 plugin_unload(GaimPlugin *plugin)
255 {
262 while(tickerbuds) { 256 while(tickerbuds) {
263 g_free(tickerbuds->data); 257 g_free(tickerbuds->data);
264 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds); 258 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds);
265 } 259 }
260
266 gtk_widget_destroy(tickerwindow); 261 gtk_widget_destroy(tickerwindow);
267 } 262
268 263 return TRUE;
269 struct gaim_plugin_description desc; 264 }
270 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { 265
271 desc.api_version = PLUGIN_API_VERSION; 266 static GaimGtkPluginUiInfo ui_info =
272 desc.name = g_strdup(_("Buddy Ticker")); 267 {
273 desc.version = g_strdup(VERSION); 268 NULL /**< get_config_frame */
274 desc.description = g_strdup(_("A horizontal scrolling version of the buddy list.")); 269 };
275 desc.authors = g_strdup("Syd Logan"); 270
276 desc.url = g_strdup(WEBSITE); 271 static GaimPluginInfo info =
277 return &desc; 272 {
278 } 273 2, /**< api_version */
274 GAIM_PLUGIN_STANDARD, /**< type */
275 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
276 0, /**< flags */
277 NULL, /**< dependencies */
278 GAIM_PRIORITY_DEFAULT, /**< priority */
279
280 TICKER_PLUGIN_ID, /**< id */
281 N_("Buddy Ticker"), /**< name */
282 VERSION, /**< version */
283 /** summary */
284 N_("A horizontal scrolling version of the buddy list."),
285 /** description */
286 N_("A horizontal scrolling version of the buddy list."),
287 "Syd Logan", /**< author */
288 WEBSITE, /**< homepage */
289
290 plugin_load, /**< load */
291 plugin_unload, /**< unload */
292 NULL, /**< destroy */
293
294 &ui_info, /**< ui_info */
295 NULL /**< extra_info */
296 };
297
298 static void
299 __init_plugin(GaimPlugin *plugin)
300 {
301 }
302
303 GAIM_INIT_PLUGIN(ticker, __init_plugin, info);