annotate plugins/notify.c @ 6862:0f8868b69e8a

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