Mercurial > pidgin
annotate plugins/notify.c @ 6572:4f097c1069b0
[gaim-migrate @ 7094]
this one i noticed on my own. it comes of editing an un-updated copy of the Changelog
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 22 Aug 2003 12:09:46 +0000 |
parents | 70d5122bc3ff |
children | 7230e5920911 |
rev | line source |
---|---|
6302 | 1 /* |
2 * Gaim buddy notification plugin. | |
3 * | |
4 * Copyright (C) 2000-2001, Eric Warmenhoven (original code) | |
5 * Copyright (C) 2002, Etan Reisner <deryni@eden.rutgers.edu> (rewritten code) | |
6 * Copyright (C) 2003, Christian Hammond (update for changed API) | |
6322 | 7 * Copyright (C) 2003, Brian Tarricone <bjt23@cornell.edu> (mostly rewritten) |
6302 | 8 * Copyright (C) 2003, Mark Doliner (minor cleanup) |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
3374 | 19 * |
6302 | 20 * You should have received a copy of the GNU General Public License |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 * | |
24 */ | |
25 | |
26 /* | |
27 * From Etan, 2002: | |
28 * -Added config dialog | |
29 * -Added control over notification method | |
30 * -Added control over when to release notification | |
31 * | |
32 * -Added option to get notification for chats also | |
33 * -Cleaned up code | |
34 * -Added option to notify on click as it's own option | |
35 * rather then as what happens when on focus isn't clicked | |
36 * -Added apply button to change the denotification methods for | |
37 * open conversation windows | |
38 * -Fixed apply to conversations, count now keeps count across applies | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
39 * -Fixed(?) memory leak, and in the process fixed some stupidities |
6302 | 40 * -Hit enter when done editing the title string entry box to save it |
3392 | 41 * |
42 * Thanks to Carles Pina i Estany <carles@pinux.info> | |
43 * for count of new messages option | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
44 * |
6302 | 45 * From Brian, 20 July 2003: |
46 * -Use new xml prefs | |
47 * -Better handling of notification states tracking | |
48 * -Better pref change handling | |
49 * -Fixed a possible memleak and possible crash (rare) | |
50 * -Use gtk_window_get_title() rather than gtkwin->title | |
51 * -Other random fixes and cleanups | |
3392 | 52 */ |
53 | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
54 #include "gtkinternal.h" |
6302 | 55 |
56 #include "conversation.h" | |
57 #include "debug.h" | |
58 #include "notify.h" | |
59 #include "prefs.h" | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
60 #include "signals.h" |
4202
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
61 |
6302 | 62 #include "gtkconv.h" |
63 #include "gtkplugin.h" | |
64 #include "gtkutils.h" | |
65 | |
66 #include "gtkplugin.h" | |
67 | |
3428 | 68 #include <string.h> |
69 #include <ctype.h> | |
70 #include <stdlib.h> | |
191 | 71 #include <gtk/gtk.h> |
3385 | 72 #include <X11/Xlib.h> |
3374 | 73 #include <X11/Xutil.h> |
3392 | 74 #include <X11/Xatom.h> |
3374 | 75 #include <gdk/gdkx.h> |
6302 | 76 #include <glib.h> |
3374 | 77 |
6302 | 78 #define NOTIFY_PLUGIN_ID "gtk-x11-notify" |
3710 | 79 |
6302 | 80 #define OPT_TYPE_IM ((guint)0x00000001) |
81 #define OPT_TYPE_CHAT ((guint)0x00000002) | |
82 #define OPT_NOTIFY_FOCUS ((guint)0x00000004) | |
83 #define OPT_NOTIFY_TYPE ((guint)0x00000008) | |
84 #define OPT_NOTIFY_IN_FOCUS ((guint)0x00000010) | |
85 #define OPT_NOTIFY_CLICK ((guint)0x00000020) | |
86 #define OPT_METHOD_STRING ((guint)0x00000040) | |
87 #define OPT_METHOD_QUOTE ((guint)0x00000080) | |
88 #define OPT_METHOD_URGENT ((guint)0x00000100) | |
89 #define OPT_METHOD_COUNT ((guint)0x00000200) | |
90 #define OPT_METHOD_STRING_CHNG ((guint)0x00000400) | |
91 #define STATE_IS_NOTIFIED ((guint)0x80000000) | |
3374 | 92 |
6302 | 93 #define TITLE_STR_BUFSIZE 256 |
94 | |
95 #define GDATASTR "notify-plugin-opts" | |
96 #define GDATASTRCNT "notify-plugin-count" | |
191 | 97 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
98 static GaimPlugin *my_plugin = NULL; |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
99 |
6302 | 100 static guint notify_opts = 0; |
101 static gchar title_string[TITLE_STR_BUFSIZE+1]; | |
102 | |
103 /* notification set/unset */ | |
104 static int notify(GaimConversation *c); | |
105 static void unnotify(GaimConversation *c); | |
106 static int unnotify_cb(GtkWidget *widget, gpointer data); | |
107 | |
108 /* gtk widget callbacks for prefs panel */ | |
109 static void options_toggle_cb(GtkWidget *widget, gpointer data); | |
110 static gboolean options_settitle_cb(GtkWidget *w, GdkEventFocus *evt, GtkWidget *entry); | |
111 static void options_toggle_title_cb(GtkWidget *w, GtkWidget *entry); | |
112 static void apply_options(int opt_chng); | |
113 | |
114 /* string functions */ | |
115 static void string_add(GtkWidget *widget); | |
116 static void string_remove(GtkWidget *widget); | |
191 | 117 |
4035 | 118 /* count functions */ |
6302 | 119 static void count_add(GtkWidget *widget); |
120 static void count_remove(GtkWidget *widget); | |
121 | |
4035 | 122 /* quote functions */ |
6302 | 123 static void quote_add(GtkWidget *widget); |
124 static void quote_remove(GtkWidget *widget); | |
125 | |
4035 | 126 /* urgent functions */ |
6302 | 127 static void urgent_add(GaimConversation *c); |
128 static void urgent_remove(GaimConversation *c); | |
3710 | 129 |
6302 | 130 /****************************************/ |
131 /* Begin doing stuff below this line... */ | |
132 /****************************************/ | |
133 | |
134 static int notify(GaimConversation *c) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
135 GaimGtkWindow *gtkwin; |
3710 | 136 Window focus_return; |
4035 | 137 int revert_to_return; |
6302 | 138 guint opts; |
139 gint count; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
140 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
141 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5021 | 142 |
6302 | 143 /* increment message counter */ |
144 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), GDATASTRCNT)); | |
145 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER(count+1)); | |
146 | |
147 /* if we aren't doing notifications for this type of convo, bail */ | |
148 if (((gaim_conversation_get_type(c) == GAIM_CONV_IM) && !(notify_opts & OPT_TYPE_IM)) || | |
149 ((gaim_conversation_get_type(c) == GAIM_CONV_CHAT) && !(notify_opts & OPT_TYPE_CHAT))) | |
150 return 0; | |
151 | |
152 XGetInputFocus(GDK_WINDOW_XDISPLAY(gtkwin->window->window), &focus_return, &revert_to_return); | |
5021 | 153 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
154 if ((notify_opts & OPT_NOTIFY_IN_FOCUS) || |
6302 | 155 (focus_return != GDK_WINDOW_XWINDOW(gtkwin->window->window))) { |
156 if (notify_opts & OPT_METHOD_STRING) | |
157 string_add(gtkwin->window); | |
158 if (notify_opts & OPT_METHOD_COUNT) | |
159 count_add(gtkwin->window); | |
160 if (notify_opts & OPT_METHOD_QUOTE) | |
161 quote_add(gtkwin->window); | |
162 if (notify_opts & OPT_METHOD_URGENT) | |
163 urgent_add(c); | |
164 } | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
165 |
6302 | 166 opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), GDATASTR)); |
167 opts |= STATE_IS_NOTIFIED; | |
168 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER(opts)); | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
169 |
6302 | 170 return 0; |
3374 | 171 } |
172 | |
6302 | 173 static void unnotify(GaimConversation *c) { |
174 GaimGtkWindow *gtkwin; | |
175 | |
176 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
177 | |
178 urgent_remove(c); | |
179 quote_remove(GTK_WIDGET(gtkwin->window)); | |
180 count_remove(GTK_WIDGET(gtkwin->window)); | |
181 string_remove(GTK_WIDGET(gtkwin->window)); | |
182 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); | |
183 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
184 } | |
185 | |
186 static int unnotify_cb(GtkWidget *widget, gpointer data) { | |
187 GaimConversation *c = g_object_get_data(G_OBJECT(widget), "user_data"); | |
188 | |
189 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "in unnotify_cb()\n"); | |
190 | |
191 if (c) | |
192 urgent_remove(c); | |
193 quote_remove(widget); | |
194 count_remove(widget); | |
195 string_remove(widget); | |
196 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER((guint)0)); | |
197 g_object_set_data(G_OBJECT(widget), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
198 | |
199 return 0; | |
200 } | |
201 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
202 static gboolean |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
203 chat_recv_im(GaimAccount *account, GaimConversation *conv, char **who, |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
204 char **text) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
205 { |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
206 if (conv) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
207 notify(conv); |
3710 | 208 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
209 return FALSE; |
3710 | 210 } |
211 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
212 static void chat_sent_im(GaimConversation *c, char **text) { |
6302 | 213 if (c) |
214 unnotify(c); | |
3710 | 215 } |
216 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
217 static gboolean |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
218 im_recv_im(GaimAccount *account, GaimConversation *conv, char **who, |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
219 char **what, int *flags, void *m) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
220 { |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
221 if (conv) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
222 notify(conv); |
3710 | 223 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
224 return FALSE; |
3710 | 225 } |
226 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
227 static void im_sent_im(GaimConversation *conv, char **what, void *m) { |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
228 if (conv) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
229 unnotify(conv); |
3710 | 230 } |
3392 | 231 |
6302 | 232 static int attach_signals(GaimConversation *c) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
233 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
234 GaimGtkWindow *gtkwin; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
235 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
236 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
237 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
238 |
6302 | 239 if (notify_opts & OPT_NOTIFY_FOCUS) { |
240 g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(unnotify_cb), NULL); | |
3374 | 241 } |
3710 | 242 |
6302 | 243 if (notify_opts & OPT_NOTIFY_CLICK) { |
244 g_signal_connect(G_OBJECT(gtkwin->window), "button_press_event", G_CALLBACK(unnotify_cb), NULL); | |
245 g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button_press_event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
246 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "button_press_event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
3374 | 247 } |
248 | |
6302 | 249 if (notify_opts & OPT_NOTIFY_TYPE) { |
250 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
191 | 251 } |
4035 | 252 |
3428 | 253 return 0; |
191 | 254 } |
255 | |
6302 | 256 static void detach_signals(GaimConversation *c) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
257 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
258 GaimGtkWindow *gtkwin; |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
259 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
260 gtkconv = GAIM_GTK_CONVERSATION(c); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
261 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
262 |
6302 | 263 if (notify_opts & OPT_NOTIFY_FOCUS) { |
264 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), unnotify_cb, NULL); | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
265 } |
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
266 |
6302 | 267 if (notify_opts & OPT_NOTIFY_CLICK) { |
268 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), unnotify_cb, NULL); | |
269 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), unnotify_cb, gtkwin->window); | |
270 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), unnotify_cb, gtkwin->window); | |
271 } | |
272 | |
273 if (notify_opts & OPT_NOTIFY_TYPE) { | |
274 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), unnotify_cb, gtkwin->window); | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
275 } |
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
276 } |
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
277 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
278 static void new_conv(GaimConversation *c) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
279 { |
6302 | 280 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
3710 | 281 |
6302 | 282 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); |
283 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
284 | |
285 if (c && (notify_opts & OPT_TYPE_IM)) | |
3710 | 286 attach_signals(c); |
287 } | |
288 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
289 static void chat_join(GaimConversation *c) { |
6302 | 290 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
3710 | 291 |
6302 | 292 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); |
293 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
294 | |
295 if (c && (notify_opts & OPT_TYPE_CHAT)) | |
3710 | 296 attach_signals(c); |
297 } | |
298 | |
6302 | 299 static void string_add(GtkWidget *widget) { |
300 GtkWindow *win = GTK_WINDOW(widget); | |
301 gchar newtitle[256]; | |
302 const gchar *curtitle = gtk_window_get_title(win); | |
303 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
304 | |
305 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "string_add(): opts=0x%04x\n", opts); | |
306 | |
307 if (opts & OPT_METHOD_STRING) | |
308 return; | |
3374 | 309 |
6302 | 310 if (!strstr(curtitle, title_string)) { |
311 if (opts & OPT_METHOD_COUNT) { | |
312 char *p = strchr(curtitle, ']'); | |
313 int len1; | |
314 if (!p) | |
315 return; | |
316 len1 = p-curtitle+2; | |
317 memcpy(newtitle, curtitle, len1); | |
318 strncpy(newtitle+len1, title_string, sizeof(newtitle)-len1); | |
319 strncpy(newtitle+len1+strlen(title_string), curtitle+len1, | |
320 sizeof(newtitle)-len1-strlen(title_string)); | |
321 } else if (opts & OPT_METHOD_QUOTE) { | |
322 g_snprintf(newtitle, sizeof(newtitle), "\"%s%s", title_string, curtitle+1); | |
323 } else { | |
324 g_snprintf(newtitle, sizeof(newtitle), "%s%s", title_string, curtitle); | |
325 } | |
326 gtk_window_set_title(win, newtitle); | |
327 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "added string to window title\n"); | |
328 } | |
329 | |
330 opts |= OPT_METHOD_STRING; | |
331 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
3374 | 332 } |
333 | |
6302 | 334 static void string_remove(GtkWidget *widget) { |
335 GtkWindow *win = GTK_WINDOW(widget); | |
336 gchar newtitle[256]; | |
337 const gchar *curtitle; | |
338 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
3392 | 339 |
6302 | 340 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "string_remove(): opts=0x%04x\n", opts); |
4035 | 341 |
6302 | 342 if (!(opts & OPT_METHOD_STRING)) |
343 return; | |
344 | |
345 curtitle = gtk_window_get_title(win); | |
3392 | 346 |
6302 | 347 if (strstr(curtitle, title_string)) { |
348 if (opts & OPT_METHOD_COUNT) { | |
349 char *p = strchr(curtitle, ']'); | |
350 int len1; | |
351 if (!p) | |
352 return; | |
353 len1 = p-curtitle+2; | |
354 memcpy(newtitle, curtitle, len1); | |
355 strncpy(newtitle+len1, curtitle+len1+strlen(title_string), sizeof(newtitle)-len1); | |
356 } else if (opts & OPT_METHOD_QUOTE) { | |
357 g_snprintf(newtitle, sizeof(newtitle), "\"%s", curtitle+strlen(title_string)+1); | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
358 } else |
6302 | 359 strncpy(newtitle, curtitle+strlen(title_string), sizeof(newtitle)); |
360 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
361 |
6302 | 362 gtk_window_set_title(win, newtitle); |
363 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed string from window title (title now %s)\n", newtitle); | |
3374 | 364 } |
365 | |
6302 | 366 static void count_add(GtkWidget *widget) { |
4035 | 367 GtkWindow *win = GTK_WINDOW(widget); |
6302 | 368 char newtitle[256]; |
369 const gchar *curtitle; | |
370 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
371 gint curcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTRCNT)); | |
4035 | 372 |
6302 | 373 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "count_add(): opts=0x%04x\n", opts); |
374 | |
375 if (curcount>0 && (opts & OPT_METHOD_COUNT)) | |
376 count_remove(widget); | |
5021 | 377 |
6302 | 378 curtitle = gtk_window_get_title(win); |
379 if (opts & OPT_METHOD_QUOTE) | |
380 g_snprintf(newtitle, sizeof(newtitle), "\"[%d] %s", curcount, curtitle+1); | |
381 else | |
382 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", curcount, curtitle); | |
383 gtk_window_set_title(win, newtitle); | |
384 | |
385 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "added count of %d to window\n", curcount); | |
386 | |
387 opts |= OPT_METHOD_COUNT; | |
388 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
4035 | 389 } |
390 | |
6302 | 391 static void count_remove(GtkWidget *widget) { |
3392 | 392 GtkWindow *win = GTK_WINDOW(widget); |
6302 | 393 char newtitle[256], *p; |
394 const gchar *curtitle; | |
395 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
396 | |
397 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "count_remove(): opts=0x%04x\n", opts); | |
398 | |
399 if (!(opts & OPT_METHOD_COUNT)) | |
400 return; | |
401 | |
402 curtitle = gtk_window_get_title(win); | |
3392 | 403 |
6302 | 404 p = strchr(curtitle, ']'); |
405 | |
406 if (p) { | |
407 if (opts & OPT_METHOD_QUOTE) | |
408 g_snprintf(newtitle, sizeof(newtitle), "\"%s", p+2); | |
409 else | |
410 g_snprintf(newtitle, sizeof(newtitle), p+2); | |
411 gtk_window_set_title(win, newtitle); | |
412 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed count from title (title now %s)\n", newtitle); | |
3392 | 413 } |
6302 | 414 |
415 opts &= ~OPT_METHOD_COUNT; | |
416 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
3392 | 417 } |
418 | |
6302 | 419 static void quote_add(GtkWidget *widget) { |
4035 | 420 GtkWindow *win = GTK_WINDOW(widget); |
6302 | 421 char newtitle[256]; |
422 const gchar *curtitle = gtk_window_get_title(win); | |
423 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
424 | |
425 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quote_add(): opts=0x%04x\n", opts); | |
4035 | 426 |
6302 | 427 if (opts & OPT_METHOD_QUOTE) |
428 return; | |
429 | |
430 if (*curtitle != '\"') { | |
431 g_snprintf(newtitle, sizeof(newtitle), "\"%s\"", curtitle); | |
432 gtk_window_set_title(win, newtitle); | |
433 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quoted title\n"); | |
4035 | 434 } |
6302 | 435 |
436 opts |= OPT_METHOD_QUOTE; | |
437 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
4035 | 438 } |
439 | |
6302 | 440 static void quote_remove(GtkWidget *widget) { |
3374 | 441 GtkWindow *win = GTK_WINDOW(widget); |
6302 | 442 char newtitle[512]; |
443 const gchar *curtitle = gtk_window_get_title(win); | |
444 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
445 | |
446 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quote_remove(): opts=0x%04x\n", opts); | |
191 | 447 |
6302 | 448 if (!(opts & OPT_METHOD_QUOTE)) |
449 return; | |
450 | |
451 if (*curtitle == '\"' && strlen(curtitle)-2<sizeof(newtitle)) { | |
452 memcpy(newtitle, curtitle+1, strlen(curtitle)-2); | |
453 newtitle[strlen(curtitle)-2] = 0; | |
454 gtk_window_set_title(win, newtitle); | |
455 gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed quotes from title (title now %s)\n", newtitle); | |
456 } | |
457 | |
458 opts &= ~OPT_METHOD_QUOTE; | |
459 g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
3374 | 460 } |
461 | |
6302 | 462 static void urgent_add(GaimConversation *c) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
463 GaimGtkWindow *gtkwin; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
464 XWMHints *hints; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
465 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
466 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
467 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
468 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); |
4035 | 469 hints->flags |= XUrgencyHint; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
470 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
4218 | 471 XFree(hints); |
4035 | 472 } |
473 | |
6302 | 474 static void urgent_remove(GaimConversation *c) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
475 GaimGtkConversation *gtkconv; |
6302 | 476 const char *convo_placement = gaim_prefs_get_string("/core/conversations/placement"); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
477 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
478 gtkconv = GAIM_GTK_CONVERSATION(c); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
479 |
6302 | 480 if (!strcmp(convo_placement, "new")) { |
481 GaimGtkWindow *gtkwin; | |
482 XWMHints *hints; | |
483 | |
484 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
485 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
486 | |
487 if (hints->flags & XUrgencyHint) { | |
488 hints->flags &= ~XUrgencyHint; | |
489 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
490 } | |
491 XFree(hints); | |
492 } else { | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
493 if (gaim_conversation_get_type(c) == GAIM_CONV_CHAT) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
494 GaimConversation *c = (GaimConversation *)gaim_get_chats()->data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
495 GaimGtkWindow *gtkwin; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
496 GdkWindow *win; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
497 XWMHints *hints; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
498 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
499 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
500 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
501 win = gtkwin->window->window; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
502 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
503 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
504 if (hints->flags & XUrgencyHint) { |
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
505 hints->flags &= ~XUrgencyHint; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
506 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
507 } |
4218 | 508 XFree(hints); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
509 } else { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
510 GaimConversation *c; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
511 GaimGtkWindow *gtkwin; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
512 GdkWindow *win; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
513 XWMHints *hints; |
3374 | 514 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
515 c = (GaimConversation *)gaim_get_ims()->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
516 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
517 win = gtkwin->window->window; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
518 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
519 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
520 if (hints->flags & XUrgencyHint) { |
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
521 hints->flags &= ~XUrgencyHint; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
522 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
523 } |
4218 | 524 XFree(hints); |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
525 } |
4035 | 526 } |
3374 | 527 } |
528 | |
6302 | 529 static void save_notify_prefs() { |
6464 | 530 gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_im", notify_opts & OPT_TYPE_IM); |
531 gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_chat", notify_opts & OPT_TYPE_CHAT); | |
532 gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_focused", notify_opts & OPT_NOTIFY_IN_FOCUS); | |
6302 | 533 gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_focus", notify_opts & OPT_NOTIFY_FOCUS); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
534 gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_click", notify_opts & OPT_NOTIFY_CLICK); |
6302 | 535 gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_type", notify_opts & OPT_NOTIFY_TYPE); |
536 gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_string", notify_opts & OPT_METHOD_STRING); | |
537 gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_quote", notify_opts & OPT_METHOD_QUOTE); | |
538 gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_urgent", notify_opts & OPT_METHOD_URGENT); | |
539 gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_count", notify_opts & OPT_METHOD_COUNT); | |
3374 | 540 |
6302 | 541 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", title_string); |
3374 | 542 } |
543 | |
6302 | 544 static void load_notify_prefs() { |
545 notify_opts = 0; | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
546 |
6464 | 547 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im") ? OPT_TYPE_IM : 0); |
548 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat") ? OPT_TYPE_CHAT : 0); | |
549 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ? OPT_NOTIFY_IN_FOCUS : 0); | |
6302 | 550 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus") ? OPT_NOTIFY_FOCUS : 0); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
551 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click") ? OPT_NOTIFY_CLICK : 0); |
6302 | 552 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type") ? OPT_NOTIFY_TYPE : 0); |
553 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string") ? OPT_METHOD_STRING : 0); | |
554 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_quote") ? OPT_METHOD_QUOTE : 0); | |
555 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent") ? OPT_METHOD_URGENT : 0); | |
556 notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count") ? OPT_METHOD_COUNT : 0); | |
3374 | 557 |
6302 | 558 strncpy(title_string, gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), TITLE_STR_BUFSIZE); |
3374 | 559 } |
560 | |
6302 | 561 static void options_toggle_cb(GtkWidget *w, gpointer data) { |
4035 | 562 gint option = GPOINTER_TO_INT(data); |
3374 | 563 |
6302 | 564 notify_opts ^= option; |
565 | |
566 /* save prefs and re-notify the windows */ | |
567 save_notify_prefs(); | |
568 apply_options(option); | |
569 } | |
570 | |
571 static gboolean options_settitle_cb(GtkWidget *w, GdkEventFocus *evt, GtkWidget *entry) { | |
572 GList *cnv = gaim_get_conversations(); | |
573 | |
574 /* first we have to kill all the old strings */ | |
575 while (cnv) { | |
576 GaimConversation *c = (GaimConversation *)cnv->data; | |
577 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
578 string_remove(gtkwin->window); | |
579 cnv = cnv->next; | |
3374 | 580 } |
6302 | 581 |
582 g_snprintf(title_string, sizeof(title_string), gtk_entry_get_text(GTK_ENTRY(entry))); | |
583 | |
584 /* save prefs and re-notify the windows */ | |
585 save_notify_prefs(); | |
586 apply_options(OPT_METHOD_STRING_CHNG); | |
587 | |
588 return FALSE; | |
589 } | |
590 | |
591 static void options_toggle_title_cb(GtkWidget *w, GtkWidget *entry) { | |
592 notify_opts ^= OPT_METHOD_STRING; | |
593 | |
594 if (notify_opts & OPT_METHOD_STRING) | |
595 gtk_widget_set_sensitive(entry, TRUE); | |
596 else | |
597 gtk_widget_set_sensitive(entry, FALSE); | |
3710 | 598 |
599 save_notify_prefs(); | |
6302 | 600 apply_options(OPT_METHOD_STRING); |
3374 | 601 } |
602 | |
6302 | 603 static void apply_options(int opt_chng) { |
4376
2c985a9e994c
[gaim-migrate @ 4642]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
604 GList *cnv = gaim_get_conversations(); |
4035 | 605 |
6302 | 606 /* option-setting handlers should have cleared out all window notifications */ |
607 | |
4035 | 608 while (cnv) { |
6302 | 609 GaimConversation *c = (GaimConversation *)cnv->data; |
610 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
611 guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), GDATASTR)); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
612 |
6302 | 613 /* kill signals */ |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
614 detach_signals(c); |
4035 | 615 |
6302 | 616 /* |
617 * do a full notify if the option that changed was an OPT_TYPE_* | |
618 * either notify if it was enabled, or unnotify if it was disabled | |
619 */ | |
620 if (opt_chng==OPT_TYPE_IM || opt_chng==OPT_TYPE_CHAT) { | |
621 if ((gaim_conversation_get_type(c)==GAIM_CONV_IM && (notify_opts & OPT_TYPE_IM)) || | |
622 (gaim_conversation_get_type(c)==GAIM_CONV_CHAT && (notify_opts & OPT_TYPE_CHAT))) { | |
623 Window focus_return; | |
624 int revert_to_return; | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
625 |
6302 | 626 XGetInputFocus(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
627 &focus_return, &revert_to_return); | |
628 if ((notify_opts & OPT_NOTIFY_IN_FOCUS) || | |
629 focus_return != GDK_WINDOW_XWINDOW(gtkwin->window->window)) { | |
630 if (notify_opts & OPT_METHOD_STRING) | |
631 string_add(gtkwin->window); | |
632 if (notify_opts & OPT_METHOD_COUNT) | |
633 count_add(gtkwin->window); | |
634 if (notify_opts & OPT_METHOD_QUOTE) | |
635 quote_add(gtkwin->window); | |
636 if (notify_opts & OPT_METHOD_URGENT) | |
637 urgent_add(c); | |
638 } | |
639 } else { | |
640 //don't simply call unnotify(), because that will kill the msg counter | |
641 urgent_remove(c); | |
642 quote_remove(gtkwin->window); | |
643 count_remove(gtkwin->window); | |
644 string_remove(gtkwin->window); | |
645 } | |
646 } else if (opts & STATE_IS_NOTIFIED) { | |
647 //add/remove the status that was changed | |
648 switch(opt_chng) { | |
649 case OPT_METHOD_COUNT: | |
650 if (notify_opts & OPT_METHOD_COUNT) | |
651 count_add(gtkwin->window); | |
652 else | |
653 count_remove(gtkwin->window); | |
654 break; | |
655 case OPT_METHOD_QUOTE: | |
656 if (notify_opts & OPT_METHOD_QUOTE) | |
657 quote_add(gtkwin->window); | |
658 else | |
659 quote_remove(gtkwin->window); | |
660 break; | |
661 case OPT_METHOD_STRING: | |
662 if (notify_opts & OPT_METHOD_STRING) | |
663 string_add(gtkwin->window); | |
664 else | |
665 string_remove(gtkwin->window); | |
666 break; | |
667 case OPT_METHOD_URGENT: | |
668 if (notify_opts & OPT_METHOD_URGENT) | |
669 urgent_add(c); | |
670 else | |
671 urgent_remove(c); | |
672 break; | |
673 case OPT_METHOD_STRING_CHNG: | |
674 string_add(gtkwin->window); | |
675 break; | |
676 } | |
677 } | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
678 |
4035 | 679 /* attach new unnotification signals */ |
6302 | 680 attach_signals(c); |
4035 | 681 |
6302 | 682 cnv = cnv->next; |
4035 | 683 } |
684 } | |
685 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
686 static GtkWidget * |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
687 get_config_frame(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
688 { |
3565 | 689 GtkWidget *ret; |
6302 | 690 GtkWidget *frame; |
3565 | 691 GtkWidget *vbox, *hbox; |
6302 | 692 GtkWidget *toggle, *entry; |
693 | |
3565 | 694 ret = gtk_vbox_new(FALSE, 18); |
6302 | 695 gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
3392 | 696 |
6302 | 697 /*---------- "Notify For" ----------*/ |
698 frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
699 vbox = gtk_vbox_new(FALSE, 5); | |
700 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
701 | |
3710 | 702 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
703 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
6302 | 704 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_TYPE_IM); |
705 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_TYPE_IM)); | |
3710 | 706 |
707 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); | |
708 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
6302 | 709 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_TYPE_CHAT); |
710 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_TYPE_CHAT)); | |
3710 | 711 |
6302 | 712 /*---------- "Notification Methods" ----------*/ |
713 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
714 vbox = gtk_vbox_new(FALSE, 5); | |
715 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
716 | |
3565 | 717 hbox = gtk_hbox_new(FALSE, 18); |
718 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6302 | 719 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
720 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_STRING); | |
3565 | 721 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
6302 | 722 entry = gtk_entry_new(); |
723 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
724 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
725 gtk_widget_set_sensitive(GTK_WIDGET(entry), notify_opts & OPT_METHOD_STRING); | |
726 gtk_entry_set_text(GTK_ENTRY(entry), title_string); | |
727 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_title_cb), entry); | |
728 g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(options_settitle_cb), entry); | |
3374 | 729 |
6302 | 730 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); |
731 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
732 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_QUOTE); | |
733 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_QUOTE)); | |
3374 | 734 |
6302 | 735 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); |
736 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
737 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_URGENT); | |
738 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_URGENT)); | |
4035 | 739 |
6302 | 740 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); |
741 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_COUNT); | |
742 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
743 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_COUNT)); | |
3710 | 744 |
6302 | 745 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus")); |
746 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_IN_FOCUS); | |
747 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
748 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_IN_FOCUS)); | |
3392 | 749 |
6302 | 750 /*---------- "Notification Methods" ----------*/ |
751 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); | |
752 vbox = gtk_vbox_new(FALSE, 5); | |
753 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
3374 | 754 |
6302 | 755 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus")); |
756 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
757 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_FOCUS); | |
758 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_FOCUS)); | |
3710 | 759 |
6302 | 760 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); |
761 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
762 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_CLICK); | |
763 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_CLICK)); | |
4035 | 764 |
6302 | 765 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); |
766 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
767 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_TYPE); | |
768 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_TYPE)); | |
3565 | 769 |
6302 | 770 gtk_widget_show_all(ret); |
771 return ret; | |
3374 | 772 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
773 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
774 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
775 plugin_load(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
776 { |
6302 | 777 GList *cnv = gaim_get_conversations(); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
778 void *conv_handle = gaim_conversations_get_handle(); |
6302 | 779 |
780 my_plugin = plugin; | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
781 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
782 load_notify_prefs(); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
783 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
784 gaim_signal_connect(conv_handle, "received-im-msg", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
785 plugin, GAIM_CALLBACK(im_recv_im), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
786 gaim_signal_connect(conv_handle, "received-chat-msg", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
787 plugin, GAIM_CALLBACK(chat_recv_im), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
788 gaim_signal_connect(conv_handle, "sent-im-msg", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
789 plugin, GAIM_CALLBACK(im_sent_im), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
790 gaim_signal_connect(conv_handle, "sent-chat-msg", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
791 plugin, GAIM_CALLBACK(chat_sent_im), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
792 gaim_signal_connect(conv_handle, "conversation-created", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
793 plugin, GAIM_CALLBACK(new_conv), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
794 gaim_signal_connect(conv_handle, "chat-joined", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
795 plugin, GAIM_CALLBACK(chat_join), NULL); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
796 |
6302 | 797 while (cnv) { |
798 GaimConversation *c = (GaimConversation *)cnv->data; | |
799 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
800 | |
801 /* attach signals */ | |
802 attach_signals(c); | |
803 /* zero out data */ | |
804 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); | |
805 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
806 | |
807 cnv = cnv->next; | |
808 } | |
809 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
810 return TRUE; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
811 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
812 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
813 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
814 plugin_unload(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
815 { |
6302 | 816 GList *cnv = gaim_get_conversations(); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
817 |
6302 | 818 while (cnv) { |
819 GaimConversation *c = (GaimConversation *)cnv->data; | |
820 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
821 |
6302 | 822 /* kill signals */ |
823 detach_signals(c); | |
824 /* zero out data */ | |
825 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); | |
826 g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
827 |
6302 | 828 cnv = cnv->next; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
829 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
830 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
831 return TRUE; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
832 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
833 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
834 static GaimGtkPluginUiInfo ui_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
835 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
836 get_config_frame |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
837 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
838 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
839 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
840 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
841 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
842 GAIM_PLUGIN_STANDARD, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
843 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
844 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
845 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
846 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
847 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
848 NOTIFY_PLUGIN_ID, /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
849 N_("Message Notification"), /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
850 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
851 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
852 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
|
853 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
854 N_("Provides a variety of ways of notifying you of unread messages."), |
6302 | 855 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu", |
856 /**< author */ | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
857 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
858 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
859 plugin_load, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
860 plugin_unload, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
861 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
862 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
863 &ui_info, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
864 NULL /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
865 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
866 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
867 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
868 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
869 { |
6302 | 870 gaim_prefs_add_none("/plugins/gtk"); |
871 gaim_prefs_add_none("/plugins/gtk/X11"); | |
872 gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
873 | |
6464 | 874 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
875 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
876 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
6302 | 877 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
878 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
879 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
880 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
881 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
882 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
883 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
6464 | 884 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
885 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
886 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
887 |
6063 | 888 GAIM_INIT_PLUGIN(notify, init_plugin, info) |