comparison plugins/chkmail.c @ 10320:61852117568f

[gaim-migrate @ 11527] A little code cleanup here and there. And I removed gaim_setup() from gtkmain.c and put it in gtksound.c committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 05 Dec 2004 21:05:52 +0000
parents a09ffb82aef1
children
comparison
equal deleted inserted replaced
10319:32e7baa81e03 10320:61852117568f
15 #include <netinet/in.h> 15 #include <netinet/in.h>
16 #include <pthread.h> 16 #include <pthread.h>
17 17
18 #include "internal.h" 18 #include "internal.h"
19 #include "gtkgaim.h" 19 #include "gtkgaim.h"
20
21 #include "gaim.h"
22 20
23 char username[] = ""; 21 char username[] = "";
24 char password[] = ""; 22 char password[] = "";
25 char mailhost[] = ""; 23 char mailhost[] = "";
26 int mailport = 110; 24 int mailport = 110;
99 } 97 }
100 list = list->next; 98 list = list->next;
101 } 99 }
102 } 100 }
103 101
104
105 void setup_mail_list() 102 void setup_mail_list()
106 { 103 {
107 GList *list; 104 GList *list;
108 GtkWidget *w; 105 GtkWidget *w;
109 GtkWidget *item; 106 GtkWidget *item;
129 gtk_widget_show(tree); 126 gtk_widget_show(tree);
130 gtk_tree_append(GTK_TREE(buddies), item); 127 gtk_tree_append(GTK_TREE(buddies), item);
131 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); 128 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree);
132 gtk_tree_item_expand(GTK_TREE_ITEM(item)); 129 gtk_tree_item_expand(GTK_TREE_ITEM(item));
133 130
134 buf = g_malloc(BUF_LONG); 131 /* XXX - This needs to use ngettext() */
135 132 buf = g_strdup_printf(_("%s (%d new/%d total)"), mailhost, lastnum - orig, lastnum);
136 g_snprintf(buf, BUF_LONG, _("%s (%d new/%d total)"), mailhost, lastnum - orig, lastnum);
137 item = gtk_tree_item_new_with_label(buf); 133 item = gtk_tree_item_new_with_label(buf);
138 g_free(buf); 134 g_free(buf);
139 135
140 gtk_tree_append(GTK_TREE(tree), item); 136 gtk_tree_append(GTK_TREE(tree), item);
141 gtk_widget_show(item); 137 gtk_widget_show(item);
142 } 138 }
143 139
144 void gaim_plugin_init(void *h) { 140 void gaim_plugin_init(void *h) {
145 handle = h; 141 handle = h;
146 142
147 orig = num_msgs(); 143 orig = num_msgs();
148 lastnum = orig; 144 lastnum = orig;
149 145
150 gaim_signal_connect(handle, event_blist_update, setup_mail_list, NULL); 146 gaim_signal_connect(handle, event_blist_update, setup_mail_list, NULL);
151 setup_mail_list(); 147 setup_mail_list();
152 148
153 mytimer = g_timeout_add(30000, check_mail, NULL); 149 mytimer = g_timeout_add(30000, check_mail, NULL);
154 } 150 }
155 151
156 void check_mail() { 152 void check_mail() {
157 pthread_t mail_thread; 153 pthread_t mail_thread;
185 mytimer = g_timeout_add(30000, check_mail, NULL); 181 mytimer = g_timeout_add(30000, check_mail, NULL);
186 setup_mail_list(); 182 setup_mail_list();
187 state = 0; 183 state = 0;
188 } 184 }
189 185
190
191 void gaim_plugin_remove() { 186 void gaim_plugin_remove() {
192 g_source_remove(mytimer); 187 g_source_remove(mytimer);
193 while (state == 1) { } 188 while (state == 1) { }
194 destroy_mail_list(); 189 destroy_mail_list();
195 handle = NULL; 190 handle = NULL;