annotate plugins/notify.c @ 5280:c9116905a08c

[gaim-migrate @ 5652] Miloslav Trmac (trmac) updated the Czech translation. on a semi-random note, why is Czech .cz buts its translations cs.po? committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 02 May 2003 01:43:34 +0000
parents fefad67de2c7
children ad445074d239
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
1 /* Rewritten by Etan Reisner <deryni@eden.rutgers.edu>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
2 *
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
3 * Added config dialog
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
4 * Added control over notification method
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
5 * Added control over when to release notification
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
6 *
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
7 * Added option to get notification for chats also
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
8 * Cleaned up code
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
9 * Added option to notify on click as it's own option
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
10 * rather then as what happens when on focus isn't clicked
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
11 * Added apply button to change the denotification methods for
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
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
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
16 *
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
17 * Thanks to Carles Pina i Estany <carles@pinux.info>
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
18 * for count of new messages option
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
19 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
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
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 #include "gaim.h"
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
24 #include <string.h>
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
25 #include <ctype.h>
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
26 #include <stdlib.h>
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #include <gtk/gtk.h>
3385
7931eb8bba19 [gaim-migrate @ 3404]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
28 #include <X11/Xlib.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
29 #include <X11/Xutil.h>
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
30 #include <X11/Xatom.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
31 #include <gdk/gdkx.h>
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
32 #include "gtkplugin.h"
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
33
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
34 #define NOTIFY_PLUGIN_ID "gtk-notify"
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
35
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
36 guint type = 1;
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
37 #define TYPE_IM 0x00000001
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
38 #define TYPE_CHAT 0x00000002
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
39
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
40 guint choice = 1;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
41 #define NOTIFY_FOCUS 0x00000001
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
42 #define NOTIFY_TYPE 0x00000002
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
43 #define NOTIFY_IN_FOCUS 0x00000004
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
44 #define NOTIFY_CLICK 0x00000008
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
45
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
46 guint method = 1;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
47 #define METHOD_STRING 0x00000001
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
48 #define METHOD_QUOTE 0x00000002
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
49 #define METHOD_URGENT 0x00000004
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
50 #define METHOD_COUNT 0x00000008
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 void *handle;
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
53 GtkWidget *Entry;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
54 gchar *title_string;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
55 int Number = 0;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
57 /* predefine some functions, less warnings */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
58 void options(GtkWidget *widget, gpointer data);
4047
0fccde7ed9b8 [gaim-migrate @ 4255]
Sean Egan <seanegan@gmail.com>
parents: 4043
diff changeset
59 /* 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
60 int un_star(GtkWidget *widget, gpointer data);
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
61 int counter (char *buf, int *length);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
62 /*string functions */
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
63 void string_add(GtkWidget *widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
64 gboolean string_remove(GtkWidget *widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
65 /* count functions */
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
66 void count_add(GtkWidget *widget, int number);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
67 gboolean count_remove(GtkWidget *widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
68 /* quote functions */
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
69 void quote_add(GtkWidget *widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
70 gboolean quote_remove(GtkWidget *widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
71 /* urgent functions */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
72 void urgent_add(struct gaim_conversation *c);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
73 gboolean urgent_remove(struct gaim_conversation *c);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
74
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
75 int notify(struct gaim_conversation *cnv) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
76 struct gaim_gtk_window *gtkwin;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
77 Window focus_return;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
78 int revert_to_return;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
80 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(cnv));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
81
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
82 XGetInputFocus(GDK_WINDOW_XDISPLAY(gtkwin->window->window), &focus_return, &revert_to_return);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
83
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
84 if ((choice & NOTIFY_IN_FOCUS) ||
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
85 focus_return != GDK_WINDOW_XWINDOW(gtkwin->window->window)) {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
86 if (method & METHOD_STRING)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
87 string_add(gtkwin->window);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
88 if (method & METHOD_COUNT)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
89 count_add(gtkwin->window, 0);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
90 if (method & METHOD_QUOTE)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
91 quote_add(gtkwin->window);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
92 if (method & METHOD_URGENT)
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
93 urgent_add(cnv);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
94 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
95 return 0;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
96 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
97
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
98 guint unnotify(struct gaim_conversation *c, gboolean clean) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
99 struct gaim_gtk_window *gtkwin;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
100 guint option = 0;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
101
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
102 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
103
4043
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
104 /* The top level ifs check whether we are either cleaning all methods,
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
105 * or whether we have that method is currently selected.
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
106 * If we do then they are cleaned
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
107 *
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
108 * The second level ifs check if we removed something,
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
109 * and if that method is currently selected.
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
110 * If we did and it is then set option so that it can be re-added */
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
111 if (clean || (method & METHOD_QUOTE))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
112 if (quote_remove(gtkwin->window) && (method & METHOD_QUOTE))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
113 option ^= METHOD_QUOTE;
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
114
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
115 if (clean || (method & METHOD_COUNT))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
116 if (count_remove(gtkwin->window) && (method & METHOD_COUNT))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
117 option ^= METHOD_COUNT;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
118
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
119 if (clean || (method & METHOD_STRING))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
120 if (string_remove(gtkwin->window) && (method & METHOD_STRING))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
121 option ^= METHOD_STRING;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
122
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
123 if (clean || (method & METHOD_URGENT))
4043
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
124 if (urgent_remove(c) && (method & METHOD_URGENT))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
125 option ^= METHOD_URGENT;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
126
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
127 return option;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
128 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
129
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
130 void chat_recv_im(struct gaim_connection *gc, int id, char **who, char **text) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
131 struct gaim_conversation *c = gaim_find_chat(gc, id);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
132
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
133 if (c && (type & TYPE_CHAT))
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
134 notify(c);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
135 return;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
136 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
137
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
138 void chat_sent_im(struct gaim_connection *gc, int id, char **text) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
139 struct gaim_conversation *c = gaim_find_chat(gc, id);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
140
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
141 if (c && (type & TYPE_CHAT))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
142 unnotify(c, FALSE);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
143 return;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
144 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
145
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
146 int im_recv_im(struct gaim_connection *gc, char **who, char **what, void *m) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
147 struct gaim_conversation *c = gaim_find_conversation(*who);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
148
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
149 if (c && (type & TYPE_IM))
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
150 notify(c);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
151 return 0;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
152 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
153
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
154 int im_sent_im(struct gaim_connection *gc, char *who, char **what, void *m) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
155 struct gaim_conversation *c = gaim_find_conversation(who);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
156
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
157 if (c && (type & TYPE_IM))
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
158 unnotify(c, FALSE);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
159 return 0;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
160 }
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
161
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
162 int attach_signals(struct gaim_conversation *c) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
163 struct gaim_gtk_conversation *gtkconv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
164 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
165
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
166 gtkconv = GAIM_GTK_CONVERSATION(c);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
167 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
168
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
169 if (choice & NOTIFY_FOCUS) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
170 g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(un_star), NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
171 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
172
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
173 if (choice & NOTIFY_CLICK) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
174 g_signal_connect(G_OBJECT(gtkwin->window), "button_press_event", G_CALLBACK(un_star), NULL);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
175
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
176 g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button_press_event", G_CALLBACK(un_star), G_OBJECT(gtkwin->window));
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
177
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
178 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "button_press_event", G_CALLBACK(un_star), G_OBJECT(gtkwin->window));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
179 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
180
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
181 if (choice & NOTIFY_TYPE) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
182 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(un_star), G_OBJECT(gtkwin->window));
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 }
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
184
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
185 g_object_set_data(G_OBJECT(gtkwin->window), "user_data", c);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
186 g_object_set_data(G_OBJECT(gtkwin->window), "notify_data", GUINT_TO_POINTER(choice));
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
187 return 0;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
190 void detach_signals(struct gaim_conversation *c) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
191 struct gaim_gtk_conversation *gtkconv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
192 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
193 guint options;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
194
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
195 gtkconv = GAIM_GTK_CONVERSATION(c);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
196 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
197
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
198 options = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(gtkwin->window), "notify_data"));
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
199
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
200 if (options & NOTIFY_FOCUS) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
201 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), un_star, NULL);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
202 }
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
203 if (options & NOTIFY_CLICK) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
204 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), un_star, NULL);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
205 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), un_star, gtkwin->window);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
206 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), un_star, gtkwin->window);
4203
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 if (options & NOTIFY_TYPE) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
210 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), un_star, gtkwin->window);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
211 }
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
212 }
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
213
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
214 void new_conv(char *who) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
215 struct gaim_conversation *c = gaim_find_conversation(who);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
216
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
217 if (c && (type & TYPE_IM))
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
218 attach_signals(c);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
219 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
220
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
221 void chat_join(struct gaim_connection *gc, int id, char *room) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
222 struct gaim_conversation *c = gaim_find_chat(gc, id);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
223
4043
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
224 if (c && (type & TYPE_CHAT))
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
225 attach_signals(c);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
226 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
227
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
228 int un_star(GtkWidget *widget, gpointer data) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
229 struct gaim_conversation *c = g_object_get_data(G_OBJECT(widget), "user_data");
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
230
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
231 if (method & METHOD_QUOTE)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
232 quote_remove(widget);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
233 if (method & METHOD_COUNT)
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
234 count_remove(widget);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
235 if (method & METHOD_STRING)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
236 string_remove(widget);
4043
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
237 if (c && method & METHOD_URGENT)
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
238 urgent_remove(c);
4047
0fccde7ed9b8 [gaim-migrate @ 4255]
Sean Egan <seanegan@gmail.com>
parents: 4043
diff changeset
239 return 0;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
240 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
241
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
242 /* This function returns the number in [ ]'s or 0
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
243 and sets *length to the number of digits in that number */
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
244 int counter (char *buf, int *length) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
245 char temp[256];
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
246 int i = 0;
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
247 int j = 0;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
248 *length = 0;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
249
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
250 /* Don't assume buf[0]=='[' */
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
251 while( buf[i++] != '[' && i<sizeof(buf));
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
252
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
253 while (isdigit(buf[i]) && i<sizeof(buf)) {
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
254 temp[j++] = buf[i++];
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
255 (*length)++;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
256 }
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
257 temp[j] = '\0';
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
258
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
259 if (buf[i] != ']') {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
260 *length = 0;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
261 return (0);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
262 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
263
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
264 return (atoi(temp));
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
265 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
266
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
267 void string_add(GtkWidget *widget) {
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
268 char buf[256];
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
269 GtkWindow *win = GTK_WINDOW(widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
270
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
271 strncpy(buf, win->title, sizeof(buf));
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
272 if (!strstr(buf, title_string)) {
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
273 g_snprintf(buf, sizeof(buf), "%s%s", title_string, win->title);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
274 gtk_window_set_title(win, buf);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
275 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
276 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
277
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
278 gboolean string_remove(GtkWidget *widget) {
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 char buf[256];
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
280 GtkWindow *win = GTK_WINDOW(widget);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
281
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
282 strncpy(buf, win->title, sizeof(buf));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
283 if (strstr(buf, title_string)) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
284 g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
285 gtk_window_set_title(win, buf);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
286 return TRUE;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
287 }
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
288 return FALSE;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
289 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
290
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
291 void count_add(GtkWidget *widget, int number) {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
292 char buf[256];
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
293 int c, length;
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
294 GtkWindow *win = GTK_WINDOW(widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
295
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
296 strncpy(buf, win->title, sizeof(buf));
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
297 c = counter(buf, &length);
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
298
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
299 if (number) {
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
300 /* This might cause problems in the future.
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
301 I'm pretty sure if count_add is called after quote_add
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
302 and number!=0, then this will have problems dealing with
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
303 the quotation marks. */
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
304 g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title);
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
305 } else if (!c) {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
306 g_snprintf(buf, sizeof(buf), "[1] %s", win->title);
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
307 } else if (buf[0] == '[' || buf[1] == '[' ) {
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
308 /* This has to be so complicated in order to account for METHOD_QUOTE */
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
309 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[ ((method & METHOD_QUOTE) ? 4 : 3)+length ]);
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
310 if( buf[ strlen(buf)-1 ] == '"' )
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
311 buf[ strlen(buf)-1 ] = '\0';
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
312 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
313 gtk_window_set_title(win, buf);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
314 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
315
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
316 gboolean count_remove(GtkWidget *widget) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
317 char buf[256];
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
318 GtkWindow *win = GTK_WINDOW(widget);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
319 int length;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
320
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
321 strncpy(buf, win->title, sizeof(buf));
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4585
diff changeset
322 if (buf[0] == '[') {
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
323 Number = counter(buf, &length);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
324 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
325 gtk_window_set_title(win, buf);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
326 return TRUE;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
327 }
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
328 return FALSE;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
329 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
330
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
331 void quote_add(GtkWidget *widget) {
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
332 char buf[256];
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
333 GtkWindow *win = GTK_WINDOW(widget);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
334
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
335 strncpy(buf, win->title, sizeof(buf));
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4585
diff changeset
336 if (buf[0] != '\"') {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
337 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
338 gtk_window_set_title(win, buf);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
339 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
340 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
341
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
342 gboolean quote_remove(GtkWidget *widget) {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
343 char buf[256];
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
344 GtkWindow *win = GTK_WINDOW(widget);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
346 strncpy(buf, win->title, sizeof(buf));
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4585
diff changeset
347 if (buf[0] == '\"') {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
348 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 gtk_window_set_title(win, buf);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
350 return TRUE;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 }
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
352 return FALSE;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
353 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
354
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
355 void urgent_add(struct gaim_conversation *c) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
356 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
357 XWMHints *hints;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
358
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
359 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
360
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
361 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window));
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
362 hints->flags |= XUrgencyHint;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
363 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
364 XFree(hints);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
365 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
366
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
367 gboolean urgent_remove(struct gaim_conversation *c) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
368 struct gaim_gtk_conversation *gtkconv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
369
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
370 gtkconv = GAIM_GTK_CONVERSATION(c);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
371
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
372 if ((gaim_conversation_get_type(c) == GAIM_CONV_CHAT &&
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
373 (chat_options & OPT_CHAT_ONE_WINDOW)) ||
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
374 (gaim_conversation_get_type(c) != GAIM_CONV_CHAT &&
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
375 (im_options & OPT_IM_ONE_WINDOW))) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
376 if (gaim_conversation_get_type(c) == GAIM_CONV_CHAT) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
377 struct gaim_conversation *c = (struct gaim_conversation *)gaim_get_chats()->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
378 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
379 GdkWindow *win;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
380 XWMHints *hints;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
381
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
382 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
383
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
384 win = gtkwin->window->window;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
385
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
386 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win));
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
387 if (hints->flags & XUrgencyHint) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
388 hints->flags &= ~XUrgencyHint;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
389 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
390 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
391 return TRUE;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
392 }
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
393 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
394 return FALSE;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
395 } else {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
396 struct gaim_conversation *c;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
397 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
398 GdkWindow *win;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
399 XWMHints *hints;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
400
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
401 c = (struct gaim_conversation *)gaim_get_ims()->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
402 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
403 win = gtkwin->window->window;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
404
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
405 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win));
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
406 if (hints->flags & XUrgencyHint) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
407 hints->flags &= ~XUrgencyHint;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
408 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
409 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
410 return TRUE;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
411 }
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
412 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
413 return FALSE;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
414 }
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
415 } else {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
416 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
417 XWMHints *hints;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
418
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
419 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
420 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
421
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
422 if (hints->flags & XUrgencyHint) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
423 hints->flags &= ~XUrgencyHint;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
424 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
425 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
426 return TRUE;
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
427 }
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
428 XFree(hints);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
429 return FALSE;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
430 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
431 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
432
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
433 void save_notify_prefs() {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
434 gchar buf[1000];
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
435 FILE *fp;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
436
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
437 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME"));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
438 if (!(fp = fopen(buf, "w"))) {
3561
333551497ff8 [gaim-migrate @ 3655]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
439 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
440 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
441 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
442
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
443 fprintf(fp, "%d=TYPE\n", type);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
444 fprintf(fp, "%d=CHOICE\n", choice);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
445 fprintf(fp, "%d=METHOD\n", method);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
446 fprintf(fp, "%s=STRING\n", title_string);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
447 fclose(fp);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
448 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
449
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
450 void load_notify_prefs() {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
451 gchar buf[1000];
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
452 gchar **parsed;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
453 FILE *fp;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
454
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
455 g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME"));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
456 if (!(fp = fopen(buf, "r")))
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
457 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
458
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
459 while (fgets(buf, 1000, fp) != NULL) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
460 parsed = g_strsplit(g_strchomp(buf), "=", 2);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
461 if (parsed[0] && parsed[1]) {
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
462 if (!strcmp(parsed[1], "TYPE"))
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
463 type = atoi(parsed[0]);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
464 if (!strcmp(parsed[1], "CHOICE"))
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
465 choice = atoi(parsed[0]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
466 if (!strcmp(parsed[1], "METHOD"))
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
467 method = atoi(parsed[0]);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
468 if (!strcmp(parsed[1], "STRING")) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
469 if (title_string != NULL)
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
470 g_free(title_string);
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
471 title_string = g_strdup(parsed[0]);
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
472 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
473 }
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
474 g_strfreev(parsed);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
475 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
476 fclose(fp);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
477 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
478 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
479
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
480 void options(GtkWidget *widget, gpointer data) {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
481 gint option = GPOINTER_TO_INT(data);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
482
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
483 if (option == 0)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
484 choice ^= NOTIFY_FOCUS;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
485 else if (option == 1)
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
486 choice ^= NOTIFY_CLICK;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
487 else if (option == 2)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
488 choice ^= NOTIFY_TYPE;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
489 else if (option == 3) {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
490 method ^= METHOD_STRING;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
491 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
492 gtk_widget_set_sensitive(Entry, TRUE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
493 else
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
494 gtk_widget_set_sensitive(Entry, FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
495 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
496 else if (option == 4)
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
497 method ^= METHOD_QUOTE;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
498 else if (option == 5)
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
499 method ^= METHOD_URGENT;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
500 else if (option == 6)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
501 choice ^= NOTIFY_IN_FOCUS;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
502 else if (option == 7)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
503 method ^= METHOD_COUNT;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
504 else if (option == 8)
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
505 type ^= TYPE_IM;
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
506 else if (option == 9)
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
507 type ^= TYPE_CHAT;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
508 else if (option == 10) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
509 /* 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
510 * 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
511 * 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
512 if (title_string != NULL) {
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
513 g_free(title_string);
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
514 title_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(Entry)));
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
515 }
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
516 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
517
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
518 save_notify_prefs();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
519 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
520
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
521 void apply_options(GtkWidget *widget, gpointer data) {
4376
2c985a9e994c [gaim-migrate @ 4642]
Christian Hammond <chipx86@chipx86.com>
parents: 4359
diff changeset
522 GList *cnv = gaim_get_conversations();
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
523
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
524 while (cnv) {
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
525 guint notification;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
526 struct gaim_conversation *c = (struct gaim_conversation *) cnv->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
527 struct gaim_gtk_conversation *gtkconv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
528 struct gaim_gtk_window *gtkwin;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
529 guint options = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(c->window), "notify_data"));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
530
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
531 gtkconv = GAIM_GTK_CONVERSATION(c);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
532 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
533
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
534 if (options & NOTIFY_FOCUS)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
535 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), un_star, NULL);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
536
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
537 /* remove old notification signals */
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
538 detach_signals(c);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
539
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
540 /* clean off all notification markings */
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
541 notification = unnotify(c, TRUE);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
542
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
543 /* re-add appropriate notification methods cleaned above */
4043
e25edee01c33 [gaim-migrate @ 4251]
Luke Schierer <lschiere@pidgin.im>
parents: 4035
diff changeset
544 if (notification & METHOD_STRING) /* re-add string */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
545 string_add(gtkwin->window);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
546 if (notification & METHOD_QUOTE) /* re-add quote */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
547 quote_add(gtkwin->window);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
548 if (notification & METHOD_COUNT) /* re-add count */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
549 count_add(gtkwin->window, Number);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
550 if (notification & METHOD_URGENT) /* re-add urgent */
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
551 urgent_add(c);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
552
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
553 /* attach new unnotification signals */
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
554 attach_signals(c);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
555
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
556 cnv = cnv->next;
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
557 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
558 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
559
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
560 static GtkWidget *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
561 get_config_frame(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
562 {
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
563 GtkWidget *ret;
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
564 GtkWidget *vbox, *hbox;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
565 GtkWidget *toggle, *button;
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
566 ret = gtk_vbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
567 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
568
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
569 vbox = make_frame(ret, _("Notify For"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
570 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
571 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
572 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
573 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(8));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
574
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
575 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
576 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
577 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
578 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(9));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
579
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
580 /*--------------*/
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
581 vbox = make_frame(ret, _("Notification Methods"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
582 hbox = gtk_hbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
583 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
584 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title (hit enter to save):"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
585 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
586 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(3));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
587 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
588 Entry = gtk_entry_new();
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
589 gtk_entry_set_max_length(GTK_ENTRY(Entry), 10);
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
590 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
591 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
592 gtk_entry_set_text(GTK_ENTRY(Entry), title_string);
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
593 g_signal_connect(G_OBJECT(Entry), "activate", G_CALLBACK(options), GINT_TO_POINTER(10));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
594
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
595 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
596 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
597 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
598 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(4));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
599
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
600 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
601 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
602 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
603 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(5));
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
604
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
605 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
607 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
608 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(7));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
609
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
610 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
611 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
612 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
613 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(6));
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
614
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
615 /*--------------*/
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
616 vbox = make_frame(ret, _("Notification Removal"));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
617 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
618 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
619 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
620 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(0));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
621
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
622 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
623 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
624 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_CLICK);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
625 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(1));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
626
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
627 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
628 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
629 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
630 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(2));
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
631
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
632 button = gtk_button_new_with_mnemonic(_("Appl_y"));
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
633 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 5);
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
634 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(apply_options), NULL);
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
635
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
636 gtk_widget_show_all(ret);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
637 return ret;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
638 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
639
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
640 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
641 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
642 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
643 title_string = g_strdup("(*) ");
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
644
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
645 load_notify_prefs();
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
646
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
647 gaim_signal_connect(plugin, event_im_recv, im_recv_im, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
648 gaim_signal_connect(plugin, event_chat_recv, chat_recv_im, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
649 gaim_signal_connect(plugin, event_im_send, im_sent_im, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
650 gaim_signal_connect(plugin, event_chat_send, chat_sent_im, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
651 gaim_signal_connect(plugin, event_new_conversation, new_conv, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
652 gaim_signal_connect(plugin, event_chat_join, chat_join, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
653
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
654 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
655 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
656
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
657 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
658 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
659 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
660 GList *c = gaim_get_conversations();
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
661
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
662 while (c) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
663 struct gaim_conversation *cnv = (struct gaim_conversation *)c->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
664 struct gaim_gtk_window *gtkwin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
665
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
666 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(cnv));
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
667
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
668 detach_signals(cnv);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
669 un_star(gtkwin->window, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
670
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
671 c = c->next;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
672 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
673
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
674 /* this might be a hack I'm not sure, I don't think so but... */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
675 g_free(title_string);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
676
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
677 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
678 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
679
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
680 static GaimGtkPluginUiInfo ui_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
681 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
682 get_config_frame
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
683 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
684
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
685 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
686 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
687 2, /**< api_version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
688 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
689 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
690 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
691 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
692 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
693
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
694 NOTIFY_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
695 N_("Message Notification"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
696 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
697 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
698 N_("Provides a variety of ways of notifying you of unread messages."),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
699 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
700 N_("Provides a variety of ways of notifying you of unread messages."),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
701 "Etan Reisner <deryni@eden.rutgers.edu>", /**< author */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
702 WEBSITE, /**< homepage */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
703
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
704 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
705 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
706 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
707
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
708 &ui_info, /**< ui_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
709 NULL /**< extra_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
710 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
711
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
712 static void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
713 __init_plugin(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
714 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
715 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
716
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
717 GAIM_INIT_PLUGIN(notify, __init_plugin, info);