Mercurial > pidgin.yaz
annotate plugins/notify.c @ 4203:ec6d0c5e5c23
[gaim-migrate @ 4439]
- Should fix the Urgent hint crash (really this time).
- Fixes the apply to conversations button (count is now kept across
applications).
- Other general cleanups.
Thanks deryni.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sun, 05 Jan 2003 04:36:41 +0000 |
| parents | 59751fe608c5 |
| children | fac89c0d55c2 |
| rev | line source |
|---|---|
| 3392 | 1 /* Rewritten by Etan Reisner <deryni@eden.rutgers.edu> |
| 3374 | 2 * |
| 3 * Added config dialog | |
| 4 * Added control over notification method | |
| 5 * Added control over when to release notification | |
| 4035 | 6 * |
| 7 * Added option to get notification for chats also | |
| 8 * Cleaned up code | |
| 9 * Added option to notify on click as it's own option | |
| 10 * rather then as what happens when on focus isn't clicked | |
| 11 * Added apply button to change the denotification methods for | |
| 12 * open conversation windows | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
13 * Fixed apply to conversations, count now keeps count across applies |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
14 * Fixed(?) memory leak, and in the process fixed some stupidities |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
15 * Hit enter when done editing the title string entry box to save it |
| 3392 | 16 * |
| 17 * Thanks to Carles Pina i Estany <carles@pinux.info> | |
| 18 * for count of new messages option | |
| 19 */ | |
| 20 | |
|
4202
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
21 #include "config.h" |
|
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
22 |
| 3710 | 23 #ifndef GAIM_PLUGINS |
| 24 #define GAIM_PLUGINS | |
| 25 #endif | |
| 3374 | 26 |
| 191 | 27 #include "gaim.h" |
| 3428 | 28 #include <string.h> |
| 29 #include <ctype.h> | |
| 30 #include <stdlib.h> | |
| 191 | 31 #include <gtk/gtk.h> |
| 3385 | 32 #include <X11/Xlib.h> |
| 3374 | 33 #include <X11/Xutil.h> |
| 3392 | 34 #include <X11/Xatom.h> |
| 3374 | 35 #include <gdk/gdkx.h> |
| 36 | |
| 3710 | 37 guint type = 1; |
| 38 #define TYPE_IM 0x00000001 | |
| 39 #define TYPE_CHAT 0x00000002 | |
| 40 | |
| 3392 | 41 guint choice = 1; |
| 42 #define NOTIFY_FOCUS 0x00000001 | |
| 43 #define NOTIFY_TYPE 0x00000002 | |
| 44 #define NOTIFY_IN_FOCUS 0x00000004 | |
| 3710 | 45 #define NOTIFY_CLICK 0x00000008 |
| 3374 | 46 |
| 3392 | 47 guint method = 1; |
| 48 #define METHOD_STRING 0x00000001 | |
| 49 #define METHOD_QUOTE 0x00000002 | |
| 50 #define METHOD_URGENT 0x00000004 | |
| 51 #define METHOD_COUNT 0x00000008 | |
| 191 | 52 |
| 53 void *handle; | |
| 3565 | 54 GtkWidget *Entry; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
55 gchar *title_string; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
56 int Number = 0; |
| 191 | 57 |
| 3374 | 58 /* predefine some functions, less warnings */ |
| 59 void options(GtkWidget *widget, gpointer data); | |
| 4047 | 60 /* this returns an int so that typing events don't get stopped here */ |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
61 int un_star(GtkWidget *widget, gpointer data); |
| 3428 | 62 int counter (char *buf, int *length); |
| 4035 | 63 /*string functions */ |
| 64 void string_add(GtkWidget *widget); | |
| 65 gboolean string_remove(GtkWidget *widget); | |
| 66 /* count functions */ | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
67 void count_add(GtkWidget *widget, int number); |
| 4035 | 68 gboolean count_remove(GtkWidget *widget); |
| 69 /* quote functions */ | |
| 70 void quote_add(GtkWidget *widget); | |
| 71 gboolean quote_remove(GtkWidget *widget); | |
| 72 /* urgent functions */ | |
| 73 void urgent_add(struct conversation *c); | |
| 74 gboolean urgent_remove(struct conversation *c); | |
| 3374 | 75 |
| 3710 | 76 struct conversation *find_chat(struct gaim_connection *gc, int id) { |
| 77 GList *cnv = chats; | |
| 78 struct conversation *c; | |
| 79 | |
| 80 while (cnv) { | |
| 81 c = (struct conversation *) cnv->data; | |
| 82 | |
| 83 if (c && (c->gc == gc) && c->is_chat && (c->id == id)) | |
| 84 return c; | |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
85 |
| 3710 | 86 cnv = cnv->next; |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
87 } |
| 3710 | 88 return NULL; |
| 89 } | |
| 191 | 90 |
| 3710 | 91 int notify(struct conversation *cnv) { |
| 92 Window focus_return; | |
| 4035 | 93 int revert_to_return; |
| 191 | 94 |
| 3374 | 95 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return); |
| 96 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
97 if ((choice & NOTIFY_IN_FOCUS) || |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
98 focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) { |
| 4035 | 99 if (method & METHOD_STRING) |
| 100 string_add(cnv->window); | |
| 101 if (method & METHOD_COUNT) | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
102 count_add(cnv->window, 0); |
| 4035 | 103 if (method & METHOD_QUOTE) |
| 104 quote_add(cnv->window); | |
| 105 if (method & METHOD_URGENT) | |
| 106 urgent_add(cnv); | |
| 3374 | 107 } |
| 108 return 0; | |
| 109 } | |
| 110 | |
| 4035 | 111 guint unnotify(struct conversation *c, gboolean clean) { |
| 112 guint option = 0; | |
| 4043 | 113 /* The top level ifs check whether we are either cleaning all methods, |
| 114 * or whether we have that method is currently selected. | |
| 115 * If we do then they are cleaned | |
| 116 * | |
| 117 * The second level ifs check if we removed something, | |
| 118 * and if that method is currently selected. | |
| 119 * If we did and it is then set option so that it can be re-added */ | |
| 4035 | 120 if (clean || (method & METHOD_QUOTE)) |
| 4043 | 121 if (quote_remove(c->window) && (method & METHOD_QUOTE)) |
| 4035 | 122 option ^= METHOD_QUOTE; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
123 |
| 4035 | 124 if (clean || (method & METHOD_COUNT)) |
| 4043 | 125 if (count_remove(c->window) && (method & METHOD_COUNT)) |
| 4035 | 126 option ^= METHOD_COUNT; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
127 |
| 4035 | 128 if (clean || (method & METHOD_STRING)) |
| 4043 | 129 if (string_remove(c->window) && (method & METHOD_STRING)) |
| 4035 | 130 option ^= METHOD_STRING; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
131 |
| 4035 | 132 if (clean || (method & METHOD_URGENT)) |
| 4043 | 133 if (urgent_remove(c) && (method & METHOD_URGENT)) |
| 4035 | 134 option ^= METHOD_URGENT; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
135 |
| 4035 | 136 return option; |
| 3374 | 137 } |
| 138 | |
| 3710 | 139 void chat_recv_im(struct gaim_connection *gc, int id, char **who, char **text) { |
| 140 struct conversation *c = find_chat(gc, id); | |
| 141 | |
| 142 if (c && (type & TYPE_CHAT)) | |
| 143 notify(c); | |
| 144 return; | |
| 145 } | |
| 146 | |
| 147 void chat_sent_im(struct gaim_connection *gc, int id, char **text) { | |
| 148 struct conversation *c = find_chat(gc, id); | |
| 149 | |
| 150 if (c && (type & TYPE_CHAT)) | |
| 4035 | 151 unnotify(c, FALSE); |
| 3710 | 152 return; |
| 153 } | |
| 154 | |
| 155 int im_recv_im(struct gaim_connection *gc, char **who, char **what, void *m) { | |
| 156 struct conversation *c = find_conversation(*who); | |
| 157 | |
| 158 if (c && (type & TYPE_IM)) | |
| 159 notify(c); | |
| 160 return 0; | |
| 161 } | |
| 162 | |
| 163 int im_sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { | |
| 3374 | 164 struct conversation *c = find_conversation(who); |
| 165 | |
| 3710 | 166 if (c && (type & TYPE_IM)) |
| 4035 | 167 unnotify(c, FALSE); |
| 3710 | 168 return 0; |
| 169 } | |
| 3392 | 170 |
| 3710 | 171 int attach_signals(struct conversation *c) { |
| 3392 | 172 if (choice & NOTIFY_FOCUS) { |
| 4035 | 173 g_signal_connect(G_OBJECT(c->window), "focus-in-event", G_CALLBACK(un_star), NULL); |
| 3374 | 174 } |
| 3710 | 175 |
| 176 if (choice & NOTIFY_CLICK) { | |
| 4035 | 177 g_signal_connect(G_OBJECT(c->window), "button_press_event", G_CALLBACK(un_star), NULL); |
| 178 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
179 g_signal_connect_swapped(G_OBJECT(c->text), "button_press_event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 4035 | 180 |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
181 g_signal_connect_swapped(G_OBJECT(c->entry), "button_press_event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 3374 | 182 } |
| 183 | |
| 3392 | 184 if (choice & NOTIFY_TYPE) { |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
185 g_signal_connect_swapped(G_OBJECT(c->entry), "key-press-event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 191 | 186 } |
| 4035 | 187 |
| 4043 | 188 g_object_set_data(G_OBJECT(c->window), "user_data", c); |
| 4035 | 189 g_object_set_data(G_OBJECT(c->window), "notify_data", GUINT_TO_POINTER(choice)); |
| 3428 | 190 return 0; |
| 191 | 191 } |
| 192 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
193 void detach_signals(struct conversation *c) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
194 guint options = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(c->window), "notify_data")); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
195 |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
196 if (options & NOTIFY_FOCUS) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
197 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
198 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
199 if (options & NOTIFY_CLICK) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
200 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
201 g_signal_handlers_disconnect_by_func(G_OBJECT(c->text), un_star, c->window); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
202 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star, c->window); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
203 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
204 |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
205 if (options & NOTIFY_TYPE) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
206 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star, c->window); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
207 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
208 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
209 |
| 3710 | 210 void new_conv(char *who) { |
| 4035 | 211 struct conversation *c = find_conversation(who); |
| 3710 | 212 |
| 4035 | 213 if (c && (type & TYPE_IM)) |
| 3710 | 214 attach_signals(c); |
| 215 return; | |
| 216 } | |
| 217 | |
| 218 void chat_join(struct gaim_connection *gc, int id, char *room) { | |
| 219 struct conversation *c = find_chat(gc, id); | |
| 220 | |
| 4043 | 221 if (c && (type & TYPE_CHAT)) |
| 3710 | 222 attach_signals(c); |
| 223 return; | |
| 224 } | |
| 225 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
226 int un_star(GtkWidget *widget, gpointer data) { |
| 4043 | 227 struct conversation *c = g_object_get_data(G_OBJECT(widget), "user_data"); |
| 3374 | 228 |
| 229 if (method & METHOD_QUOTE) | |
| 230 quote_remove(widget); | |
| 3392 | 231 if (method & METHOD_COUNT) |
| 232 count_remove(widget); | |
| 3374 | 233 if (method & METHOD_STRING) |
| 234 string_remove(widget); | |
| 4043 | 235 if (c && method & METHOD_URGENT) |
| 3374 | 236 urgent_remove(c); |
| 4047 | 237 return 0; |
| 3374 | 238 } |
| 239 | |
| 3392 | 240 /* This function returns the number in [ ]'s or 0 */ |
| 241 int counter (char *buf, int *length) { | |
| 242 char temp[256]; | |
| 243 int i = 1; | |
| 244 *length = 0; | |
| 245 | |
| 246 while (isdigit(buf[i]) && i<sizeof(buf)) { | |
| 247 temp[i-1] = buf[i]; | |
| 248 (*length)++; | |
| 249 i++; | |
| 250 } | |
| 251 temp[i] = '\0'; | |
| 4035 | 252 |
| 3392 | 253 if (buf[i] != ']') { |
| 254 *length = 0; | |
| 255 return (0); | |
| 256 } | |
| 257 | |
| 258 return (atoi(temp)); | |
| 259 } | |
| 260 | |
| 4035 | 261 void string_add(GtkWidget *widget) { |
| 262 char buf[256]; | |
| 263 GtkWindow *win = GTK_WINDOW(widget); | |
| 264 | |
| 265 strncpy(buf, win->title, sizeof(buf)); | |
| 266 if (!strstr(buf, title_string)) { | |
| 267 g_snprintf(buf, sizeof(buf), "%s%s", title_string, win->title); | |
| 268 gtk_window_set_title(win, buf); | |
| 269 } | |
| 270 } | |
| 271 | |
| 272 gboolean string_remove(GtkWidget *widget) { | |
| 191 | 273 char buf[256]; |
| 3374 | 274 GtkWindow *win = GTK_WINDOW(widget); |
| 275 | |
| 3392 | 276 strncpy(buf, win->title, sizeof(buf)); |
| 3374 | 277 if (strstr(buf, title_string)) { |
| 278 g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]); | |
| 279 gtk_window_set_title(win, buf); | |
| 4035 | 280 return TRUE; |
| 3374 | 281 } |
| 4035 | 282 return FALSE; |
| 3374 | 283 } |
| 284 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
285 void count_add(GtkWidget *widget, int number) { |
| 4035 | 286 char buf[256]; |
| 287 int c, length; | |
| 288 GtkWindow *win = GTK_WINDOW(widget); | |
| 289 | |
| 290 strncpy(buf, win->title, sizeof(buf)); | |
| 291 c = counter(buf, &length); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
292 if (number) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
293 g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
294 } else if (!c) { |
| 4035 | 295 g_snprintf(buf, sizeof(buf), "[1] %s", win->title); |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
296 } else if (!g_strncasecmp(buf, "[", 1)) { |
| 4035 | 297 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); |
| 298 } | |
| 299 gtk_window_set_title(win, buf); | |
| 300 } | |
| 301 | |
| 302 gboolean count_remove(GtkWidget *widget) { | |
| 3392 | 303 char buf[256]; |
| 304 GtkWindow *win = GTK_WINDOW(widget); | |
| 305 int length; | |
| 306 | |
| 307 strncpy(buf, win->title, sizeof(buf)); | |
| 308 if (!g_strncasecmp(buf, "[", 1)) { | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
309 Number = counter(buf, &length); |
| 3392 | 310 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); |
| 311 gtk_window_set_title(win, buf); | |
| 4035 | 312 return TRUE; |
| 3392 | 313 } |
| 4035 | 314 return FALSE; |
| 3392 | 315 } |
| 316 | |
| 4035 | 317 void quote_add(GtkWidget *widget) { |
| 318 char buf[256]; | |
| 319 GtkWindow *win = GTK_WINDOW(widget); | |
| 320 | |
| 321 strncpy(buf, win->title, sizeof(buf)); | |
| 322 if (g_strncasecmp(buf, "\"", 1)) { | |
| 323 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title); | |
| 324 gtk_window_set_title(win, buf); | |
| 325 } | |
| 326 } | |
| 327 | |
| 328 gboolean quote_remove(GtkWidget *widget) { | |
| 3374 | 329 char buf[256]; |
| 330 GtkWindow *win = GTK_WINDOW(widget); | |
| 191 | 331 |
| 3392 | 332 strncpy(buf, win->title, sizeof(buf)); |
| 3374 | 333 if (!g_strncasecmp(buf, "\"", 1)) { |
| 334 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]); | |
| 191 | 335 gtk_window_set_title(win, buf); |
| 4035 | 336 return TRUE; |
| 191 | 337 } |
| 4035 | 338 return FALSE; |
| 3374 | 339 } |
| 340 | |
| 4035 | 341 void urgent_add(struct conversation *c) { |
| 342 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window)); | |
| 343 hints->flags |= XUrgencyHint; | |
| 344 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); | |
| 345 } | |
| 346 | |
| 347 gboolean urgent_remove(struct conversation *c) { | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
348 if ((c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW)) || (!c->is_chat && (im_options & OPT_IM_ONE_WINDOW))) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
349 if (c->is_chat) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
350 struct conversation *c = (struct conversation *)chats->data; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
351 GdkWindow *win = c->window->window; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
352 |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
353 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
354 if (hints->flags & XUrgencyHint) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
355 hints->flags &= ~XUrgencyHint; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
356 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
357 return TRUE; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
358 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
359 return FALSE; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
360 } else { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
361 struct conversation *c = (struct conversation *)conversations->data; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
362 GdkWindow *win = c->window->window; |
| 3374 | 363 |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
364 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
365 if (hints->flags & XUrgencyHint) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
366 hints->flags &= ~XUrgencyHint; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
367 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
368 return TRUE; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
369 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
370 return FALSE; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
371 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
372 } else { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
373 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window)); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
374 if (hints->flags & XUrgencyHint) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
375 hints->flags &= ~XUrgencyHint; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
376 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
377 return TRUE; |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
378 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
379 return FALSE; |
| 4035 | 380 } |
| 3374 | 381 } |
| 382 | |
| 383 void save_notify_prefs() { | |
| 3392 | 384 gchar buf[1000]; |
| 3374 | 385 FILE *fp; |
| 386 | |
| 387 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME")); | |
| 388 if (!(fp = fopen(buf, "w"))) { | |
| 3561 | 389 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR); |
| 3374 | 390 return; |
| 391 } | |
| 392 | |
| 3710 | 393 fprintf(fp, "%d=TYPE\n", type); |
| 3392 | 394 fprintf(fp, "%d=CHOICE\n", choice); |
| 395 fprintf(fp, "%d=METHOD\n", method); | |
| 396 fprintf(fp, "%s=STRING\n", title_string); | |
| 3374 | 397 fclose(fp); |
| 398 } | |
| 399 | |
| 400 void load_notify_prefs() { | |
| 401 gchar buf[1000]; | |
| 402 gchar **parsed; | |
| 403 FILE *fp; | |
| 404 | |
| 405 g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME")); | |
| 406 if (!(fp = fopen(buf, "r"))) | |
| 407 return; | |
| 408 | |
| 409 while (fgets(buf, 1000, fp) != NULL) { | |
| 410 parsed = g_strsplit(g_strchomp(buf), "=", 2); | |
| 411 if (parsed[0] && parsed[1]) { | |
| 3710 | 412 if (!strcmp(parsed[1], "TYPE")) |
| 413 type = atoi(parsed[0]); | |
| 3392 | 414 if (!strcmp(parsed[1], "CHOICE")) |
| 415 choice = atoi(parsed[0]); | |
| 416 if (!strcmp(parsed[1], "METHOD")) | |
| 417 method = atoi(parsed[0]); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
418 if (!strcmp(parsed[1], "STRING")) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
419 if (title_string != NULL) |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
420 g_free(title_string); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
421 title_string = g_strdup(parsed[0]); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
422 } |
| 3374 | 423 } |
| 3392 | 424 g_strfreev(parsed); |
| 3374 | 425 } |
| 426 fclose(fp); | |
| 427 return; | |
| 428 } | |
| 429 | |
| 430 void options(GtkWidget *widget, gpointer data) { | |
| 4035 | 431 gint option = GPOINTER_TO_INT(data); |
| 3374 | 432 |
| 433 if (option == 0) | |
| 3392 | 434 choice ^= NOTIFY_FOCUS; |
| 3374 | 435 else if (option == 1) |
| 3710 | 436 choice ^= NOTIFY_CLICK; |
| 437 else if (option == 2) | |
| 3392 | 438 choice ^= NOTIFY_TYPE; |
| 3710 | 439 else if (option == 3) { |
| 3374 | 440 method ^= METHOD_STRING; |
| 441 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) | |
| 442 gtk_widget_set_sensitive(Entry, TRUE); | |
| 443 else | |
| 444 gtk_widget_set_sensitive(Entry, FALSE); | |
| 445 } | |
| 3710 | 446 else if (option == 4) |
| 3374 | 447 method ^= METHOD_QUOTE; |
| 3710 | 448 else if (option == 5) |
| 3374 | 449 method ^= METHOD_URGENT; |
| 3710 | 450 else if (option == 6) |
| 3392 | 451 choice ^= NOTIFY_IN_FOCUS; |
| 3710 | 452 else if (option == 7) |
| 3392 | 453 method ^= METHOD_COUNT; |
| 3710 | 454 else if (option == 8) |
| 455 type ^= TYPE_IM; | |
| 456 else if (option == 9) | |
| 457 type ^= TYPE_CHAT; | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
458 else if (option == 10) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
459 /* I made an option for this as at least a way to have it save correctly |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
460 * I'd much rather there were better ways, and I don't want to save this |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
461 * no matter which pref is changed, that's too much of a hack */ |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
462 if (title_string != NULL) { |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
463 g_free(title_string); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
464 title_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(Entry))); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
465 } |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
466 } |
| 3710 | 467 |
| 468 save_notify_prefs(); | |
| 3374 | 469 } |
| 470 | |
| 4035 | 471 void apply_options(GtkWidget *widget, gpointer data) { |
| 472 GList *cnv = conversations; | |
| 473 | |
| 474 while (cnv) { | |
| 475 guint notification; | |
| 476 struct conversation *c = (struct conversation *) cnv->data; | |
| 477 | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
478 /* remove old notification signals */ |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
479 detach_signals(c); |
| 4035 | 480 |
| 481 /* clean off all notification markings */ | |
| 482 notification = unnotify(c, TRUE); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
483 |
| 4035 | 484 /* re-add appropriate notification methods cleaned above */ |
| 4043 | 485 if (notification & METHOD_STRING) /* re-add string */ |
| 486 string_add(c->window); | |
| 4035 | 487 if (notification & METHOD_QUOTE) /* re-add quote */ |
| 488 quote_add(c->window); | |
| 489 if (notification & METHOD_COUNT) /* re-add count */ | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
490 count_add(c->window, Number); |
| 4035 | 491 if (notification & METHOD_URGENT) /* re-add urgent */ |
| 492 urgent_add(c); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
493 |
| 4035 | 494 /* attach new unnotification signals */ |
| 495 attach_signals(c); | |
| 496 | |
| 497 cnv = cnv->next; | |
| 498 } | |
| 499 | |
| 500 return; | |
| 501 } | |
| 502 | |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
503 char *gaim_plugin_init(GModule *hndl) { |
| 191 | 504 handle = hndl; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
505 title_string = g_strdup("(*) "); |
| 191 | 506 |
| 3374 | 507 load_notify_prefs(); |
| 508 | |
| 3710 | 509 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL); |
| 510 gaim_signal_connect(handle, event_chat_recv, chat_recv_im, NULL); | |
| 511 gaim_signal_connect(handle, event_im_send, im_sent_im, NULL); | |
| 512 gaim_signal_connect(handle, event_chat_send, chat_sent_im, NULL); | |
| 3374 | 513 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL); |
| 3710 | 514 gaim_signal_connect(handle, event_chat_join, chat_join, NULL); |
|
1052
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
515 return NULL; |
| 191 | 516 } |
| 517 | |
| 3392 | 518 void gaim_plugin_remove() { |
| 519 GList *c = conversations; | |
| 520 | |
| 521 while (c) { | |
| 522 struct conversation *cnv = (struct conversation *)c->data; | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
523 |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
524 detach_signals(cnv); |
| 3710 | 525 un_star(cnv->window, NULL); |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
526 |
| 3710 | 527 c = c->next; |
| 3392 | 528 } |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
529 |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
530 /* this might be a hack I'm not sure, I don't think so but... */ |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
531 g_free(title_string); |
| 3392 | 532 } |
| 533 | |
| 3551 | 534 struct gaim_plugin_description desc; |
| 535 struct gaim_plugin_description *gaim_plugin_desc() { | |
| 536 desc.api_version = PLUGIN_API_VERSION; | |
| 537 desc.name = g_strdup("Message Notification"); | |
| 538 desc.version = g_strdup(VERSION); | |
| 539 desc.description = g_strdup("Provides a variety of ways of notifying you of unread messages."); | |
| 540 desc.authors = g_strdup("Etan Reisner <deryni@eden.rutgers.edu>"); | |
| 541 desc.url = g_strdup(WEBSITE); | |
| 542 return &desc; | |
| 543 } | |
| 544 | |
| 191 | 545 char *name() { |
| 546 return "Visual Notification"; | |
| 547 } | |
| 548 | |
| 549 char *description() { | |
| 550 return "Puts an asterisk in the title bar of all conversations" | |
| 551 " where you have not responded to a message yet."; | |
| 552 } | |
| 3374 | 553 |
| 3565 | 554 GtkWidget *gaim_plugin_config_gtk() { |
| 555 GtkWidget *ret; | |
| 556 GtkWidget *vbox, *hbox; | |
| 4035 | 557 GtkWidget *toggle, *button; |
| 3565 | 558 ret = gtk_vbox_new(FALSE, 18); |
| 559 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
| 3392 | 560 |
| 3710 | 561 vbox = make_frame(ret, _("Notify For")); |
| 562 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); | |
| 563 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 564 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_IM); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
565 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(8)); |
| 3710 | 566 |
| 567 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); | |
| 568 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 569 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_CHAT); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
570 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(9)); |
| 3710 | 571 |
| 572 /*--------------*/ | |
| 3565 | 573 vbox = make_frame(ret, _("Notification Methods")); |
| 574 hbox = gtk_hbox_new(FALSE, 18); | |
| 575 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
576 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title (hit enter to save):")); |
| 3565 | 577 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); |
| 4035 | 578 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(3)); |
| 3565 | 579 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
580 Entry = gtk_entry_new(); |
|
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
581 gtk_entry_set_max_length(GTK_ENTRY(Entry), 10); |
| 3565 | 582 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); |
| 583 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); | |
| 3392 | 584 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
585 g_signal_connect(G_OBJECT(Entry), "activate", G_CALLBACK(options), GINT_TO_POINTER(10)); |
| 3374 | 586 |
| 3710 | 587 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); |
| 3565 | 588 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 589 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); | |
| 4035 | 590 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(4)); |
| 3374 | 591 |
| 3565 | 592 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); |
| 593 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 594 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT); | |
| 4035 | 595 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(5)); |
| 596 | |
| 3710 | 597 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); |
| 3565 | 598 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT); |
| 599 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 4035 | 600 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(7)); |
| 3710 | 601 |
| 602 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus")); | |
| 603 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS); | |
| 604 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 4035 | 605 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(6)); |
| 3392 | 606 |
| 3565 | 607 /*--------------*/ |
| 608 vbox = make_frame(ret, _("Notification Removal")); | |
| 3710 | 609 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus")); |
| 3565 | 610 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 611 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS); | |
| 4035 | 612 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(0)); |
| 3374 | 613 |
| 3710 | 614 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); |
| 615 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 616 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_CLICK); | |
| 4035 | 617 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(1)); |
| 3710 | 618 |
| 3565 | 619 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); |
| 620 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 621 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE); | |
| 4035 | 622 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(2)); |
| 623 | |
| 624 button = gtk_button_new_with_mnemonic(_("Appl_y")); | |
| 625 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 5); | |
| 626 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(apply_options), NULL); | |
| 3565 | 627 |
| 628 gtk_widget_show_all(ret); | |
| 629 return ret; | |
| 3374 | 630 } |
