Mercurial > pidgin
comparison PRPL @ 2318:a7bfb5dfab25
[gaim-migrate @ 2328]
documentation updates.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 20 Sep 2001 08:13:25 +0000 |
parents | b332d8f46b84 |
children |
comparison
equal
deleted
inserted
replaced
2317:ab8ca5d75dcd | 2318:a7bfb5dfab25 |
---|---|
48 | 48 |
49 Erg. Now the fun part. The part that you would have never guessed if you | 49 Erg. Now the fun part. The part that you would have never guessed if you |
50 weren't me. (I know that you wouldn't have guessed this stuff because | 50 weren't me. (I know that you wouldn't have guessed this stuff because |
51 it isn't painfully obvious to me. Use the Source, Luke.) | 51 it isn't painfully obvious to me. Use the Source, Luke.) |
52 | 52 |
53 Let's start with the basics. PRPLs shouldn't use GTK at all. That said, | 53 Let's start with the basics. PRPLs shouldn't use GTK at all. If you use |
54 they have to in no fewer than three functions: action_menu, user_opts, and | 54 GTK I will hunt you down like the dog you are and kill you. |
55 draw_new_user (probably do_new_user too). Fortunately, all of these are | |
56 optional. Unfortunatly, all of these are so incredibly useful that they | |
57 probably aren't optional. If you use GTK (other than gdk_input_add/remove | |
58 for the connections) in any function other than these three I will hunt | |
59 you down like the dog you are and kill you. (Oscar and TOC are excused | |
60 temporarily because they existed long before all the other PRPLs.) | |
61 | 55 |
62 You're probably wondering how you can do certain things without GTK. Well, | 56 You're probably wondering how you can do certain things without GTK. Well, |
63 you're just going to have to make do. Rely on the UI, that's why it's | 57 you're just going to have to make do. Rely on the UI, that's why it's |
64 there. A PRPL should have absolutely ZERO interaction with the user, | 58 there. A PRPL should have absolutely ZERO interaction with the user, |
65 it should all be handled by the UI. So far, about the only thing that's | 59 it should all be handled by the UI. |
66 been added to gaim to aid in this goal is do_ask_dialog. But at least | |
67 it's a start. | |
68 | 60 |
69 do_ask_dialogs is one of the worst creations ever to come from my ass. It | 61 So let's talk about what that means in a practical way. Have a socket that |
70 must have been very late in the morning, just before I went to sleep, | 62 you want notification on? Use gaim_input functions; they work just like |
71 when I coded it. That's my excuse. | 63 the gdk_input functions. Want to add a timeout? g_timeout_add and |
64 g_source_remove. Want to ask a question? do_ask_dialog. Etc. | |
72 | 65 |
73 You pass it the question you want to ask, what to do on Yes, what to | 66 Don't use the _options variables at all. The core should take care of all |
74 do on No, and optional data. The logic actually isn't like that at | 67 of that. |
75 all. Given you call do_ask_dialog("Wanna?", mydata, yes_func, no_func), | |
76 the logic is: | |
77 | 68 |
78 if (clicked_yes) | 69 Um. I'm sure there's more. |
79 yes_func(); | |
80 no_func(); | |
81 | |
82 i.e. no_func() gets called regardless of what's clicked. So | |
83 it's best to use it for freeing mydata, and not freeing mydata in | |
84 yes_func. To be quite honest, I'm not sure no_func is needed. (I | |
85 also seem to think that yes_func isn't entirely necessary either, | |
86 except for the little part about it being the point of do_ask_dialog.) | |
87 | |
88 Um. So that was interesting. |