Mercurial > pidgin.yaz
comparison plugins/notify.c @ 3428:0202b5e1af69
[gaim-migrate @ 3454]
Thanks Etan.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 25 Aug 2002 19:24:30 +0000 |
parents | 8fa61405af2b |
children | 7e1c6c16dd41 |
comparison
equal
deleted
inserted
replaced
3427:8fa61405af2b | 3428:0202b5e1af69 |
---|---|
13 */ | 13 */ |
14 | 14 |
15 #define GAIM_PLUGINS | 15 #define GAIM_PLUGINS |
16 #include "gaim.h" | 16 #include "gaim.h" |
17 | 17 |
18 #include <string.h> | |
19 #include <ctype.h> | |
20 #include <stdlib.h> | |
18 #include <gtk/gtk.h> | 21 #include <gtk/gtk.h> |
19 #include <string.h> | |
20 #include <X11/Xlib.h> | 22 #include <X11/Xlib.h> |
21 #include <X11/Xutil.h> | 23 #include <X11/Xutil.h> |
22 #include <X11/Xatom.h> | 24 #include <X11/Xatom.h> |
23 #include <gdk/gdkx.h> | 25 #include <gdk/gdkx.h> |
24 #include <errno.h> | |
25 | 26 |
26 guint choice = 1; | 27 guint choice = 1; |
27 #define NOTIFY_FOCUS 0x00000001 | 28 #define NOTIFY_FOCUS 0x00000001 |
28 #define NOTIFY_TYPE 0x00000002 | 29 #define NOTIFY_TYPE 0x00000002 |
29 #define NOTIFY_IN_FOCUS 0x00000004 | 30 #define NOTIFY_IN_FOCUS 0x00000004 |
51 void un_star_window(GtkWidget *widget, gpointer data); | 52 void un_star_window(GtkWidget *widget, gpointer data); |
52 void string_remove(GtkWidget *widget); | 53 void string_remove(GtkWidget *widget); |
53 void count_remove(GtkWidget *widget); | 54 void count_remove(GtkWidget *widget); |
54 void quote_remove(GtkWidget *widget); | 55 void quote_remove(GtkWidget *widget); |
55 void urgent_remove(struct conversation *c); | 56 void urgent_remove(struct conversation *c); |
57 int counter (char *buf, int *length); | |
56 | 58 |
57 int received_im(struct gaim_connection *gc, char **who, char **what, void *m) { | 59 int received_im(struct gaim_connection *gc, char **who, char **what, void *m) { |
58 char buf[256]; | 60 char buf[256]; |
59 struct conversation *cnv = find_conversation(*who); | 61 struct conversation *cnv = find_conversation(*who); |
60 GtkWindow *win; | 62 GtkWindow *win; |
120 | 122 |
121 return 0; | 123 return 0; |
122 } | 124 } |
123 | 125 |
124 int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { | 126 int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { |
125 char buf[256]; | 127 /* char buf[256]; */ |
126 struct conversation *c = find_conversation(who); | 128 struct conversation *c = find_conversation(who); |
127 | 129 |
128 if (method & METHOD_QUOTE) | 130 if (method & METHOD_QUOTE) |
129 quote_remove(c->window); | 131 quote_remove(c->window); |
130 if (method & METHOD_COUNT) | 132 if (method & METHOD_COUNT) |
156 | 158 |
157 if (choice & NOTIFY_TYPE) { | 159 if (choice & NOTIFY_TYPE) { |
158 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); | 160 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); |
159 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c); | 161 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c); |
160 } | 162 } |
163 return 0; | |
161 } | 164 } |
162 | 165 |
163 void un_star(GtkWidget *widget, gpointer data) { | 166 void un_star(GtkWidget *widget, gpointer data) { |
164 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget)); | 167 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget)); |
165 | 168 |
241 } | 244 } |
242 return; | 245 return; |
243 } | 246 } |
244 | 247 |
245 void urgent_remove(struct conversation *c) { | 248 void urgent_remove(struct conversation *c) { |
246 char buf[256]; | |
247 GdkWindow *win = c->window->window; | 249 GdkWindow *win = c->window->window; |
248 | 250 |
249 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window)); | 251 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
250 hints->flags &= ~XUrgencyHint; | 252 hints->flags &= ~XUrgencyHint; |
251 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); | 253 XSetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win), hints); |
252 return; | 254 return; |
253 } | 255 } |
254 | 256 |
255 void save_notify_prefs() { | 257 void save_notify_prefs() { |
256 gchar buf[1000]; | 258 gchar buf[1000]; |
257 FILE *fp; | 259 FILE *fp; |
258 | 260 |
259 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME")); | 261 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME")); |
260 if (!(fp = fopen(buf, "w"))) { | 262 if (!(fp = fopen(buf, "w"))) { |
261 do_error_dialog(_("Unable to write notify plugin config file"), strerror(errno), GAIM_ERROR); | 263 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR); |
262 return; | 264 return; |
263 } | 265 } |
264 | 266 |
265 fprintf(fp, "%d=CHOICE\n", choice); | 267 fprintf(fp, "%d=CHOICE\n", choice); |
266 fprintf(fp, "%d=METHOD\n", method); | 268 fprintf(fp, "%d=METHOD\n", method); |
378 return NULL; | 380 return NULL; |
379 } | 381 } |
380 | 382 |
381 void gaim_plugin_remove() { | 383 void gaim_plugin_remove() { |
382 GList *c = conversations; | 384 GList *c = conversations; |
383 guint options; | 385 /* guint options; */ |
384 | 386 |
385 gtk_widget_destroy(really_evil_hack); | 387 gtk_widget_destroy(really_evil_hack); |
386 | 388 |
387 while (c) { | 389 while (c) { |
388 struct conversation *cnv = (struct conversation *)c->data; | 390 struct conversation *cnv = (struct conversation *)c->data; |