Mercurial > pidgin.yaz
annotate plugins/idle.c @ 4171:858822a27529
[gaim-migrate @ 4400]
Alex Converse (alex4):
"Gaim had a nasty habbit of not converting prefrenced
colors from 48-bit to 24-bit for outputting as html.
(causing malformed colors like #00FFFF00) I fixed this
by doing all the conversions at the time of outputting."
he further wrote, when i failed to see a need for this patch at first:
"The issue is GdkColors are 48-bit (16 of Red, green, and
blue) HTML colors are 24-bit (bit of Red, Green, and Blue)
gaim stores colors as GdkColors but when sends the color as
HTML. The problem is colors that were stored inb gaimrc
never got downsampled to 24bit."
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 02 Jan 2003 16:24:53 +0000 |
parents | 07a3d1fae88f |
children | 59751fe608c5 |
rev | line source |
---|---|
4103 | 1 /* a nifty little plugin to set your idle time to whatever you want it to be. |
2 * useful for almost nothing. mostly just a demo plugin. but it's fun to have | |
3 * 40-day idle times. | |
4 */ | |
5 | |
6 #define GAIM_PLUGINS | |
7 #include "multi.h" | |
8 #include "gaim.h" | |
9 #include <sys/time.h> | |
10 #include "pixmaps/ok.xpm" | |
11 | |
12 static struct gaim_connection *gc = NULL; | |
13 | |
14 char *name() { | |
15 return "I'dle Mak'er"; | |
16 } | |
17 | |
18 char *description() { | |
19 return "Allows you to hand-configure how long you've been idle for"; | |
20 } | |
21 | |
22 char *gaim_plugin_init(GModule *module) { | |
23 return NULL; | |
24 } | |
25 | |
26 static void set_idle(GtkWidget *button, GtkWidget *spinner) { | |
27 time_t t; | |
28 int tm = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 0, G_MAXINT); | |
29 if (!gc) { | |
30 return; | |
31 } | |
32 debug_printf("setting idle time for %s to %d\n", gc->username, tm); | |
33 time(&t); | |
34 t -= 60 * tm; | |
35 gc->lastsent = t; | |
36 serv_set_idle(gc, 60 * tm); | |
37 gc->is_idle = 0; | |
38 } | |
39 | |
40 static void sel_gc(GtkWidget *opt, struct gaim_connection *g) { | |
41 gc = g; | |
42 } | |
43 | |
44 static void make_connect_menu(GtkWidget *box) { | |
45 GtkWidget *optmenu, *menu, *opt; | |
46 GSList *c = connections; | |
47 struct gaim_connection *g; | |
48 | |
49 optmenu = gtk_option_menu_new(); | |
50 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
51 | |
52 menu = gtk_menu_new(); | |
53 | |
54 while (c) { | |
55 g = (struct gaim_connection *)c->data; | |
56 opt = gtk_menu_item_new_with_label(g->username); | |
4165
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
57 g_signal_connect(GTK_OBJECT(opt), "activate", |
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
58 G_CALLBACK(sel_gc), g); |
4103 | 59 gtk_menu_append(GTK_MENU(menu), opt); |
60 gtk_widget_show(opt); | |
61 c = g_slist_next(c); | |
62 } | |
63 | |
64 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); | |
65 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
66 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); | |
67 | |
68 if (connections) | |
69 gc = connections->data; | |
70 else | |
71 gc = NULL; | |
72 } | |
73 | |
74 struct gaim_plugin_description desc; | |
75 struct gaim_plugin_description *gaim_plugin_desc() { | |
76 desc.api_version = PLUGIN_API_VERSION; | |
77 desc.name = g_strdup("I'dle Mak'er"); | |
78 desc.version = g_strdup(VERSION); | |
79 desc.description = g_strdup("Allows you to hand-configure how long you've been idle for"); | |
80 desc.authors = g_strdup("Eric Warmenhoven <eric@warmenhoven.org>"); | |
81 desc.url = g_strdup(WEBSITE); | |
82 return &desc; | |
83 } | |
84 | |
85 GtkWidget *gaim_plugin_config_gtk() { | |
86 GtkWidget *ret; | |
87 GtkWidget *frame, *label; | |
88 GtkWidget *vbox, *hbox; | |
89 GtkAdjustment *adj; | |
90 GtkWidget *spinner, *button; | |
91 | |
92 ret = gtk_vbox_new(FALSE, 18); | |
93 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
94 | |
95 frame = make_frame(ret, _("Idle Time")); | |
96 | |
97 vbox = gtk_vbox_new(FALSE, 5); | |
98 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
99 | |
100 hbox = gtk_hbox_new(FALSE, 5); | |
101 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
102 | |
103 label = gtk_label_new("Set"); | |
104 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
105 | |
106 make_connect_menu(hbox); | |
107 | |
108 label = gtk_label_new("idle for"); | |
109 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
110 | |
111 adj = (GtkAdjustment *)gtk_adjustment_new(10, 0, G_MAXINT, 1, 0, 0); | |
112 spinner = gtk_spin_button_new(adj, 0, 0); | |
113 gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0); | |
114 | |
115 label = gtk_label_new("minutes."); | |
116 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
117 | |
118 hbox = gtk_hbox_new(TRUE, 5); | |
119 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
120 | |
121 button = gtk_button_new_with_mnemonic(_("_Set")); | |
122 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
4165
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
123 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(set_idle), spinner); |
4103 | 124 |
125 gtk_widget_show_all(ret); | |
126 | |
127 return ret; | |
128 } |