annotate plugins/notify.c @ 9010:54a0f8069f76

[gaim-migrate @ 9786] " This patch makes pressing enter in the entry box, or pressing Alt-F, actually do what you'd expect - perform the search - in the log and system log viewer." --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 22 May 2004 16:38:54 +0000
parents 8f838ae3e710
children b0b544e0f246
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
1 /*
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
2 * Gaim buddy notification plugin.
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
3 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
4 * Copyright (C) 2000-2001, Eric Warmenhoven (original code)
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
5 * Copyright (C) 2002, Etan Reisner <deryni@eden.rutgers.edu> (rewritten code)
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
6 * Copyright (C) 2003, Christian Hammond (update for changed API)
6322
dd2be7cd66df [gaim-migrate @ 6821]
Mark Doliner <mark@kingant.net>
parents: 6302
diff changeset
7 * Copyright (C) 2003, Brian Tarricone <bjt23@cornell.edu> (mostly rewritten)
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
8 * Copyright (C) 2003, Mark Doliner (minor cleanup)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
9 * Copyright (C) 2003, Etan Reisner (largely rewritten again)
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
10 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
11 * This program is free software; you can redistribute it and/or modify
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
12 * it under the terms of the GNU General Public License as published by
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
14 * (at your option) any later version.
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
15 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
16 * This program is distributed in the hope that it will be useful,
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
19 * GNU General Public License for more details.
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
20 *
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
21 * You should have received a copy of the GNU General Public License
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
22 * along with this program; if not, write to the Free Software
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
24 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
25 */
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
26
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
27 /*
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
28 * From Etan, 2002:
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
29 * -Added config dialog
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
30 * -Added control over notification method
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
31 * -Added control over when to release notification
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
32 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
33 * -Added option to get notification for chats also
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
34 * -Cleaned up code
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
35 * -Added option to notify on click as it's own option
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
36 * rather then as what happens when on focus isn't clicked
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
37 * -Added apply button to change the denotification methods for
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
38 * open conversation windows
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
39 * -Fixed apply to conversations, count now keeps count across applies
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
40 * -Fixed(?) memory leak, and in the process fixed some stupidities
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
41 * -Hit enter when done editing the title string entry box to save it
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
42 *
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
43 * Thanks to Carles Pina i Estany <carles@pinux.info>
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
44 * for count of new messages option
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
45 *
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
46 * From Brian, 20 July 2003:
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
47 * -Use new xml prefs
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
48 * -Better handling of notification states tracking
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
49 * -Better pref change handling
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
50 * -Fixed a possible memleak and possible crash (rare)
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
51 * -Use gtk_window_get_title() rather than gtkwin->title
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
52 * -Other random fixes and cleanups
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
53 *
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
54 * Etan again, 12 August 2003:
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
55 * -Better use of the new xml prefs
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
56 * -Removed all bitmask stuff
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
57 * -Even better pref change handling
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
58 * -Removed unnecessary functions
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
59 * -Reworking of notification/unnotification stuff
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
60 * -Header file include cleanup
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
61 * -General code cleanup
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
62 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
63
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6322
diff changeset
64 #include "gtkinternal.h"
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
65
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
66 #include "conversation.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
67 #include "debug.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
68 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
69 #include "signals.h"
4202
59751fe608c5 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4165
diff changeset
70
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
71 #include "gtkconv.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
72 #include "gtkplugin.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
73 #include "gtkutils.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
74
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
75 #include <X11/Xatom.h>
3385
7931eb8bba19 [gaim-migrate @ 3404]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
76 #include <X11/Xlib.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
77 #include <X11/Xutil.h>
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
78
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
79 #define NOTIFY_PLUGIN_ID "gtk-x11-notify"
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
80
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
81 static GaimPlugin *my_plugin = NULL;
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
82
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
83 /* notification set/unset */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
84 static int notify(GaimConversation *conv, gboolean increment);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
85 static gboolean unnotify(GaimConversation *conv, gboolean reset);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
86 static int unnotify_cb(GtkWidget *widget, GaimConversation *conv);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
87 static void renotify(GaimConvWindow *gaimwin);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
88
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
89 /* gtk widget callbacks for prefs panel */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
90 static void type_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
91 static void method_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
92 static void notify_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
93 static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
94 static void apply_method();
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
95 static void apply_notify();
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
97 /* string function */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
98 static void handle_string(GtkWidget *widget);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
99
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
100 /* count function */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
101 static void handle_count(GtkWidget *widget);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
102
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
103 /* urgent function */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
104 static void handle_urgent(GtkWidget *widget, gboolean add);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
105
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
106 /****************************************/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
107 /* Begin doing stuff below this line... */
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
108 /****************************************/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
109
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
110 static int
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
111 notify(GaimConversation *conv, gboolean increment)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
112 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
113 GaimConvWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
114 GaimGtkWindow *gtkwin = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
115 /*
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
116 Window focus_return;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
117 */
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
118 gint count;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
119 gboolean has_focus;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
120
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
121 if (conv == NULL)
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
122 return 0;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
123
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
124 /* We want to remove the notifications, but not reset the counter */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
125 unnotify(conv, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
126
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
127 gaimwin = gaim_conversation_get_window(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
128 gtkwin = GAIM_GTK_WINDOW(gaimwin);
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
129
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
130 /* If we aren't doing notifications for this type of conversation, return */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
131 if (((gaim_conversation_get_type(conv) == GAIM_CONV_IM) &&
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
132 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) ||
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
133 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) &&
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
134 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")))
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
135 return 0;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
136
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
137 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
138
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
139 /* TODO need to test these different levels of having focus
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
140 * only still need to test the window has focus, but tab doesn't one */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
141 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ||
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
142 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) ||
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
143 !has_focus) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
144 if (increment) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
145 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
146 count++;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
147 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
148
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
149 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
150 count++;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
151 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
152 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
153
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
154 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"))
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
155 handle_count(gtkwin->window);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
156 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"))
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
157 handle_string(gtkwin->window);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
158 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent"))
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
159 handle_urgent(gtkwin->window, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
160 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
161
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
162 return 0;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
163 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
164
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
165 static gboolean
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
166 unnotify(GaimConversation *conv, gboolean reset)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
167 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
168 GaimConversation *active_conv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
169 GaimGtkWindow *gtkwin = NULL;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
170 GaimConvWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
171 gint count;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
172
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
173 if (conv == NULL)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
174 return FALSE;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
175
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
176 gaimwin = gaim_conversation_get_window(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
177 gtkwin = GAIM_GTK_WINDOW(gaimwin);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
178 active_conv = gaim_conv_window_get_active_conversation(gaimwin);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
179
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
180 /* This should mean that there is no notification on the window */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
181 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
182 if (count == 0)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
183 return FALSE;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
184
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
185 /* reset the conversation window title */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
186 gaim_conversation_autoset_title(active_conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
187
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
188 if (reset) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
189 int count2;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
190 /* There is no point in removing the urgent wm_hint if we are just going
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
191 * to add it back again in a second */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
192 handle_urgent(gtkwin->window, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
193 count2 = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
194 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count2-count));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
195 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
196 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
197
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
198 renotify(gaimwin);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
199
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
200 return TRUE;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
201 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
202
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
203 static int
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
204 unnotify_cb(GtkWidget *widget, GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
205 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
206 GaimConversation *c = g_object_get_data(G_OBJECT(widget), "notify-conversation");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
207
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
208 unnotify(c, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
209
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
210 return 0;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
211 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
212
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
213 static void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
214 renotify(GaimConvWindow *gaimwin)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
215 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
216 GList *convs = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
217
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
218
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
219 for (convs = gaim_conv_window_get_conversations(gaimwin);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
220 convs != NULL; convs = convs->next) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
221 GaimGtkWindow *gtkwin = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
222 int count;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
223
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
224 gtkwin = GAIM_GTK_WINDOW(gaimwin);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
225 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message_count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
226 if (count != 0) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
227 notify((GaimConversation *)convs->data, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
228 return;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
229 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
230 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
231 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
232
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
233 static gboolean
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
234 chat_recv_im(GaimAccount *account, char *who, char *text, int id, void *m)
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
235 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
236 GaimConversation *conv = gaim_find_chat(gaim_account_get_connection(account),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
237 id);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
238
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
239 notify(conv, TRUE);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
240
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
241 return FALSE;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
242 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
243
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
244 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
245 chat_sent_im(GaimAccount *account, char *text, int id, void *m)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
246 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
247 GaimConversation *conv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
248
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
249 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
250 conv = gaim_find_chat(gaim_account_get_connection(account), id);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
251 unnotify(conv, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
252 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
253 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
254
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
255 static gboolean
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
256 im_recv_im(GaimAccount *account, char *who, char *what, int flags, void *m)
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
257 {
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
258 GaimConversation *conv = gaim_find_conversation_with_account(who, account);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
259
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
260 notify(conv, TRUE);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
261
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
262 return FALSE;
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
263 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
264
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
265 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
266 im_sent_im(GaimAccount *account, char *who, void *m) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
267 GaimConversation *conv = NULL;
6620
7230e5920911 [gaim-migrate @ 7144]
Ethan Blanton <elb@pidgin.im>
parents: 6485
diff changeset
268
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
269 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
270 conv = gaim_find_conversation_with_account(who, account);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
271 unnotify(conv, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
272 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
273 }
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
274
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
275 static int
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
276 attach_signals(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
277 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
278 /* TODO I can't seem to get passing a GaimConversation to a callback to work
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
279 * correctly, so in the interest of not g_object_set_data'ing on multiple
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
280 * widgets, I'm going to just _set_data on ->entry and _connect_swapped the
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
281 * other signals, if I ever get passing the GaimConversation to work I'll
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
282 * stop this ugliness */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
283 GaimGtkConversation *gtkconv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
284 GaimGtkWindow *gtkwin = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
285 GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
286 guint id;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
287
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
288 gtkconv = GAIM_GTK_CONVERSATION(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
289 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
290
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
291 /*
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
292 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
293 id = g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(unnotify_cb), conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
294 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
295 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
296 */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
297
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
298 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
299 /* TODO I think this might crash when convs dragged in/out of windows.
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
300 * needs testing
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
301 id = g_signal_connect(G_OBJECT(gtkwin->window), "button-press-event", G_CALLBACK(unnotify_cb), conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
302 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
303 */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
304
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
305 /*
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
306 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
307 */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
308 id = g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkconv->entry));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
309 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
310
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
311 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", G_CALLBACK(unnotify_cb), conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
312 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
313 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
314
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
315 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
316 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(unnotify_cb), conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
317 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
318 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
319
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
320 g_object_set_data(G_OBJECT(gtkconv->entry), "notify-conversation", conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
321
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
322 gaim_conversation_set_data(conv, "notify-window-signals", window_ids);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
323 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
324 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
325
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
326 return 0;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
329 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
330 detach_signals(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
331 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
332 GaimGtkConversation *gtkconv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
333 GaimGtkWindow *gtkwin = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
334 GSList *ids = NULL;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
335
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
336 gtkconv = GAIM_GTK_CONVERSATION(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
337 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv));
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
338
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
339 ids = gaim_conversation_get_data(conv, "notify-window-signals");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
340 for (; ids != NULL; ids = ids->next)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
341 g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(ids->data));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
342
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
343 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
344 for (; ids != NULL; ids = ids->next)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
345 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(ids->data));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
346
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
347 ids = gaim_conversation_get_data(conv, "notify-entry-signals");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
348 for (; ids != NULL; ids = ids->next)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
349 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
350
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
351 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message_count", GINT_TO_POINTER(0));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
352
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
353 gaim_conversation_set_data(conv, "notify-window-signals", NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
354 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
355 gaim_conversation_set_data(conv, "notify-entry-signals", NULL);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
356 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
357
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
358 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
359 conv_created(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
360 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
361 GaimConvWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
362 GaimGtkWindow *gtkwin = NULL;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
363
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
364 gaimwin = gaim_conversation_get_window(conv);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
365
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
366 if (gaimwin == NULL)
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
367 return;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
368
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
369 gtkwin = GAIM_GTK_WINDOW(gaimwin);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
370
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
371 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
372
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
373 /* always attach the signals, notify() will take care of conversation type
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
374 * checking */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
375 attach_signals(conv);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
376 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
377
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
378 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
379 chat_join(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
380 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
381 GaimConvWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
382 GaimGtkWindow *gtkwin = NULL;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
383
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
384 gaimwin = gaim_conversation_get_window(conv);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
385
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
386 if (gaimwin == NULL)
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
387 return;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
388
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
389 gtkwin = GAIM_GTK_WINDOW(gaimwin);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
390
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
391 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
392
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
393 /* always attach the signals, notify() will take care of conversation type
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
394 * checking */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
395 attach_signals(conv);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
396 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
397
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
398 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
399 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
400 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
401 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
402 GaimConvWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
403 GaimGtkWindow *gtkwin = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
404 /*
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
405 gint count;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
406 */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
407 gaim_debug(GAIM_DEBUG_INFO, "notify", "conv_switch\n");
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
408
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
409 if (!gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
410 gaimwin = gaim_conversation_get_window(new_conv);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
411
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
412 if (gaimwin == NULL);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
413
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
414 gtkwin = GAIM_GTK_WINDOW(gaimwin);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
415
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
416 /* if we don't have notification on the window then we don't want to add
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
417 * it back */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
418 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")) != 0)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
419 notify(new_conv, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
420 } else
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
421 unnotify(new_conv, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
422 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
423 #endif
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
424
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
425 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
426 deleting_conv(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
427 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
428 detach_signals(conv);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
429 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
430
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
431 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
432 handle_string(GtkWidget *widget)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
433 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
434 GtkWindow *win = GTK_WINDOW(widget);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
435 gchar newtitle[256];
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
436
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
437 g_snprintf(newtitle, sizeof(newtitle), "%s%s",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
438 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
439 gtk_window_get_title(win));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
440 gtk_window_set_title(win, newtitle);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
441 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
442
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
443 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
444 handle_count(GtkWidget *widget)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
445 {
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
446 GtkWindow *win = GTK_WINDOW(widget);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
447 char newtitle[256];
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
448 gint count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(win), "notify-message-count"));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
449
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
450 g_snprintf(newtitle, sizeof(newtitle), "[%d]%s", count,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
451 gtk_window_get_title(win));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
452 gtk_window_set_title(win, newtitle);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
453 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
454
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
455 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
456 handle_urgent(GtkWidget *widget, gboolean add)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
457 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
458 XWMHints *hints;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
459
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
460 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
461 if (add)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
462 hints->flags |= XUrgencyHint;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
463 else
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
464 hints->flags &= ~XUrgencyHint;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
465 XSetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
466 XFree(hints);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
467 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
468
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
469 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
470 type_toggle_cb(GtkWidget *widget, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
471 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
472 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
473 gchar pref[256];
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
474
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
475 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
476
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
477 gaim_prefs_set_bool(pref, on);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
478 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
479
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
480 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
481 method_toggle_cb(GtkWidget *widget, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
482 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
483 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
484 gchar pref[256];
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
485
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
486 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
487
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
488 gaim_prefs_set_bool(pref, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
489
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
490 if (!strcmp(data, "method_string")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
491 GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
492 gtk_widget_set_sensitive(entry, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
493
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
494 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(entry)));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
495 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
496
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
497 apply_method();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
498 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
499
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
500 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
501 notify_toggle_cb(GtkWidget *widget, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
502 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
503 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
504 gchar pref[256];
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
505
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
506 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
507
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
508 gaim_prefs_set_bool(pref, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
509
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
510 apply_notify();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
511 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
512
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
513 static gboolean
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
514 options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
515 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
516 if (data == NULL)
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6977
diff changeset
517 return FALSE;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
518
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
519 if (!strcmp(data, "method_string")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
520 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(widget)));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
521 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
522
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
523 apply_method();
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
524
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
525 return FALSE;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
526 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
527
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
528 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
529 apply_method() {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
530 GList *convs = gaim_get_conversations();
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
531
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
532 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
533 GaimConversation *conv = (GaimConversation *)convs->data;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
534
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
535 /* remove notifications */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
536 if (unnotify(conv, FALSE))
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
537 /* reattach appropriate notifications */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
538 notify(conv, FALSE);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
539
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
540 convs = convs->next;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
541 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
542 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
543
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
544 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
545 apply_notify()
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
546 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
547 GList *convs = gaim_get_conversations();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
548
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
549 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
550 GaimConversation *conv = (GaimConversation *)convs->data;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
551
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
552 /* detach signals */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
553 detach_signals(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
554 /* reattach appropriate signals */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
555 attach_signals(conv);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
556
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
557 convs = convs->next;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
558 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
559 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
560
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
561 static GtkWidget *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
562 get_config_frame(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
563 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
564 GtkWidget *ret = NULL, *frame = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
565 GtkWidget *vbox = NULL, *hbox = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
566 GtkWidget *toggle = NULL, *entry = NULL;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
567
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
568 ret = gtk_vbox_new(FALSE, 18);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
569 gtk_container_set_border_width(GTK_CONTAINER (ret), 12);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
570
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
571 /*---------- "Notify For" ----------*/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
572 frame = gaim_gtk_make_frame(ret, _("Notify For"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
573 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
574 gtk_container_add(GTK_CONTAINER(frame), vbox);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
575
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
576 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
577 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
578 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
579 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
580 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
581 G_CALLBACK(type_toggle_cb), "type_im");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
582
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
583 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows"));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
584 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
585 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
586 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
587 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
588 G_CALLBACK(type_toggle_cb), "type_chat");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
589
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
590 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
591 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
592 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
593 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
594 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
595 G_CALLBACK(type_toggle_cb), "type_focused");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
596
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
597 /*---------- "Notification Methods" ----------*/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
598 frame = gaim_gtk_make_frame(ret, _("Notification Methods"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
599 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
600 gtk_container_add(GTK_CONTAINER(frame), vbox);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
601
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
602 /* String method button */
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
603 hbox = gtk_hbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
604 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
605 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
607 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
608 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
609
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
610 entry = gtk_entry_new();
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
611 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
612 gtk_entry_set_max_length(GTK_ENTRY(entry), 10);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
613 gtk_widget_set_sensitive(GTK_WIDGET(entry),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
614 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
615 gtk_entry_set_text(GTK_ENTRY(entry),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
616 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
617 g_object_set_data(G_OBJECT(toggle), "title-entry", entry);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
618 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
619 G_CALLBACK(method_toggle_cb), "method_string");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
620 g_signal_connect(G_OBJECT(entry), "focus-out-event",
7486
b4285106f396 [gaim-migrate @ 8099]
Mark Doliner <mark@kingant.net>
parents: 7118
diff changeset
621 G_CALLBACK(options_entry_cb), "method_string");
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
622
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
623 /* Count method button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
624 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
625 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
626 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
627 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
628 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
629 G_CALLBACK(method_toggle_cb), "method_count");
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
630
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
631 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
632 /* Urgent method button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
633 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
634 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
635 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
636 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
637 #endif
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
638
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
639 /*---------- "Notification Removals" ----------*/
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
640 frame = gaim_gtk_make_frame(ret, _("Notification Removal"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
641 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
642 gtk_container_add(GTK_CONTAINER(frame), vbox);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
643
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
644 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
645 /* Remove on focus button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
646 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
647 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
648 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
649 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
650 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
651 #endif
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
652
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
653 /* Remove on click button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
654 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
655 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
656 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
657 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
658 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
659 G_CALLBACK(notify_toggle_cb), "notify_click");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
660
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
661 /* Remove on type button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
662 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
663 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
664 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
665 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
666 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
667 G_CALLBACK(notify_toggle_cb), "notify_type");
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
668
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
669 /* Remove on message send button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
670 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
671 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
672 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
673 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
674 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
675 G_CALLBACK(notify_toggle_cb), "notify_send");
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
676
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
677 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
678 /* Remove on conversation switch button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
679 toggle = gtk_check_button_new_with_mnemonic(_("Remove on conversation ta_b switch"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
680 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
681 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
682 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
683 g_signal_connect(G_OBJECT(toggle), "toggled",
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
684 G_CALLBACK(notify_toggle_cb), "notify_switch");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
685 #endif
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
686
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
687 gtk_widget_show_all(ret);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
688 return ret;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
689 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
690
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
691 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
692 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
693 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
694 GList *convs = gaim_get_conversations();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
695 void *conv_handle = gaim_conversations_get_handle();
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
696
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
697 my_plugin = plugin;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
698
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
699 gaim_signal_connect(conv_handle, "received-im-msg", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
700 GAIM_CALLBACK(im_recv_im), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
701 gaim_signal_connect(conv_handle, "received-chat-msg", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
702 GAIM_CALLBACK(chat_recv_im), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
703 gaim_signal_connect(conv_handle, "sent-im-msg", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
704 GAIM_CALLBACK(im_sent_im), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
705 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
706 GAIM_CALLBACK(chat_sent_im), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
707 gaim_signal_connect(conv_handle, "conversation-created", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
708 GAIM_CALLBACK(conv_created), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
709 gaim_signal_connect(conv_handle, "chat-joined", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
710 GAIM_CALLBACK(chat_join), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
711 gaim_signal_connect(conv_handle, "deleting-conversation", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
712 GAIM_CALLBACK(deleting_conv), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
713 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
714 gaim_signal_connect(conv_handle, "conversation-switched", plugin,
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
715 GAIM_CALLBACK(conv_switched), NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
716 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
717
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
718 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
719 GaimConversation *conv = (GaimConversation *)convs->data;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
720
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
721 /* attach signals */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
722 attach_signals(conv);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
723
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
724 convs = convs->next;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
725 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
726
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
727 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
728 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
729
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
730 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
731 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
732 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
733 GList *convs = gaim_get_conversations();
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
734
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
735 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
736 GaimConversation *conv = (GaimConversation *)convs->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
737
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
738 /* kill signals */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
739 detach_signals(conv);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
740
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
741 convs = convs->next;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
742 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
743
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
744 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
745 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
746
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
747 static GaimGtkPluginUiInfo ui_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
748 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
749 get_config_frame
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
750 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
751
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
752 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
753 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 7486
diff changeset
754 GAIM_PLUGIN_API_VERSION, /**< api_version */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
755 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
756 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
757 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
758 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
759 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
760
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
761 NOTIFY_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
762 N_("Message Notification"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
763 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
764 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
765 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
766 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
767 N_("Provides a variety of ways of notifying you of unread messages."),
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
768 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu",
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
769 /**< author */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
770 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
771
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
772 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
773 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
774 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
775
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
776 &ui_info, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
777 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
778 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
779 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
780 };
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 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
783 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
784 {
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
785 gaim_prefs_add_none("/plugins/gtk");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
786 gaim_prefs_add_none("/plugins/gtk/X11");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
787 gaim_prefs_add_none("/plugins/gtk/X11/notify");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
788
6464
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
789 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE);
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
790 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE);
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
791 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
792 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
793 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
794 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
795 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
796 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
797 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
798 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE);
6464
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
799 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE);
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
800 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
801 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
802
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
803 GAIM_INIT_PLUGIN(notify, init_plugin, info)