pidgin/plugins/mailchk.c

changeset 26753
a8dca8faae69
parent 20288
5ca925a094e2
child 33940
b44d15793c83
equal deleted inserted replaced
26752:27fe5aa7cbd0 26753:a8dca8faae69
11 11
12 #define ANY_MAIL 0x01 12 #define ANY_MAIL 0x01
13 #define UNREAD_MAIL 0x02 13 #define UNREAD_MAIL 0x02
14 #define NEW_MAIL 0x04 14 #define NEW_MAIL 0x04
15 15
16 static guint32 timer = 0; 16 static guint timer = 0;
17 static GtkWidget *mail = NULL; 17 static GtkWidget *mail = NULL;
18 18
19 static gint 19 static gint
20 check_mail() 20 check_mail()
21 { 21 {
91 signon_cb(PurpleConnection *gc) 91 signon_cb(PurpleConnection *gc)
92 { 92 {
93 PurpleBuddyList *list = purple_get_blist(); 93 PurpleBuddyList *list = purple_get_blist();
94 if (list && PURPLE_IS_GTK_BLIST(list) && !timer) { 94 if (list && PURPLE_IS_GTK_BLIST(list) && !timer) {
95 check_timeout(NULL); /* we want the box to be drawn immediately */ 95 check_timeout(NULL); /* we want the box to be drawn immediately */
96 timer = g_timeout_add(2000, check_timeout, NULL); 96 timer = purple_timeout_add_seconds(2, check_timeout, NULL);
97 } 97 }
98 } 98 }
99 99
100 static void 100 static void
101 signoff_cb(PurpleConnection *gc) 101 signoff_cb(PurpleConnection *gc)
102 { 102 {
103 PurpleBuddyList *list = purple_get_blist(); 103 PurpleBuddyList *list = purple_get_blist();
104 if ((!list || !PURPLE_IS_GTK_BLIST(list) || !PIDGIN_BLIST(list)->vbox) && timer) { 104 if ((!list || !PURPLE_IS_GTK_BLIST(list) || !PIDGIN_BLIST(list)->vbox) && timer) {
105 g_source_remove(timer); 105 purple_timeout_remove(timer);
106 timer = 0; 106 timer = 0;
107 } 107 }
108 } 108 }
109 109
110 /* 110 /*
121 purple_debug_warning("mailchk", "Could not read $MAIL or /var/spool/mail/$USER\n"); 121 purple_debug_warning("mailchk", "Could not read $MAIL or /var/spool/mail/$USER\n");
122 return FALSE; 122 return FALSE;
123 } 123 }
124 124
125 if (list && PURPLE_IS_GTK_BLIST(list) && PIDGIN_BLIST(list)->vbox) 125 if (list && PURPLE_IS_GTK_BLIST(list) && PIDGIN_BLIST(list)->vbox)
126 timer = g_timeout_add(2000, check_timeout, NULL); 126 timer = purple_timeout_add_seconds(2, check_timeout, NULL);
127 127
128 purple_signal_connect(conn_handle, "signed-on", 128 purple_signal_connect(conn_handle, "signed-on",
129 plugin, PURPLE_CALLBACK(signon_cb), NULL); 129 plugin, PURPLE_CALLBACK(signon_cb), NULL);
130 purple_signal_connect(conn_handle, "signed-off", 130 purple_signal_connect(conn_handle, "signed-off",
131 plugin, PURPLE_CALLBACK(signoff_cb), NULL); 131 plugin, PURPLE_CALLBACK(signoff_cb), NULL);
135 135
136 static gboolean 136 static gboolean
137 plugin_unload(PurplePlugin *plugin) 137 plugin_unload(PurplePlugin *plugin)
138 { 138 {
139 if (timer) 139 if (timer)
140 g_source_remove(timer); 140 purple_timeout_remove(timer);
141 timer = 0; 141 timer = 0;
142 if (mail) 142 if (mail)
143 gtk_widget_destroy(mail); 143 gtk_widget_destroy(mail);
144 mail = NULL; 144 mail = NULL;
145 145

mercurial