Mon, 15 Sep 2003 21:57:37 +0000
[gaim-migrate @ 7397]
pt_BR.po update
| 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
35fdae8a156f
[gaim-migrate @ 6821]
Mark Doliner <markdoliner@pidgin.im>
parents:
6302
diff
changeset
|
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
3c7ba18e32f1
[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
3c7ba18e32f1
[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
e92b66ee5518
[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
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
60 | #include "signals.h" |
|
4202
8b92de3b1c07
[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
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
98 | static GaimPlugin *my_plugin = NULL; |
|
a0e0bacaa196
[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
d3c2fdaf4821
[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
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
140 | |
|
cf899ee07d1d
[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
3c7ba18e32f1
[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 | 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 | 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
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
202 | static gboolean |
| 6620 | 203 | chat_recv_im(GaimAccount *account, char **who, char **text, int id, void *m) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
204 | { |
| 6620 | 205 | GaimConversation *conv = gaim_find_chat( |
| 206 | gaim_account_get_connection(account), | |
| 207 | id); | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
208 | if (conv) |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
209 | notify(conv); |
| 3710 | 210 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
211 | return FALSE; |
| 3710 | 212 | } |
| 213 | ||
| 6620 | 214 | static void chat_sent_im(GaimAccount *account, char *text, int id, void *m) { |
| 215 | GaimConversation *conv = gaim_find_chat( | |
| 216 | gaim_account_get_connection(account), | |
| 217 | id); | |
| 218 | ||
| 219 | if (conv) | |
| 220 | unnotify(conv); | |
| 3710 | 221 | } |
| 222 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
223 | static gboolean |
| 6620 | 224 | im_recv_im(GaimAccount *account, char **who, char **what, int *flags, void *m) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
225 | { |
| 6620 | 226 | GaimConversation *conv = gaim_find_conversation_with_account(*who, account); |
| 227 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
228 | if (conv) |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
229 | notify(conv); |
| 3710 | 230 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
231 | return FALSE; |
| 3710 | 232 | } |
| 233 | ||
| 6620 | 234 | static void im_sent_im(GaimAccount *account, char *who, void *m) { |
| 235 | GaimConversation *conv = gaim_find_conversation_with_account(who, account); | |
| 236 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
237 | if (conv) |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
238 | unnotify(conv); |
| 3710 | 239 | } |
| 3392 | 240 | |
| 6302 | 241 | static int attach_signals(GaimConversation *c) { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
242 | GaimGtkConversation *gtkconv; |
|
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
243 | GaimGtkWindow *gtkwin; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
244 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
245 | gtkconv = GAIM_GTK_CONVERSATION(c); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
246 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
247 | |
| 6302 | 248 | if (notify_opts & OPT_NOTIFY_FOCUS) { |
| 249 | g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(unnotify_cb), NULL); | |
| 3374 | 250 | } |
| 3710 | 251 | |
| 6302 | 252 | if (notify_opts & OPT_NOTIFY_CLICK) { |
| 253 | g_signal_connect(G_OBJECT(gtkwin->window), "button_press_event", G_CALLBACK(unnotify_cb), NULL); | |
| 254 | g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button_press_event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
| 255 | g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "button_press_event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
| 3374 | 256 | } |
| 257 | ||
| 6302 | 258 | if (notify_opts & OPT_NOTIFY_TYPE) { |
| 259 | g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkwin->window)); | |
| 191 | 260 | } |
| 4035 | 261 | |
| 3428 | 262 | return 0; |
| 191 | 263 | } |
| 264 | ||
| 6302 | 265 | static void detach_signals(GaimConversation *c) { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
266 | GaimGtkConversation *gtkconv; |
|
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
267 | GaimGtkWindow *gtkwin; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
268 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
269 | gtkconv = GAIM_GTK_CONVERSATION(c); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
270 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
271 | |
| 6302 | 272 | if (notify_opts & OPT_NOTIFY_FOCUS) { |
| 273 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), unnotify_cb, NULL); | |
| 4203 | 274 | } |
| 275 | ||
| 6302 | 276 | if (notify_opts & OPT_NOTIFY_CLICK) { |
| 277 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkwin->window), unnotify_cb, NULL); | |
| 278 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), unnotify_cb, gtkwin->window); | |
| 279 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), unnotify_cb, gtkwin->window); | |
| 280 | } | |
| 281 | ||
| 282 | if (notify_opts & OPT_NOTIFY_TYPE) { | |
| 283 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry), unnotify_cb, gtkwin->window); | |
| 4203 | 284 | } |
| 285 | } | |
| 286 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
287 | static void new_conv(GaimConversation *c) |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
288 | { |
| 6302 | 289 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
| 3710 | 290 | |
| 6302 | 291 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); |
| 292 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
| 293 | ||
| 294 | if (c && (notify_opts & OPT_TYPE_IM)) | |
| 3710 | 295 | attach_signals(c); |
| 296 | } | |
| 297 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
298 | static void chat_join(GaimConversation *c) { |
| 6302 | 299 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
| 3710 | 300 | |
| 6302 | 301 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); |
| 302 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
| 303 | ||
| 304 | if (c && (notify_opts & OPT_TYPE_CHAT)) | |
| 3710 | 305 | attach_signals(c); |
| 306 | } | |
| 307 | ||
| 6302 | 308 | static void string_add(GtkWidget *widget) { |
| 309 | GtkWindow *win = GTK_WINDOW(widget); | |
| 310 | gchar newtitle[256]; | |
| 311 | const gchar *curtitle = gtk_window_get_title(win); | |
| 312 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 313 | ||
| 314 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "string_add(): opts=0x%04x\n", opts); | |
| 315 | ||
| 316 | if (opts & OPT_METHOD_STRING) | |
| 317 | return; | |
| 3374 | 318 | |
| 6302 | 319 | if (!strstr(curtitle, title_string)) { |
| 320 | if (opts & OPT_METHOD_COUNT) { | |
| 321 | char *p = strchr(curtitle, ']'); | |
| 322 | int len1; | |
| 323 | if (!p) | |
| 324 | return; | |
| 325 | len1 = p-curtitle+2; | |
| 326 | memcpy(newtitle, curtitle, len1); | |
| 327 | strncpy(newtitle+len1, title_string, sizeof(newtitle)-len1); | |
| 328 | strncpy(newtitle+len1+strlen(title_string), curtitle+len1, | |
| 329 | sizeof(newtitle)-len1-strlen(title_string)); | |
| 330 | } else if (opts & OPT_METHOD_QUOTE) { | |
| 331 | g_snprintf(newtitle, sizeof(newtitle), "\"%s%s", title_string, curtitle+1); | |
| 332 | } else { | |
| 333 | g_snprintf(newtitle, sizeof(newtitle), "%s%s", title_string, curtitle); | |
| 334 | } | |
| 335 | gtk_window_set_title(win, newtitle); | |
| 336 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "added string to window title\n"); | |
| 337 | } | |
| 338 | ||
| 339 | opts |= OPT_METHOD_STRING; | |
| 340 | g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
| 3374 | 341 | } |
| 342 | ||
| 6302 | 343 | static void string_remove(GtkWidget *widget) { |
| 344 | GtkWindow *win = GTK_WINDOW(widget); | |
| 345 | gchar newtitle[256]; | |
| 346 | const gchar *curtitle; | |
| 347 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 3392 | 348 | |
| 6302 | 349 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "string_remove(): opts=0x%04x\n", opts); |
| 4035 | 350 | |
| 6302 | 351 | if (!(opts & OPT_METHOD_STRING)) |
| 352 | return; | |
| 353 | ||
| 354 | curtitle = gtk_window_get_title(win); | |
| 3392 | 355 | |
| 6302 | 356 | if (strstr(curtitle, title_string)) { |
| 357 | if (opts & OPT_METHOD_COUNT) { | |
| 358 | char *p = strchr(curtitle, ']'); | |
| 359 | int len1; | |
| 360 | if (!p) | |
| 361 | return; | |
| 362 | len1 = p-curtitle+2; | |
| 363 | memcpy(newtitle, curtitle, len1); | |
| 364 | strncpy(newtitle+len1, curtitle+len1+strlen(title_string), sizeof(newtitle)-len1); | |
| 365 | } else if (opts & OPT_METHOD_QUOTE) { | |
| 366 | g_snprintf(newtitle, sizeof(newtitle), "\"%s", curtitle+strlen(title_string)+1); | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
367 | } else |
| 6302 | 368 | strncpy(newtitle, curtitle+strlen(title_string), sizeof(newtitle)); |
| 369 | } | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
370 | |
| 6302 | 371 | gtk_window_set_title(win, newtitle); |
| 372 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed string from window title (title now %s)\n", newtitle); | |
| 3374 | 373 | } |
| 374 | ||
| 6302 | 375 | static void count_add(GtkWidget *widget) { |
| 4035 | 376 | GtkWindow *win = GTK_WINDOW(widget); |
| 6302 | 377 | char newtitle[256]; |
| 378 | const gchar *curtitle; | |
| 379 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 380 | gint curcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTRCNT)); | |
| 4035 | 381 | |
| 6302 | 382 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "count_add(): opts=0x%04x\n", opts); |
| 383 | ||
| 384 | if (curcount>0 && (opts & OPT_METHOD_COUNT)) | |
| 385 | count_remove(widget); | |
| 5021 | 386 | |
| 6302 | 387 | curtitle = gtk_window_get_title(win); |
| 388 | if (opts & OPT_METHOD_QUOTE) | |
| 389 | g_snprintf(newtitle, sizeof(newtitle), "\"[%d] %s", curcount, curtitle+1); | |
| 390 | else | |
| 391 | g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", curcount, curtitle); | |
| 392 | gtk_window_set_title(win, newtitle); | |
| 393 | ||
| 394 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "added count of %d to window\n", curcount); | |
| 395 | ||
| 396 | opts |= OPT_METHOD_COUNT; | |
| 397 | g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
| 4035 | 398 | } |
| 399 | ||
| 6302 | 400 | static void count_remove(GtkWidget *widget) { |
| 3392 | 401 | GtkWindow *win = GTK_WINDOW(widget); |
| 6302 | 402 | char newtitle[256], *p; |
| 403 | const gchar *curtitle; | |
| 404 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 405 | ||
| 406 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "count_remove(): opts=0x%04x\n", opts); | |
| 407 | ||
| 408 | if (!(opts & OPT_METHOD_COUNT)) | |
| 409 | return; | |
| 410 | ||
| 411 | curtitle = gtk_window_get_title(win); | |
| 3392 | 412 | |
| 6302 | 413 | p = strchr(curtitle, ']'); |
| 414 | ||
| 415 | if (p) { | |
| 416 | if (opts & OPT_METHOD_QUOTE) | |
| 417 | g_snprintf(newtitle, sizeof(newtitle), "\"%s", p+2); | |
| 418 | else | |
| 419 | g_snprintf(newtitle, sizeof(newtitle), p+2); | |
| 420 | gtk_window_set_title(win, newtitle); | |
| 421 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed count from title (title now %s)\n", newtitle); | |
| 3392 | 422 | } |
| 6302 | 423 | |
| 424 | opts &= ~OPT_METHOD_COUNT; | |
| 425 | g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
| 3392 | 426 | } |
| 427 | ||
| 6302 | 428 | static void quote_add(GtkWidget *widget) { |
| 4035 | 429 | GtkWindow *win = GTK_WINDOW(widget); |
| 6302 | 430 | char newtitle[256]; |
| 431 | const gchar *curtitle = gtk_window_get_title(win); | |
| 432 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 433 | ||
| 434 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quote_add(): opts=0x%04x\n", opts); | |
| 4035 | 435 | |
| 6302 | 436 | if (opts & OPT_METHOD_QUOTE) |
| 437 | return; | |
| 438 | ||
| 439 | if (*curtitle != '\"') { | |
| 440 | g_snprintf(newtitle, sizeof(newtitle), "\"%s\"", curtitle); | |
| 441 | gtk_window_set_title(win, newtitle); | |
| 442 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quoted title\n"); | |
| 4035 | 443 | } |
| 6302 | 444 | |
| 445 | opts |= OPT_METHOD_QUOTE; | |
| 446 | g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
| 4035 | 447 | } |
| 448 | ||
| 6302 | 449 | static void quote_remove(GtkWidget *widget) { |
| 3374 | 450 | GtkWindow *win = GTK_WINDOW(widget); |
| 6302 | 451 | char newtitle[512]; |
| 452 | const gchar *curtitle = gtk_window_get_title(win); | |
| 453 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), GDATASTR)); | |
| 454 | ||
| 455 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "quote_remove(): opts=0x%04x\n", opts); | |
| 191 | 456 | |
| 6302 | 457 | if (!(opts & OPT_METHOD_QUOTE)) |
| 458 | return; | |
| 459 | ||
| 460 | if (*curtitle == '\"' && strlen(curtitle)-2<sizeof(newtitle)) { | |
| 461 | memcpy(newtitle, curtitle+1, strlen(curtitle)-2); | |
| 462 | newtitle[strlen(curtitle)-2] = 0; | |
| 463 | gtk_window_set_title(win, newtitle); | |
| 464 | gaim_debug(GAIM_DEBUG_INFO, "notify.c", "removed quotes from title (title now %s)\n", newtitle); | |
| 465 | } | |
| 466 | ||
| 467 | opts &= ~OPT_METHOD_QUOTE; | |
| 468 | g_object_set_data(G_OBJECT(widget), GDATASTR, GINT_TO_POINTER(opts)); | |
| 3374 | 469 | } |
| 470 | ||
| 6302 | 471 | static void urgent_add(GaimConversation *c) { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
472 | GaimGtkWindow *gtkwin; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
473 | XWMHints *hints; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
474 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
475 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
476 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
477 | hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); |
| 4035 | 478 | hints->flags |= XUrgencyHint; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
479 | XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
| 4218 | 480 | XFree(hints); |
| 4035 | 481 | } |
| 482 | ||
| 6302 | 483 | static void urgent_remove(GaimConversation *c) { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
484 | GaimGtkConversation *gtkconv; |
| 6302 | 485 | const char *convo_placement = gaim_prefs_get_string("/core/conversations/placement"); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
486 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
487 | gtkconv = GAIM_GTK_CONVERSATION(c); |
| 4203 | 488 | |
| 6302 | 489 | if (!strcmp(convo_placement, "new")) { |
| 490 | GaimGtkWindow *gtkwin; | |
| 491 | XWMHints *hints; | |
| 492 | ||
| 493 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
| 494 | hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
| 495 | ||
| 496 | if (hints->flags & XUrgencyHint) { | |
| 497 | hints->flags &= ~XUrgencyHint; | |
| 498 | XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
| 499 | } | |
| 500 | XFree(hints); | |
| 501 | } else { | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
502 | if (gaim_conversation_get_type(c) == GAIM_CONV_CHAT) { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
503 | GaimConversation *c = (GaimConversation *)gaim_get_chats()->data; |
|
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
504 | GaimGtkWindow *gtkwin; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
505 | GdkWindow *win; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
506 | XWMHints *hints; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
507 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
508 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
509 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
510 | win = gtkwin->window->window; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
511 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
512 | hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
| 4203 | 513 | if (hints->flags & XUrgencyHint) { |
| 514 | hints->flags &= ~XUrgencyHint; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
515 | XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
| 4203 | 516 | } |
| 4218 | 517 | XFree(hints); |
| 4203 | 518 | } else { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
519 | GaimConversation *c; |
|
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
520 | GaimGtkWindow *gtkwin; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
521 | GdkWindow *win; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
522 | XWMHints *hints; |
| 3374 | 523 | |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
524 | c = (GaimConversation *)gaim_get_ims()->data; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
525 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
526 | win = gtkwin->window->window; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
527 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
528 | hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
| 4203 | 529 | if (hints->flags & XUrgencyHint) { |
| 530 | hints->flags &= ~XUrgencyHint; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
531 | XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); |
| 4203 | 532 | } |
| 4218 | 533 | XFree(hints); |
| 4203 | 534 | } |
| 4035 | 535 | } |
| 3374 | 536 | } |
| 537 | ||
| 6302 | 538 | static void save_notify_prefs() { |
| 6464 | 539 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_im", notify_opts & OPT_TYPE_IM); |
| 540 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_chat", notify_opts & OPT_TYPE_CHAT); | |
| 541 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/type_focused", notify_opts & OPT_NOTIFY_IN_FOCUS); | |
| 6302 | 542 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_focus", notify_opts & OPT_NOTIFY_FOCUS); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
543 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_click", notify_opts & OPT_NOTIFY_CLICK); |
| 6302 | 544 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/notify_type", notify_opts & OPT_NOTIFY_TYPE); |
| 545 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_string", notify_opts & OPT_METHOD_STRING); | |
| 546 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_quote", notify_opts & OPT_METHOD_QUOTE); | |
| 547 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_urgent", notify_opts & OPT_METHOD_URGENT); | |
| 548 | gaim_prefs_set_bool("/plugins/gtk/X11/notify/method_count", notify_opts & OPT_METHOD_COUNT); | |
| 3374 | 549 | |
| 6302 | 550 | gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", title_string); |
| 3374 | 551 | } |
| 552 | ||
| 6302 | 553 | static void load_notify_prefs() { |
| 554 | notify_opts = 0; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
555 | |
| 6464 | 556 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im") ? OPT_TYPE_IM : 0); |
| 557 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat") ? OPT_TYPE_CHAT : 0); | |
| 558 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ? OPT_NOTIFY_IN_FOCUS : 0); | |
| 6302 | 559 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus") ? OPT_NOTIFY_FOCUS : 0); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
560 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click") ? OPT_NOTIFY_CLICK : 0); |
| 6302 | 561 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type") ? OPT_NOTIFY_TYPE : 0); |
| 562 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string") ? OPT_METHOD_STRING : 0); | |
| 563 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_quote") ? OPT_METHOD_QUOTE : 0); | |
| 564 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent") ? OPT_METHOD_URGENT : 0); | |
| 565 | notify_opts |= (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count") ? OPT_METHOD_COUNT : 0); | |
| 3374 | 566 | |
| 6302 | 567 | strncpy(title_string, gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), TITLE_STR_BUFSIZE); |
| 3374 | 568 | } |
| 569 | ||
| 6302 | 570 | static void options_toggle_cb(GtkWidget *w, gpointer data) { |
| 4035 | 571 | gint option = GPOINTER_TO_INT(data); |
| 3374 | 572 | |
| 6302 | 573 | notify_opts ^= option; |
| 574 | ||
| 575 | /* save prefs and re-notify the windows */ | |
| 576 | save_notify_prefs(); | |
| 577 | apply_options(option); | |
| 578 | } | |
| 579 | ||
| 580 | static gboolean options_settitle_cb(GtkWidget *w, GdkEventFocus *evt, GtkWidget *entry) { | |
| 581 | GList *cnv = gaim_get_conversations(); | |
| 582 | ||
| 583 | /* first we have to kill all the old strings */ | |
| 584 | while (cnv) { | |
| 585 | GaimConversation *c = (GaimConversation *)cnv->data; | |
| 586 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
| 587 | string_remove(gtkwin->window); | |
| 588 | cnv = cnv->next; | |
| 3374 | 589 | } |
| 6302 | 590 | |
| 591 | g_snprintf(title_string, sizeof(title_string), gtk_entry_get_text(GTK_ENTRY(entry))); | |
| 592 | ||
| 593 | /* save prefs and re-notify the windows */ | |
| 594 | save_notify_prefs(); | |
| 595 | apply_options(OPT_METHOD_STRING_CHNG); | |
| 596 | ||
| 597 | return FALSE; | |
| 598 | } | |
| 599 | ||
| 600 | static void options_toggle_title_cb(GtkWidget *w, GtkWidget *entry) { | |
| 601 | notify_opts ^= OPT_METHOD_STRING; | |
| 602 | ||
| 603 | if (notify_opts & OPT_METHOD_STRING) | |
| 604 | gtk_widget_set_sensitive(entry, TRUE); | |
| 605 | else | |
| 606 | gtk_widget_set_sensitive(entry, FALSE); | |
| 3710 | 607 | |
| 608 | save_notify_prefs(); | |
| 6302 | 609 | apply_options(OPT_METHOD_STRING); |
| 3374 | 610 | } |
| 611 | ||
| 6302 | 612 | static void apply_options(int opt_chng) { |
|
4376
88f8faf7cb61
[gaim-migrate @ 4642]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
613 | GList *cnv = gaim_get_conversations(); |
| 4035 | 614 | |
| 6302 | 615 | /* option-setting handlers should have cleared out all window notifications */ |
| 616 | ||
| 4035 | 617 | while (cnv) { |
| 6302 | 618 | GaimConversation *c = (GaimConversation *)cnv->data; |
| 619 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
| 620 | guint opts = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), GDATASTR)); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
621 | |
| 6302 | 622 | /* kill signals */ |
| 4203 | 623 | detach_signals(c); |
| 4035 | 624 | |
| 6302 | 625 | /* |
| 626 | * do a full notify if the option that changed was an OPT_TYPE_* | |
| 627 | * either notify if it was enabled, or unnotify if it was disabled | |
| 628 | */ | |
| 629 | if (opt_chng==OPT_TYPE_IM || opt_chng==OPT_TYPE_CHAT) { | |
| 630 | if ((gaim_conversation_get_type(c)==GAIM_CONV_IM && (notify_opts & OPT_TYPE_IM)) || | |
| 631 | (gaim_conversation_get_type(c)==GAIM_CONV_CHAT && (notify_opts & OPT_TYPE_CHAT))) { | |
| 632 | Window focus_return; | |
| 633 | int revert_to_return; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
634 | |
| 6302 | 635 | XGetInputFocus(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
| 636 | &focus_return, &revert_to_return); | |
| 637 | if ((notify_opts & OPT_NOTIFY_IN_FOCUS) || | |
| 638 | focus_return != GDK_WINDOW_XWINDOW(gtkwin->window->window)) { | |
| 639 | if (notify_opts & OPT_METHOD_STRING) | |
| 640 | string_add(gtkwin->window); | |
| 641 | if (notify_opts & OPT_METHOD_COUNT) | |
| 642 | count_add(gtkwin->window); | |
| 643 | if (notify_opts & OPT_METHOD_QUOTE) | |
| 644 | quote_add(gtkwin->window); | |
| 645 | if (notify_opts & OPT_METHOD_URGENT) | |
| 646 | urgent_add(c); | |
| 647 | } | |
| 648 | } else { | |
|
6735
a8c70aeddbe7
[gaim-migrate @ 7267]
Mark Doliner <markdoliner@pidgin.im>
parents:
6620
diff
changeset
|
649 | /* don't simply call unnotify(), because that will kill the msg counter */ |
| 6302 | 650 | urgent_remove(c); |
| 651 | quote_remove(gtkwin->window); | |
| 652 | count_remove(gtkwin->window); | |
| 653 | string_remove(gtkwin->window); | |
| 654 | } | |
| 655 | } else if (opts & STATE_IS_NOTIFIED) { | |
|
6735
a8c70aeddbe7
[gaim-migrate @ 7267]
Mark Doliner <markdoliner@pidgin.im>
parents:
6620
diff
changeset
|
656 | /* add/remove the status that was changed */ |
| 6302 | 657 | switch(opt_chng) { |
| 658 | case OPT_METHOD_COUNT: | |
| 659 | if (notify_opts & OPT_METHOD_COUNT) | |
| 660 | count_add(gtkwin->window); | |
| 661 | else | |
| 662 | count_remove(gtkwin->window); | |
| 663 | break; | |
| 664 | case OPT_METHOD_QUOTE: | |
| 665 | if (notify_opts & OPT_METHOD_QUOTE) | |
| 666 | quote_add(gtkwin->window); | |
| 667 | else | |
| 668 | quote_remove(gtkwin->window); | |
| 669 | break; | |
| 670 | case OPT_METHOD_STRING: | |
| 671 | if (notify_opts & OPT_METHOD_STRING) | |
| 672 | string_add(gtkwin->window); | |
| 673 | else | |
| 674 | string_remove(gtkwin->window); | |
| 675 | break; | |
| 676 | case OPT_METHOD_URGENT: | |
| 677 | if (notify_opts & OPT_METHOD_URGENT) | |
| 678 | urgent_add(c); | |
| 679 | else | |
| 680 | urgent_remove(c); | |
| 681 | break; | |
| 682 | case OPT_METHOD_STRING_CHNG: | |
| 683 | string_add(gtkwin->window); | |
| 684 | break; | |
| 685 | } | |
| 686 | } | |
| 4203 | 687 | |
| 4035 | 688 | /* attach new unnotification signals */ |
| 6302 | 689 | attach_signals(c); |
| 4035 | 690 | |
| 6302 | 691 | cnv = cnv->next; |
| 4035 | 692 | } |
| 693 | } | |
| 694 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
695 | static GtkWidget * |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
696 | get_config_frame(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
697 | { |
| 3565 | 698 | GtkWidget *ret; |
| 6302 | 699 | GtkWidget *frame; |
| 3565 | 700 | GtkWidget *vbox, *hbox; |
| 6302 | 701 | GtkWidget *toggle, *entry; |
| 702 | ||
| 3565 | 703 | ret = gtk_vbox_new(FALSE, 18); |
| 6302 | 704 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 705 | |
| 6302 | 706 | /*---------- "Notify For" ----------*/ |
| 707 | frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
| 708 | vbox = gtk_vbox_new(FALSE, 5); | |
| 709 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 710 | ||
| 3710 | 711 | toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 712 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6302 | 713 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_TYPE_IM); |
| 714 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_TYPE_IM)); | |
| 3710 | 715 | |
| 716 | toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); | |
| 717 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6302 | 718 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_TYPE_CHAT); |
| 719 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_TYPE_CHAT)); | |
| 3710 | 720 | |
| 6302 | 721 | /*---------- "Notification Methods" ----------*/ |
| 722 | frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
| 723 | vbox = gtk_vbox_new(FALSE, 5); | |
| 724 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 725 | ||
| 3565 | 726 | hbox = gtk_hbox_new(FALSE, 18); |
| 727 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 6302 | 728 | toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 729 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_STRING); | |
| 3565 | 730 | gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6302 | 731 | entry = gtk_entry_new(); |
| 732 | gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 733 | gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 734 | gtk_widget_set_sensitive(GTK_WIDGET(entry), notify_opts & OPT_METHOD_STRING); | |
| 735 | gtk_entry_set_text(GTK_ENTRY(entry), title_string); | |
| 736 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_title_cb), entry); | |
| 737 | g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(options_settitle_cb), entry); | |
| 3374 | 738 | |
| 6302 | 739 | toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); |
| 740 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 741 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_QUOTE); | |
| 742 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_QUOTE)); | |
| 3374 | 743 | |
| 6302 | 744 | toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); |
| 745 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 746 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_URGENT); | |
| 747 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_URGENT)); | |
| 4035 | 748 | |
| 6302 | 749 | toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); |
| 750 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_METHOD_COUNT); | |
| 751 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 752 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_METHOD_COUNT)); | |
| 3710 | 753 | |
| 6302 | 754 | toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus")); |
| 755 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_IN_FOCUS); | |
| 756 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 757 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_IN_FOCUS)); | |
| 3392 | 758 | |
| 6302 | 759 | /*---------- "Notification Methods" ----------*/ |
| 760 | frame = gaim_gtk_make_frame(ret, _("Notification Removal")); | |
| 761 | vbox = gtk_vbox_new(FALSE, 5); | |
| 762 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 3374 | 763 | |
| 6302 | 764 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus")); |
| 765 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 766 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_FOCUS); | |
| 767 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_FOCUS)); | |
| 3710 | 768 | |
| 6302 | 769 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); |
| 770 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 771 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_CLICK); | |
| 772 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_CLICK)); | |
| 4035 | 773 | |
| 6302 | 774 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); |
| 775 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 776 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), notify_opts & OPT_NOTIFY_TYPE); | |
| 777 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options_toggle_cb), GINT_TO_POINTER(OPT_NOTIFY_TYPE)); | |
| 3565 | 778 | |
| 6302 | 779 | gtk_widget_show_all(ret); |
| 780 | return ret; | |
| 3374 | 781 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
782 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
783 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
784 | plugin_load(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
785 | { |
| 6302 | 786 | GList *cnv = gaim_get_conversations(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
787 | void *conv_handle = gaim_conversations_get_handle(); |
| 6302 | 788 | |
| 789 | my_plugin = plugin; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
790 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
791 | load_notify_prefs(); |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
792 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
793 | gaim_signal_connect(conv_handle, "received-im-msg", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
794 | plugin, GAIM_CALLBACK(im_recv_im), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
795 | gaim_signal_connect(conv_handle, "received-chat-msg", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
796 | plugin, GAIM_CALLBACK(chat_recv_im), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
797 | gaim_signal_connect(conv_handle, "sent-im-msg", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
798 | plugin, GAIM_CALLBACK(im_sent_im), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
799 | gaim_signal_connect(conv_handle, "sent-chat-msg", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
800 | plugin, GAIM_CALLBACK(chat_sent_im), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
801 | gaim_signal_connect(conv_handle, "conversation-created", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
802 | plugin, GAIM_CALLBACK(new_conv), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
803 | gaim_signal_connect(conv_handle, "chat-joined", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
804 | plugin, GAIM_CALLBACK(chat_join), NULL); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
805 | |
| 6302 | 806 | while (cnv) { |
| 807 | GaimConversation *c = (GaimConversation *)cnv->data; | |
| 808 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
| 809 | ||
| 810 | /* attach signals */ | |
| 811 | attach_signals(c); | |
| 812 | /* zero out data */ | |
| 813 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); | |
| 814 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
| 815 | ||
| 816 | cnv = cnv->next; | |
| 817 | } | |
| 818 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
819 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
820 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
821 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
822 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
823 | plugin_unload(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
824 | { |
| 6302 | 825 | GList *cnv = gaim_get_conversations(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
826 | |
| 6302 | 827 | while (cnv) { |
| 828 | GaimConversation *c = (GaimConversation *)cnv->data; | |
| 829 | GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
830 | |
| 6302 | 831 | /* kill signals */ |
| 832 | detach_signals(c); | |
| 833 | /* zero out data */ | |
| 834 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTR, GINT_TO_POINTER((guint)0)); | |
| 835 | g_object_set_data(G_OBJECT(gtkwin->window), GDATASTRCNT, GINT_TO_POINTER((guint)0)); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
836 | |
| 6302 | 837 | cnv = cnv->next; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
838 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
839 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
840 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
841 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
842 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
843 | static GaimGtkPluginUiInfo ui_info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
844 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
845 | get_config_frame |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
846 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
847 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
848 | static GaimPluginInfo info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
849 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
850 | 2, /**< api_version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
851 | GAIM_PLUGIN_STANDARD, /**< type */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
852 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
853 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
854 | NULL, /**< dependencies */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
855 | GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
856 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
857 | NOTIFY_PLUGIN_ID, /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
858 | N_("Message Notification"), /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
859 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
860 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
861 | N_("Provides a variety of ways of notifying you of unread messages."), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
862 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
863 | N_("Provides a variety of ways of notifying you of unread messages."), |
| 6302 | 864 | "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu", |
| 865 | /**< author */ | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
866 | GAIM_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
867 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
868 | plugin_load, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
869 | plugin_unload, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
870 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
871 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
872 | &ui_info, /**< ui_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
873 | NULL /**< extra_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
874 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
875 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
876 | static void |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
877 | init_plugin(GaimPlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
878 | { |
| 6302 | 879 | gaim_prefs_add_none("/plugins/gtk"); |
| 880 | gaim_prefs_add_none("/plugins/gtk/X11"); | |
| 881 | gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
| 882 | ||
| 6464 | 883 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
| 884 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
| 885 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
| 6302 | 886 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
| 887 | gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
| 888 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
| 889 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
| 890 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
| 891 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
| 892 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
| 6464 | 893 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
| 894 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
895 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
896 | |
| 6063 | 897 | GAIM_INIT_PLUGIN(notify, init_plugin, info) |