annotate plugins/notify.c @ 6485:70d5122bc3ff

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