annotate plugins/notify.c @ 13904:863feae7fefa

[gaim-migrate @ 16393] This isn't necessary. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 01 Jul 2006 23:21:12 +0000
parents b76c6de0c3b5
children
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
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
27 /* TODO
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
28 * 22:22:17 <seanegan> deryni: speaking of notify.c... you know what else
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
29 * might be a neat feature?
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
30 * 22:22:30 <seanegan> Changing the window icon.
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
31 * 22:23:25 <deryni> seanegan: To what?
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
32 * 22:23:42 <seanegan> deryni: I dunno. Flash it between the regular icon and
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
33 * blank or something.
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
34 * 22:23:53 <deryni> Also I think gaim might re-set that sort of frequently,
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
35 * but I'd have to look.
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
36 * 22:25:16 <seanegan> deryni: I keep my conversations in one workspace and am
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
37 * frequently in an another, and the icon flashing in the pager would be a
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
38 * neat visual clue.
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
39 */
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
40
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
41 /*
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
42 * From Etan, 2002:
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
43 * -Added config dialog
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
44 * -Added control over notification method
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
45 * -Added control over when to release notification
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
46 *
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
47 * -Added option to get notification for chats also
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
48 * -Cleaned up code
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
49 * -Added option to notify on click as it's own option
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
50 * rather then as what happens when on focus isn't clicked
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
51 * -Added apply button to change the denotification methods for
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
52 * open conversation windows
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
53 * -Fixed apply to conversations, count now keeps count across applies
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
54 * -Fixed(?) memory leak, and in the process fixed some stupidities
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
55 * -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
56 *
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
57 * Thanks to Carles Pina i Estany <carles@pinux.info>
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
58 * for count of new messages option
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
59 *
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
60 * From Brian, 20 July 2003:
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
61 * -Use new xml prefs
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
62 * -Better handling of notification states tracking
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
63 * -Better pref change handling
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
64 * -Fixed a possible memleak and possible crash (rare)
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
65 * -Use gtk_window_get_title() rather than gtkwin->title
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
66 * -Other random fixes and cleanups
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
67 *
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
68 * Etan again, 12 August 2003:
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
69 * -Better use of the new xml prefs
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
70 * -Removed all bitmask stuff
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
71 * -Even better pref change handling
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
72 * -Removed unnecessary functions
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
73 * -Reworking of notification/unnotification stuff
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
74 * -Header file include cleanup
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
75 * -General code cleanup
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
76 *
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
77 * Etan yet again, 04 April 2004:
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
78 * -Re-added Urgent option
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
79 * -Re-added unnotify on focus option (still needs work, as it will only
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
80 * react to focus-in events when the entry or history widgets are focused)
10492
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
81 *
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
82 * Sean, 08 January, 2005:
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
83 * -Added Raise option, formally in Gaim proper
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
84 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
85
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9303
diff changeset
86 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9303
diff changeset
87 #include "gtkgaim.h"
10492
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
88 #include "gtkprefs.h"
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
89
12604
71299d63801d [gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
90 #include "conversation.h"
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
91 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
92 #include "signals.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
93 #include "version.h"
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
94 #include "debug.h"
4202
59751fe608c5 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4165
diff changeset
95
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
96 #include "gtkplugin.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
97 #include "gtkutils.h"
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
98
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
99 #ifndef _WIN32
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
100 #include <X11/Xatom.h>
3385
7931eb8bba19 [gaim-migrate @ 3404]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
101 #include <X11/Xlib.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
102 #include <X11/Xutil.h>
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
103 #endif
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
104
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
105 #define NOTIFY_PLUGIN_ID "gtk-x11-notify"
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
106
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
107 static GaimPlugin *my_plugin = NULL;
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
108
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
109 /* notification set/unset */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
110 static int notify(GaimConversation *conv, gboolean increment);
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
111 static void notify_win(GaimGtkWindow *gaimwin);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
112 static void unnotify(GaimConversation *conv, gboolean reset);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
113 static int unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
114
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
115 /* gtk widget callbacks for prefs panel */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
116 static void type_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
117 static void method_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
118 static void notify_toggle_cb(GtkWidget *widget, gpointer data);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
119 static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data);
12397
8d1cf3f847b1 [gaim-migrate @ 14704]
Richard Laager <rlaager@wiktel.com>
parents: 12286
diff changeset
120 static void apply_method(void);
8d1cf3f847b1 [gaim-migrate @ 14704]
Richard Laager <rlaager@wiktel.com>
parents: 12286
diff changeset
121 static void apply_notify(void);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
123 /* string function */
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
124 static void handle_string(GaimGtkWindow *gaimwin);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
125
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
126 /* count function */
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
127 static void handle_count(GaimGtkWindow *gaimwin);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
128
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
129 /* urgent function */
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
130 static void handle_urgent(GaimGtkWindow *gaimwin, gboolean add);
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
131
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
132 /* raise function */
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
133 static void handle_raise(GaimGtkWindow *gaimwin);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
134
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
135 /****************************************/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
136 /* Begin doing stuff below this line... */
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
137 /****************************************/
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
138 static int
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
139 count_messages(GaimGtkWindow *gaimwin)
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
140 {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
141 gint count = 0;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
142 GList *convs = NULL, *l;
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
143
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
144 for (convs = gaimwin->gtkconvs; convs != NULL; convs = convs->next) {
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
145 GaimGtkConversation *conv = convs->data;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
146 for (l = conv->convs; l != NULL; l = l->next) {
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
147 count += GPOINTER_TO_INT(gaim_conversation_get_data(l->data, "notify-message-count"));
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
148 }
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
149 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
150
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
151 return count;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
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 static int
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
155 notify(GaimConversation *conv, gboolean increment)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
156 {
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
157 GaimGtkWindow *gaimwin = NULL;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
158 gint count;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
159 gboolean has_focus;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
160
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
161 if (conv == NULL)
6302
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
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
164 /* We want to remove the notifications, but not reset the counter */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
165 unnotify(conv, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
166
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
167 gaimwin = GAIM_GTK_CONVERSATION(conv)->win;
5021
00b6af528964 [gaim-migrate @ 5357]
Luke Schierer <lschiere@pidgin.im>
parents: 4793
diff changeset
168
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
169 /* If we aren't doing notifications for this type of conversation, return */
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 10984
diff changeset
170 if (((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) &&
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
171 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) ||
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 10984
diff changeset
172 ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) &&
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
173 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")))
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
174 return 0;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
175
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
176 g_object_get(G_OBJECT(gaimwin->window),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
177 "has-toplevel-focus", &has_focus, NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
178
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
179 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ||
10984
caaacfede4ae [gaim-migrate @ 12819]
Mark Doliner <mark@kingant.net>
parents: 10971
diff changeset
180 !has_focus) {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
181 if (increment) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
182 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
183 count++;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
184 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
185 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
186
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
187 notify_win(gaimwin);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
188 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
189
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
190 return 0;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
191 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
192
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
193 static void
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
194 notify_win(GaimGtkWindow *gaimwin)
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
195 {
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
196 if (count_messages(gaimwin) <= 0)
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
197 return;
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
198
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
199 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
200 handle_count(gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
201 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
202 handle_string(gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
203 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent"))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
204 handle_urgent(gaimwin, TRUE);
10492
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
205 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_raise"))
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
206 handle_raise(gaimwin);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
207 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
208
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
209 static void
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
210 unnotify(GaimConversation *conv, gboolean reset)
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
211 {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
212 GaimConversation *active_conv = NULL;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
213 GaimGtkWindow *gaimwin = NULL;
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
214
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
215 g_return_if_fail(conv != NULL);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
216
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
217 gaimwin = GAIM_GTK_CONVERSATION(conv)->win;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
218 active_conv = gaim_gtk_conv_window_get_active_conversation(gaimwin);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
219
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
220 /* reset the conversation window title */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
221 gaim_conversation_autoset_title(active_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
222
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
223 if (reset) {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
224 /* Only need to actually remove the urgent hinting here, since removing it
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
225 * just to have it readded in re-notify is an unnecessary couple extra RTs
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
226 * to the server */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
227 handle_urgent(gaimwin, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
228 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
229 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
230
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
231 return;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
232 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
233
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
234 static int
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
235 unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv)
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
236 {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
237 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0)
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
238 unnotify(conv, TRUE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
239
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
240 return 0;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
241 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
242
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
243 static gboolean
13233
f09c6e8df82c [gaim-migrate @ 15598]
Richard Laager <rlaager@wiktel.com>
parents: 12968
diff changeset
244 message_displayed_cb(GaimAccount *account, const char *who, char *message,
f09c6e8df82c [gaim-migrate @ 15598]
Richard Laager <rlaager@wiktel.com>
parents: 12968
diff changeset
245 GaimConversation *conv, GaimMessageFlags flags)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
246 {
13236
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
247 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
248 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick") &&
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
249 !(flags & GAIM_MESSAGE_NICK)))
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
250 return FALSE;
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
251
12604
71299d63801d [gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
252 if ((flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_DELAYED))
71299d63801d [gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
253 notify(conv, TRUE);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
254
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
255 return FALSE;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
256 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
257
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
258 static void
12968
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
259 im_sent_im(GaimAccount *account, const char *receiver, const char *message) {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
260 GaimConversation *conv = NULL;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
261
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
262 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 10984
diff changeset
263 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, receiver, account);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
264 unnotify(conv, TRUE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
265 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
266 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
267
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
268 static void
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
269 chat_sent_im(GaimAccount *account, const char *message, int id)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
270 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
271 GaimConversation *conv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
272
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
273 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
274 conv = gaim_find_chat(gaim_account_get_connection(account), id);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
275 unnotify(conv, TRUE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
276 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
277 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
278
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
279 static int
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
280 attach_signals(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
281 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
282 GaimGtkConversation *gtkconv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
283 GaimGtkWindow *gtkwin = NULL;
11728
89e416ac9ef7 [gaim-migrate @ 14019]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11690
diff changeset
284 GSList *imhtml_ids = NULL, *entry_ids = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
285 guint id;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
286
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
287 gtkconv = GAIM_GTK_CONVERSATION(conv);
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
288 if (!gtkconv) {
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
289 gaim_debug_misc("notify", "Failed to find gtkconv\n");
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
290 return 0;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
291 }
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
292
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
293 gtkwin = gtkconv->win;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
294
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
295 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
296 /* TODO should really find a way to make this work no matter where the
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
297 * focus is inside the conv window, without having to bind to
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
298 * focus-in-event on the g(d|t)kwindow */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
299 /* try setting the signal on the focus-in-event for
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
300 * gtkwin->notebook->container? */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
301 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
302 G_CALLBACK(unnotify_cb), conv);
11728
89e416ac9ef7 [gaim-migrate @ 14019]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11690
diff changeset
303 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id));
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
304
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
305 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
306 G_CALLBACK(unnotify_cb), conv);
11728
89e416ac9ef7 [gaim-migrate @ 14019]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11690
diff changeset
307 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
308 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
309
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
310 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
311 /* TODO similarly should really find a way to allow for clicking in other
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
312 * places of the window */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
313 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
314 G_CALLBACK(unnotify_cb), conv);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
315 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id));
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12184
diff changeset
316
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12184
diff changeset
317 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event",
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12184
diff changeset
318 G_CALLBACK(unnotify_cb), conv);
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12184
diff changeset
319 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
320 }
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
321
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
322 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
323 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
324 G_CALLBACK(unnotify_cb), conv);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
325 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
326 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
327
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
328 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
329 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
330
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
331 return 0;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
334 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
335 detach_signals(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
336 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
337 GaimGtkConversation *gtkconv = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
338 GaimGtkWindow *gtkwin = NULL;
11606
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
339 GSList *ids = NULL, *l;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
340
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
341 gtkconv = GAIM_GTK_CONVERSATION(conv);
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
342 if (!gtkconv)
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
343 return;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
344 gtkwin = gtkconv->win;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
345
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
346 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals");
11606
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
347 for (l = ids; l != NULL; l = l->next)
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
348 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(l->data));
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
349 g_slist_free(ids);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
350
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
351 ids = gaim_conversation_get_data(conv, "notify-entry-signals");
11606
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
352 for (l = ids; l != NULL; l = l->next)
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
353 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(l->data));
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
354 g_slist_free(ids);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
355
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
356 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
3710
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 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
359 gaim_conversation_set_data(conv, "notify-entry-signals", NULL);
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
360 }
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
361
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
362 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
363 conv_created(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
364 {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
365 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
366
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
367 /* always attach the signals, notify() will take care of conversation type
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
368 * checking */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
369 attach_signals(conv);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
370 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
371
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
372 static void
12968
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
373 conv_switched(GaimConversation *conv)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
374 {
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
375 #if 0
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
376 GaimGtkWindow *gaimwin = gaim_conversation_get_window(new_conv);
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
377 #endif
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
378
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
379 /*
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
380 * If the conversation was switched, then make sure we re-notify
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
381 * because Gaim will have overwritten our custom window title.
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
382 */
12968
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
383 notify(conv, FALSE);
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
384
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
385 #if 0
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
386 printf("conv_switched - %p - %p\n", old_conv, new_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
387 printf("count - %d\n", count_messages(gaimwin));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
388 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch"))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
389 unnotify(new_conv, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
390 else {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
391 /* if we don't have notification on the window then we don't want to
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
392 * re-notify it */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
393 if (count_messages(gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
394 notify_win(gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
395 }
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
396 #endif
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
397 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
398
6977
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 deleting_conv(GaimConversation *conv)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
401 {
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
402 GaimGtkWindow *gaimwin = NULL;
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
403
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
404 detach_signals(conv);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
405
11606
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
406 gaimwin = GAIM_GTK_CONVERSATION(conv)->win;
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
407
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
408 handle_urgent(gaimwin, FALSE);
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
409 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0));
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
410
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
411 return;
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11581
diff changeset
412
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
413 #if 0
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
414 /* i think this line crashes */
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
415 if (count_messages(gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
416 notify_win(gaimwin);
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
417 #endif
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
418 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
419
9303
fe931c791fc0 [gaim-migrate @ 10107]
Mark Doliner <mark@kingant.net>
parents: 9298
diff changeset
420 #if 0
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
421 static void
11447
ef6e94bdda08 [gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11338
diff changeset
422 conversation_dragging(GaimConversation *active_conv,
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
423 GaimGtkWindow *old_gaimwin,
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
424 GaimGtkWindow *new_gaimwin)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
425 {
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
426 if (old_gaimwin != new_gaimwin) {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
427 if (old_gaimwin == NULL) {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
428 /*
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
429 gaim_conversation_autoset_title(active_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
430 handle_urgent(new_gaimwin, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
431 */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
432
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
433 if (count_messages(new_gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
434 notify_win(new_gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
435 } else {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
436 printf("if else count = %d\n", count_messages(new_gaimwin));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
437 printf("if else count = %d\n", count_messages(old_gaimwin));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
438 /*
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
439 GaimConversation *old_active_conv = NULL;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
440 old_active_conv = gaim_conv_window_get_active_conversation(new_gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
441
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
442 gaim_conversation_autoset_title(old_active_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
443 handle_urgent(old_gaimwin, FALSE);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
444
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
445 if (count_messages(old_gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
446 notify_win(old_gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
447
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
448 gaim_conversation_autoset_title(active_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
449 handle_urgent(new_gaimwin, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
450
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
451 if (count_messages(new_gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
452 notify_win(new_gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
453 */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
454 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
455 } else {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
456 printf("else count = %d\n", count_messages(new_gaimwin));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
457 printf("else count = %d\n", count_messages(old_gaimwin));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
458 /*
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
459 gaim_conversation_autoset_title(active_conv);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
460 handle_urgent(old_gaimwin, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
461
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
462 if (count_messages(old_gaimwin))
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
463 notify_win(old_gaimwin);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
464 */
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
465 }
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
466 }
9303
fe931c791fc0 [gaim-migrate @ 10107]
Mark Doliner <mark@kingant.net>
parents: 9298
diff changeset
467 #endif
4035
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
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
470 handle_string(GaimGtkWindow *gaimwin)
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
471 {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
472 GtkWindow *window = NULL;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
473 gchar newtitle[256];
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
474
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
475 g_return_if_fail(gaimwin != NULL);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
476
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
477 window = GTK_WINDOW(gaimwin->window);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
478 g_return_if_fail(window != NULL);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
479
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
480 g_snprintf(newtitle, sizeof(newtitle), "%s%s",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
481 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"),
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
482 gtk_window_get_title(window));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
483 gtk_window_set_title(window, newtitle);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
484 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
485
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
486 static void
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
487 handle_count(GaimGtkWindow *gaimwin)
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
488 {
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
489 GtkWindow *window;
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
490 char newtitle[256];
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
491
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
492 g_return_if_fail(gaimwin != NULL);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
493
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
494 window = GTK_WINDOW(gaimwin->window);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
495 g_return_if_fail(window != NULL);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
496
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
497 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s",
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
498 count_messages(gaimwin), gtk_window_get_title(window));
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
499 gtk_window_set_title(window, newtitle);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
500 }
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
501
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
502 static void
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
503 handle_urgent(GaimGtkWindow *win, gboolean add)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
504 {
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
505 #ifndef _WIN32
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
506 XWMHints *hints;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
507
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
508 g_return_if_fail(win != NULL);
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
509 g_return_if_fail(win->window != NULL);
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
510 g_return_if_fail(win->window->window != NULL);
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
511
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
512 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win->window->window),
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
513 GDK_WINDOW_XWINDOW(win->window->window));
12184
5cd2294127e8 [gaim-migrate @ 14486]
Richard Laager <rlaager@wiktel.com>
parents: 11728
diff changeset
514 if(!hints)
5cd2294127e8 [gaim-migrate @ 14486]
Richard Laager <rlaager@wiktel.com>
parents: 11728
diff changeset
515 hints = XAllocWMHints();
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12184
diff changeset
516
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
517 if (add)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
518 hints->flags |= XUrgencyHint;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
519 else
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
520 hints->flags &= ~XUrgencyHint;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
521 XSetWMHints(GDK_WINDOW_XDISPLAY(win->window->window),
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
522 GDK_WINDOW_XWINDOW(win->window->window), hints);
4218
fac89c0d55c2 [gaim-migrate @ 4462]
Sean Egan <seanegan@gmail.com>
parents: 4203
diff changeset
523 XFree(hints);
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
524 #endif
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
525 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
526
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
527 static void
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
528 handle_raise(GaimGtkWindow *gaimwin)
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
529 {
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
530 gaim_gtk_conv_window_raise(gaimwin);
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
531 }
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
532
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
533 static void
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
534 type_toggle_cb(GtkWidget *widget, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
535 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
536 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
537 gchar pref[256];
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4218
diff changeset
538
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
539 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
540
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
541 gaim_prefs_set_bool(pref, on);
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 method_toggle_cb(GtkWidget *widget, gpointer data)
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 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
548 gchar pref[256];
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
549
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
550 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
551
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
552 gaim_prefs_set_bool(pref, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
553
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
554 if (!strcmp(data, "method_string")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
555 GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry");
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
556 gtk_widget_set_sensitive(entry, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
557
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
558 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
559 }
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
560
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
561 apply_method();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
562 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
563
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
564 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
565 notify_toggle_cb(GtkWidget *widget, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
566 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
567 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
568 gchar pref[256];
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
569
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
570 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
571
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
572 gaim_prefs_set_bool(pref, on);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
573
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
574 apply_notify();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
575 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
576
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
577 static gboolean
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
578 options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data)
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
579 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
580 if (data == NULL)
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6977
diff changeset
581 return FALSE;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
582
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
583 if (!strcmp(data, "method_string")) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
584 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
585 }
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
586
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
587 apply_method();
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
588
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
589 return FALSE;
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
590 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
591
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
592 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
593 apply_method() {
13663
b76c6de0c3b5 [gaim-migrate @ 16065]
Richard Laager <rlaager@wiktel.com>
parents: 13549
diff changeset
594 GList *convs;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
595 GaimGtkWindow *gaimwin = NULL;
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
596
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
597 for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
598 GaimConversation *conv = (GaimConversation *)convs->data;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
599
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
600 /* remove notifications */
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
601 unnotify(conv, FALSE);
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
602
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11447
diff changeset
603 gaimwin = GAIM_GTK_CONVERSATION(conv)->win;
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
604 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0)
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
605 /* reattach appropriate notifications */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
606 notify(conv, FALSE);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
607 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
608 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
609
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
610 static void
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
611 apply_notify()
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
612 {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
613 GList *convs = gaim_get_conversations();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
614
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
615 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
616 GaimConversation *conv = (GaimConversation *)convs->data;
4203
ec6d0c5e5c23 [gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
617
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
618 /* detach signals */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
619 detach_signals(conv);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
620 /* reattach appropriate signals */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
621 attach_signals(conv);
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
622
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
623 convs = convs->next;
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
624 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
625 }
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
626
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
627 static GtkWidget *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
628 get_config_frame(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
629 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
630 GtkWidget *ret = NULL, *frame = NULL;
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
631 GtkWidget *vbox = NULL, *hbox = NULL;
13236
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
632 GtkWidget *toggle = NULL, *entry = NULL, *ref;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
633
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
634 ret = gtk_vbox_new(FALSE, 18);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
635 gtk_container_set_border_width(GTK_CONTAINER (ret), 12);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
636
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
637 /*---------- "Notify For" ----------*/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
638 frame = gaim_gtk_make_frame(ret, _("Notify For"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
639 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
640 gtk_container_add(GTK_CONTAINER(frame), vbox);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
641
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
642 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows"));
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
643 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
644 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
645 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
646 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
647 G_CALLBACK(type_toggle_cb), "type_im");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
648
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
649 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows"));
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
650 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
651 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
652 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
653 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
654 G_CALLBACK(type_toggle_cb), "type_chat");
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
655
13236
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
656 ref = toggle;
13549
cef825f41d56 [gaim-migrate @ 15926]
Richard Laager <rlaager@wiktel.com>
parents: 13236
diff changeset
657 toggle = gtk_check_button_new_with_mnemonic(_("\t_Only when someone says your screen name"));
13236
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
658 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
660 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick"));
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
661 g_signal_connect(G_OBJECT(toggle), "toggled",
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
662 G_CALLBACK(type_toggle_cb), "type_chat_nick");
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
663 gtk_widget_set_sensitive(toggle, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ref)));
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
664 g_signal_connect(G_OBJECT(ref), "toggled",
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
665 G_CALLBACK(gaim_gtk_toggle_sensitive), toggle);
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
666
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
667 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows"));
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
668 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
669 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
670 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
671 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
672 G_CALLBACK(type_toggle_cb), "type_focused");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
673
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
674 /*---------- "Notification Methods" ----------*/
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
675 frame = gaim_gtk_make_frame(ret, _("Notification Methods"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
676 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
677 gtk_container_add(GTK_CONTAINER(frame), vbox);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
678
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
679 /* String method button */
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
680 hbox = gtk_hbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
681 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
682 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
683 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
684 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"));
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
685 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
686
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
687 entry = gtk_entry_new();
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
688 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
689 gtk_entry_set_max_length(GTK_ENTRY(entry), 10);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
690 gtk_widget_set_sensitive(GTK_WIDGET(entry),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
691 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
692 gtk_entry_set_text(GTK_ENTRY(entry),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
693 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
694 g_object_set_data(G_OBJECT(toggle), "title-entry", entry);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
695 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
696 G_CALLBACK(method_toggle_cb), "method_string");
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
697 g_signal_connect(G_OBJECT(entry), "focus-out-event",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
698 G_CALLBACK(options_entry_cb), "method_string");
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
699
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
700 /* Count method button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
701 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
702 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
703 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
704 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
705 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
706 G_CALLBACK(method_toggle_cb), "method_count");
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
707
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
708 #ifndef _WIN32
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
709 /* Urgent method button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
710 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
711 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
712 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
713 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent"));
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
714 g_signal_connect(G_OBJECT(toggle), "toggled",
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
715 G_CALLBACK(method_toggle_cb), "method_urgent");
12959
acf22abb86ba [gaim-migrate @ 15312]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12604
diff changeset
716 #endif
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
717
10606
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
718 /* Raise window method button */
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
719 toggle = gtk_check_button_new_with_mnemonic(_("R_aise conversation window"));
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
720 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
721 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
722 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_raise"));
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
723 g_signal_connect(G_OBJECT(toggle), "toggled",
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
724 G_CALLBACK(method_toggle_cb), "method_raise");
1a65fc2d7978 [gaim-migrate @ 12039]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10492
diff changeset
725
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
726 /*---------- "Notification Removals" ----------*/
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
727 frame = gaim_gtk_make_frame(ret, _("Notification Removal"));
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
728 vbox = gtk_vbox_new(FALSE, 5);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
729 gtk_container_add(GTK_CONTAINER(frame), vbox);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
730
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
731 /* Remove on focus button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
732 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
733 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
734 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
735 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
736 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
737
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
738 /* Remove on click button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
739 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
740 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
741 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
742 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
743 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
744 G_CALLBACK(notify_toggle_cb), "notify_click");
3710
03ba413ca20b [gaim-migrate @ 3843]
Luke Schierer <lschiere@pidgin.im>
parents: 3565
diff changeset
745
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
746 /* Remove on type button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
747 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
748 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
749 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
750 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
751 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
752 G_CALLBACK(notify_toggle_cb), "notify_type");
4035
4cea75cf291d [gaim-migrate @ 4241]
Luke Schierer <lschiere@pidgin.im>
parents: 3710
diff changeset
753
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
754 /* Remove on message send button */
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
755 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
756 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
757 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
758 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
759 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
760 G_CALLBACK(notify_toggle_cb), "notify_send");
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
761
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
762 #if 0
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
763 /* Remove on conversation switch button */
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
764 toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
765 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
766 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
767 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch"));
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
768 g_signal_connect(G_OBJECT(toggle), "toggled",
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
769 G_CALLBACK(notify_toggle_cb), "notify_switch");
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
770 #endif
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
771
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
772 gtk_widget_show_all(ret);
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
773 return ret;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
774 }
5205
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 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
777 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
778 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
779 GList *convs = gaim_get_conversations();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
780 void *conv_handle = gaim_conversations_get_handle();
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
781 void *gtk_conv_handle = gaim_gtk_conversations_get_handle();
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
782
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
783 my_plugin = plugin;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
784
12604
71299d63801d [gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
785 gaim_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
12968
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
786 GAIM_CALLBACK(message_displayed_cb), NULL);
12604
71299d63801d [gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
787 gaim_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin,
12968
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
788 GAIM_CALLBACK(message_displayed_cb), NULL);
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
789 gaim_signal_connect(gtk_conv_handle, "conversation-switched", plugin,
384661a6ead6 [gaim-migrate @ 15321]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12959
diff changeset
790 GAIM_CALLBACK(conv_switched), NULL);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
791 gaim_signal_connect(conv_handle, "sent-im-msg", plugin,
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
792 GAIM_CALLBACK(im_sent_im), NULL);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
793 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin,
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
794 GAIM_CALLBACK(chat_sent_im), NULL);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
795 gaim_signal_connect(conv_handle, "conversation-created", plugin,
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
796 GAIM_CALLBACK(conv_created), NULL);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
797 gaim_signal_connect(conv_handle, "chat-joined", plugin,
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
798 GAIM_CALLBACK(conv_created), NULL);
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
799 gaim_signal_connect(conv_handle, "deleting-conversation", plugin,
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
800 GAIM_CALLBACK(deleting_conv), NULL);
10971
57e3e958ff49 [gaim-migrate @ 12796]
Mark Doliner <mark@kingant.net>
parents: 10841
diff changeset
801 #if 0
11447
ef6e94bdda08 [gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11338
diff changeset
802 gaim_signal_connect(gtk_conv_handle, "conversation-dragging", plugin,
ef6e94bdda08 [gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11338
diff changeset
803 GAIM_CALLBACK(conversation_dragging), NULL);
9303
fe931c791fc0 [gaim-migrate @ 10107]
Mark Doliner <mark@kingant.net>
parents: 9298
diff changeset
804 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
805
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
806 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
807 GaimConversation *conv = (GaimConversation *)convs->data;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
808
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
809 /* attach signals */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
810 attach_signals(conv);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
811
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
812 convs = convs->next;
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
813 }
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
814
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
815 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
816 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
817
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
818 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
819 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
820 {
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
821 GList *convs = gaim_get_conversations();
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
822
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
823 while (convs) {
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
824 GaimConversation *conv = (GaimConversation *)convs->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
825
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
826 /* kill signals */
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
827 detach_signals(conv);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
828
6977
996a182029f7 [gaim-migrate @ 7530]
Luke Schierer <lschiere@pidgin.im>
parents: 6735
diff changeset
829 convs = convs->next;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
830 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
831
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
832 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
833 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
834
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
835 static GaimGtkPluginUiInfo ui_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
836 {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
837 get_config_frame,
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
838 0 /* page_num (Reserved) */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
839 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
840
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
841 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
842 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
843 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
844 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
845 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
846 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
847 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
848 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
849 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
850 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
851
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
852 NOTIFY_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
853 N_("Message Notification"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
854 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
855 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
856 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
857 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
858 N_("Provides a variety of ways of notifying you of unread messages."),
9298
b0b544e0f246 [gaim-migrate @ 10101]
Luke Schierer <lschiere@pidgin.im>
parents: 8999
diff changeset
859 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu>",
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
860 /**< author */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6464
diff changeset
861 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
862
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
863 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
864 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
865 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
866
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
867 &ui_info, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
868 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
869 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
870 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
871 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
872
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
873 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
874 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
875 {
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
876 gaim_prefs_add_none("/plugins/gtk");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
877 gaim_prefs_add_none("/plugins/gtk/X11");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
878 gaim_prefs_add_none("/plugins/gtk/X11/notify");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
879
6464
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
880 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE);
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
881 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE);
13236
0fa8153beebf [gaim-migrate @ 15602]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13233
diff changeset
882 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE);
6464
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
883 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
884 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
885 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)");
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
886 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
887 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE);
10492
45ad1d15fab3 [gaim-migrate @ 11782]
Sean Egan <seanegan@gmail.com>
parents: 10345
diff changeset
888 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE);
6302
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
889 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
890 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE);
511003c99302 [gaim-migrate @ 6801]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
891 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
892 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE);
059649ed25ed [gaim-migrate @ 6973]
Mark Doliner <mark@kingant.net>
parents: 6371
diff changeset
893 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
894 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5021
diff changeset
895
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
896 GAIM_INIT_PLUGIN(notify, init_plugin, info)