Mercurial > pidgin
annotate src/gtkconv.c @ 12356:4b8c20fcecd6
[gaim-migrate @ 14660]
Bias the color selection away from the nick highlight and send colors.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 05 Dec 2005 19:10:04 +0000 |
parents | 709548d845a1 |
children | d1af58b4a463 |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10274
diff
changeset
|
2 * @file gtkconv.c GTK+ Conversation API |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10274
diff
changeset
|
5 * gaim |
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10274
diff
changeset
|
6 * |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
10 * |
4359 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
9791 | 26 #include "internal.h" |
27 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 |
4359 | 29 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
30 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
32 |
4359 | 33 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
35 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
36 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
37 # endif |
4359 | 38 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 |
4359 | 40 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 |
9699 | 42 #include "account.h" |
9130 | 43 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "debug.h" |
12272 | 45 #include "idle.h" |
6982 | 46 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
48 #include "notify.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "prpl.h" |
6038 | 50 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10274
diff
changeset
|
53 #include "gtkdnd-hints.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
54 #include "gtkblist.h" |
5717 | 55 #include "gtkconv.h" |
11583 | 56 #include "gtkconvwin.h" |
9709 | 57 #include "gtkdialogs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkimhtml.h" |
8317 | 59 #include "gtkimhtmltoolbar.h" |
7431 | 60 #include "gtklog.h" |
11554
f8443218b7fe
[gaim-migrate @ 13814]
Gary Kramlich <grim@reaperworld.com>
parents:
11552
diff
changeset
|
61 #include "gtkmenutray.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
62 #include "gtkpounce.h" |
11206
86d3ce670f05
[gaim-migrate @ 13334]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11145
diff
changeset
|
63 #include "gtkprefs.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
64 #include "gtkprivacy.h" |
11525 | 65 #include "gtkthemes.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #include "gtkutils.h" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10274
diff
changeset
|
67 #include "gtkstock.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
68 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
69 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
70 |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
71 #define SEND_COLOR "#16569E" |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
72 #define RECV_COLOR "#A82F2F" |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
73 #define HIGHLIGHT_COLOR "#AF7F00" |
7854 | 74 |
12335 | 75 /* Undef this to turn off "custom-smiley" debug messages */ |
76 #define DEBUG_CUSTOM_SMILEY | |
77 | |
10108 | 78 #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue))) |
79 | |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
80 #if 0 |
10108 | 81 /* These colors come from the default GNOME palette */ |
82 static GdkColor nick_colors[] = { | |
10117
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
83 {0, 47616, 46336, 43776}, /* Basic 3D Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
84 {0, 32768, 32000, 29696}, /* Basic 3D Dark */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
85 {0, 22016, 20992, 18432}, /* 3D Shadow */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
86 {0, 33536, 42496, 32512}, /* Green Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
87 {0, 23808, 29952, 21760}, /* Green Dark */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
88 {0, 17408, 22016, 12800}, /* Green Shadow */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
89 {0, 57344, 46592, 44800}, /* Red Hilight */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
90 {0, 49408, 26112, 23040}, /* Red Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
91 {0, 34816, 17920, 12544}, /* Red Dark */ |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
92 {0, 49408, 14336, 8704}, /* Red Shadow */ |
10117
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
93 {0, 34816, 32512, 41728}, /* Purple Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
94 {0, 25088, 23296, 33024}, /* Purple Dark */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
95 {0, 18688, 16384, 26112}, /* Purple Shadow */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
96 {0, 40192, 47104, 53760}, /* Blue Hilight */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
97 {0, 29952, 36864, 44544}, /* Blue Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
98 {0, 57344, 49920, 40448}, /* Face Skin Medium */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
99 {0, 45824, 37120, 26880}, /* Face skin Dark */ |
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
100 {0, 33280, 26112, 18176}, /* Face Skin Shadow */ |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
101 {0, 57088, 16896, 7680}, /* Accent Red */ |
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
102 {0, 39168, 0, 0}, /* Accent Red Dark */ |
10117
d520ab74fe8f
[gaim-migrate @ 11154]
Luke Schierer <lschiere@pidgin.im>
parents:
10116
diff
changeset
|
103 {0, 17920, 40960, 17920}, /* Accent Green */ |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
104 {0, 9728, 50944, 9728} /* Accent Green Dark */ |
4359 | 105 }; |
6291 | 106 |
4359 | 107 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
108 #endif |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
109 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
110 /* From http://www.w3.org/TR/AERT#color-contrast */ |
12354
709548d845a1
[gaim-migrate @ 14658]
Luke Schierer <lschiere@pidgin.im>
parents:
12353
diff
changeset
|
111 #define MIN_BRIGHTNESS_CONTRAST 75 |
709548d845a1
[gaim-migrate @ 14658]
Luke Schierer <lschiere@pidgin.im>
parents:
12353
diff
changeset
|
112 #define MIN_COLOR_CONTRAST 200 |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
113 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
114 #define NUM_NICK_COLORS 220 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
115 static GdkColor *nick_colors = NULL; |
4359 | 116 |
11581 | 117 typedef struct { |
4359 | 118 GtkWidget *window; |
119 | |
120 GtkWidget *entry; | |
121 GtkWidget *message; | |
122 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
124 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 } InviteBuddyInfo; |
4359 | 126 |
127 static GtkWidget *invite_dialog = NULL; | |
11206
86d3ce670f05
[gaim-migrate @ 13334]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11145
diff
changeset
|
128 static GtkWidget *warn_close_dialog = NULL; |
4359 | 129 |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
130 static GaimGtkWindow *hidden_convwin = NULL; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
131 static GList *window_list = NULL; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
132 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
133 |
11594 | 134 static gboolean update_send_to_selection(GaimGtkWindow *win); |
135 static void generate_send_to_items(GaimGtkWindow *win); | |
11581 | 136 |
4359 | 137 /* Prototypes. <-- because Paco-Paco hates this comment. */ |
10810 | 138 static void got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first); |
11604 | 139 static void gray_stuff_out(GaimGtkConversation *gtkconv); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
140 static GList *generate_invite_user_names(GaimConnection *gc); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
141 static void add_chat_buddy_common(GaimConversation *conv, const char *name, |
11869 | 142 GaimConvChatBuddyFlags flags, const char *alias, const char *old_name); |
9605 | 143 static gboolean tab_complete(GaimConversation *conv); |
11604 | 144 static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type); |
11613 | 145 static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state); |
10810 | 146 static void update_typing_icon(GaimGtkConversation *gtkconv); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
147 static char *item_factory_translate_func (const char *path, gpointer func_data); |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
148 gboolean gaim_gtkconv_has_focus(GaimConversation *conv); |
12335 | 149 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); |
150 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data); | |
12351
af152afe7bac
[gaim-migrate @ 14655]
Richard Laager <rlaager@wiktel.com>
parents:
12346
diff
changeset
|
151 static GdkColor* generate_nick_colors(guint numcolors, GdkColor background); |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
152 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); |
4359 | 153 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
154 static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
155 static GdkColor col; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
156 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); |
11480
e9251afae7b8
[gaim-migrate @ 13722]
Richard Laager <rlaager@wiktel.com>
parents:
11479
diff
changeset
|
157 float scale; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
158 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
159 col = nick_colors[g_str_hash(name) % NUM_NICK_COLORS]; |
11480
e9251afae7b8
[gaim-migrate @ 13722]
Richard Laager <rlaager@wiktel.com>
parents:
11479
diff
changeset
|
160 scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) * |
e9251afae7b8
[gaim-migrate @ 13722]
Richard Laager <rlaager@wiktel.com>
parents:
11479
diff
changeset
|
161 (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green))); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
162 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
163 /* The colors are chosen to look fine on white; we should never have to darken */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
164 if (scale > 1) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
165 col.red *= scale; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
166 col.green *= scale; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
167 col.blue *= scale; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
168 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
169 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
170 return &col; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
171 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
172 |
4359 | 173 /************************************************************************** |
174 * Callbacks | |
175 **************************************************************************/ | |
10971 | 176 |
4359 | 177 static gint |
10810 | 178 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
4359 | 179 { |
10810 | 180 GList *list = g_list_copy(gtkconv->convs), *l; |
11508 | 181 |
10810 | 182 l = list; |
183 while (l) { | |
184 GaimConversation *conv = l->data; | |
185 gaim_conversation_destroy(conv); | |
186 l = l->next; | |
187 } | |
11508 | 188 |
10810 | 189 g_list_free(list); |
11508 | 190 |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
191 return TRUE; |
4359 | 192 } |
193 | |
8914 | 194 static gboolean |
10810 | 195 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv) |
8914 | 196 { |
10810 | 197 GaimConversation *conv = gtkconv->active_conv; |
11508 | 198 |
8914 | 199 if (!GTK_WIDGET_VISIBLE(w)) |
200 return FALSE; | |
201 | |
202 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
203 return FALSE; | |
204 | |
11620
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
205 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
206 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
207 * if there is only one conversation in the window. This way we'll be setting new windows to the |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
208 * size of the last resized new window. */ |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
209 /* I think that the above justification is not the majority, and that the new tab resizing should |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
210 * negate it anyway. --luke */ |
11338 | 211 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
8914 | 212 { |
11453
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
213 if (w == gtkconv->imhtml) { |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
214 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
215 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
216 } |
8914 | 217 if (w == gtkconv->entry) |
218 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
219 } | |
11338 | 220 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
8914 | 221 { |
11453
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
222 if (w == gtkconv->imhtml) { |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
223 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
224 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); |
d446fcc2c63b
[gaim-migrate @ 13692]
Luke Schierer <lschiere@pidgin.im>
parents:
11452
diff
changeset
|
225 } |
8914 | 226 if (w == gtkconv->entry) |
227 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
228 } | |
229 | |
230 return FALSE; | |
231 } | |
232 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
233 static void |
10810 | 234 default_formatize(GaimGtkConversation *c) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
235 { |
10810 | 236 GaimConversation *conv = c->active_conv; |
11508 | 237 |
10665 | 238 if (conv->features & GAIM_CONNECTION_HTML) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
239 { |
11267
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
240 char *color; |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
241 GdkColor fg_color, bg_color; |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
242 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
243 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold") != GTK_IMHTML(c->entry)->edit.bold) |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
244 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
245 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
246 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic") != GTK_IMHTML(c->entry)->edit.italic) |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
247 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
248 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
249 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline") != GTK_IMHTML(c->entry)->edit.underline) |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
250 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
251 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
252 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
253 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
254 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
255 if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE)) |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
256 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
257 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
258 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
259 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
260 { |
11267
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
261 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
262 &fg_color); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
263 color = g_strdup_printf("#%02x%02x%02x", |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
264 fg_color.red / 256, |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
265 fg_color.green / 256, |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
266 fg_color.blue / 256); |
8061 | 267 } |
11267
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
268 else |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
269 color = g_strdup(""); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
270 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
271 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
272 g_free(color); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
273 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
274 if(!(conv->features & GAIM_CONNECTION_NO_BGCOLOR) && |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
275 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
276 { |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
277 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
278 &bg_color); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
279 color = g_strdup_printf("#%02x%02x%02x", |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
280 bg_color.red / 256, |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
281 bg_color.green / 256, |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
282 bg_color.blue / 256); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
283 } |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
284 else |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
285 color = g_strdup(""); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
286 |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
287 gtk_imhtml_toggle_background(GTK_IMHTML(c->entry), color); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
288 g_free(color); |
8677 | 289 |
9025 | 290 |
10665 | 291 if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO) |
8677 | 292 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); |
293 else | |
294 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 295 } |
296 } | |
9130 | 297 |
11275
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
298 static void |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
299 clear_formatting_cb(GtkIMHtml *imhtml, GaimGtkConversation *gtkconv) |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
300 { |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
301 default_formatize(gtkconv); |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
302 } |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
303 |
9130 | 304 static const char * |
305 gaim_gtk_get_cmd_prefix(void) | |
306 { | |
307 return "/"; | |
308 } | |
309 | |
9167 | 310 static GaimCmdRet |
9829 | 311 say_command_cb(GaimConversation *conv, |
312 const char *cmd, char **args, char **error, void *data) | |
313 { | |
11338 | 314 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
9829 | 315 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); |
11338 | 316 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
9829 | 317 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); |
318 | |
319 return GAIM_CMD_RET_OK; | |
320 } | |
321 | |
322 static GaimCmdRet | |
9167 | 323 me_command_cb(GaimConversation *conv, |
9597 | 324 const char *cmd, char **args, char **error, void *data) |
9167 | 325 { |
326 char *tmp; | |
327 | |
328 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 329 |
11338 | 330 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
9167 | 331 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); |
11338 | 332 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
9167 | 333 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); |
334 | |
335 g_free(tmp); | |
336 return GAIM_CMD_RET_OK; | |
337 } | |
338 | |
9212 | 339 static GaimCmdRet |
340 debug_command_cb(GaimConversation *conv, | |
9597 | 341 const char *cmd, char **args, char **error, void *data) |
9212 | 342 { |
343 char *tmp, *markup; | |
344 GaimCmdStatus status; | |
345 | |
346 if (!g_ascii_strcasecmp(args[0], "version")) { | |
347 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10698
diff
changeset
|
348 markup = g_markup_escape_text(tmp, -1); |
9212 | 349 |
350 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
351 | |
352 g_free(tmp); | |
353 g_free(markup); | |
354 return status; | |
355 } else { | |
356 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
357 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
358 return GAIM_CMD_STATUS_OK; | |
359 } | |
360 } | |
361 | |
9213 | 362 static GaimCmdRet |
11145
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
363 clear_command_cb(GaimConversation *conv, |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
364 const char *cmd, char **args, char **error, void *data) |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
365 { |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
366 GaimGtkConversation *gtkconv = NULL; |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
367 |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
368 gtkconv = GAIM_GTK_CONVERSATION(conv); |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
369 |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
370 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
371 return GAIM_CMD_STATUS_OK; |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
372 } |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
373 |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
374 static GaimCmdRet |
9213 | 375 help_command_cb(GaimConversation *conv, |
9597 | 376 const char *cmd, char **args, char **error, void *data) |
9213 | 377 { |
9597 | 378 GList *l, *text; |
9213 | 379 GString *s; |
9597 | 380 |
381 if (args[0] != NULL) { | |
382 s = g_string_new(""); | |
383 text = gaim_cmd_help(conv, args[0]); | |
384 | |
385 if (text) { | |
386 for (l = text; l; l = l->next) | |
387 if (l->next) | |
9816 | 388 g_string_append_printf(s, "%s\n", (char *)l->data); |
9597 | 389 else |
9816 | 390 g_string_append_printf(s, "%s", (char *)l->data); |
9597 | 391 } else { |
392 g_string_append(s, _("No such command (in this context).")); | |
393 } | |
394 } else { | |
395 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
396 "The following commands are available in this context:\n")); | |
397 | |
398 text = gaim_cmd_list(conv); | |
399 for (l = text; l; l = l->next) | |
9213 | 400 if (l->next) |
9597 | 401 g_string_append_printf(s, "%s, ", (char *)l->data); |
9213 | 402 else |
9597 | 403 g_string_append_printf(s, "%s.", (char *)l->data); |
9213 | 404 } |
405 | |
406 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
407 g_string_free(s, TRUE); | |
408 | |
409 return GAIM_CMD_STATUS_OK; | |
410 } | |
411 | |
4359 | 412 static void |
9374 | 413 send_history_add(GaimConversation *conv, const char *message) |
414 { | |
415 GList *first; | |
416 | |
417 first = g_list_first(conv->send_history); | |
418 | |
419 if (first->data) | |
420 g_free(first->data); | |
421 | |
422 first->data = g_strdup(message); | |
423 | |
424 conv->send_history = g_list_prepend(first, NULL); | |
425 } | |
426 | |
9832 | 427 static gboolean |
428 check_for_and_do_command(GaimConversation *conv) | |
429 { | |
430 GaimGtkConversation *gtkconv; | |
431 char *cmd; | |
432 const char *prefix; | |
433 GaimAccount *account; | |
434 GtkTextIter start; | |
435 | |
436 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
437 account = gaim_conversation_get_account(conv); | |
438 prefix = gaim_gtk_get_cmd_prefix(); | |
439 | |
440 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
441 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); | |
442 | |
443 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) | |
444 && !gtk_text_iter_get_child_anchor(&start)) { | |
445 GaimCmdStatus status; | |
446 char *error, *cmdline, *markup, *send_history; | |
447 GtkTextIter end; | |
448 | |
449 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); | |
450 send_history_add(conv, send_history); | |
451 g_free(send_history); | |
452 | |
453 cmdline = cmd + strlen(prefix); | |
454 | |
455 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
456 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
457 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
458 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
459 g_free(cmd); | |
460 g_free(markup); | |
461 | |
462 switch (status) { | |
463 case GAIM_CMD_STATUS_OK: | |
464 return TRUE; | |
465 case GAIM_CMD_STATUS_NOT_FOUND: | |
466 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/passthrough_unknown_commands")) { | |
467 gaim_conversation_write(conv, "", _("No such command."), | |
468 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
469 | |
470 return TRUE; | |
471 } | |
472 return FALSE; | |
473 case GAIM_CMD_STATUS_WRONG_ARGS: | |
474 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " | |
475 "to that command."), | |
476 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
477 return TRUE; | |
478 case GAIM_CMD_STATUS_FAILED: | |
479 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), | |
480 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
481 if(error) | |
482 g_free(error); | |
483 return TRUE; | |
484 case GAIM_CMD_STATUS_WRONG_TYPE: | |
11338 | 485 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
10843 | 486 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
9832 | 487 GAIM_MESSAGE_NO_LOG, time(NULL)); |
488 else | |
10843 | 489 gaim_conversation_write(conv, "", _("That command only works in IMs, not chats."), |
9832 | 490 GAIM_MESSAGE_NO_LOG, time(NULL)); |
491 return TRUE; | |
492 case GAIM_CMD_STATUS_WRONG_PRPL: | |
493 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
494 GAIM_MESSAGE_NO_LOG, time(NULL)); | |
495 return TRUE; | |
496 } | |
497 } | |
498 | |
499 g_free(cmd); | |
500 return FALSE; | |
501 } | |
502 | |
9374 | 503 static void |
10810 | 504 send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
4359 | 505 { |
10810 | 506 GaimConversation *conv = gtkconv->active_conv; |
8655 | 507 GaimAccount *account; |
8677 | 508 GaimConnection *gc; |
12216 | 509 GaimMessageFlags flags = 0; |
8448 | 510 char *buf, *clean; |
4359 | 511 |
8655 | 512 account = gaim_conversation_get_account(conv); |
9130 | 513 |
9471 | 514 if (!gaim_account_is_connected(account)) |
515 return; | |
516 | |
11338 | 517 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) && |
9474 | 518 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) |
9471 | 519 return; |
520 | |
9832 | 521 if (check_for_and_do_command(conv)) { |
522 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
523 return; | |
9130 | 524 } |
525 | |
8442 | 526 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 527 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 528 |
4359 | 529 gtk_widget_grab_focus(gtkconv->entry); |
530 | |
8448 | 531 if (strlen(clean) == 0) { |
532 g_free(clean); | |
4359 | 533 return; |
534 } | |
535 | |
12272 | 536 gaim_idle_touch(); |
537 | |
12216 | 538 /* XXX: is there a better way to tell if the message has images? */ |
539 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL) | |
540 flags |= GAIM_MESSAGE_IMAGES; | |
541 | |
8677 | 542 gc = gaim_account_get_connection(account); |
10665 | 543 if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) { |
8677 | 544 char **bufs; |
545 int i; | |
546 | |
547 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
548 for (i = 0; bufs[i]; i++) { | |
9374 | 549 send_history_add(conv, bufs[i]); |
11338 | 550 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
12216 | 551 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), bufs[i], flags); |
11338 | 552 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
12216 | 553 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), bufs[i], flags); |
8677 | 554 } |
555 | |
556 g_strfreev(bufs); | |
557 | |
558 } else { | |
9374 | 559 send_history_add(conv, buf); |
11338 | 560 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
12216 | 561 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), buf, flags); |
11338 | 562 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
12216 | 563 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), buf, flags); |
8677 | 564 } |
4359 | 565 |
8677 | 566 g_free(clean); |
4359 | 567 g_free(buf); |
568 | |
8061 | 569 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
11613 | 570 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); |
4359 | 571 } |
572 | |
573 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
574 add_remove_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
4359 | 575 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
576 GaimAccount *account; |
4359 | 577 const char *name; |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
578 GaimConversation *conv = gtkconv->active_conv; |
4359 | 579 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
580 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
581 name = gaim_conversation_get_name(conv); |
7879 | 582 |
11338 | 583 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
7859 | 584 GaimBuddy *b; |
585 | |
586 b = gaim_find_buddy(account, name); | |
587 if (b != NULL) | |
9730 | 588 gaim_gtkdialogs_remove_buddy(b); |
7859 | 589 else if (account != NULL && gaim_account_is_connected(account)) |
590 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
11338 | 591 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
7859 | 592 GaimChat *c; |
593 | |
594 c = gaim_blist_find_chat(account, name); | |
595 if (c != NULL) | |
9730 | 596 gaim_gtkdialogs_remove_chat(c); |
7859 | 597 else if (account != NULL && gaim_account_is_connected(account)) |
9754 | 598 gaim_blist_request_add_chat(account, NULL, NULL, name); |
7859 | 599 } |
4359 | 600 |
601 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
602 } | |
603 | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
604 static void chat_do_info(GaimGtkConversation *gtkconv, const char *who) |
7975 | 605 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
606 GaimConversation *conv = gtkconv->active_conv; |
7975 | 607 GaimPluginProtocolInfo *prpl_info = NULL; |
608 GaimConnection *gc; | |
609 | |
610 if ((gc = gaim_conversation_get_gc(conv))) { | |
611 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
612 | |
613 /* | |
614 * If there are special needs for getting info on users in | |
615 * buddy chat "rooms"... | |
616 */ | |
617 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
618 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
619 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
620 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
621 } |
7975 | 622 else |
623 prpl_info->get_info(gc, who); | |
624 } | |
625 } | |
626 | |
627 | |
4359 | 628 static void |
10810 | 629 info_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
4359 | 630 { |
10810 | 631 GaimConversation *conv = gtkconv->active_conv; |
4359 | 632 |
11338 | 633 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
7879 | 634 serv_get_info(gaim_conversation_get_gc(conv), |
635 gaim_conversation_get_name(conv)); | |
636 | |
637 gtk_widget_grab_focus(gtkconv->entry); | |
11338 | 638 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
7879 | 639 /* Get info of the person currently selected in the GtkTreeView */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
640 GaimGtkChatPane *gtkchat; |
4359 | 641 GtkTreeIter iter; |
642 GtkTreeModel *model; | |
643 GtkTreeSelection *sel; | |
9554 | 644 char *name; |
4359 | 645 |
646 gtkchat = gtkconv->u.chat; | |
647 | |
648 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
649 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
650 | |
651 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
9498 | 652 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4359 | 653 else |
654 return; | |
655 | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
656 chat_do_info(gtkconv, name); |
9554 | 657 g_free(name); |
4359 | 658 } |
659 } | |
660 | |
661 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
662 block_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
4359 | 663 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
664 GaimConversation *conv = gtkconv->active_conv; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
665 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
666 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
667 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
668 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
669 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
670 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 671 |
672 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
673 } | |
674 | |
675 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
676 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 677 { |
678 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
679 GaimGtkConversation *gtkconv; |
4359 | 680 |
681 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
682 | |
683 if (resp == GTK_RESPONSE_OK) { | |
684 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
685 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
686 | |
10113 | 687 if (!g_ascii_strcasecmp(buddy, "")) |
4359 | 688 return; |
689 | |
690 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
691 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 692 message, buddy); |
693 } | |
694 | |
695 gtk_widget_destroy(invite_dialog); | |
696 invite_dialog = NULL; | |
697 | |
698 g_free(info); | |
699 } | |
700 | |
701 static void | |
9909 | 702 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
703 GtkSelectionData *sd, guint inf, guint t, gpointer data) | |
704 { | |
705 InviteBuddyInfo *info = (InviteBuddyInfo *)data; | |
706 const char *convprotocol; | |
707 | |
708 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv)); | |
709 | |
710 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | |
711 { | |
712 GaimBlistNode *node = NULL; | |
713 GaimBuddy *buddy; | |
714 | |
715 memcpy(&node, sd->data, sizeof(node)); | |
716 | |
717 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | |
718 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); | |
719 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
720 buddy = (GaimBuddy *)node; | |
721 else | |
722 return; | |
723 | |
724 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | |
725 { | |
726 gaim_notify_error(NULL, NULL, | |
727 _("That buddy is not on the same protocol as this " | |
10843 | 728 "chat."), NULL); |
9909 | 729 } |
730 else | |
731 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | |
732 | |
733 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
734 } | |
735 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | |
736 { | |
737 char *protocol = NULL; | |
738 char *username = NULL; | |
739 GaimAccount *account; | |
740 | |
11137 | 741 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
9909 | 742 &protocol, &username, NULL)) |
743 { | |
744 if (account == NULL) | |
745 { | |
746 gaim_notify_error(NULL, NULL, | |
747 _("You are not currently signed on with an account that " | |
748 "can invite that buddy."), NULL); | |
749 } | |
750 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | |
751 { | |
752 gaim_notify_error(NULL, NULL, | |
753 _("That buddy is not on the same protocol as this " | |
10843 | 754 "chat."), NULL); |
9909 | 755 } |
756 else | |
757 { | |
758 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); | |
759 } | |
760 } | |
761 | |
762 if (username != NULL) g_free(username); | |
763 if (protocol != NULL) g_free(protocol); | |
764 | |
765 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
766 } | |
767 } | |
768 | |
769 static const GtkTargetEntry dnd_targets[] = | |
770 { | |
771 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, | |
772 {"application/x-im-contact", 0, 1} | |
773 }; | |
774 | |
775 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
776 invite_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
4359 | 777 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
778 GaimConversation *conv = gtkconv->active_conv; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
779 InviteBuddyInfo *info = NULL; |
4359 | 780 |
781 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
782 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
783 GaimGtkWindow *gtkwin; |
4359 | 784 GtkWidget *label; |
785 GtkWidget *vbox, *hbox; | |
786 GtkWidget *table; | |
787 GtkWidget *img; | |
788 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
789 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
11581 | 790 GTK_ICON_SIZE_DIALOG); |
4359 | 791 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
792 info = g_new0(InviteBuddyInfo, 1); |
4359 | 793 info->conv = conv; |
794 | |
11581 | 795 gc = gaim_conversation_get_gc(conv); |
796 gtkwin = gaim_gtkconv_get_window(gtkconv); | |
4359 | 797 |
798 /* Create the new dialog. */ | |
799 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 800 _("Invite Buddy Into Chat Room"), |
7879 | 801 GTK_WINDOW(gtkwin->window), 0, |
802 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
803 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 804 |
805 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
11581 | 806 GTK_RESPONSE_OK); |
11243 | 807 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), GAIM_HIG_BOX_SPACE); |
4359 | 808 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); |
809 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
810 | |
9909 | 811 info->window = GTK_WIDGET(invite_dialog); |
812 | |
4359 | 813 /* Setup the outside spacing. */ |
814 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
815 | |
11243 | 816 gtk_box_set_spacing(GTK_BOX(vbox), GAIM_HIG_BORDER); |
817 gtk_container_set_border_width(GTK_CONTAINER(vbox), GAIM_HIG_BOX_SPACE); | |
4359 | 818 |
819 /* Setup the inner hbox and put the dialog's icon in it. */ | |
11243 | 820 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
4359 | 821 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
822 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
823 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
824 | |
825 /* Setup the right vbox. */ | |
826 vbox = gtk_vbox_new(FALSE, 0); | |
827 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
828 | |
829 /* Put our happy label in it. */ | |
830 label = gtk_label_new(_("Please enter the name of the user you wish " | |
831 "to invite, along with an optional invite " | |
832 "message.")); | |
833 gtk_widget_set_size_request(label, 350, -1); | |
834 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
835 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
836 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
837 | |
838 /* hbox for the table, and to give it some spacing on the left. */ | |
11243 | 839 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
4359 | 840 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
841 | |
842 /* Setup the table we're going to use to lay stuff out. */ | |
843 table = gtk_table_new(2, 2, FALSE); | |
11243 | 844 gtk_table_set_row_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE); |
845 gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE); | |
846 gtk_container_set_border_width(GTK_CONTAINER(table), GAIM_HIG_BORDER); | |
4359 | 847 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); |
848 | |
849 /* Now the Buddy label */ | |
850 label = gtk_label_new(NULL); | |
851 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
852 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
853 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
854 | |
855 /* Now the Buddy drop-down entry field. */ | |
856 info->entry = gtk_combo_new(); | |
857 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
858 gtk_entry_set_activates_default( | |
859 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
860 | |
861 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
862 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
863 | |
864 /* Fill in the names. */ | |
865 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
866 generate_invite_user_names(gc)); | |
867 | |
868 | |
869 /* Now the label for "Message" */ | |
870 label = gtk_label_new(NULL); | |
871 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
872 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
873 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
874 | |
875 | |
876 /* And finally, the Message entry field. */ | |
877 info->message = gtk_entry_new(); | |
878 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
879 | |
880 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
881 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
882 | |
883 /* Connect the signals. */ | |
884 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
885 G_CALLBACK(do_invite), info); | |
9909 | 886 /* Setup drag-and-drop */ |
887 gtk_drag_dest_set(info->window, | |
888 GTK_DEST_DEFAULT_MOTION | | |
889 GTK_DEST_DEFAULT_DROP, | |
890 dnd_targets, | |
891 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
892 GDK_ACTION_COPY); | |
893 gtk_drag_dest_set(info->entry, | |
894 GTK_DEST_DEFAULT_MOTION | | |
895 GTK_DEST_DEFAULT_DROP, | |
896 dnd_targets, | |
897 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
898 GDK_ACTION_COPY); | |
899 | |
900 g_signal_connect(G_OBJECT(info->window), "drag_data_received", | |
901 G_CALLBACK(invite_dnd_recv), info); | |
902 g_signal_connect(G_OBJECT(info->entry), "drag_data_received", | |
903 G_CALLBACK(invite_dnd_recv), info); | |
904 | |
4359 | 905 } |
906 | |
907 gtk_widget_show_all(invite_dialog); | |
908 | |
909 if (info != NULL) | |
910 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
911 } | |
912 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
913 static void |
7748 | 914 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
915 { | |
9714 | 916 gaim_gtkdialogs_im(); |
7748 | 917 } |
918 | |
919 static void | |
9504 | 920 savelog_writefile_cb(void *user_data, const char *filename) |
9489 | 921 { |
9504 | 922 GaimConversation *conv = (GaimConversation *)user_data; |
9489 | 923 FILE *fp; |
924 const char *name; | |
10849 | 925 gchar *text; |
9489 | 926 |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10572
diff
changeset
|
927 if ((fp = g_fopen(filename, "w+")) == NULL) { |
9504 | 928 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9489 | 929 return; |
930 } | |
931 | |
932 name = gaim_conversation_get_name(conv); | |
10849 | 933 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); |
9489 | 934 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); |
10849 | 935 |
936 text = gtk_imhtml_get_markup( | |
937 GTK_IMHTML(GAIM_GTK_CONVERSATION(conv)->imhtml)); | |
938 fprintf(fp, "%s", text); | |
939 g_free(text); | |
940 | |
941 fprintf(fp, "\n</body>\n</html>\n"); | |
9489 | 942 fclose(fp); |
943 } | |
944 | |
10849 | 945 /* |
946 * It would be kinda cool if this gave the option of saving a | |
947 * plaintext v. HTML file. | |
948 */ | |
9489 | 949 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 { |
11581 | 952 GaimGtkWindow *win = data; |
953 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); | |
9489 | 954 gchar *buf; |
955 | |
956 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | |
9504 | 957 |
10849 | 958 gaim_request_file(conv, _("Save Conversation"), gaim_escape_filename(buf), |
959 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); | |
9489 | 960 |
961 g_free(buf); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 { |
11581 | 967 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 GaimConversation *conv; |
9917 | 969 GaimLogType type; |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
970 GaimGtkBuddyList *gtkblist; |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
971 GdkCursor *cursor; |
10809
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
972 const char *name; |
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
973 GaimAccount *account; |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
974 GSList *buddies; |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
975 GSList *cur; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
976 |
11581 | 977 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 |
11338 | 979 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
9917 | 980 type = GAIM_LOG_IM; |
11338 | 981 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
9917 | 982 type = GAIM_LOG_CHAT; |
983 else | |
984 return; | |
985 | |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
986 gtkblist = gaim_gtk_blist_get_default_gtk_blist(); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
987 cursor = gdk_cursor_new(GDK_WATCH); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
988 |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
989 gdk_window_set_cursor(gtkblist->window->window, cursor); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
990 gdk_window_set_cursor(win->window->window, cursor); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
991 gdk_cursor_unref(cursor); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
992 while (gtk_events_pending()) |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
993 gtk_main_iteration(); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
994 |
10809
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
995 name = gaim_conversation_get_name(conv); |
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
996 account = gaim_conversation_get_account(conv); |
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
997 |
10845 | 998 buddies = gaim_find_buddies(account, name); |
999 for (cur = buddies; cur != NULL; cur = cur->next) | |
1000 { | |
1001 GaimBlistNode *node = cur->data; | |
10846 | 1002 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) |
10845 | 1003 { |
1004 gaim_gtk_log_show_contact((GaimContact *)node->parent); | |
1005 g_slist_free(buddies); | |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1006 gdk_window_set_cursor(gtkblist->window->window, NULL); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1007 gdk_window_set_cursor(win->window->window, NULL); |
10845 | 1008 return; |
1009 } | |
10809
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
1010 } |
10845 | 1011 g_slist_free(buddies); |
10809
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
1012 |
f9e01ccd6046
[gaim-migrate @ 12461]
Luke Schierer <lschiere@pidgin.im>
parents:
10807
diff
changeset
|
1013 gaim_gtk_log_show(type, name, account); |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1014 |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1015 gdk_window_set_cursor(gtkblist->window->window, NULL); |
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1016 gdk_window_set_cursor(win->window->window, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 |
8974 | 1019 static void |
1020 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
1021 { | |
11581 | 1022 GaimGtkWindow *win = data; |
8974 | 1023 GaimConversation *conv; |
1024 GaimGtkConversation *gtkconv; | |
1025 | |
11581 | 1026 conv = gaim_gtk_conv_window_get_active_conversation(win); |
8974 | 1027 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1028 | |
1029 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1030 } | |
1031 | |
7295 | 1032 struct _search { |
1033 GaimGtkConversation *gtkconv; | |
1034 GtkWidget *entry; | |
1035 }; | |
1036 | |
7929 | 1037 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 1038 { |
7929 | 1039 switch (resp) { |
1040 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1041 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1042 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 1043 break; |
1044 | |
1045 case GTK_RESPONSE_DELETE_EVENT: | |
1046 case GTK_RESPONSE_CLOSE: | |
1047 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
1048 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
1049 s->gtkconv->dialogs.search = NULL; | |
1050 g_free(s); | |
1051 break; | |
1052 } | |
7295 | 1053 } |
1054 | |
1055 static void | |
7751 | 1056 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 1057 { |
11581 | 1058 GaimGtkWindow *gtkwin = data; |
1059 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(gtkwin); | |
7295 | 1060 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
7929 | 1061 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1062 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1063 GTK_ICON_SIZE_DIALOG); |
7929 | 1064 GtkWidget *label; |
7295 | 1065 struct _search *s; |
1066 | |
7798 | 1067 if (gtkconv->dialogs.search) { |
1068 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 1069 return; |
7798 | 1070 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
1071 |
7295 | 1072 s = g_malloc(sizeof(struct _search)); |
1073 s->gtkconv = gtkconv; | |
7929 | 1074 |
1075 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
1076 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
1077 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
1078 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1079 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1080 GTK_RESPONSE_OK); |
7929 | 1081 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
1082 G_CALLBACK(do_search_cb), s); | |
1083 | |
11243 | 1084 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), GAIM_HIG_BOX_SPACE); |
7929 | 1085 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); |
1086 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
11243 | 1087 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), GAIM_HIG_BORDER); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1088 gtk_container_set_border_width( |
11243 | 1089 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), GAIM_HIG_BOX_SPACE); |
1090 | |
1091 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1092 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1093 hbox); |
7929 | 1094 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
1095 | |
1096 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1097 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1098 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1099 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1100 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1101 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 1102 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1103 | |
1104 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1105 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1106 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 1107 g_signal_connect(G_OBJECT(s->entry), "changed", |
1108 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
1109 gtkconv->dialogs.search); | |
1110 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
1111 |
7295 | 1112 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 1113 gtk_widget_grab_focus(s->entry); |
7295 | 1114 } |
1115 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 static void |
9468 | 1117 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
1118 { | |
11581 | 1119 GaimGtkWindow *win = data; |
1120 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); | |
9468 | 1121 |
11338 | 1122 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
9468 | 1123 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); |
1124 } | |
1125 | |
1126 } | |
1127 | |
1128 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 { |
11581 | 1131 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 |
11581 | 1134 conv = gaim_gtk_conv_window_get_active_gtkconv(win)->active_conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 |
12136
370f9d7868f9
[gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents:
12132
diff
changeset
|
1136 gaim_gtk_pounce_editor_show(gaim_conversation_get_account(conv), |
370f9d7868f9
[gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents:
12132
diff
changeset
|
1137 gaim_conversation_get_name(conv), NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1139 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 { |
11581 | 1143 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1144 GaimGtkConversation *gtkconv; |
8756 | 1145 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1146 |
11581 | 1147 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); |
8756 | 1148 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1149 | |
1150 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
1151 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1156 { |
11581 | 1157 GaimGtkWindow *win = data; |
8756 | 1158 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 GaimGtkConversation *gtkconv; |
8756 | 1160 GtkIMHtmlToolbar *toolbar; |
1161 | |
11581 | 1162 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); |
1163 conv = gtkconv->active_conv; | |
8756 | 1164 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1165 | |
1166 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
1167 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1169 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 { |
11581 | 1173 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 GaimConversation *conv; |
7879 | 1175 GaimAccount *account; |
1176 const char *name; | |
1177 | |
11581 | 1178 conv = gaim_gtk_conv_window_get_active_conversation(win); |
7879 | 1179 account = gaim_conversation_get_account(conv); |
1180 name = gaim_conversation_get_name(conv); | |
1181 | |
11338 | 1182 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
7879 | 1183 GaimBuddy *b; |
1184 | |
1185 b = gaim_find_buddy(account, name); | |
1186 if (b != NULL) | |
9730 | 1187 gaim_gtkdialogs_alias_buddy(b); |
11338 | 1188 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
7879 | 1189 GaimChat *c; |
1190 | |
1191 c = gaim_blist_find_chat(account, name); | |
1192 if (c != NULL) | |
9730 | 1193 gaim_gtkdialogs_alias_chat(c); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 { |
11581 | 1200 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 |
11581 | 1203 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 |
10810 | 1205 info_cb(NULL, GAIM_GTK_CONVERSATION(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 { |
11581 | 1211 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 |
11581 | 1214 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1216 invite_cb(NULL, GAIM_GTK_CONVERSATION(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 { |
11581 | 1222 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 |
11581 | 1225 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1227 block_cb(NULL, GAIM_GTK_CONVERSATION(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 { |
11581 | 1233 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 |
11581 | 1236 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1238 add_remove_cb(NULL, GAIM_GTK_CONVERSATION(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 { |
11581 | 1244 GaimGtkWindow *win = data; |
1245 | |
1246 close_conv_cb(NULL, GAIM_GTK_CONVERSATION(gaim_gtk_conv_window_get_active_conversation(win))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 { |
11581 | 1252 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1253 GaimConversation *conv; |
11805
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1254 gboolean logging; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 |
11581 | 1256 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 |
11805
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1261 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1262 |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1263 if (logging == gaim_conversation_is_logging(conv)) |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1264 return; |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1265 |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1266 if (logging) |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1267 { |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1268 /* Enable logging first so the message below can be logged. */ |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1269 gaim_conversation_set_logging(conv, TRUE); |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1270 |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1271 gaim_conversation_write(conv, NULL, |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1272 _("Logging started. Future messages in this conversation will be logged."), |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1273 conv->logs ? (GAIM_MESSAGE_SYSTEM) : |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1274 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG), |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1275 time(NULL)); |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1276 } |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1277 else |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1278 { |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1279 gaim_conversation_write(conv, NULL, |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1280 _("Logging stopped. Future messages in this conversation will not be logged."), |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1281 conv->logs ? (GAIM_MESSAGE_SYSTEM) : |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1282 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG), |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1283 time(NULL)); |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1284 |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1285 /* Disable the logging second, so that the above message can be logged. */ |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1286 gaim_conversation_set_logging(conv, FALSE); |
615c2fd3d72e
[gaim-migrate @ 14096]
Richard Laager <rlaager@wiktel.com>
parents:
11799
diff
changeset
|
1287 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1288 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1289 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1291 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1292 { |
11581 | 1293 GaimGtkWindow *win = data; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1294 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1295 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1296 |
11581 | 1297 conv = gaim_gtk_conv_window_get_active_conversation(win); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1298 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1299 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1300 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1301 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1302 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1303 |
10377 | 1304 gaim_prefs_set_bool("/gaim/gtk/conversations/show_formatting_toolbar", |
11581 | 1305 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1306 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1307 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1308 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1310 { |
11581 | 1311 GaimGtkWindow *win = data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1312 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 |
11581 | 1315 conv = gaim_gtk_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1320 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1321 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1322 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1323 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1324 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1325 |
7961 | 1326 static void |
9188 | 1327 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1328 { | |
11581 | 1329 GaimGtkWindow *win = data; |
9188 | 1330 GaimConversation *conv; |
1331 GaimGtkConversation *gtkconv; | |
1332 | |
11581 | 1333 conv = gaim_gtk_conv_window_get_active_conversation(win); |
9188 | 1334 |
1335 if (!conv) | |
1336 return; | |
1337 | |
1338 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1339 | |
12188 | 1340 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", |
9188 | 1341 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
1342 } | |
1343 | |
1344 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1345 chat_do_im(GaimGtkConversation *gtkconv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1346 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1347 GaimConversation *conv = gtkconv->active_conv; |
10431 | 1348 GaimAccount *account; |
1349 GaimConnection *gc; | |
7961 | 1350 GaimPluginProtocolInfo *prpl_info = NULL; |
1351 char *real_who; | |
1352 | |
1353 account = gaim_conversation_get_account(conv); | |
10431 | 1354 g_return_if_fail(account != NULL); |
1355 | |
1356 gc = gaim_account_get_connection(account); | |
1357 g_return_if_fail(gc != NULL); | |
1358 | |
1359 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1360 | |
1361 if (prpl_info && prpl_info->get_cb_real_name) | |
1362 real_who = prpl_info->get_cb_real_name(gc, | |
7961 | 1363 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
1364 else | |
1365 real_who = g_strdup(who); | |
1366 | |
1367 if(!real_who) | |
1368 return; | |
1369 | |
10431 | 1370 gaim_gtkdialogs_im_with_user(account, real_who); |
7961 | 1371 |
1372 g_free(real_who); | |
1373 } | |
1374 | |
1375 static void | |
10810 | 1376 chat_im_button_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
7961 | 1377 { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1378 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1379 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1380 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1381 GtkTreeSelection *sel; |
9554 | 1382 char *name; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1383 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1384 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1385 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1386 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1387 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1388 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1389 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
9498 | 1390 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1391 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1392 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1393 |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1394 chat_do_im(gtkconv, name); |
9554 | 1395 g_free(name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1396 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1397 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1398 static void |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1399 ignore_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1400 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1401 GaimConversation *conv = gtkconv->active_conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1402 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1403 GaimConvChat *chat; |
11869 | 1404 GaimConvChatBuddyFlags flags; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1405 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1406 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1407 GtkTreeSelection *sel; |
10504 | 1408 char *name; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1409 char *alias; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1410 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1411 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1412 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1413 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1414 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1415 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1416 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1417 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1418 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1419 CHAT_USERS_NAME_COLUMN, &name, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1420 CHAT_USERS_ALIAS_COLUMN, &alias, |
11869 | 1421 CHAT_USERS_FLAGS_COLUMN, &flags, |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1422 -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1423 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1424 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1425 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1426 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1427 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1428 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1429 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1430 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1431 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1432 |
11869 | 1433 add_chat_buddy_common(conv, name, flags, alias, NULL); |
10504 | 1434 g_free(name); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1435 g_free(alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1436 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1437 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1438 static void |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1439 menu_chat_im_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
7398 | 1440 { |
1441 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1442 | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1443 chat_do_im(gtkconv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1444 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1445 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1446 static void |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1447 menu_chat_send_file_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
9468 | 1448 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1449 GaimConversation *conv = gtkconv->active_conv; |
9468 | 1450 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); |
1451 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1452 | |
1453 serv_send_file(gc, who, NULL); | |
1454 } | |
1455 | |
1456 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1457 menu_chat_info_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1460 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1461 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1462 |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1463 chat_do_info(gtkconv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1464 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1465 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1466 static void |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1467 menu_chat_get_away_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1468 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1469 GaimConversation *conv = gtkconv->active_conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1470 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1471 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1472 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1473 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1474 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1475 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1477 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1478 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1479 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1480 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1481 * May want to expand this to work similarly to menu_info_cb? |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1482 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1483 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1484 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1485 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1486 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1487 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1488 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1489 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1490 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1491 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1492 static void |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1493 menu_chat_add_remove_cb(GtkWidget *w, GaimGtkConversation *gtkconv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1494 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1495 GaimConversation *conv = gtkconv->active_conv; |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1496 GaimAccount *account; |
6695 | 1497 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1498 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1499 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1500 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1501 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1502 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1503 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1504 if (b != NULL) |
9730 | 1505 gaim_gtkdialogs_remove_buddy(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1506 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1507 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1508 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1509 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1510 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1511 |
8143 | 1512 static GtkWidget * |
10504 | 1513 create_chat_menu(GaimConversation *conv, const char *who, |
8143 | 1514 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) |
1515 { | |
1516 static GtkWidget *menu = NULL; | |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
1517 GaimConvChat *chat = GAIM_CONV_CHAT(conv); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1518 gboolean is_me = FALSE; |
8143 | 1519 GtkWidget *button; |
1520 | |
1521 /* | |
1522 * If a menu already exists, destroy it before creating a new one, | |
1523 * thus freeing-up the memory it occupied. | |
1524 */ | |
1525 if (menu) | |
1526 gtk_widget_destroy(menu); | |
1527 | |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
1528 if (!strcmp(chat->nick, gaim_normalize(conv->account, who))) |
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
1529 is_me = TRUE; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1530 |
8143 | 1531 menu = gtk_menu_new(); |
1532 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1533 if (!is_me) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1534 button = gaim_new_item_from_stock(menu, _("IM"), GAIM_STOCK_IM, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1535 G_CALLBACK(menu_chat_im_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1536 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1537 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1538 if (prpl_info && prpl_info->send_file |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1539 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { |
11508 | 1540 button = gaim_new_item_from_stock(menu, _("Send File"), |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1541 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb), |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1542 GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1543 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1544 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1545 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1546 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1547 button = gaim_new_item_from_stock(menu, _("Un-Ignore"), GAIM_STOCK_IGNORE, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1548 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1549 else |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1550 button = gaim_new_item_from_stock(menu, _("Ignore"), GAIM_STOCK_IGNORE, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1551 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
10504 | 1552 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
9468 | 1553 } |
9498 | 1554 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1555 if (prpl_info->get_info || prpl_info->get_cb_info) { |
10221 | 1556 button = gaim_new_item_from_stock(menu, _("Info"), GAIM_STOCK_INFO, |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1557 G_CALLBACK(menu_chat_info_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
10504 | 1558 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
8143 | 1559 } |
1560 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1561 if (prpl_info->get_cb_away) { |
10221 | 1562 button = gaim_new_item_from_stock(menu, _("Get Away Message"), GAIM_STOCK_AWAY, |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1563 G_CALLBACK(menu_chat_get_away_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
10504 | 1564 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
8143 | 1565 } |
1566 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
1567 if (!is_me && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
8143 | 1568 if (gaim_find_buddy(gc->account, who)) |
10221 | 1569 button = gaim_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1570 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
8143 | 1571 else |
10221 | 1572 button = gaim_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD, |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1573 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); |
10504 | 1574 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
8143 | 1575 } |
1576 | |
1577 return menu; | |
1578 } | |
1579 | |
1580 | |
1581 static gint | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1582 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
8143 | 1583 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1584 GaimConversation *conv = gtkconv->active_conv; |
8143 | 1585 GaimPluginProtocolInfo *prpl_info = NULL; |
1586 GaimGtkChatPane *gtkchat; | |
1587 GaimConnection *gc; | |
1588 GaimAccount *account; | |
1589 GtkTreeSelection *sel; | |
1590 GtkTreeIter iter; | |
1591 GtkTreeModel *model; | |
1592 GtkWidget *menu; | |
1593 gchar *who; | |
1594 | |
1595 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1596 gtkchat = gtkconv->u.chat; | |
1597 account = gaim_conversation_get_account(conv); | |
1598 gc = account->gc; | |
1599 | |
1600 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1601 | |
1602 if (gc != NULL) | |
1603 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1604 | |
1605 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1606 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1607 return FALSE; | |
1608 | |
9498 | 1609 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
8143 | 1610 menu = create_chat_menu (conv, who, prpl_info, gc); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1611 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1612 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1613 0, GDK_CURRENT_TIME); |
10504 | 1614 g_free(who); |
8143 | 1615 |
1616 return TRUE; | |
1617 } | |
1618 | |
1619 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1620 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1621 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1622 GaimGtkConversation *gtkconv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1623 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1624 GaimConversation *conv = gtkconv->active_conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1625 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1626 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1627 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1628 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1629 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1630 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1631 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1632 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1633 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1634 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1635 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1636 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1637 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1638 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1639 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1640 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1641 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1642 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1643 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1644 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1645 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1646 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1647 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1648 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1649 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1650 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1651 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1652 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1653 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1654 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
9498 | 1655 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1656 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1657 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
1658 chat_do_im(gtkconv, who); |
7398 | 1659 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
8143 | 1660 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1661 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1662 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1663 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1664 |
10504 | 1665 g_free(who); |
1666 gtk_tree_path_free(path); | |
1667 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1668 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1669 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1670 |
8133 | 1671 static void |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1672 move_to_next_unread_tab(GaimGtkConversation *gtkconv, gboolean forward) |
8133 | 1673 { |
10827 | 1674 GaimGtkConversation *next_gtkconv = NULL; |
11581 | 1675 GaimGtkWindow *win; |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1676 int index, i, total, found = 0; |
8133 | 1677 |
11581 | 1678 win = gtkconv->win; |
1679 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); | |
1680 total = gaim_gtk_conv_window_get_gtkconv_count(win); | |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1681 |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1682 /* First check the tabs after (forward) or before (!forward) this position. */ |
11620
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
1683 for (i = forward ? index + 1 : index - 1; |
11581 | 1684 !found && (next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i)); |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1685 forward ? i++ : i--) { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1686 if (i == -1) { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1687 break; |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1688 } |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1689 |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1690 if (next_gtkconv->unseen_state > 0) |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1691 found = 1; |
8133 | 1692 } |
11252 | 1693 |
10893
3f85d6fc763a
[gaim-migrate @ 12606]
Luke Schierer <lschiere@pidgin.im>
parents:
10892
diff
changeset
|
1694 if (!found) { |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1695 /* Now check from the beginning up to (forward) or end back to (!forward) this position. */ |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1696 for (i = forward ? 0 : total - 1; |
11620
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
1697 !found && (forward ? i < index : i >= 0) && |
fbc4eeab2227
[gaim-migrate @ 13894]
Luke Schierer <lschiere@pidgin.im>
parents:
11619
diff
changeset
|
1698 (next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i)); |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1699 forward ? i++ : i--) { |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1700 |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1701 if (next_gtkconv->unseen_state > 0) |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
1702 found = 1; |
8133 | 1703 } |
10827 | 1704 |
10893
3f85d6fc763a
[gaim-migrate @ 12606]
Luke Schierer <lschiere@pidgin.im>
parents:
10892
diff
changeset
|
1705 if (!found) { |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1706 /* Okay, just grab the next (forward) or previous (!forward) conversation tab. */ |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1707 if (forward) { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1708 index++; |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1709 } |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1710 else { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1711 index = (index == 0) ? total - 1 : index - 1; |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1712 } |
11581 | 1713 if (!(next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, index))) |
1714 next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, 0); | |
10827 | 1715 } |
8133 | 1716 } |
1717 | |
10827 | 1718 if (next_gtkconv != NULL && next_gtkconv != gtkconv) |
11581 | 1719 gaim_gtk_conv_window_switch_gtkconv(win, next_gtkconv); |
8133 | 1720 } |
1721 | |
4359 | 1722 static gboolean |
8105 | 1723 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1724 { |
11581 | 1725 GaimGtkWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1726 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1727 GaimGtkConversation *gtkconv; |
8105 | 1728 int curconv; |
1729 | |
10810 | 1730 gtkconv = (GaimGtkConversation *)data; |
10849 | 1731 conv = gtkconv->active_conv; |
11581 | 1732 win = gtkconv->win; |
1733 curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); | |
10839 | 1734 |
8105 | 1735 /* If CTRL was held down... */ |
1736 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1737 switch (event->keyval) { |
1738 case GDK_Up: | |
1739 if (!conv->send_history) | |
1740 break; | |
1741 | |
1742 if (!conv->send_history->prev) { | |
1743 GtkTextIter start, end; | |
1744 | |
1745 if (conv->send_history->data) | |
1746 g_free(conv->send_history->data); | |
1747 | |
1748 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1749 &start); | |
1750 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1751 | |
1752 conv->send_history->data = | |
8506 | 1753 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1754 } |
8677 | 1755 |
11276
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1756 if (conv->send_history->next && conv->send_history->next->data) { |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1757 GObject *object; |
8677 | 1758 GtkTextIter iter; |
1759 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1760 |
1761 conv->send_history = conv->send_history->next; | |
11276
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1762 |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1763 /* Block the signal to prevent application of default formatting. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1764 object = g_object_ref(G_OBJECT(gtkconv->entry)); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1765 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1766 NULL, gtkconv); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1767 /* Clear the formatting. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1768 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1769 /* Unblock the signal. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1770 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1771 NULL, gtkconv); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1772 g_object_unref(object); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1773 |
8061 | 1774 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1775 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1776 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1777 0, NULL); |
8677 | 1778 /* this is mainly just a hack so the formatting at the |
1779 * cursor gets picked up. */ | |
1780 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1781 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1782 } |
1783 | |
8105 | 1784 return TRUE; |
4359 | 1785 break; |
1786 | |
1787 case GDK_Down: | |
1788 if (!conv->send_history) | |
1789 break; | |
1790 | |
11276
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1791 if (conv->send_history->prev && conv->send_history->prev->data) { |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1792 GObject *object; |
8677 | 1793 GtkTextIter iter; |
1794 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1795 |
4359 | 1796 conv->send_history = conv->send_history->prev; |
11276
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1797 |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1798 /* Block the signal to prevent application of default formatting. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1799 object = g_object_ref(G_OBJECT(gtkconv->entry)); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1800 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1801 NULL, gtkconv); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1802 /* Clear the formatting. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1803 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1804 /* Unblock the signal. */ |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1805 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1806 NULL, gtkconv); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1807 g_object_unref(object); |
17ebda61c6ce
[gaim-migrate @ 13463]
Richard Laager <rlaager@wiktel.com>
parents:
11275
diff
changeset
|
1808 |
8105 | 1809 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1810 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1811 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1812 0, NULL); |
8677 | 1813 /* this is mainly just a hack so the formatting at the |
1814 * cursor gets picked up. */ | |
11267
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1815 if (*(char *)conv->send_history->data) { |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1816 gtk_text_buffer_get_end_iter(buffer, &iter); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1817 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1818 } else { |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1819 /* Restore the default formatting */ |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1820 default_formatize(gtkconv); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
1821 } |
4359 | 1822 } |
1823 | |
8105 | 1824 return TRUE; |
4359 | 1825 break; |
8105 | 1826 |
8108 | 1827 case GDK_Page_Down: |
8143 | 1828 case ']': |
11581 | 1829 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv + 1)) |
1830 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); | |
10827 | 1831 else |
11581 | 1832 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv + 1); |
8105 | 1833 return TRUE; |
1834 break; | |
1835 | |
8108 | 1836 case GDK_Page_Up: |
8143 | 1837 case '[': |
11581 | 1838 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv - 1)) |
1839 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1); | |
10827 | 1840 else |
11581 | 1841 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv - 1); |
8133 | 1842 return TRUE; |
1843 break; | |
1844 | |
8108 | 1845 case GDK_Tab: |
11467
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1846 case GDK_ISO_Left_Tab: |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1847 if (event->state & GDK_SHIFT_MASK) { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1848 move_to_next_unread_tab(gtkconv, FALSE); |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1849 } else { |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1850 move_to_next_unread_tab(gtkconv, TRUE); |
2952c6dfa738
[gaim-migrate @ 13707]
Luke Schierer <lschiere@pidgin.im>
parents:
11460
diff
changeset
|
1851 } |
8108 | 1852 |
1853 return TRUE; | |
1854 break; | |
1855 | |
11252 | 1856 case GDK_comma: |
11581 | 1857 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), |
1858 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), | |
11252 | 1859 curconv - 1); |
1860 break; | |
1861 | |
1862 case GDK_period: | |
11581 | 1863 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), |
1864 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), | |
11780 | 1865 #if GTK_CHECK_VERSION(2,2,0) |
11581 | 1866 (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook))); |
11780 | 1867 #else |
1868 (curconv + 1) % g_list_length(GTK_NOTEBOOK(win->notebook)->children)); | |
1869 #endif | |
11252 | 1870 break; |
1871 | |
8105 | 1872 } /* End of switch */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1873 } |
8758 | 1874 |
8105 | 1875 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1876 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1877 { |
10864 | 1878 if (event->keyval > '0' && event->keyval <= '9') |
1879 { | |
12232
375f1f3817a8
[gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1880 guint switchto = event->keyval - '1'; |
11581 | 1881 if (switchto < gaim_gtk_conv_window_get_gtkconv_count(win)) |
1882 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto); | |
4359 | 1883 |
1884 return TRUE; | |
1885 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1886 } |
8758 | 1887 |
8105 | 1888 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1889 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1890 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1891 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1892 { |
10678
210e38f53b7b
[gaim-migrate @ 12221]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10666
diff
changeset
|
1893 case GDK_Tab: |
9605 | 1894 return tab_complete(conv); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1895 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1896 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1897 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1898 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1899 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1900 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1901 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1902 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1903 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1904 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1905 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1906 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1907 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1908 } |
4359 | 1909 return FALSE; |
1910 } | |
1911 | |
1912 /* | |
1913 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1914 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1915 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1916 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1917 * going all the way down to the notebook. I suspect a bug in |
4359 | 1918 * GtkTextView, but I'm not ready to point any fingers yet. |
1919 */ | |
1920 static gboolean | |
1921 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1922 { | |
1923 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1924 /* Right single click */ | |
1925 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1926 | |
1927 return TRUE; | |
1928 } | |
1929 | |
1930 return FALSE; | |
1931 } | |
1932 | |
8173 | 1933 /* |
1934 * If someone tries to type into the conversation backlog of a | |
1935 * conversation window then we yank focus from the conversation backlog | |
1936 * and give it to the text entry box so that people can type | |
1937 * all the live long day and it will get entered into the entry box. | |
1938 */ | |
6057 | 1939 static gboolean |
8105 | 1940 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1941 { |
1942 GaimGtkConversation *gtkconv = data; | |
1943 | |
8237 | 1944 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1945 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1946 (event->keyval == GDK_F10) || |
1947 (event->keyval == GDK_Shift_L) || | |
1948 (event->keyval == GDK_Shift_R) || | |
1949 (event->keyval == GDK_Escape) || | |
8177 | 1950 (event->keyval == GDK_Up) || |
1951 (event->keyval == GDK_Down) || | |
1952 (event->keyval == GDK_Left) || | |
8191 | 1953 (event->keyval == GDK_Right) || |
1954 (event->keyval == GDK_Home) || | |
9297 | 1955 (event->keyval == GDK_End) || |
1956 (event->keyval == GDK_Tab) || | |
1957 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1958 return FALSE; |
1959 | |
1960 if (event->type == GDK_KEY_RELEASE) | |
1961 gtk_widget_grab_focus(gtkconv->entry); | |
1962 | |
1963 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1964 | |
1965 return TRUE; | |
6057 | 1966 } |
1967 | |
4359 | 1968 static void |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1969 gaim_gtkconv_set_active_conversation(GaimConversation *conv) |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1970 { |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1971 GaimGtkConversation *gtkconv; |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1972 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1973 g_return_if_fail(conv != NULL); |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1974 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1975 gtkconv = GAIM_GTK_CONVERSATION(conv); |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1976 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1977 if (gtkconv->active_conv == conv) |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1978 return; |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1979 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1980 gaim_conversation_close_logs(gtkconv->active_conv); |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1981 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1982 gtkconv->active_conv = conv; |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1983 |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1984 gaim_conversation_set_logging(conv, |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1985 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1986 } |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1987 |
11911
fe12abd6b879
[gaim-migrate @ 14202]
Richard Laager <rlaager@wiktel.com>
parents:
11908
diff
changeset
|
1988 void |
11604 | 1989 gaim_gtkconv_switch_active_conversation(GaimConversation *conv) |
1990 { | |
1991 GaimGtkConversation *gtkconv; | |
1992 | |
1993 g_return_if_fail(conv != NULL); | |
1994 | |
1995 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1996 | |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
1997 gaim_gtkconv_set_active_conversation(conv); |
11604 | 1998 |
1999 gray_stuff_out(gtkconv); | |
2000 update_typing_icon(gtkconv); | |
2001 | |
2002 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window), | |
2003 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); | |
2004 | |
11671
4ebd27e664c4
[gaim-migrate @ 13957]
Luke Schierer <lschiere@pidgin.im>
parents:
11669
diff
changeset
|
2005 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT); |
11604 | 2006 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
2007 gaim_account_get_protocol_name(conv->account)); | |
2008 } | |
2009 | |
2010 static void | |
4673 | 2011 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 2012 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2013 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
11594 | 2014 gchar *name = g_object_get_data(m, "gaim_buddy_name"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2015 GaimConversation *conv; |
4359 | 2016 |
10059
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
2017 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) |
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
2018 return; |
79fafe47d919
[gaim-migrate @ 11027]
Luke Schierer <lschiere@pidgin.im>
parents:
10053
diff
changeset
|
2019 |
11594 | 2020 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); |
11604 | 2021 gaim_gtkconv_switch_active_conversation(conv); |
4359 | 2022 } |
2023 | |
2024 static void | |
2025 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
2026 gchar *new_text, gint new_text_length, gpointer user_data) | |
2027 { | |
10810 | 2028 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; |
2029 GaimConversation *conv; | |
2030 | |
2031 g_return_if_fail(gtkconv != NULL); | |
11508 | 2032 |
10810 | 2033 conv = gtkconv->active_conv; |
4359 | 2034 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2035 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 2036 return; |
2037 | |
10810 | 2038 got_typing_keypress(gtkconv, (gtk_text_iter_is_start(position) && |
2039 gtk_text_iter_is_end(position))); | |
4359 | 2040 } |
2041 | |
2042 static void | |
2043 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
2044 GtkTextIter *end_pos, gpointer user_data) | |
2045 { | |
10810 | 2046 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; |
2047 GaimConversation *conv; | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2048 GaimConvIm *im; |
4359 | 2049 |
10810 | 2050 g_return_if_fail(gtkconv != NULL); |
11508 | 2051 |
10810 | 2052 conv = gtkconv->active_conv; |
4359 | 2053 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2054 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 2055 return; |
2056 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2057 im = GAIM_CONV_IM(conv); |
4359 | 2058 |
2059 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
2060 | |
2061 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2062 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2063 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 2064 |
2065 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 2066 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2067 GAIM_NOT_TYPING); |
4359 | 2068 } |
2069 else { | |
2070 /* We're deleting, but not all of it, so it counts as typing. */ | |
10810 | 2071 got_typing_keypress(gtkconv, FALSE); |
4359 | 2072 } |
2073 } | |
2074 | |
8189 | 2075 /************************************************************************** |
2076 * A bunch of buddy icon functions | |
2077 **************************************************************************/ | |
11581 | 2078 GdkPixbuf * |
2079 gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon) | |
7143 | 2080 { |
10116 | 2081 GaimAccount *account = NULL; |
2082 const char *name = NULL; | |
7143 | 2083 GdkPixbuf *status = NULL; |
2084 | |
10116 | 2085 g_return_val_if_fail(conv != NULL, NULL); |
2086 | |
2087 account = gaim_conversation_get_account(conv); | |
2088 name = gaim_conversation_get_name(conv); | |
2089 | |
2090 g_return_val_if_fail(account != NULL, NULL); | |
2091 g_return_val_if_fail(name != NULL, NULL); | |
2092 | |
11338 | 2093 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
7143 | 2094 GaimBuddy *b = gaim_find_buddy(account, name); |
2095 if (b != NULL) { | |
2096 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2097 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2098 } |
2099 } | |
2100 | |
2101 if (!status) { | |
2102 GdkPixbuf *pixbuf; | |
10884 | 2103 pixbuf = gaim_gtk_create_prpl_icon(account); |
7143 | 2104 |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2105 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2106 { |
7143 | 2107 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2108 GDK_INTERP_BILINEAR); | |
2109 g_object_unref(pixbuf); | |
2110 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2111 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2112 status = pixbuf; |
7143 | 2113 } |
2114 return status; | |
2115 } | |
2116 | |
8189 | 2117 static void |
2118 update_tab_icon(GaimConversation *conv) | |
2119 { | |
2120 GaimGtkConversation *gtkconv; | |
11581 | 2121 GaimGtkWindow *win; |
8189 | 2122 GaimAccount *account; |
2123 const char *name; | |
2124 GdkPixbuf *status = NULL; | |
2125 | |
10116 | 2126 g_return_if_fail(conv != NULL); |
2127 | |
8189 | 2128 gtkconv = GAIM_GTK_CONVERSATION(conv); |
11581 | 2129 win = gtkconv->win; |
8189 | 2130 name = gaim_conversation_get_name(conv); |
2131 account = gaim_conversation_get_account(conv); | |
2132 | |
11581 | 2133 status = gaim_gtkconv_get_tab_icon(conv, TRUE); |
8189 | 2134 |
10116 | 2135 g_return_if_fail(status != NULL); |
2136 | |
8189 | 2137 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); |
2138 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2139 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2140 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2141 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2142 |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2143 if (gaim_gtk_conv_window_is_active_conversation(conv) && |
11338 | 2144 (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM || |
10504 | 2145 gtkconv->u.im->anim == NULL)) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2146 { |
11581 | 2147 status = gaim_gtkconv_get_tab_icon(conv, FALSE); |
2148 | |
2149 gtk_window_set_icon(GTK_WINDOW(win->window), status); | |
8189 | 2150 |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2151 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2152 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2153 } |
8189 | 2154 } |
2155 | |
2156 static gboolean | |
2157 redraw_icon(gpointer data) | |
2158 { | |
10810 | 2159 GaimGtkConversation *gtkconv = (GaimGtkConversation *)data; |
2160 GaimConversation *conv = gtkconv->active_conv; | |
9318 | 2161 GaimAccount *account; |
2162 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2163 |
2164 GdkPixbuf *buf; | |
2165 GdkPixbuf *scale; | |
2166 GdkPixmap *pm; | |
2167 GdkBitmap *bm; | |
2168 gint delay; | |
9318 | 2169 int scale_width, scale_height; |
8189 | 2170 |
2171 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2172 account = gaim_conversation_get_account(conv); |
2173 if(account && account->gc) | |
2174 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2175 |
2176 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2177 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2178 | |
10483 | 2179 gaim_gtk_buddy_icon_get_scale_size(buf, prpl_info ? &prpl_info->icon_spec : |
9318 | 2180 NULL, &scale_width, &scale_height); |
2181 | |
2182 /* this code is ugly, and scares me */ | |
8189 | 2183 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2184 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2185 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2186 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2187 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
11324 | 2188 GDK_INTERP_BILINEAR); |
8189 | 2189 |
2190 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2191 g_object_unref(G_OBJECT(scale)); | |
2192 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2193 g_object_unref(G_OBJECT(pm)); | |
2194 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2195 | |
2196 if (bm) | |
2197 g_object_unref(G_OBJECT(bm)); | |
2198 | |
9131 | 2199 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
10639 | 2200 |
2201 if (delay < 100) | |
9131 | 2202 delay = 100; |
2203 | |
11799
a3c28707ef4d
[gaim-migrate @ 14090]
Gary Kramlich <grim@reaperworld.com>
parents:
11787
diff
changeset
|
2204 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv); |
8189 | 2205 |
2206 return FALSE; | |
2207 } | |
2208 | |
2209 static void | |
10810 | 2210 start_anim(GtkObject *obj, GaimGtkConversation *gtkconv) |
8189 | 2211 { |
2212 int delay; | |
2213 | |
8228 | 2214 if (gtkconv->u.im->anim == NULL) |
2215 return; | |
2216 | |
8202 | 2217 if (gtkconv->u.im->icon_timer != 0) |
2218 return; | |
2219 | |
8189 | 2220 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2221 return; | |
2222 | |
10639 | 2223 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2224 | |
2225 if (delay < 100) | |
2226 delay = 100; | |
2227 | |
11799
a3c28707ef4d
[gaim-migrate @ 14090]
Gary Kramlich <grim@reaperworld.com>
parents:
11787
diff
changeset
|
2228 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv); |
8189 | 2229 } |
2230 | |
2231 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2232 remove_icon(GaimGtkConversation *gtkconv) |
8189 | 2233 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2234 GaimConversation *conv = gtkconv->active_conv; |
10456 | 2235 GaimGtkWindow *gtkwin; |
2236 | |
2237 g_return_if_fail(conv != NULL); | |
2238 | |
9887 | 2239 if (gtkconv->u.im->icon_container != NULL) |
2240 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
8189 | 2241 |
2242 if (gtkconv->u.im->anim != NULL) | |
2243 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2244 | |
2245 if (gtkconv->u.im->icon_timer != 0) | |
2246 g_source_remove(gtkconv->u.im->icon_timer); | |
2247 | |
2248 if (gtkconv->u.im->iter != NULL) | |
2249 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2250 | |
2251 gtkconv->u.im->icon_timer = 0; | |
2252 gtkconv->u.im->icon = NULL; | |
2253 gtkconv->u.im->anim = NULL; | |
2254 gtkconv->u.im->iter = NULL; | |
10456 | 2255 gtkconv->u.im->icon_container = NULL; |
9687 | 2256 gtkconv->u.im->show_icon = FALSE; |
10456 | 2257 |
11581 | 2258 gtkwin = gtkconv->win; |
10456 | 2259 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_icon), FALSE); |
8189 | 2260 } |
2261 | |
9497 | 2262 static void |
9504 | 2263 saveicon_writefile_cb(void *user_data, const char *filename) |
9497 | 2264 { |
10810 | 2265 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; |
2266 GaimConversation *conv = gtkconv->active_conv; | |
9497 | 2267 FILE *fp; |
2268 GaimBuddyIcon *icon; | |
2269 const void *data; | |
2270 size_t len; | |
2271 | |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10572
diff
changeset
|
2272 if ((fp = g_fopen(filename, "wb")) == NULL) { |
9504 | 2273 gaim_notify_error(conv, NULL, _("Unable to open file."), NULL); |
9497 | 2274 return; |
2275 } | |
2276 | |
2277 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
2278 data = gaim_buddy_icon_get_data(icon, &len); | |
2279 | |
2280 if ((len <= 0) || (data == NULL)) { | |
9504 | 2281 gaim_notify_error(conv, NULL, _("Unable to save icon file to disk."), NULL); |
9497 | 2282 return; |
2283 } | |
2284 | |
2285 fwrite(data, 1, len, fp); | |
2286 fclose(fp); | |
2287 } | |
2288 | |
2289 static void | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2290 icon_menu_save_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
9497 | 2291 { |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2292 GaimConversation *conv = gtkconv->active_conv; |
10953 | 2293 const gchar *ext; |
9497 | 2294 gchar *buf; |
2295 | |
2296 g_return_if_fail(conv != NULL); | |
9504 | 2297 |
10953 | 2298 ext = gaim_buddy_icon_get_type(gaim_conv_im_get_icon(GAIM_CONV_IM(conv))); |
2299 if (ext == NULL) | |
2300 ext = "icon"; | |
2301 | |
2302 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); | |
9504 | 2303 |
2304 gaim_request_file(conv, _("Save Icon"), buf, TRUE, | |
11799
a3c28707ef4d
[gaim-migrate @ 14090]
Gary Kramlich <grim@reaperworld.com>
parents:
11787
diff
changeset
|
2305 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); |
9497 | 2306 |
2307 g_free(buf); | |
2308 } | |
2309 | |
11581 | 2310 static void |
2311 stop_anim(GtkObject *obj, GaimGtkConversation *gtkconv) | |
2312 { | |
2313 if (gtkconv->u.im->icon_timer != 0) | |
2314 g_source_remove(gtkconv->u.im->icon_timer); | |
2315 | |
2316 gtkconv->u.im->icon_timer = 0; | |
2317 } | |
2318 | |
2319 | |
2320 static void | |
2321 toggle_icon_animate_cb(GtkWidget *w, GaimGtkConversation *gtkconv) | |
2322 { | |
2323 gtkconv->u.im->animate = | |
2324 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); | |
2325 | |
2326 if (gtkconv->u.im->animate) | |
2327 start_anim(NULL, gtkconv); | |
2328 else | |
2329 stop_anim(NULL, gtkconv); | |
2330 } | |
2331 | |
8189 | 2332 static gboolean |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2333 icon_menu(GtkObject *obj, GdkEventButton *e, GaimGtkConversation *gtkconv) |
8189 | 2334 { |
2335 static GtkWidget *menu = NULL; | |
2336 GtkWidget *button; | |
2337 | |
2338 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2339 return FALSE; | |
2340 | |
2341 /* | |
2342 * If a menu already exists, destroy it before creating a new one, | |
2343 * thus freeing-up the memory it occupied. | |
2344 */ | |
2345 if (menu != NULL) | |
2346 gtk_widget_destroy(menu); | |
2347 | |
2348 menu = gtk_menu_new(); | |
2349 | |
2350 if (gtkconv->u.im->anim && | |
2351 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2352 { | |
2353 gaim_new_check_item(menu, _("Animate"), | |
11799
a3c28707ef4d
[gaim-migrate @ 14090]
Gary Kramlich <grim@reaperworld.com>
parents:
11787
diff
changeset
|
2354 G_CALLBACK(toggle_icon_animate_cb), gtkconv, |
8189 | 2355 gtkconv->u.im->icon_timer); |
2356 } | |
2357 | |
2358 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2359 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2360 G_CALLBACK(remove_icon), gtkconv); |
8189 | 2361 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
2362 gtk_widget_show(button); | |
2363 | |
2364 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2365 G_CALLBACK(icon_menu_save_cb), gtkconv, |
8189 | 2366 0, 0, NULL); |
2367 | |
2368 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2369 | |
2370 return TRUE; | |
2371 } | |
10456 | 2372 |
2373 static void | |
2374 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget) | |
2375 { | |
11581 | 2376 GaimGtkWindow *win = data; |
10456 | 2377 GaimConversation *conv; |
2378 GaimGtkConversation *gtkconv; | |
2379 gboolean active; | |
2380 | |
11581 | 2381 conv = gaim_gtk_conv_window_get_active_conversation(win); |
10456 | 2382 |
2383 if (!conv) | |
2384 return; | |
2385 | |
11338 | 2386 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); |
10456 | 2387 |
2388 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2389 | |
2390 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
2391 gtkconv->u.im->show_icon = active; | |
2392 if (active) | |
2393 gaim_gtkconv_update_buddy_icon(conv); | |
2394 else | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
2395 remove_icon(gtkconv); |
10456 | 2396 } |
2397 | |
8189 | 2398 /************************************************************************** |
2399 * End of the bunch of buddy icon functions | |
2400 **************************************************************************/ | |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2401 void |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2402 gaim_gtkconv_present_conversation(GaimConversation *conv) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2403 { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2404 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2405 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2406 if(gtkconv->win==hidden_convwin) { |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
2407 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2408 gaim_gtkconv_placement_place(gtkconv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2409 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2410 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2411 gaim_gtkconv_set_active_conversation(conv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2412 gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2413 gaim_gtk_conv_window_raise(gtkconv->win); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2414 gtk_window_present(GTK_WINDOW(gtkconv->win->window)); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2415 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
2416 |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2417 GaimConversation * |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2418 gaim_gtk_conversations_get_first_unseen(GaimConversationType type, |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2419 GaimUnseenState min_state) |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2420 { |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2421 GList *l; |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2422 |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2423 if(type==GAIM_CONV_TYPE_IM) { |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2424 l = gaim_get_ims(); |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2425 } else if(type==GAIM_CONV_TYPE_CHAT) { |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2426 l = gaim_get_chats(); |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2427 } else { |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2428 l = gaim_get_conversations(); |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2429 } |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2430 |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2431 for(; l!=NULL; l=l->next) { |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2432 GaimConversation *conv = (GaimConversation*)l->data; |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2433 if (GAIM_GTK_CONVERSATION(conv)->unseen_state >= min_state) |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2434 return conv; |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2435 } |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2436 |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2437 return NULL; |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
2438 } |
8189 | 2439 |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2440 static void |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2441 unseen_conv_menu_cb(GtkMenuItem *item, GaimConversation *conv) |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2442 { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2443 g_return_if_fail(conv != NULL); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2444 gaim_gtkconv_present_conversation(conv); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2445 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2446 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2447 guint |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2448 gaim_gtk_conversations_fill_unseen_menu(GtkWidget *menu, |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2449 GaimConversationType type, |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2450 GaimUnseenState min_state) |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2451 { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2452 GList *l; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2453 guint ret = 0; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2454 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2455 g_return_val_if_fail(menu != NULL, 0); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2456 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2457 if (type == GAIM_CONV_TYPE_IM) { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2458 l = gaim_get_ims(); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2459 } else if (type == GAIM_CONV_TYPE_CHAT) { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2460 l = gaim_get_chats(); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2461 } else { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2462 l = gaim_get_conversations(); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2463 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2464 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2465 for (; l != NULL ; l = l->next) { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2466 GaimConversation *conv = (GaimConversation*)l->data; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2467 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2468 |
12239 | 2469 if (gtkconv->unseen_state >= min_state && gtkconv->win == hidden_convwin) { |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2470 GtkWidget *icon = gtk_image_new(); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2471 GdkPixbuf *pbuf = gaim_gtkconv_get_tab_icon(conv, TRUE); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2472 GtkWidget *item; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2473 gchar *text = g_strdup_printf("%s (%d)", |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2474 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)), |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2475 gtkconv->unseen_count); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2476 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2477 gtk_image_set_from_pixbuf(GTK_IMAGE(icon), pbuf); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2478 g_object_unref(pbuf); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2479 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2480 item = gtk_image_menu_item_new_with_label(text); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2481 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), icon); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2482 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(unseen_conv_menu_cb), conv); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2483 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2484 g_free(text); |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2485 ret++; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2486 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2487 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2488 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2489 return ret; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2490 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
2491 |
11581 | 2492 GaimGtkWindow * |
2493 gaim_gtkconv_get_window(GaimGtkConversation *gtkconv) | |
2494 { | |
2495 g_return_val_if_fail(gtkconv != NULL, NULL); | |
2496 return gtkconv->win; | |
2497 } | |
2498 | |
2499 static GtkItemFactoryEntry menu_items[] = | |
2500 { | |
2501 /* Conversation menu */ | |
2502 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, | |
2503 | |
2504 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, | |
2505 0, "<StockItem>", GAIM_STOCK_IM }, | |
2506 | |
2507 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
2508 | |
2509 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, | |
2510 "<StockItem>", GTK_STOCK_FIND }, | |
12191
bc2b9f925979
[gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents:
12190
diff
changeset
|
2511 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<StockItem>", GAIM_STOCK_LOG }, |
11581 | 2512 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
2513 "<StockItem>", GTK_STOCK_SAVE_AS }, | |
12240 | 2514 { N_("/Conversation/Clea_r"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
11581 | 2515 |
2516 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, | |
2517 | |
2518 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, | |
2519 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, | |
12191
bc2b9f925979
[gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents:
12190
diff
changeset
|
2520 0, "<StockItem>", GAIM_STOCK_POUNCE }, |
11581 | 2521 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0, |
2522 "<StockItem>", GAIM_STOCK_INFO }, | |
2523 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, | |
2524 "<StockItem>", GAIM_STOCK_INVITE }, | |
2525 | |
2526 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, | |
2527 | |
2528 { N_("/Conversation/Al_ias..."), NULL, menu_alias_cb, 0, | |
2529 "<StockItem>", GAIM_STOCK_EDIT }, | |
2530 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, | |
2531 "<StockItem>", GAIM_STOCK_BLOCK }, | |
2532 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, | |
2533 "<StockItem>", GTK_STOCK_ADD }, | |
2534 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, | |
2535 "<StockItem>", GTK_STOCK_REMOVE }, | |
2536 | |
2537 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, | |
2538 | |
2539 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, | |
2540 "<StockItem>", GAIM_STOCK_LINK }, | |
2541 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, | |
2542 "<StockItem>", GAIM_STOCK_IMAGE }, | |
2543 | |
2544 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, | |
2545 | |
2546 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, | |
2547 "<StockItem>", GTK_STOCK_CLOSE }, | |
2548 | |
2549 /* Options */ | |
2550 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, | |
2551 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
2552 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
2553 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, | |
2554 { N_("/Options/Show Ti_mestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, | |
2555 { N_("/Options/Show Buddy _Icon"), NULL, menu_buddyicon_cb, 0, "<CheckItem>" }, | |
2556 }; | |
2557 | |
2558 static const int menu_item_count = | |
2559 sizeof(menu_items) / sizeof(*menu_items); | |
2560 | |
2561 static char * | |
2562 item_factory_translate_func (const char *path, gpointer func_data) | |
2563 { | |
2564 return _((char *)path); | |
2565 } | |
2566 | |
2567 static GtkWidget * | |
2568 setup_menubar(GaimGtkWindow *win) | |
2569 { | |
2570 GtkAccelGroup *accel_group; | |
2571 | |
2572 accel_group = gtk_accel_group_new (); | |
2573 gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); | |
2574 g_object_unref(accel_group); | |
2575 | |
2576 win->menu.item_factory = | |
2577 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); | |
2578 | |
2579 gtk_item_factory_set_translate_func(win->menu.item_factory, | |
2580 item_factory_translate_func, | |
2581 NULL, NULL); | |
2582 | |
2583 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count, | |
2584 menu_items, win); | |
2585 g_signal_connect(G_OBJECT(accel_group), "accel-changed", | |
2586 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
2587 | |
2588 | |
2589 win->menu.menubar = | |
2590 gtk_item_factory_get_widget(win->menu.item_factory, "<main>"); | |
2591 | |
2592 | |
2593 win->menu.view_log = | |
2594 gtk_item_factory_get_widget(win->menu.item_factory, | |
2595 N_("/Conversation/View Log")); | |
2596 | |
2597 /* --- */ | |
2598 | |
2599 win->menu.send_file = | |
2600 gtk_item_factory_get_widget(win->menu.item_factory, | |
2601 N_("/Conversation/Send File...")); | |
2602 | |
2603 win->menu.add_pounce = | |
2604 gtk_item_factory_get_widget(win->menu.item_factory, | |
2605 N_("/Conversation/Add Buddy Pounce...")); | |
2606 | |
2607 /* --- */ | |
2608 | |
2609 win->menu.get_info = | |
2610 gtk_item_factory_get_widget(win->menu.item_factory, | |
2611 N_("/Conversation/Get Info")); | |
2612 | |
2613 win->menu.invite = | |
2614 gtk_item_factory_get_widget(win->menu.item_factory, | |
2615 N_("/Conversation/Invite...")); | |
2616 | |
2617 /* --- */ | |
2618 | |
2619 win->menu.alias = | |
2620 gtk_item_factory_get_widget(win->menu.item_factory, | |
2621 N_("/Conversation/Alias...")); | |
2622 | |
2623 win->menu.block = | |
2624 gtk_item_factory_get_widget(win->menu.item_factory, | |
2625 N_("/Conversation/Block...")); | |
2626 | |
2627 win->menu.add = | |
2628 gtk_item_factory_get_widget(win->menu.item_factory, | |
2629 N_("/Conversation/Add...")); | |
2630 | |
2631 win->menu.remove = | |
2632 gtk_item_factory_get_widget(win->menu.item_factory, | |
2633 N_("/Conversation/Remove...")); | |
2634 | |
2635 /* --- */ | |
2636 | |
2637 win->menu.insert_link = | |
2638 gtk_item_factory_get_widget(win->menu.item_factory, | |
2639 N_("/Conversation/Insert Link...")); | |
2640 | |
2641 win->menu.insert_image = | |
2642 gtk_item_factory_get_widget(win->menu.item_factory, | |
2643 N_("/Conversation/Insert Image...")); | |
2644 | |
2645 /* --- */ | |
2646 | |
2647 win->menu.logging = | |
2648 gtk_item_factory_get_widget(win->menu.item_factory, | |
2649 N_("/Options/Enable Logging")); | |
2650 win->menu.sounds = | |
2651 gtk_item_factory_get_widget(win->menu.item_factory, | |
2652 N_("/Options/Enable Sounds")); | |
2653 win->menu.show_formatting_toolbar = | |
2654 gtk_item_factory_get_widget(win->menu.item_factory, | |
2655 N_("/Options/Show Formatting Toolbars")); | |
2656 win->menu.show_timestamps = | |
2657 gtk_item_factory_get_widget(win->menu.item_factory, | |
2658 N_("/Options/Show Timestamps")); | |
2659 win->menu.show_icon = | |
2660 gtk_item_factory_get_widget(win->menu.item_factory, | |
2661 N_("/Options/Show Buddy Icon")); | |
2662 | |
2663 | |
2664 win->menu.tray = gaim_gtk_menu_tray_new(); | |
2665 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), | |
2666 win->menu.tray); | |
2667 gtk_widget_show(win->menu.tray); | |
2668 | |
2669 gtk_widget_show(win->menu.menubar); | |
2670 | |
2671 return win->menu.menubar; | |
2672 } | |
2673 | |
4359 | 2674 |
2675 /************************************************************************** | |
2676 * Utility functions | |
2677 **************************************************************************/ | |
2678 | |
2679 static void | |
10810 | 2680 got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first) |
4359 | 2681 { |
10810 | 2682 GaimConversation *conv = gtkconv->active_conv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2683 GaimConvIm *im; |
4685 | 2684 |
4359 | 2685 /* |
2686 * We know we got something, so we at least have to make sure we don't | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2687 * send GAIM_TYPED any time soon. |
4359 | 2688 */ |
2689 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2690 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2691 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2692 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2693 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2694 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2695 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2696 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2697 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2698 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2699 |
2700 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2701 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2702 GAIM_TYPING); |
4359 | 2703 |
2704 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2705 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2706 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2707 gaim_conv_im_set_type_again(im, 0); |
4359 | 2708 } |
2709 } | |
2710 | |
4736 | 2711 static void |
10810 | 2712 update_typing_icon(GaimGtkConversation *gtkconv) |
4736 | 2713 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2714 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2715 GaimConvIm *im = NULL; |
10810 | 2716 GaimConversation *conv = gtkconv->active_conv; |
12008 | 2717 char *stock_id, *tooltip; |
11508 | 2718 |
11581 | 2719 gtkwin = gtkconv->win; |
4736 | 2720 |
12008 | 2721 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2722 im = GAIM_CONV_IM(conv); |
4736 | 2723 |
12008 | 2724 if (gtkwin->menu.typing_icon) { |
2725 gtk_widget_hide(gtkwin->menu.typing_icon); | |
11787
c9188d3eb9d3
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11780
diff
changeset
|
2726 } |
c9188d3eb9d3
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11780
diff
changeset
|
2727 |
12008 | 2728 if (!im || (gaim_conv_im_get_typing_state(im) == GAIM_NOT_TYPING)) |
2729 return; | |
2730 | |
2731 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { | |
2732 stock_id = GAIM_STOCK_TYPING; | |
2733 tooltip = _("User is typing..."); | |
2734 } else { | |
2735 stock_id = GAIM_STOCK_TYPED; | |
2736 tooltip = _("User has typed something and stopped"); | |
11787
c9188d3eb9d3
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11780
diff
changeset
|
2737 } |
12008 | 2738 |
2739 if (gtkwin->menu.typing_icon == NULL) | |
2740 { | |
2741 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); | |
11787
c9188d3eb9d3
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11780
diff
changeset
|
2742 gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray), |
11908
34ea75bdd0c9
[gaim-migrate @ 14199]
Richard Laager <rlaager@wiktel.com>
parents:
11869
diff
changeset
|
2743 gtkwin->menu.typing_icon, |
12008 | 2744 tooltip); |
4736 | 2745 } |
12008 | 2746 else |
2747 { | |
2748 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU); | |
2749 gaim_gtk_menu_tray_set_tooltip(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray), | |
2750 gtkwin->menu.typing_icon, | |
2751 tooltip); | |
2752 } | |
2753 | |
2754 gtk_widget_show(gtkwin->menu.typing_icon); | |
4736 | 2755 } |
2756 | |
4685 | 2757 static gboolean |
11594 | 2758 update_send_to_selection(GaimGtkWindow *win) |
4359 | 2759 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2760 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2761 GaimConversation *conv; |
4359 | 2762 GtkWidget *menu; |
2763 GList *child; | |
11594 | 2764 GaimBuddy *b; |
11581 | 2765 |
2766 conv = gaim_gtk_conv_window_get_active_conversation(win); | |
4359 | 2767 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2768 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2769 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2770 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2771 account = gaim_conversation_get_account(conv); |
11581 | 2772 |
11594 | 2773 if (win->menu.send_to == NULL) |
4685 | 2774 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2775 |
11594 | 2776 if (!(b = gaim_find_buddy(account, conv->name))) |
2777 return FALSE; | |
2778 | |
2779 | |
2780 gtk_widget_show(win->menu.send_to); | |
4359 | 2781 |
2782 menu = gtk_menu_item_get_submenu( | |
11594 | 2783 GTK_MENU_ITEM(win->menu.send_to)); |
4359 | 2784 |
2785 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2786 child != NULL; | |
2787 child = child->next) { | |
2788 | |
2789 GtkWidget *item = child->data; | |
11594 | 2790 GaimBuddy *item_buddy; |
2791 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), "gaim_account"); | |
2792 gchar *buddy_name = g_object_get_data(G_OBJECT(item), | |
2793 "gaim_buddy_name"); | |
2794 item_buddy = gaim_find_buddy(item_account, buddy_name); | |
2795 | |
2796 if (b == item_buddy) { | |
4359 | 2797 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2798 break; | |
2799 } | |
2800 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2801 |
4685 | 2802 return FALSE; |
4359 | 2803 } |
2804 | |
2805 static void | |
11594 | 2806 create_sendto_item(GtkWidget *menu, GtkSizeGroup *sg, GSList **group, GaimBuddy *bud) |
2807 { | |
2808 GaimAccount *account; | |
2809 GtkWidget *box; | |
2810 GtkWidget *label; | |
2811 GtkWidget *image; | |
2812 GtkWidget *menuitem; | |
11625 | 2813 GdkPixbuf *pixbuf; |
11616 | 2814 gchar *text; |
11594 | 2815 |
2816 account = bud->account; | |
2817 | |
2818 /* Create a pixmap for the protocol icon. */ | |
11625 | 2819 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)bud, GAIM_STATUS_ICON_SMALL); |
11594 | 2820 /* Now convert it to GtkImage */ |
2821 if (pixbuf == NULL) | |
2822 image = gtk_image_new(); | |
2823 else | |
11625 | 2824 image = gtk_image_new_from_pixbuf(pixbuf); |
11594 | 2825 |
2826 gtk_size_group_add_widget(sg, image); | |
2827 | |
2828 g_object_unref(G_OBJECT(pixbuf)); | |
2829 | |
2830 /* Make our menu item */ | |
11616 | 2831 text = g_strdup_printf("%s (%s)", gaim_buddy_get_name(bud), gaim_account_get_username(bud->account)); |
2832 menuitem = gtk_radio_menu_item_new_with_label(*group, text); | |
2833 g_free(text); | |
11594 | 2834 *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
2835 | |
2836 /* Do some evil, see some evil, speak some evil. */ | |
2837 box = gtk_hbox_new(FALSE, 0); | |
2838 | |
2839 label = gtk_bin_get_child(GTK_BIN(menuitem)); | |
2840 g_object_ref(label); | |
2841 gtk_container_remove(GTK_CONTAINER(menuitem), label); | |
2842 | |
2843 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); | |
2844 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); | |
2845 | |
2846 g_object_unref(label); | |
2847 | |
2848 gtk_container_add(GTK_CONTAINER(menuitem), box); | |
2849 | |
2850 gtk_widget_show(label); | |
2851 gtk_widget_show(image); | |
2852 gtk_widget_show(box); | |
2853 | |
2854 /* Set our data and callbacks. */ | |
2855 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); | |
2856 g_object_set_data_full(G_OBJECT(menuitem), "gaim_buddy_name", g_strdup(gaim_buddy_get_name(bud)), g_free); | |
2857 | |
2858 g_signal_connect(G_OBJECT(menuitem), "activate", | |
2859 G_CALLBACK(menu_conv_sel_send_cb), NULL); | |
2860 | |
2861 gtk_widget_show(menuitem); | |
2862 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2863 } | |
2864 | |
2865 static void | |
2866 generate_send_to_items(GaimGtkWindow *win) | |
11581 | 2867 { |
4359 | 2868 GtkWidget *menu; |
2869 GSList *group = NULL; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2870 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
11594 | 2871 GaimGtkConversation *gtkconv; |
2872 GSList *l, *buds; | |
2873 | |
2874 g_return_if_fail(win != NULL); | |
2875 | |
2876 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); | |
2877 | |
11604 | 2878 g_return_if_fail(gtkconv != NULL); |
2879 | |
11594 | 2880 if (win->menu.send_to != NULL) |
2881 gtk_widget_destroy(win->menu.send_to); | |
2882 | |
12286
255e6912607b
[gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12272
diff
changeset
|
2883 /* Build the Send To menu */ |
11594 | 2884 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("_Send To")); |
2885 gtk_widget_show(win->menu.send_to); | |
4359 | 2886 |
2887 menu = gtk_menu_new(); | |
11581 | 2888 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar), |
11594 | 2889 win->menu.send_to, 2); |
2890 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu); | |
4359 | 2891 |
2892 gtk_widget_show(menu); | |
2893 | |
11604 | 2894 if (gtkconv->active_conv->type == GAIM_CONV_TYPE_IM) { |
2895 buds = gaim_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); | |
2896 for (l = buds; l != NULL; l = l->next) { | |
2897 GaimBuddy *b; | |
2898 GaimBlistNode *node; | |
2899 | |
2900 b = l->data; | |
2901 node = (GaimBlistNode *) gaim_buddy_get_contact(b); | |
2902 | |
2903 for (node = node->child; node != NULL; node = node->next) | |
2904 if (GAIM_BLIST_NODE_IS_BUDDY(node) && gaim_account_is_connected(((GaimBuddy *)node)->account)) | |
2905 create_sendto_item(menu, sg, &group, (GaimBuddy *) node); | |
2906 } | |
2907 | |
2908 g_slist_free(buds); | |
4359 | 2909 } |
2910 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2911 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2912 |
11594 | 2913 gtk_widget_show(win->menu.send_to); |
2914 if (!group) | |
2915 gtk_widget_set_sensitive(win->menu.send_to, FALSE); | |
2916 update_send_to_selection(win); | |
4359 | 2917 } |
2918 | |
2919 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2920 generate_invite_user_names(GaimConnection *gc) |
4359 | 2921 { |
6695 | 2922 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2923 static GList *tmp = NULL; |
2924 | |
2925 if (tmp) | |
2926 g_list_free(tmp); | |
2927 | |
2928 tmp = g_list_append(NULL, ""); | |
2929 | |
2930 if (gc != NULL) { | |
4785 | 2931 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2932 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2933 continue; | |
6695 | 2934 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2935 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2936 continue; |
6695 | 2937 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2938 GaimBuddy *buddy; | |
2939 | |
2940 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2941 continue; | |
2942 | |
2943 buddy = (GaimBuddy *)bnode; | |
2944 | |
2945 if (buddy->account == gc->account && | |
2946 GAIM_BUDDY_IS_ONLINE(buddy)) | |
10572 | 2947 tmp = g_list_insert_sorted(tmp, buddy->name, |
2948 (GCompareFunc)g_utf8_collate); | |
6695 | 2949 } |
4359 | 2950 } |
2951 } | |
2952 } | |
2953 | |
2954 return tmp; | |
2955 } | |
2956 | |
9498 | 2957 static GdkPixbuf * |
9554 | 2958 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) |
9498 | 2959 { |
9554 | 2960 GdkPixbuf *pixbuf, *scale, *scale2; |
9498 | 2961 char *filename; |
10274 | 2962 const char *image = NULL; |
9554 | 2963 |
2964 if (flags & GAIM_CBFLAGS_FOUNDER) { | |
10274 | 2965 image = "founder.png"; |
9554 | 2966 } else if (flags & GAIM_CBFLAGS_OP) { |
10274 | 2967 image = "op.png"; |
9554 | 2968 } else if (flags & GAIM_CBFLAGS_HALFOP) { |
10274 | 2969 image = "halfop.png"; |
9554 | 2970 } else if (flags & GAIM_CBFLAGS_VOICE) { |
10274 | 2971 image = "voice.png"; |
9554 | 2972 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { |
10274 | 2973 image = "ignored.png"; |
2974 } else { | |
2975 return NULL; | |
9554 | 2976 } |
10274 | 2977 |
2978 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | |
2979 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
2980 g_free(filename); | |
2981 | |
2982 if (!pixbuf) | |
2983 return NULL; | |
2984 | |
2985 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
2986 g_object_unref(pixbuf); | |
2987 | |
2988 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { | |
2989 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL); | |
9498 | 2990 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
2991 g_free(filename); | |
10274 | 2992 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); |
9498 | 2993 g_object_unref(pixbuf); |
10274 | 2994 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); |
2995 g_object_unref(scale2); | |
9498 | 2996 } |
2997 | |
10274 | 2998 return scale; |
9498 | 2999 } |
3000 | |
4359 | 3001 static void |
11869 | 3002 add_chat_buddy_common(GaimConversation *conv, const char *name, GaimConvChatBuddyFlags flags, const char *alias, const char *old_name) |
4359 | 3003 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3004 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3005 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3006 GaimConvChat *chat; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3007 GaimConnection *gc; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3008 GaimPluginProtocolInfo *prpl_info; |
4359 | 3009 GtkListStore *ls; |
9498 | 3010 GdkPixbuf *pixbuf; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3011 GtkTreeIter iter; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3012 gboolean is_me = FALSE; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3013 gboolean is_buddy; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3014 GdkColor send_color; |
11508 | 3015 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3016 gdk_color_parse(SEND_COLOR, &send_color); |
4359 | 3017 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3018 chat = GAIM_CONV_CHAT(conv); |
4359 | 3019 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3020 gtkchat = gtkconv->u.chat; | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3021 gc = gaim_conversation_get_gc(conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3022 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3023 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3024 return; |
4359 | 3025 |
3026 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3027 | |
9554 | 3028 pixbuf = get_chat_buddy_status_icon(chat, name, flags); |
9498 | 3029 |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
3030 if (!strcmp(chat->nick, gaim_normalize(conv->account, old_name != NULL ? old_name : name))) |
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
3031 is_me = TRUE; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3032 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3033 is_buddy = (gaim_find_buddy(conv->account, name) != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3034 |
4359 | 3035 gtk_list_store_append(ls, &iter); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3036 gtk_list_store_set(ls, &iter, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3037 CHAT_USERS_ICON_COLUMN, pixbuf, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3038 CHAT_USERS_ALIAS_COLUMN, alias, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3039 CHAT_USERS_NAME_COLUMN, name, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3040 CHAT_USERS_FLAGS_COLUMN, flags, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3041 CHAT_USERS_COLOR_COLUMN, is_me ? &send_color : get_nick_color(gtkconv, alias), |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3042 CHAT_USERS_BUDDY_COLUMN, is_buddy, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3043 -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3044 |
9554 | 3045 if (pixbuf) |
3046 g_object_unref(pixbuf); | |
4359 | 3047 } |
3048 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3049 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3050 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3051 GList **matches, gboolean command, char *name) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3052 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3053 strncpy(nick_partial, name, strlen(entered)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3054 nick_partial[strlen(entered)] = '\0'; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3055 if (gaim_utf8_strcasecmp(nick_partial, entered)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3056 return; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3057 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3058 /* if we're here, it's a possible completion */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3059 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3060 if (*most_matched == -1) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3061 /* |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3062 * this will only get called once, since from now |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3063 * on *most_matched is >= 0 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3064 */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3065 *most_matched = strlen(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3066 *partial = g_strdup(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3067 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3068 else if (*most_matched) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3069 char *tmp = g_strdup(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3070 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3071 while (gaim_utf8_strcasecmp(tmp, *partial)) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3072 (*partial)[*most_matched] = '\0'; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3073 if (*most_matched < strlen(tmp)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3074 tmp[*most_matched] = '\0'; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3075 (*most_matched)--; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3076 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3077 (*most_matched)++; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3078 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3079 g_free(tmp); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3080 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3081 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3082 *matches = g_list_insert_sorted(*matches, g_strdup(name), |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3083 (GCompareFunc)gaim_utf8_strcasecmp); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3084 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3085 |
9605 | 3086 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3087 tab_complete(GaimConversation *conv) |
4359 | 3088 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3089 GaimGtkConversation *gtkconv; |
4359 | 3090 GtkTextIter cursor, word_start, start_buffer; |
3091 int start; | |
3092 int most_matched = -1; | |
3093 char *entered, *partial = NULL; | |
3094 char *text; | |
8021 | 3095 char *nick_partial; |
9605 | 3096 const char *prefix; |
4359 | 3097 GList *matches = NULL; |
9605 | 3098 gboolean command = FALSE; |
4359 | 3099 |
3100 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3101 | |
3102 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3103 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3104 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3105 | |
3106 word_start = cursor; | |
3107 | |
3108 /* if there's nothing there just return */ | |
3109 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
11338 | 3110 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3111 |
4359 | 3112 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3113 &cursor, FALSE); | |
3114 | |
3115 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3116 start = strlen(text) - 1; | |
3117 | |
8021 | 3118 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3119 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3120 start-=2; |
3121 } | |
4359 | 3122 |
3123 /* find the start of the word that we're tabbing */ | |
3124 while (start >= 0 && text[start] != ' ') { | |
3125 gtk_text_iter_backward_char(&word_start); | |
3126 start--; | |
3127 } | |
3128 | |
9605 | 3129 prefix = gaim_gtk_get_cmd_prefix(); |
3130 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) { | |
3131 command = TRUE; | |
3132 gtk_text_iter_forward_chars(&word_start, strlen(prefix)); | |
3133 } | |
3134 | |
4359 | 3135 g_free(text); |
3136 | |
3137 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3138 &cursor, FALSE); | |
3139 | |
8021 | 3140 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3141 g_free(entered); |
11338 | 3142 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; |
4359 | 3143 } |
3144 | |
8021 | 3145 nick_partial = g_malloc(strlen(entered)+1); |
3146 | |
9605 | 3147 if (command) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3148 GList *list = gaim_cmd_list(conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3149 GList *l; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3150 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3151 /* Commands */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3152 for (l = list; l != NULL; l = l->next) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3153 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3154 &matches, TRUE, l->data); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3155 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3156 g_list_free(list); |
11338 | 3157 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3158 GaimConvChat *chat = GAIM_CONV_CHAT(conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3159 GList *l = gaim_conv_chat_get_users(chat); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3160 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3161 GtkTreeIter iter; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3162 int f; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3163 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3164 /* Users */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3165 for (; l != NULL; l = l->next) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3166 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3167 &matches, TRUE, ((GaimConvChatBuddy *)l->data)->name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3168 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3169 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3170 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3171 /* Aliases */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3172 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3173 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3174 do { |
11460
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3175 char *name; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3176 char *alias; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3177 |
11460
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3178 gtk_tree_model_get(model, &iter, |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3179 CHAT_USERS_NAME_COLUMN, &name, |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3180 CHAT_USERS_ALIAS_COLUMN, &alias, |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3181 -1); |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3182 |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3183 if (strcmp(name, alias)) |
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3184 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3185 &matches, FALSE, alias); |
11460
d68ca756e983
[gaim-migrate @ 13699]
Richard Laager <rlaager@wiktel.com>
parents:
11454
diff
changeset
|
3186 g_free(name); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3187 g_free(alias); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3188 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3189 f = gtk_tree_model_iter_next(model, &iter); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3190 } while (f != 0); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3191 } |
9605 | 3192 } else { |
3193 g_free(nick_partial); | |
3194 g_free(entered); | |
3195 return FALSE; | |
3196 } | |
3197 | |
8021 | 3198 g_free(nick_partial); |
3199 | |
4359 | 3200 /* we're only here if we're doing new style */ |
3201 | |
3202 /* if there weren't any matches, return */ | |
3203 if (!matches) { | |
3204 /* if matches isn't set partials won't be either */ | |
3205 g_free(entered); | |
11338 | 3206 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; |
4359 | 3207 } |
3208 | |
3209 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3210 | |
3211 if (!matches->next) { | |
3212 /* there was only one match. fill it in. */ | |
3213 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3214 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3215 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3216 | |
3217 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3218 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3219 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3220 g_free(tmp); | |
3221 } | |
3222 else | |
3223 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3224 matches->data, -1); | |
3225 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3226 g_free(matches->data); |
4359 | 3227 matches = g_list_remove(matches, matches->data); |
3228 } | |
3229 else { | |
3230 /* | |
3231 * there were lots of matches, fill in as much as possible | |
3232 * and display all of them | |
3233 */ | |
3234 char *addthis = g_malloc0(1); | |
3235 | |
3236 while (matches) { | |
3237 char *tmp = addthis; | |
3238 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3239 g_free(tmp); | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3240 g_free(matches->data); |
4359 | 3241 matches = g_list_remove(matches, matches->data); |
3242 } | |
3243 | |
6982 | 3244 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3245 time(NULL)); |
3246 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3247 g_free(addthis); | |
3248 } | |
3249 | |
3250 g_free(entered); | |
3251 g_free(partial); | |
9605 | 3252 |
3253 return TRUE; | |
4359 | 3254 } |
3255 | |
10810 | 3256 static void topic_callback(GtkWidget *w, GaimGtkConversation *gtkconv) |
7971 | 3257 { |
3258 GaimPluginProtocolInfo *prpl_info = NULL; | |
3259 GaimConnection *gc; | |
10810 | 3260 GaimConversation *conv = gtkconv->active_conv; |
7971 | 3261 GaimGtkChatPane *gtkchat; |
11261
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3262 char *new_topic; |
8858 | 3263 const char *current_topic; |
7971 | 3264 |
3265 gc = gaim_conversation_get_gc(conv); | |
3266 | |
3267 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3268 return; | |
3269 | |
3270 if(prpl_info->set_chat_topic == NULL) | |
3271 return; | |
3272 | |
3273 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3274 gtkchat = gtkconv->u.chat; | |
11261
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3275 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); |
8858 | 3276 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); |
3277 | |
11261
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3278 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3279 g_free(new_topic); |
7971 | 3280 return; |
11261
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3281 } |
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3282 |
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3283 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); |
7971 | 3284 |
8858 | 3285 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3286 new_topic); | |
11261
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3287 |
b53606580f68
[gaim-migrate @ 13439]
Richard Laager <rlaager@wiktel.com>
parents:
11257
diff
changeset
|
3288 g_free(new_topic); |
7971 | 3289 } |
3290 | |
9554 | 3291 static gint |
3292 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | |
3293 { | |
3294 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | |
3295 char *user1 = NULL, *user2 = NULL; | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3296 gboolean buddy1 = FALSE, buddy2 = FALSE; |
9554 | 3297 gint ret = 0; |
3298 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3299 gtk_tree_model_get(model, a, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3300 CHAT_USERS_ALIAS_COLUMN, &user1, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3301 CHAT_USERS_FLAGS_COLUMN, &f1, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3302 CHAT_USERS_BUDDY_COLUMN, &buddy1, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3303 -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3304 gtk_tree_model_get(model, b, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3305 CHAT_USERS_ALIAS_COLUMN, &user2, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3306 CHAT_USERS_FLAGS_COLUMN, &f2, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3307 CHAT_USERS_BUDDY_COLUMN, &buddy2, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3308 -1); |
9554 | 3309 |
3310 if (user1 == NULL || user2 == NULL) { | |
3311 if (!(user1 == NULL && user2 == NULL)) | |
3312 ret = (user1 == NULL) ? -1: 1; | |
3313 } else if (f1 != f2) { | |
3314 /* sort more important users first */ | |
3315 ret = (f1 > f2) ? -1 : 1; | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3316 } else if (buddy1 != buddy2) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3317 ret = buddy1 ? -1 : 1; |
9554 | 3318 } else { |
10904 | 3319 ret = gaim_utf8_strcasecmp(user1, user2); |
9554 | 3320 } |
3321 | |
3322 g_free(user1); | |
3323 g_free(user2); | |
3324 | |
3325 return ret; | |
3326 } | |
3327 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3328 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3329 update_chat_alias(GaimBuddy *buddy, GaimConversation *conv, GaimConnection *gc, GaimPluginProtocolInfo *prpl_info) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3330 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3331 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
3332 GaimConvChat *chat = GAIM_CONV_CHAT(conv); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3333 GtkTreeModel *model; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3334 char *normalized_name; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3335 GtkTreeIter iter; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3336 int f; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3337 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3338 g_return_if_fail(buddy != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3339 g_return_if_fail(conv != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3340 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3341 /* This is safe because this callback is only used in chats, not IMs. */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3342 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3343 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3344 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3345 return; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3346 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3347 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3348 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3349 do { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3350 char *name; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3351 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3352 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3353 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3354 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3355 const char *alias = name; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3356 GaimBuddy *buddy2; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3357 |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
3358 if (strcmp(chat->nick, gaim_normalize(conv->account, name))) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3359 /* This user is not me, so look into updating the alias. */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3360 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3361 if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3362 alias = gaim_buddy_get_contact_alias(buddy2); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3363 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3364 gtk_list_store_set(GTK_LIST_STORE(model), &iter, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3365 CHAT_USERS_ALIAS_COLUMN, alias, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3366 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, alias), |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3367 -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3368 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3369 g_free(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3370 break; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3371 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3372 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3373 f = gtk_tree_model_iter_next(model, &iter); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3374 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3375 g_free(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3376 } while (f != 0); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3377 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3378 g_free(normalized_name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3379 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3380 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3381 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3382 blist_node_aliased_cb(GaimBlistNode *node, const char *old_alias, GaimConversation *conv) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3383 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3384 GaimConnection *gc; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3385 GaimPluginProtocolInfo *prpl_info; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3386 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3387 g_return_if_fail(node != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3388 g_return_if_fail(conv != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3389 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3390 gc = gaim_conversation_get_gc(conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3391 g_return_if_fail(gc != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3392 g_return_if_fail(gc->prpl != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3393 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3394 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3395 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3396 return; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3397 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3398 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3399 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3400 GaimBlistNode *bnode; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3401 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3402 for(bnode = node->child; bnode; bnode = bnode->next) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3403 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3404 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3405 continue; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3406 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3407 update_chat_alias((GaimBuddy *)bnode, conv, gc, prpl_info); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3408 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3409 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3410 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3411 update_chat_alias((GaimBuddy *)node, conv, gc, prpl_info); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3412 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3413 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3414 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3415 buddy_cb_common(GaimBuddy *buddy, GaimConversation *conv, gboolean is_buddy) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3416 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3417 GtkTreeModel *model; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3418 char *normalized_name; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3419 GtkTreeIter iter; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3420 int f; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3421 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3422 g_return_if_fail(buddy != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3423 g_return_if_fail(conv != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3424 |
11846
908ff9b56e99
[gaim-migrate @ 14137]
Richard Laager <rlaager@wiktel.com>
parents:
11815
diff
changeset
|
3425 /* Do nothing if the buddy does not belong to the conv's account */ |
908ff9b56e99
[gaim-migrate @ 14137]
Richard Laager <rlaager@wiktel.com>
parents:
11815
diff
changeset
|
3426 if (gaim_buddy_get_account(buddy) != gaim_conversation_get_account(conv)) |
908ff9b56e99
[gaim-migrate @ 14137]
Richard Laager <rlaager@wiktel.com>
parents:
11815
diff
changeset
|
3427 return; |
908ff9b56e99
[gaim-migrate @ 14137]
Richard Laager <rlaager@wiktel.com>
parents:
11815
diff
changeset
|
3428 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3429 /* This is safe because this callback is only used in chats, not IMs. */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3430 model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3431 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3432 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3433 return; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3434 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3435 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name)); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3436 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3437 do { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3438 char *name; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3439 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3440 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3441 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3442 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3443 gtk_list_store_set(GTK_LIST_STORE(model), &iter, CHAT_USERS_BUDDY_COLUMN, is_buddy, -1); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3444 g_free(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3445 break; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3446 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3447 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3448 f = gtk_tree_model_iter_next(model, &iter); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3449 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3450 g_free(name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3451 } while (f != 0); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3452 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3453 g_free(normalized_name); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3454 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3455 blist_node_aliased_cb((GaimBlistNode *)buddy, NULL, conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3456 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3457 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3458 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3459 buddy_added_cb(GaimBuddy *buddy, GaimConversation *conv) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3460 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3461 buddy_cb_common(buddy, conv, TRUE); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3462 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3463 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3464 static void |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3465 buddy_removed_cb(GaimBuddy *buddy, GaimConversation *conv) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3466 { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3467 /* If there's another buddy for the same "dude" on the list, do nothing. */ |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3468 if (gaim_find_buddy(buddy->account, buddy->name) != NULL) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3469 return; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3470 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3471 buddy_cb_common(buddy, conv, FALSE); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3472 } |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3473 |
4359 | 3474 static GtkWidget * |
10810 | 3475 setup_chat_pane(GaimGtkConversation *gtkconv) |
4359 | 3476 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3477 GaimPluginProtocolInfo *prpl_info = NULL; |
10810 | 3478 GaimConversation *conv = gtkconv->active_conv; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3479 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3480 GaimConnection *gc; |
4359 | 3481 GtkWidget *vpaned, *hpaned; |
10175 | 3482 GtkWidget *vbox, *hbox, *frame; |
4359 | 3483 GtkWidget *lbox, *bbox; |
3484 GtkWidget *label; | |
3485 GtkWidget *list; | |
3486 GtkWidget *button; | |
7949 | 3487 GtkWidget *sw; |
4359 | 3488 GtkListStore *ls; |
3489 GtkCellRenderer *rend; | |
3490 GtkTreeViewColumn *col; | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3491 void *blist_handle = gaim_blist_get_handle(); |
9080 | 3492 GList *focus_chain = NULL; |
4359 | 3493 |
3494 gtkchat = gtkconv->u.chat; | |
3495 gc = gaim_conversation_get_gc(conv); | |
3496 | |
3497 /* Setup the outer pane. */ | |
3498 vpaned = gtk_vpaned_new(); | |
3499 gtk_widget_show(vpaned); | |
3500 | |
3501 /* Setup the top part of the pane. */ | |
11243 | 3502 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
8914 | 3503 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3504 gtk_widget_show(vbox); |
3505 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3506 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3507 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3508 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3509 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3510 { |
11243 | 3511 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3512 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3513 gtk_widget_show(hbox); |
3514 | |
3515 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3516 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3517 gtk_widget_show(label); |
3518 | |
3519 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3520 |
7971 | 3521 if(prpl_info->set_chat_topic == NULL) { |
3522 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3523 } else { | |
3524 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
10810 | 3525 G_CALLBACK(topic_callback), gtkconv); |
7971 | 3526 } |
3527 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3528 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3529 gtk_widget_show(gtkchat->topic_text); |
3530 } | |
3531 | |
3532 /* Setup the horizontal pane. */ | |
3533 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3534 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3535 gtk_widget_show(hpaned); |
3536 | |
10175 | 3537 /* Setup gtkihmtml. */ |
3538 frame = gaim_gtk_create_imhtml(FALSE, >kconv->imhtml, NULL); | |
3539 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); | |
10389 | 3540 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE); |
10175 | 3541 gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE); |
3542 gtk_widget_show(frame); | |
3543 | |
3544 gtk_widget_set_size_request(gtkconv->imhtml, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3545 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3546 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
10175 | 3547 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", |
10810 | 3548 G_CALLBACK(size_allocate_cb), gtkconv); |
8914 | 3549 |
4359 | 3550 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", |
3551 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3552 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3553 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3554 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3555 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3556 |
3557 /* Build the right pane. */ | |
11243 | 3558 lbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3559 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3560 gtk_widget_show(lbox); |
3561 | |
3562 /* Setup the label telling how many people are in the room. */ | |
3563 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3564 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3565 gtk_widget_show(gtkchat->count); | |
3566 | |
3567 /* Setup the list of users. */ | |
7949 | 3568 sw = gtk_scrolled_window_new(NULL, NULL); |
3569 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3570 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3571 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3572 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3573 gtk_widget_show(sw); | |
4359 | 3574 |
9554 | 3575 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3576 G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR, G_TYPE_BOOLEAN); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3577 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_COLUMN, |
9554 | 3578 sort_chat_users, NULL, NULL); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3579 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_COLUMN, |
4359 | 3580 GTK_SORT_ASCENDING); |
3581 | |
3582 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3583 | |
9498 | 3584 rend = gtk_cell_renderer_pixbuf_new(); |
3585 | |
4359 | 3586 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
9498 | 3587 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3588 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); |
9498 | 3589 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4359 | 3590 |
3591 g_signal_connect(G_OBJECT(list), "button_press_event", | |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
3592 G_CALLBACK(right_click_chat_cb), gtkconv); |
8143 | 3593 g_signal_connect(G_OBJECT(list), "popup-menu", |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
3594 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv); |
4359 | 3595 |
9498 | 3596 rend = gtk_cell_renderer_text_new(); |
3597 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3598 g_object_set(rend, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3599 "foreground-set", TRUE, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3600 "weight", PANGO_WEIGHT_BOLD, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3601 NULL); |
4359 | 3602 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3603 "text", CHAT_USERS_ALIAS_COLUMN, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3604 "foreground-gdk", CHAT_USERS_COLOR_COLUMN, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3605 "weight-set", CHAT_USERS_BUDDY_COLUMN, |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3606 NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3607 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3608 gaim_signal_connect(blist_handle, "buddy-added", |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3609 gtkchat, GAIM_CALLBACK(buddy_added_cb), conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3610 gaim_signal_connect(blist_handle, "buddy-removed", |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3611 gtkchat, GAIM_CALLBACK(buddy_removed_cb), conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3612 gaim_signal_connect(blist_handle, "blist-node-aliased", |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3613 gtkchat, GAIM_CALLBACK(blist_node_aliased_cb), conv); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3614 |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3615 #if GTK_CHECK_VERSION(2,6,0) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3616 gtk_tree_view_column_set_expand(col, TRUE); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3617 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
3618 #endif |
4359 | 3619 |
3620 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3621 | |
3622 gtk_widget_set_size_request(list, 150, -1); | |
3623 | |
3624 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3625 gtk_widget_show(list); | |
3626 | |
3627 gtkchat->list = list; | |
3628 | |
7949 | 3629 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3630 |
3631 /* Setup the user list toolbar. */ | |
11243 | 3632 bbox = gtk_hbox_new(TRUE, GAIM_HIG_BOX_SPACE); |
4359 | 3633 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3634 gtk_widget_show(bbox); | |
3635 | |
3636 /* IM */ | |
10221 | 3637 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IM, |
4359 | 3638 GAIM_BUTTON_VERTICAL); |
10500 | 3639 gtkchat->userlist_im = button; |
4359 | 3640 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
3641 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3642 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3643 g_signal_connect(G_OBJECT(button), "clicked", |
10810 | 3644 G_CALLBACK(chat_im_button_cb), gtkconv); |
4359 | 3645 |
3646 gtk_widget_show(button); | |
3647 | |
3648 /* Ignore */ | |
3649 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3650 GAIM_BUTTON_VERTICAL); | |
10500 | 3651 gtkchat->userlist_ignore = button; |
4359 | 3652 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
3653 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3654 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3655 _("Ignore the user"), NULL); |
4359 | 3656 g_signal_connect(G_OBJECT(button), "clicked", |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
3657 G_CALLBACK(ignore_cb), gtkconv); |
4359 | 3658 gtk_widget_show(button); |
3659 | |
3660 /* Info */ | |
3661 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3662 GAIM_BUTTON_VERTICAL); | |
10500 | 3663 gtkchat->userlist_info = button; |
4359 | 3664 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
3665 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3666 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3667 _("Get the user's information"), NULL); |
4359 | 3668 g_signal_connect(G_OBJECT(button), "clicked", |
10810 | 3669 G_CALLBACK(info_cb), gtkconv); |
4359 | 3670 |
3671 gtk_widget_show(button); | |
3672 | |
10175 | 3673 /* Setup the bottom half of the conversation window */ |
11243 | 3674 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
8914 | 3675 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3676 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3677 |
11243 | 3678 gtkconv->lower_hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
9332 | 3679 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); |
3680 gtk_widget_show(gtkconv->lower_hbox); | |
3681 | |
11243 | 3682 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
9332 | 3683 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); |
3684 gtk_widget_show(vbox); | |
3685 | |
10175 | 3686 /* Setup the toolbar, entry widget and all signals */ |
3687 frame = gaim_gtk_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar); | |
10080 | 3688 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
10175 | 3689 gtk_widget_show(frame); |
3690 | |
9005 | 3691 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 3692 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
9699 | 3693 gaim_account_get_protocol_name(conv->account)); |
10175 | 3694 gtk_widget_set_size_request(gtkconv->entry, -1, |
3695 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3696 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3697 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
10810 | 3698 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
7949 | 3699 |
3700 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
10810 | 3701 G_CALLBACK(entry_key_press_cb), gtkconv); |
10115 | 3702 g_signal_connect(G_OBJECT(gtkconv->entry), "message_send", |
10810 | 3703 G_CALLBACK(send_cb), gtkconv); |
4359 | 3704 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
10810 | 3705 G_CALLBACK(entry_stop_rclick_cb), NULL); |
8914 | 3706 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
10810 | 3707 G_CALLBACK(size_allocate_cb), gtkconv); |
3708 | |
3709 default_formatize(gtkconv); | |
4359 | 3710 |
9080 | 3711 /* |
3712 * Focus for chat windows should be as follows: | |
3713 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
3714 * user list buttons -> entry -> buttons at bottom | |
3715 */ | |
9332 | 3716 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 3717 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
3718 | |
4359 | 3719 return vpaned; |
3720 } | |
3721 | |
3722 static GtkWidget * | |
10810 | 3723 setup_im_pane(GaimGtkConversation *gtkconv) |
4359 | 3724 { |
10810 | 3725 GaimConversation *conv = gtkconv->active_conv; |
10175 | 3726 GtkWidget *frame; |
4359 | 3727 GtkWidget *paned; |
10175 | 3728 GtkWidget *vbox; |
3729 GtkWidget *vbox2; | |
9080 | 3730 GList *focus_chain = NULL; |
4359 | 3731 |
10175 | 3732 /* Setup the outer pane */ |
4359 | 3733 paned = gtk_vpaned_new(); |
3734 gtk_widget_show(paned); | |
3735 | |
10175 | 3736 /* Setup the top part of the pane */ |
11243 | 3737 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3738 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3739 gtk_widget_show(vbox); |
3740 | |
10175 | 3741 /* Setup the gtkimhtml widget */ |
3742 frame = gaim_gtk_create_imhtml(FALSE, >kconv->imhtml, NULL); | |
3743 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); | |
10389 | 3744 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE); |
10175 | 3745 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
3746 gtk_widget_show(frame); | |
3747 | |
3748 gtk_widget_set_size_request(gtkconv->imhtml, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3749 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3750 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
10175 | 3751 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", |
10810 | 3752 G_CALLBACK(size_allocate_cb), gtkconv); |
4359 | 3753 |
3754 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
10810 | 3755 G_CALLBACK(entry_stop_rclick_cb), NULL); |
8105 | 3756 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
10810 | 3757 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3758 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
10810 | 3759 G_CALLBACK(refocus_entry_cb), gtkconv); |
4359 | 3760 |
10175 | 3761 /* Setup the bottom half of the conversation window */ |
11243 | 3762 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
8914 | 3763 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3764 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3765 |
11243 | 3766 gtkconv->lower_hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
9332 | 3767 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); |
3768 gtk_widget_show(gtkconv->lower_hbox); | |
3769 | |
11243 | 3770 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
9332 | 3771 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); |
3772 gtk_widget_show(vbox2); | |
8821 | 3773 |
10175 | 3774 /* Setup the toolbar, entry widget and all signals */ |
3775 frame = gaim_gtk_create_imhtml(TRUE, >kconv->entry, >kconv->toolbar); | |
10080 | 3776 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); |
10175 | 3777 gtk_widget_show(frame); |
3778 | |
9005 | 3779 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 3780 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
9699 | 3781 gaim_account_get_protocol_name(conv->account)); |
10175 | 3782 gtk_widget_set_size_request(gtkconv->entry, -1, |
3783 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3784 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3785 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
10810 | 3786 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3787 |
4359 | 3788 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
10810 | 3789 G_CALLBACK(entry_key_press_cb), gtkconv); |
3790 g_signal_connect(G_OBJECT(gtkconv->entry), "message_send", G_CALLBACK(send_cb), gtkconv); | |
4359 | 3791 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
10810 | 3792 G_CALLBACK(entry_stop_rclick_cb), NULL); |
8914 | 3793 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
10810 | 3794 G_CALLBACK(size_allocate_cb), gtkconv); |
4359 | 3795 |
3796 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
10810 | 3797 G_CALLBACK(insert_text_cb), gtkconv); |
4359 | 3798 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
10810 | 3799 G_CALLBACK(delete_text_cb), gtkconv); |
4359 | 3800 |
8481 | 3801 /* had to move this after the imtoolbar is attached so that the |
3802 * signals get fired to toggle the buttons on the toolbar as well. | |
3803 */ | |
10810 | 3804 default_formatize(gtkconv); |
4359 | 3805 |
11275
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
3806 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
3807 G_CALLBACK(clear_formatting_cb), gtkconv); |
ffc86d9ad8b7
[gaim-migrate @ 13461]
Richard Laager <rlaager@wiktel.com>
parents:
11269
diff
changeset
|
3808 |
8758 | 3809 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
9687 | 3810 gtkconv->u.im->show_icon = TRUE; |
4359 | 3811 |
9080 | 3812 /* |
3813 * Focus for IM windows should be as follows: | |
10356 | 3814 * Tab title -> conversation scrollback -> entry |
9080 | 3815 */ |
9332 | 3816 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 3817 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 3818 |
4359 | 3819 return paned; |
3820 } | |
3821 | |
3822 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3823 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
10810 | 3824 GtkSelectionData *sd, guint info, guint t, |
3825 GaimGtkConversation *gtkconv) | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3826 { |
10810 | 3827 GaimConversation *conv = gtkconv->active_conv; |
11581 | 3828 GaimGtkWindow *win = gtkconv->win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3829 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3830 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3831 { |
4781 | 3832 GaimBlistNode *n = NULL; |
6695 | 3833 GaimBuddy *b; |
11581 | 3834 GaimGtkConversation *gtkconv = NULL; |
9622 | 3835 |
11812 | 3836 n = *(GaimBlistNode **)sd->data; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3837 |
6695 | 3838 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3839 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3840 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3841 b = (GaimBuddy*)n; | |
3842 else | |
4781 | 3843 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3844 |
9622 | 3845 /* |
3846 * If we already have an open conversation with this buddy, then | |
3847 * just move the conv to this window. Otherwise, create a new | |
3848 * conv and add it to this window. | |
3849 */ | |
11338 | 3850 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account); |
9622 | 3851 if (c != NULL) { |
11581 | 3852 GaimGtkWindow *oldwin; |
3853 gtkconv = GAIM_GTK_CONVERSATION(c); | |
3854 oldwin = gtkconv->win; | |
9622 | 3855 if (oldwin != win) { |
11581 | 3856 gaim_gtk_conv_window_remove_gtkconv(oldwin, gtkconv); |
3857 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); | |
9622 | 3858 } |
3859 } else { | |
11338 | 3860 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name); |
11581 | 3861 gtkconv = GAIM_GTK_CONVERSATION(c); |
11812 | 3862 if (gtkconv->win != win) |
3863 { | |
3864 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | |
3865 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); | |
3866 } | |
9622 | 3867 } |
3868 | |
3869 /* Make this conversation the active conversation */ | |
11581 | 3870 gaim_gtk_conv_window_switch_gtkconv(win, gtkconv); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3871 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
3872 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 3873 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3874 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3875 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3876 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3877 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3878 GaimAccount *account; |
11581 | 3879 GaimGtkConversation *gtkconv; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3880 |
11137 | 3881 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
7718 | 3882 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3883 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3884 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3885 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3886 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3887 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3888 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3889 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3890 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3891 { |
11338 | 3892 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); |
11581 | 3893 gtkconv = GAIM_GTK_CONVERSATION(c); |
11812 | 3894 if (gtkconv->win != win) |
3895 { | |
3896 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | |
3897 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); | |
3898 } | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3899 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3900 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3901 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3902 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3903 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3904 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3905 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3906 } |
9525 | 3907 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
11338 | 3908 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
10229 | 3909 gaim_dnd_file_manage(sd, gaim_conversation_get_account(conv), gaim_conversation_get_name(conv)); |
10145 | 3910 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
9495 | 3911 } |
10145 | 3912 else |
3913 gtk_drag_finish(dc, FALSE, FALSE, t); | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3914 } |
4359 | 3915 |
3916 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3917 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3918 { |
10145 | 3919 GTK_IMHTML_DND_TARGETS, |
3920 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM}, | |
3921 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1} | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3922 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3923 |
10810 | 3924 static GaimGtkConversation * |
3925 gaim_gtk_conv_find_gtkconv(GaimConversation * conv) | |
3926 { | |
3927 GaimBuddy *bud = gaim_find_buddy(conv->account, conv->name), *b; | |
3928 GaimContact *c; | |
3929 GaimBlistNode *cn; | |
10935 | 3930 |
10810 | 3931 if (!bud) |
3932 return NULL; | |
10935 | 3933 |
10810 | 3934 if (!(c = gaim_buddy_get_contact(bud))) |
3935 return NULL; | |
10935 | 3936 |
10810 | 3937 cn = (GaimBlistNode *)c; |
3938 for (b = (GaimBuddy *)cn->child; b; b = (GaimBuddy *) ((GaimBlistNode *)b)->next) { | |
3939 GaimConversation *conv; | |
11338 | 3940 if ((conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account))) { |
10810 | 3941 if (conv->ui_data) |
3942 return conv->ui_data; | |
3943 } | |
3944 } | |
10935 | 3945 |
10810 | 3946 return NULL; |
3947 } | |
3948 | |
11855 | 3949 static void |
3950 buddy_update_cb(GaimBlistNode *bnode, gpointer null) | |
3951 { | |
3952 GList *list; | |
3953 | |
3954 g_return_if_fail(bnode); | |
3955 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode)); | |
3956 | |
3957 for (list = gaim_gtk_conv_windows_get_list(); list; list = list->next) | |
3958 { | |
3959 GaimGtkWindow *win = list->data; | |
3960 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); | |
3961 | |
3962 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | |
3963 continue; | |
3964 | |
3965 gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE); | |
3966 } | |
3967 } | |
3968 | |
11581 | 3969 /************************************************************************** |
3970 * Conversation UI operations | |
3971 **************************************************************************/ | |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
3972 static void |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
3973 private_gtkconv_new(GaimConversation *conv, gboolean hidden) |
11581 | 3974 { |
3975 GaimGtkConversation *gtkconv; | |
3976 GaimConversationType conv_type = gaim_conversation_get_type(conv); | |
4359 | 3977 GtkWidget *pane = NULL; |
3978 GtkWidget *tab_cont; | |
11581 | 3979 |
3980 if (conv_type == GAIM_CONV_TYPE_IM && (gtkconv = gaim_gtk_conv_find_gtkconv(conv))) { | |
10810 | 3981 conv->ui_data = gtkconv; |
3982 if (!g_list_find(gtkconv->convs, conv)) | |
3983 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); | |
11604 | 3984 gaim_gtkconv_switch_active_conversation(conv); |
10810 | 3985 return; |
4359 | 3986 } |
3987 | |
11581 | 3988 gtkconv = g_new0(GaimGtkConversation, 1); |
3989 conv->ui_data = gtkconv; | |
3990 gtkconv->active_conv = conv; | |
3991 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); | |
3992 | |
3993 /* Setup some initial variables. */ | |
3994 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3995 gtkconv->tooltips = gtk_tooltips_new(); | |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
3996 gtkconv->unseen_state = GAIM_UNSEEN_NONE; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
3997 gtkconv->unseen_count = 0; |
11581 | 3998 |
3999 if (conv_type == GAIM_CONV_TYPE_IM) { | |
4000 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); | |
4001 | |
4002 pane = setup_im_pane(gtkconv); | |
4003 } else if (conv_type == GAIM_CONV_TYPE_CHAT) { | |
4004 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4005 pane = setup_chat_pane(gtkconv); | |
4006 } | |
4007 | |
12101 | 4008 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), |
4009 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); | |
4010 | |
11581 | 4011 if (pane == NULL) { |
4012 if (conv_type == GAIM_CONV_TYPE_CHAT) | |
4013 g_free(gtkconv->u.chat); | |
4014 else if (conv_type == GAIM_CONV_TYPE_IM) | |
4015 g_free(gtkconv->u.im); | |
4016 | |
4017 g_free(gtkconv); | |
4018 conv->ui_data = NULL; | |
4019 return; | |
10449 | 4020 } |
11581 | 4021 |
4022 /* Setup drag-and-drop */ | |
4023 gtk_drag_dest_set(pane, | |
4024 GTK_DEST_DEFAULT_MOTION | | |
4025 GTK_DEST_DEFAULT_DROP, | |
4026 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4027 GDK_ACTION_COPY); | |
4028 gtk_drag_dest_set(pane, | |
4029 GTK_DEST_DEFAULT_MOTION | | |
4030 GTK_DEST_DEFAULT_DROP, | |
4031 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4032 GDK_ACTION_COPY); | |
4033 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4034 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4035 GDK_ACTION_COPY); | |
4036 | |
4037 gtk_drag_dest_set(gtkconv->entry, 0, | |
4038 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4039 GDK_ACTION_COPY); | |
4040 | |
4041 g_signal_connect(G_OBJECT(pane), "drag_data_received", | |
4042 G_CALLBACK(conv_dnd_recv), gtkconv); | |
4043 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", | |
4044 G_CALLBACK(conv_dnd_recv), gtkconv); | |
4045 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", | |
4046 G_CALLBACK(conv_dnd_recv), gtkconv); | |
4047 | |
4048 /* Setup the container for the tab. */ | |
4049 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); | |
4050 g_object_set_data(G_OBJECT(tab_cont), "GaimGtkConversation", gtkconv); | |
4051 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), GAIM_HIG_BOX_SPACE); | |
4052 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
4053 gtk_widget_show(pane); | |
4054 | |
4055 gtkconv->make_sound = TRUE; | |
4056 | |
4057 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) | |
4058 gtk_widget_show(gtkconv->toolbar); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4059 else |
11581 | 4060 gtk_widget_hide(gtkconv->toolbar); |
4061 | |
12188 | 4062 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
4063 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
11603
b97545f21b4c
[gaim-migrate @ 13874]
Gary Kramlich <grim@reaperworld.com>
parents:
11602
diff
changeset
|
4064 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), |
b97545f21b4c
[gaim-migrate @ 13874]
Gary Kramlich <grim@reaperworld.com>
parents:
11602
diff
changeset
|
4065 gaim_account_get_protocol_name(conv->account)); |
11581 | 4066 |
4067 g_signal_connect_swapped(G_OBJECT(pane), "focus", | |
4068 G_CALLBACK(gtk_widget_grab_focus), | |
4069 gtkconv->entry); | |
4070 | |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4071 if (hidden) |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4072 gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4073 else |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4074 gaim_gtkconv_placement_place(gtkconv); |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
4075 |
12346
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
4076 if (nick_colors == NULL) |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
4077 nick_colors = generate_nick_colors(NUM_NICK_COLORS, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4078 } |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4079 |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4080 static void |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4081 gaim_gtkconv_new_hidden(GaimConversation *conv) |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4082 { |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4083 private_gtkconv_new(conv, TRUE); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4084 } |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4085 |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4086 void |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4087 gaim_gtkconv_new(GaimConversation *conv) |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4088 { |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4089 private_gtkconv_new(conv, FALSE); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4090 } |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4091 |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4092 static void |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4093 received_im_msg_cb(GaimAccount *account, char *sender, char *message, |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4094 GaimConversation *conv, int flags) |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4095 { |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4096 GaimConversationUiOps *ui_ops = gaim_gtk_conversations_get_conv_ui_ops(); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4097 if(conv) |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4098 return; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4099 |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4100 /* create hidden conv if hide_new pref is always */ |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4101 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0) { |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4102 ui_ops->create_conversation = gaim_gtkconv_new_hidden; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4103 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4104 ui_ops->create_conversation = gaim_gtkconv_new; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4105 return; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4106 } |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4107 |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4108 /* create hidden conv if hide_new pref is away and account is away */ |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4109 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0 |
12310 | 4110 && !gaim_status_is_available(gaim_account_get_active_status(account))) { |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4111 ui_ops->create_conversation = gaim_gtkconv_new_hidden; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4112 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4113 ui_ops->create_conversation = gaim_gtkconv_new; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4114 return; |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
4115 } |
11581 | 4116 } |
4117 | |
4359 | 4118 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4119 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4120 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4121 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4122 |
10810 | 4123 gtkconv->convs = g_list_remove(gtkconv->convs, conv); |
4124 /* Don't destroy ourselves until all our convos are gone */ | |
4125 if (gtkconv->convs) | |
4126 return; | |
11508 | 4127 |
11581 | 4128 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
4129 | |
9504 | 4130 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4131 gaim_request_close_with_handle(conv); | |
4359 | 4132 |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4133 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4134 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4135 |
11338 | 4136 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
4755 | 4137 if (gtkconv->u.im->icon_timer != 0) |
4138 g_source_remove(gtkconv->u.im->icon_timer); | |
4139 | |
4359 | 4140 if (gtkconv->u.im->anim != NULL) |
4793 | 4141 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4142 |
4143 g_free(gtkconv->u.im); | |
11581 | 4144 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4145 gaim_signals_disconnect_by_handle(gtkconv->u.chat); |
4359 | 4146 g_free(gtkconv->u.chat); |
4147 } | |
4148 | |
4633 | 4149 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4150 | |
4359 | 4151 g_free(gtkconv); |
4152 } | |
4153 | |
4154 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4155 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4156 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4157 time_t mtime) |
4359 | 4158 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4159 GaimGtkConversation *gtkconv; |
4359 | 4160 |
4161 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
4162 gaim_gtkconv_set_active_conversation(conv); |
4359 | 4163 |
6982 | 4164 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4165 } |
4166 | |
4167 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4168 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4169 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4170 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4171 GaimGtkConversation *gtkconv; |
4359 | 4172 |
4173 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
4174 gaim_gtkconv_set_active_conversation(conv); |
4359 | 4175 |
10398 | 4176 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4177 |
6982 | 4178 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4179 } |
4180 | |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4181 /* The callback for an event on a link tag. */ |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4182 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4183 GdkEvent *event, GtkTextIter *arg2, gpointer data) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4184 if (event->type == GDK_BUTTON_PRESS |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4185 || event->type == GDK_2BUTTON_PRESS) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4186 GdkEventButton *btn_event = (GdkEventButton*) event; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4187 GaimConversation *conv = data; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4188 char *buddyname; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4189 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4190 /* strlen("BUDDY ") == 6 */ |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4191 g_return_val_if_fail((tag->name != NULL) |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4192 && (strlen(tag->name) > 6), FALSE); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4193 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4194 buddyname = (tag->name) + 6; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4195 |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4196 if (btn_event->button == 2 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4197 && event->type == GDK_2BUTTON_PRESS) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4198 chat_do_info(GAIM_GTK_CONVERSATION(conv), buddyname); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4199 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4200 return TRUE; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4201 } else if (btn_event->button == 3 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4202 && event->type == GDK_BUTTON_PRESS) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4203 GtkTextIter start, end; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4204 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4205 /* we shouldn't display the popup |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4206 * if the user has selected something: */ |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4207 if (!gtk_text_buffer_get_selection_bounds( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4208 gtk_text_iter_get_buffer(arg2), |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4209 &start, &end)) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4210 GaimPluginProtocolInfo *prpl_info = NULL; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4211 GtkWidget *menu = NULL; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4212 GaimConnection *gc = |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4213 gaim_conversation_get_gc(conv); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4214 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4215 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4216 if (gc != NULL) |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4217 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4218 gc->prpl); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4219 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4220 menu = create_chat_menu(conv, buddyname, |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4221 prpl_info, gc); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4222 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4223 NULL, GTK_WIDGET(imhtml), |
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4224 btn_event->button, |
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4225 btn_event->time); |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4226 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4227 /* Don't propagate the event any further */ |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4228 return TRUE; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4229 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4230 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4231 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4232 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4233 return FALSE; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4234 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4235 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4236 static GtkTextTag *get_buddy_tag(GaimConversation *conv, const char *who) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4237 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4238 GtkTextTag *buddytag; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4239 /* strlen("BUDDY ") == 6 */ |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4240 gchar str[strlen(who) + 7]; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4241 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4242 g_snprintf(str, sizeof(str), "BUDDY %s", who); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4243 str[sizeof(str)] = '\0'; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4244 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4245 buddytag = gtk_text_tag_table_lookup( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4246 gtk_text_buffer_get_tag_table( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4247 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4248 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4249 if (buddytag == NULL) { |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4250 buddytag = gtk_text_buffer_create_tag( |
11096 | 4251 GTK_IMHTML(gtkconv->imhtml)->text_buffer, str, NULL); |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4252 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4253 g_signal_connect(G_OBJECT(buddytag), "event", |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4254 G_CALLBACK(buddytag_event), conv); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4255 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4256 |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4257 return buddytag; |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4258 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4259 |
4359 | 4260 static void |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4261 gaim_gtkconv_write_conv(GaimConversation *conv, const char *name, const char *alias, |
6982 | 4262 const char *message, GaimMessageFlags flags, |
4359 | 4263 time_t mtime) |
4264 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4265 GaimGtkConversation *gtkconv; |
11581 | 4266 GaimGtkWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4267 GaimConnection *gc; |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4268 GaimAccount *account; |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4269 GaimPluginProtocolInfo *prpl_info; |
4359 | 4270 int gtk_font_options = 0; |
11224
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4271 int max_scrollback_lines = gaim_prefs_get_int( |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4272 "/gaim/gtk/conversations/scrollback_lines"); |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4273 int line_count; |
4359 | 4274 char buf2[BUF_LONG]; |
4275 char mdate[64]; | |
4276 char color[10]; | |
4277 char *str; | |
4278 char *with_font_tag; | |
4896 | 4279 char *sml_attrib = NULL; |
6982 | 4280 size_t length = strlen(message) + 1; |
4895 | 4281 |
4359 | 4282 gtkconv = GAIM_GTK_CONVERSATION(conv); |
11581 | 4283 |
4284 /* Set the active conversation to the one that just messaged us. */ | |
4285 /* TODO: consider not doing this if the account is offline or something */ | |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
4286 gaim_gtkconv_set_active_conversation(conv); |
11581 | 4287 |
4359 | 4288 gc = gaim_conversation_get_gc(conv); |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4289 account = gaim_conversation_get_account(conv); |
11581 | 4290 win = gtkconv->win; |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4291 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4292 |
11224
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4293 line_count = gtk_text_buffer_get_line_count( |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4294 gtk_text_view_get_buffer(GTK_TEXT_VIEW( |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4295 gtkconv->imhtml))); |
11227
8b3d1b2c2c43
[gaim-migrate @ 13365]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11224
diff
changeset
|
4296 |
11224
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4297 /* If we're sitting at more than 100 lines more than the |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4298 max scrollback, trim down to max scrollback */ |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4299 if (max_scrollback_lines > 0 |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4300 && line_count > (max_scrollback_lines + 100)) { |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4301 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4302 GTK_TEXT_VIEW(gtkconv->imhtml)); |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4303 GtkTextIter start, end; |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4304 |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4305 gtk_text_buffer_get_start_iter(text_buffer, &start); |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4306 gtk_text_buffer_get_iter_at_line(text_buffer, &end, |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4307 (line_count - max_scrollback_lines)); |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4308 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4309 } |
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
4310 |
8677 | 4311 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4312 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4313 | |
5133 | 4314 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4315 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4316 else | |
4317 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4318 |
4896 | 4319 if(gc) |
9699 | 4320 sml_attrib = g_strdup_printf("sml=\"%s\"", |
4321 gaim_account_get_protocol_name(conv->account)); | |
7440 | 4322 |
10503 | 4323 gtk_font_options |= GTK_IMHTML_NO_COMMENTS; |
4359 | 4324 |
12064
658623020748
[gaim-migrate @ 14359]
Richard Laager <rlaager@wiktel.com>
parents:
12061
diff
changeset
|
4325 if ((flags & GAIM_MESSAGE_RECV) && |
658623020748
[gaim-migrate @ 14359]
Richard Laager <rlaager@wiktel.com>
parents:
12061
diff
changeset
|
4326 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_incoming_formatting")) |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4327 gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; |
4359 | 4328 |
7956 | 4329 /* this is gonna crash one day, I can feel it. */ |
4330 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4331 OPT_PROTO_USE_POINTSIZE) { |
10503 | 4332 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4333 } |
4359 | 4334 |
10737 | 4335 /* TODO: These colors should not be hardcoded so log.c can use them */ |
6621 | 4336 if (flags & GAIM_MESSAGE_SYSTEM) { |
4359 | 4337 g_snprintf(buf2, sizeof(buf2), |
8690 | 4338 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
10854
bdd72261ec8c
[gaim-migrate @ 12529]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10849
diff
changeset
|
4339 sml_attrib ? sml_attrib : "", mdate, message); |
7440 | 4340 |
8962 | 4341 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 4342 |
8722 | 4343 } else if (flags & GAIM_MESSAGE_ERROR) { |
4344 g_snprintf(buf2, sizeof(buf2), | |
9627 | 4345 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
10854
bdd72261ec8c
[gaim-migrate @ 12529]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10849
diff
changeset
|
4346 sml_attrib ? sml_attrib : "", mdate, message); |
9554 | 4347 |
8962 | 4348 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
4349 | |
7431 | 4350 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
10884 | 4351 g_snprintf(buf2, BUF_LONG, |
8690 | 4352 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
10854
bdd72261ec8c
[gaim-migrate @ 12529]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10849
diff
changeset
|
4353 sml_attrib ? sml_attrib : "", message); |
7440 | 4354 |
10884 | 4355 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
10346 | 4356 } else if (flags & GAIM_MESSAGE_RAW) { |
10348 | 4357 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, 0); |
10346 | 4358 } else { |
4895 | 4359 char *new_message = g_memdup(message, length); |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4360 char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup("")); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4361 /* The initial offset is to deal with |
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4362 * escaped entities making the string longer */ |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4363 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0; |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4364 int tag_end_offset = 0; |
7440 | 4365 |
6621 | 4366 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4367 str = g_malloc(1024); |
7440 | 4368 |
4359 | 4369 /* If we're whispering, it's not an autoresponse. */ |
10504 | 4370 if (gaim_message_meify(new_message, -1 )) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4371 g_snprintf(str, 1024, "***%s", alias_escaped); |
4359 | 4372 strcpy(color, "#6C2585"); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4373 tag_start_offset += 3; |
4359 | 4374 } |
4375 else { | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4376 g_snprintf(str, 1024, "*%s*:", alias_escaped); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4377 tag_start_offset += 1; |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4378 tag_end_offset = 2; |
4359 | 4379 strcpy(color, "#00FF00"); |
4380 } | |
7440 | 4381 } |
4359 | 4382 else { |
10504 | 4383 if (gaim_message_meify(new_message, -1)) { |
4359 | 4384 str = g_malloc(1024); |
7440 | 4385 |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4386 if (flags & GAIM_MESSAGE_AUTO_RESP) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4387 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4388 tag_start_offset += 4 |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4389 + strlen(AUTO_RESPONSE); |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4390 } else { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4391 g_snprintf(str, 1024, "***%s", alias_escaped); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4392 tag_start_offset += 3; |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4393 } |
7440 | 4394 |
6621 | 4395 if (flags & GAIM_MESSAGE_NICK) |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
4396 strcpy(color, HIGHLIGHT_COLOR); |
4359 | 4397 else |
4398 strcpy(color, "#062585"); | |
4399 } | |
4400 else { | |
4401 str = g_malloc(1024); | |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4402 if (flags & GAIM_MESSAGE_AUTO_RESP) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4403 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE); |
10999
56cfc50d2a81
[gaim-migrate @ 12841]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10971
diff
changeset
|
4404 tag_start_offset += 1 |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4405 + strlen(AUTO_RESPONSE); |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4406 } else { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4407 g_snprintf(str, 1024, "%s:", alias_escaped); |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4408 tag_end_offset = 1; |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4409 } |
6621 | 4410 if (flags & GAIM_MESSAGE_NICK) |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
4411 strcpy(color, HIGHLIGHT_COLOR); |
6621 | 4412 else if (flags & GAIM_MESSAGE_RECV) { |
10108 | 4413 if (flags & GAIM_MESSAGE_COLORIZE) { |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4414 GdkColor *col = get_nick_color(gtkconv, alias); |
10346 | 4415 |
10108 | 4416 g_snprintf(color, sizeof(color), "#%02X%02X%02X", |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4417 col->red >> 8, col->green >> 8, col->blue >> 8); |
10108 | 4418 } else |
7854 | 4419 strcpy(color, RECV_COLOR); |
4359 | 4420 } |
6621 | 4421 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4422 strcpy(color, SEND_COLOR); |
10892 | 4423 else { |
4424 gaim_debug_error("gtkconv", "message missing flags\n"); | |
4425 strcpy(color, "#000000"); | |
4426 } | |
4359 | 4427 } |
4428 } | |
10892 | 4429 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4430 if(alias_escaped) |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4431 g_free(alias_escaped); |
11508 | 4432 |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4433 /* Are we in a chat where we can tell which users are buddies? */ |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4434 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4435 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4436 |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4437 /* Bold buddies to make them stand out from non-buddies. */ |
11581 | 4438 if (flags & GAIM_MESSAGE_SEND || |
11530
2a13cfe607b5
[gaim-migrate @ 13779]
Richard Laager <rlaager@wiktel.com>
parents:
11525
diff
changeset
|
4439 flags & GAIM_MESSAGE_NICK || |
2a13cfe607b5
[gaim-migrate @ 13779]
Richard Laager <rlaager@wiktel.com>
parents:
11525
diff
changeset
|
4440 gaim_find_buddy(account, name) != NULL) { |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4441 g_snprintf(buf2, BUF_LONG, |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4442 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4443 "<B>%s</B></FONT> ", |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4444 color, sml_attrib ? sml_attrib : "", mdate, str); |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4445 } else { |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4446 g_snprintf(buf2, BUF_LONG, |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4447 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4448 "%s</FONT> ", |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4449 color, sml_attrib ? sml_attrib : "", mdate, str); |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4450 |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4451 } |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4452 } else { |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4453 /* Bold everyone's name to make the name stand out from the message. */ |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4454 g_snprintf(buf2, BUF_LONG, |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4455 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4456 "<B>%s</B></FONT> ", |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4457 color, sml_attrib ? sml_attrib : "", mdate, str); |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4458 } |
7440 | 4459 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4460 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4461 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4462 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4463 !(flags & GAIM_MESSAGE_SEND)) { |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4464 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4465 GtkTextIter start, end; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4466 GtkTextTag *buddytag = get_buddy_tag(conv, name); |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4467 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4468 gtk_text_buffer_get_end_iter( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4469 GTK_IMHTML(gtkconv->imhtml)->text_buffer, |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4470 &end); |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4471 gtk_text_iter_backward_chars(&end, |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4472 tag_end_offset + 1); |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4473 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4474 gtk_text_buffer_get_end_iter( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4475 GTK_IMHTML(gtkconv->imhtml)->text_buffer, |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4476 &start); |
10964
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4477 gtk_text_iter_backward_chars(&start, |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4478 strlen(str) + 1 - tag_start_offset); |
aae07c7e23a3
[gaim-migrate @ 12771]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10961
diff
changeset
|
4479 |
10961
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4480 gtk_text_buffer_apply_tag( |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4481 GTK_IMHTML(gtkconv->imhtml)->text_buffer, |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4482 buddytag, &start, &end); |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4483 } |
42769b481935
[gaim-migrate @ 12764]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10953
diff
changeset
|
4484 |
4359 | 4485 g_free(str); |
4486 | |
4895 | 4487 if(gc){ |
4896 | 4488 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4489 char *post = "</font>"; |
4490 int pre_len = strlen(pre); | |
4491 int post_len = strlen(post); | |
7440 | 4492 |
4895 | 4493 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4494 |
4895 | 4495 strcpy(with_font_tag, pre); |
4496 memcpy(with_font_tag + pre_len, new_message, length); | |
4497 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4498 |
4895 | 4499 length += pre_len + post_len; |
4500 g_free(pre); | |
4501 } | |
4608 | 4502 else |
4895 | 4503 with_font_tag = g_memdup(new_message, length); |
7440 | 4504 |
8962 | 4505 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4506 with_font_tag, gtk_font_options); | |
7440 | 4507 |
4508 g_free(with_font_tag); | |
7447 | 4509 g_free(new_message); |
7440 | 4510 } |
4511 | |
5012 | 4512 if(sml_attrib) |
4513 g_free(sml_attrib); | |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4514 |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4515 /* Tab highlighting stuff */ |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4516 if (!gaim_gtkconv_has_focus(conv)) |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4517 { |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4518 GaimUnseenState unseen = GAIM_UNSEEN_NONE; |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4519 |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
4520 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK) |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4521 unseen = GAIM_UNSEEN_NICK; |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
4522 else if (((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
4523 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4524 unseen = GAIM_UNSEEN_EVENT; |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
4525 else if ((flags & GAIM_MESSAGE_NO_LOG) == GAIM_MESSAGE_NO_LOG) |
12132
95bffda9b762
[gaim-migrate @ 14432]
Richard Laager <rlaager@wiktel.com>
parents:
12131
diff
changeset
|
4526 unseen = GAIM_UNSEEN_NO_LOG; |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4527 else |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4528 unseen = GAIM_UNSEEN_TEXT; |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4529 |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4530 gtkconv_set_unseen(gtkconv, unseen); |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
4531 } |
4359 | 4532 } |
4533 | |
4534 static void | |
11869 | 4535 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users, GList *flags, GList *aliases) |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4536 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4537 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4538 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4539 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4540 GList *l; |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4541 GList *ll; |
11869 | 4542 GList *lll; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4543 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4544 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4545 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4546 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4547 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4548 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4549 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4550 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4551 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4552 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4553 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4554 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4555 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4556 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4557 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4558 |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4559 l = users; |
11869 | 4560 ll = flags; |
4561 lll = aliases; | |
4562 while (l != NULL && ll != NULL && lll != NULL) { | |
4563 add_chat_buddy_common(conv, (const char *)l->data, GPOINTER_TO_INT(ll->data), (const char *)lll->data, NULL); | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4564 l = l->next; |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4565 ll = ll->next; |
11869 | 4566 lll = lll->next; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4567 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4568 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4569 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4570 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4571 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4572 const char *new_name, const char *new_alias) |
4359 | 4573 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4574 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4575 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4576 GaimGtkChatPane *gtkchat; |
11869 | 4577 GaimConvChatBuddyFlags flags; |
4359 | 4578 GtkTreeIter iter; |
4579 GtkTreeModel *model; | |
4580 int f = 1; | |
4581 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4582 chat = GAIM_CONV_CHAT(conv); |
4359 | 4583 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4584 gtkchat = gtkconv->u.chat; | |
4585 | |
9554 | 4586 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4587 | |
4588 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4589 return; | |
4590 | |
4591 while (f != 0) { | |
4592 char *val; | |
4593 | |
11869 | 4594 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1); |
9554 | 4595 |
4596 if (!gaim_utf8_strcasecmp(old_name, val)) { | |
4597 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
4598 g_free(val); | |
4359 | 4599 break; |
4600 } | |
9554 | 4601 |
4602 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4603 | |
4604 g_free(val); | |
4359 | 4605 } |
4606 | |
9554 | 4607 if (!gaim_conv_chat_find_user(chat, old_name)) |
4359 | 4608 return; |
4609 | |
11485
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4610 g_return_if_fail(new_alias != NULL); |
16b0da1f376f
[gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents:
11480
diff
changeset
|
4611 |
11869 | 4612 add_chat_buddy_common(conv, new_name, flags, new_alias, old_name); |
4359 | 4613 } |
4614 | |
4615 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4616 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4617 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4618 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4619 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4620 GaimGtkChatPane *gtkchat; |
4359 | 4621 GtkTreeIter iter; |
4622 GtkTreeModel *model; | |
4623 char tmp[BUF_LONG]; | |
4624 int num_users; | |
4625 int f = 1; | |
4626 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4627 chat = GAIM_CONV_CHAT(conv); |
4359 | 4628 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4629 gtkchat = gtkconv->u.chat; | |
4630 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4631 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - 1; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4632 |
9554 | 4633 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4634 | |
4635 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4636 return; | |
4637 | |
4638 while (f != 0) { | |
4639 char *val; | |
4640 | |
4641 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
4642 | |
4643 if (!gaim_utf8_strcasecmp(user, val)) { | |
4644 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
4645 g_free(val); | |
4359 | 4646 break; |
4647 } | |
9554 | 4648 |
4649 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4650 | |
4651 g_free(val); | |
4359 | 4652 } |
4653 | |
9554 | 4654 if (!gaim_conv_chat_find_user(chat, user)) |
4359 | 4655 return; |
4656 | |
4657 g_snprintf(tmp, sizeof(tmp), | |
9554 | 4658 ngettext("%d person in room", "%d people in room", |
4659 num_users), num_users); | |
4359 | 4660 |
4661 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4662 | |
4663 } | |
4664 | |
4665 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4666 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4667 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4668 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4669 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4670 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4671 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4672 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4673 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4674 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4675 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4676 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4677 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4678 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4679 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4680 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4681 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4682 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4683 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4684 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4685 for (l = users; l != NULL; l = l->next) { |
9554 | 4686 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4687 | |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
4688 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
9554 | 4689 continue; |
4690 | |
4691 do { | |
4692 char *val; | |
4693 | |
4694 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
4695 CHAT_USERS_NAME_COLUMN, &val, -1); | |
4696 | |
9696 | 4697 if (!gaim_utf8_strcasecmp((char *)l->data, val)) { |
4698 #if GTK_CHECK_VERSION(2,2,0) | |
9554 | 4699 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
9696 | 4700 #else |
4701 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
4702 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4703 #endif | |
4704 } | |
9554 | 4705 else |
4706 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4707 | |
4708 g_free(val); | |
4709 } while (f); | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4710 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4711 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4712 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4713 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4714 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4715 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4716 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4717 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4718 |
9554 | 4719 static void |
4720 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) | |
4721 { | |
4722 GaimConvChat *chat; | |
11869 | 4723 GaimConvChatBuddyFlags flags; |
9554 | 4724 GaimGtkConversation *gtkconv; |
4725 GaimGtkChatPane *gtkchat; | |
4726 GtkTreeIter iter; | |
4727 GtkTreeModel *model; | |
4728 int f = 1; | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4729 char *alias = NULL; |
9554 | 4730 |
4731 chat = GAIM_CONV_CHAT(conv); | |
4732 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4733 gtkchat = gtkconv->u.chat; | |
4734 | |
4735 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
4736 | |
4737 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4738 return; | |
4739 | |
4740 while (f != 0) { | |
4741 char *val; | |
4742 | |
4743 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | |
4744 | |
4745 if (!gaim_utf8_strcasecmp(user, val)) { | |
11500
9fc7d0153332
[gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents:
11486
diff
changeset
|
4746 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1); |
9554 | 4747 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4748 g_free(val); | |
4749 break; | |
4750 } | |
4751 | |
4752 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4753 | |
4754 g_free(val); | |
4755 } | |
4756 | |
4757 if (!gaim_conv_chat_find_user(chat, user)) | |
4758 return; | |
4759 | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4760 g_return_if_fail(alias != NULL); |
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4761 |
11869 | 4762 flags = gaim_conv_chat_user_get_flags(chat, user); |
4763 | |
4764 add_chat_buddy_common(conv, user, flags, alias, NULL); | |
11454
201617d49573
[gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents:
11453
diff
changeset
|
4765 g_free(alias); |
9554 | 4766 } |
4767 | |
11581 | 4768 gboolean |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4769 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4770 { |
11581 | 4771 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4772 GaimGtkWindow *win; | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4773 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4774 |
11581 | 4775 win = gtkconv->win; |
4776 | |
4777 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL); | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4778 |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
4779 if (has_focus && gaim_gtk_conv_window_is_active_conversation(conv)) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
4780 return TRUE; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
4781 |
11684
c1906dc6257c
[gaim-migrate @ 13970]
Luke Schierer <lschiere@pidgin.im>
parents:
11672
diff
changeset
|
4782 return FALSE; |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4783 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4784 |
12335 | 4785 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data) |
4786 { | |
4787 GtkIMHtmlSmiley *smiley; | |
4788 | |
4789 smiley = (GtkIMHtmlSmiley *)user_data; | |
4790 smiley->icon = gdk_pixbuf_loader_get_animation(loader); | |
4791 | |
4792 if (smiley->icon) | |
4793 g_object_ref(G_OBJECT(smiley->icon)); | |
4794 #ifdef DEBUG_CUSTOM_SMILEY | |
4795 gaim_debug_info("custom-smiley", "%s(): got GdkPixbufAnimation %p for smiley '%s'\n", __FUNCTION__, smiley->icon, smiley->smile); | |
4796 #endif | |
4797 } | |
4798 | |
4799 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data) | |
4800 { | |
4801 GtkIMHtmlSmiley *smiley; | |
4802 GtkWidget *icon = NULL; | |
4803 GtkTextChildAnchor *anchor = NULL; | |
4804 GSList *current = NULL; | |
4805 | |
4806 smiley = (GtkIMHtmlSmiley *)user_data; | |
4807 if (!smiley->imhtml) { | |
4808 #ifdef DEBUG_CUSTOM_SMILEY | |
4809 gaim_debug_error("custom-smiley", "%s(): orphan smiley found: %p\n", __FUNCTION__, smiley); | |
4810 #endif | |
4811 g_object_unref(G_OBJECT(loader)); | |
4812 smiley->loader = NULL; | |
4813 return; | |
4814 } | |
4815 | |
4816 for (current = smiley->anchors; current; current = g_slist_next(current)) { | |
4817 | |
4818 icon = gtk_image_new_from_animation(smiley->icon); | |
4819 | |
4820 #ifdef DEBUG_CUSTOM_SMILEY | |
4821 gaim_debug_info("custom-smiley", "%s(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n", | |
4822 __FUNCTION__, icon, smiley->icon, smiley->smile); | |
4823 #endif | |
4824 if (icon) { | |
4825 gtk_widget_show(icon); | |
4826 | |
4827 anchor = GTK_TEXT_CHILD_ANCHOR(current->data); | |
4828 | |
4829 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(gaim_unescape_html(smiley->smile)), g_free); | |
4830 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free); | |
4831 | |
4832 if (smiley->imhtml) | |
4833 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor); | |
4834 } | |
4835 | |
4836 } | |
4837 | |
4838 g_slist_free(smiley->anchors); | |
4839 smiley->anchors = NULL; | |
4840 | |
4841 g_object_unref(G_OBJECT(loader)); | |
4842 smiley->loader = NULL; | |
4843 } | |
4844 | |
10526 | 4845 static gboolean |
4846 gaim_gtkconv_custom_smiley_add(GaimConversation *conv, const char *smile) | |
4847 { | |
4848 GaimGtkConversation *gtkconv; | |
4849 GtkIMHtmlSmiley *smiley; | |
4850 GdkPixbufLoader *loader; | |
11525 | 4851 struct smiley_list *list; |
4852 const char *sml = NULL, *conv_sml; | |
4853 | |
4854 if (!conv || !smile || !*smile) { | |
10526 | 4855 return FALSE; |
4856 } | |
4857 | |
11525 | 4858 /* If smileys are off, return false */ |
4859 if (gaim_gtkthemes_smileys_disabled()) | |
4860 return FALSE; | |
4861 | |
4862 /* If possible add this smiley to the current theme. | |
4863 * The addition is only temporary: custom smilies aren't saved to disk. */ | |
4864 conv_sml = gaim_account_get_protocol_name(conv->account); | |
10526 | 4865 gtkconv = GAIM_GTK_CONVERSATION(conv); |
11525 | 4866 |
4867 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { | |
4868 if (!strcmp(list->sml, conv_sml)) { | |
4869 sml = list->sml; | |
4870 break; | |
4871 } | |
4872 } | |
4873 | |
10526 | 4874 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); |
4875 | |
4876 if (smiley) { | |
11525 | 4877 |
4878 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) { | |
4879 return FALSE; | |
4880 } | |
4881 | |
4882 /* Close the old GdkPixbufAnimation, then create a new one for | |
4883 * the smiley we are about to receive */ | |
4884 g_object_unref(G_OBJECT(smiley->icon)); | |
4885 | |
4886 smiley->loader = gdk_pixbuf_loader_new(); | |
12335 | 4887 smiley->icon = NULL; |
4888 | |
4889 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley); | |
4890 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley); | |
4891 | |
11525 | 4892 return TRUE; |
10526 | 4893 } |
4894 | |
4895 loader = gdk_pixbuf_loader_new(); | |
4896 | |
4897 /* this is wrong, this file ought not call g_new on GtkIMHtmlSmiley */ | |
4898 /* Let gtk_imhtml have a gtk_imhtml_smiley_new function, and let | |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10810
diff
changeset
|
4899 GtkIMHtmlSmiley by opaque */ |
10526 | 4900 smiley = g_new0(GtkIMHtmlSmiley, 1); |
4901 smiley->file = NULL; | |
4902 smiley->smile = g_strdup(smile); | |
4903 smiley->loader = loader; | |
11525 | 4904 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM; |
10526 | 4905 |
12335 | 4906 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley); |
4907 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley); | |
11525 | 4908 |
10526 | 4909 gtk_imhtml_associate_smiley(GTK_IMHTML(gtkconv->imhtml), sml, smiley); |
10537 | 4910 |
10526 | 4911 return TRUE; |
4912 } | |
4913 | |
10537 | 4914 static void |
10526 | 4915 gaim_gtkconv_custom_smiley_write(GaimConversation *conv, const char *smile, |
11137 | 4916 const guchar *data, gsize size) |
10526 | 4917 { |
4918 GaimGtkConversation *gtkconv; | |
4919 GtkIMHtmlSmiley *smiley; | |
10537 | 4920 GdkPixbufLoader *loader; |
10526 | 4921 const char *sml; |
4922 | |
4923 sml = gaim_account_get_protocol_name(conv->account); | |
4924 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4925 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); | |
4926 | |
10537 | 4927 if (!smiley) |
10526 | 4928 return; |
10537 | 4929 |
10526 | 4930 loader = smiley->loader; |
10537 | 4931 if (!loader) |
10526 | 4932 return; |
4933 | |
4934 gdk_pixbuf_loader_write(loader, data, size, NULL); | |
4935 } | |
4936 | |
4937 static void | |
4938 gaim_gtkconv_custom_smiley_close(GaimConversation *conv, const char *smile) | |
4939 { | |
4940 GaimGtkConversation *gtkconv; | |
4941 GtkIMHtmlSmiley *smiley; | |
4942 GdkPixbufLoader *loader; | |
4943 const char *sml; | |
4944 | |
4945 g_return_if_fail(conv != NULL); | |
4946 g_return_if_fail(smile != NULL); | |
4947 | |
4948 sml = gaim_account_get_protocol_name(conv->account); | |
4949 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4950 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); | |
4951 | |
10537 | 4952 if (!smiley) |
10526 | 4953 return; |
4954 | |
4955 loader = smiley->loader; | |
4956 | |
10537 | 4957 if (!loader) |
10526 | 4958 return; |
10537 | 4959 |
12335 | 4960 |
11525 | 4961 |
10526 | 4962 gaim_debug_info("gtkconv", "About to close the smiley pixbuf\n"); |
4963 | |
4964 gdk_pixbuf_loader_close(loader, NULL); | |
12335 | 4965 |
10526 | 4966 } |
4967 | |
11581 | 4968 /* |
4969 * Makes sure all the menu items and all the buttons are hidden/shown and | |
4970 * sensitive/insensitive. This is called after changing tabs and when an | |
4971 * account signs on or off. | |
4972 */ | |
4973 static void | |
4974 gray_stuff_out(GaimGtkConversation *gtkconv) | |
4975 { | |
4976 GaimGtkWindow *win; | |
4977 GaimConversation *conv = gtkconv->active_conv; | |
4978 GaimConnection *gc; | |
4979 GaimPluginProtocolInfo *prpl_info = NULL; | |
4980 GdkPixbuf *window_icon = NULL; | |
4981 GtkIMHtmlButtons buttons; | |
4982 GaimAccount *account; | |
4983 | |
4984 win = gaim_gtkconv_get_window(gtkconv); | |
4985 gc = gaim_conversation_get_gc(conv); | |
4986 account = gaim_conversation_get_account(conv); | |
4987 | |
4988 if (gc != NULL) | |
4989 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
4990 | |
11594 | 4991 if (win->menu.send_to != NULL) |
11734 | 4992 update_send_to_selection(win); |
11581 | 4993 |
4994 /* | |
4995 * Handle hiding and showing stuff based on what type of conv this is. | |
4996 * Stuff that Gaim IMs support in general should be shown for IM | |
4997 * conversations. Stuff that Gaim chats support in general should be | |
4998 * shown for chat conversations. It doesn't matter whether the PRPL | |
4999 * supports it or not--that only affects if the button or menu item | |
5000 * is sensitive or not. | |
5001 */ | |
5002 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | |
5003 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
5004 | |
5005 /* Deal with menu items */ | |
5006 gtk_widget_show(win->menu.view_log); | |
5007 gtk_widget_show(win->menu.send_file); | |
5008 gtk_widget_show(win->menu.add_pounce); | |
5009 gtk_widget_show(win->menu.get_info); | |
5010 gtk_widget_hide(win->menu.invite); | |
5011 gtk_widget_show(win->menu.alias); | |
5012 gtk_widget_show(win->menu.block); | |
5013 | |
5014 if (gaim_find_buddy(account, gaim_conversation_get_name(conv)) == NULL) { | |
5015 gtk_widget_show(win->menu.add); | |
5016 gtk_widget_hide(win->menu.remove); | |
5017 } else { | |
5018 gtk_widget_show(win->menu.remove); | |
5019 gtk_widget_hide(win->menu.add); | |
5020 } | |
5021 | |
5022 gtk_widget_show(win->menu.insert_link); | |
5023 gtk_widget_show(win->menu.insert_image); | |
5024 gtk_widget_show(win->menu.show_icon); | |
5025 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | |
5026 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ | |
5027 | |
5028 /* Deal with menu items */ | |
5029 gtk_widget_show(win->menu.view_log); | |
5030 gtk_widget_hide(win->menu.send_file); | |
5031 gtk_widget_hide(win->menu.add_pounce); | |
5032 gtk_widget_hide(win->menu.get_info); | |
5033 gtk_widget_show(win->menu.invite); | |
5034 gtk_widget_show(win->menu.alias); | |
5035 gtk_widget_hide(win->menu.block); | |
5036 gtk_widget_hide(win->menu.show_icon); | |
5037 | |
5038 if (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { | |
5039 /* If the chat is NOT in the buddy list */ | |
5040 gtk_widget_show(win->menu.add); | |
5041 gtk_widget_hide(win->menu.remove); | |
5042 } else { | |
5043 /* If the chat IS in the buddy list */ | |
5044 gtk_widget_hide(win->menu.add); | |
5045 gtk_widget_show(win->menu.remove); | |
5046 } | |
5047 | |
5048 gtk_widget_show(win->menu.insert_link); | |
5049 gtk_widget_hide(win->menu.insert_image); | |
5050 } | |
5051 | |
5052 /* | |
5053 * Handle graying stuff out based on whether an account is connected | |
5054 * and what features that account supports. | |
5055 */ | |
5056 if ((gc != NULL) && | |
12012 | 5057 ((gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) || |
5058 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) | |
5059 { | |
11581 | 5060 /* Account is online */ |
5061 /* Deal with the toolbar */ | |
12012 | 5062 if (conv->features & GAIM_CONNECTION_HTML) |
5063 { | |
5064 buttons = GTK_IMHTML_ALL; /* Everything on */ | |
5065 if (conv->features & GAIM_CONNECTION_NO_BGCOLOR) | |
5066 buttons &= ~GTK_IMHTML_BACKCOLOR; | |
5067 if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) | |
5068 { | |
5069 buttons &= ~GTK_IMHTML_GROW; | |
5070 buttons &= ~GTK_IMHTML_SHRINK; | |
5071 } | |
5072 if (conv->features & GAIM_CONNECTION_NO_URLDESC) | |
5073 buttons &= ~GTK_IMHTML_LINKDESC; | |
5074 } else { | |
12216 | 5075 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; |
12012 | 5076 } |
12216 | 5077 |
5078 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || | |
5079 conv->features & GAIM_CONNECTION_NO_IMAGES) | |
5080 buttons &= ~GTK_IMHTML_IMAGE; | |
5081 | |
12012 | 5082 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
5083 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); | |
11581 | 5084 |
5085 /* Deal with menu items */ | |
12012 | 5086 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |
5087 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); | |
5088 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); | |
5089 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); | |
5090 gtk_widget_set_sensitive(win->menu.block, (prpl_info->add_deny != NULL)); | |
5091 gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & GAIM_CONNECTION_HTML)); | |
12099 | 5092 gtk_widget_set_sensitive(win->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE) && !(conv->features & GAIM_CONNECTION_NO_IMAGES)); |
12012 | 5093 |
5094 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | |
5095 { | |
5096 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); | |
5097 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); | |
5098 gtk_widget_set_sensitive(win->menu.send_file, | |
5099 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || | |
5100 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
5101 gtk_widget_set_sensitive(win->menu.alias, | |
5102 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL)); | |
5103 } | |
5104 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | |
5105 { | |
5106 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); | |
5107 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); | |
5108 gtk_widget_set_sensitive(win->menu.alias, | |
5109 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL)); | |
5110 } | |
11581 | 5111 |
5112 /* Deal with chat userlist buttons */ | |
12012 | 5113 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
5114 { | |
5115 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_im, TRUE); | |
5116 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_ignore, TRUE); | |
5117 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_info, (prpl_info->get_info != NULL)); | |
5118 } | |
5119 } else { | |
11581 | 5120 /* Account is offline */ |
5121 /* Or it's a chat that we've left. */ | |
5122 | |
5123 /* Then deal with menu items */ | |
12012 | 5124 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |
5125 gtk_widget_set_sensitive(win->menu.send_file, FALSE); | |
5126 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); | |
5127 gtk_widget_set_sensitive(win->menu.get_info, FALSE); | |
5128 gtk_widget_set_sensitive(win->menu.invite, FALSE); | |
5129 gtk_widget_set_sensitive(win->menu.alias, FALSE); | |
5130 gtk_widget_set_sensitive(win->menu.block, FALSE); | |
5131 gtk_widget_set_sensitive(win->menu.add, FALSE); | |
5132 gtk_widget_set_sensitive(win->menu.remove, FALSE); | |
5133 gtk_widget_set_sensitive(win->menu.insert_link, TRUE); | |
5134 gtk_widget_set_sensitive(win->menu.insert_image, FALSE); | |
11581 | 5135 |
5136 /* Deal with chat userlist buttons */ | |
12012 | 5137 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
5138 { | |
5139 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_im, FALSE); | |
5140 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_ignore, FALSE); | |
5141 gtk_widget_set_sensitive(gtkconv->u.chat->userlist_info, FALSE); | |
5142 } | |
5143 } | |
11581 | 5144 |
5145 /* | |
5146 * Update the window's icon | |
5147 */ | |
12171 | 5148 if (gaim_gtk_conv_window_is_active_conversation(conv)) |
11581 | 5149 { |
12171 | 5150 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && |
5151 (gtkconv->u.im->anim)) | |
5152 { | |
5153 window_icon = | |
5154 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5155 g_object_ref(window_icon); | |
5156 } else { | |
5157 window_icon = gaim_gtkconv_get_tab_icon(conv, FALSE); | |
5158 } | |
5159 gtk_window_set_icon(GTK_WINDOW(win->window), window_icon); | |
5160 if (window_icon != NULL) | |
5161 g_object_unref(G_OBJECT(window_icon)); | |
5162 } | |
11581 | 5163 } |
5164 | |
10526 | 5165 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5166 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5167 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5168 { |
11581 | 5169 GaimGtkWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5170 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5171 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5172 GaimConvChat *chat; |
4359 | 5173 |
10116 | 5174 g_return_if_fail(conv != NULL); |
5175 | |
4359 | 5176 gtkconv = GAIM_GTK_CONVERSATION(conv); |
11581 | 5177 win = gtkconv->win; |
10810 | 5178 conv = gtkconv->active_conv; /* Gross hack */ |
11581 | 5179 /* Maybe we should just ignore it if conv != gtkconv->active_conv, |
5180 * instead of the gross hack? | |
5181 */ | |
4359 | 5182 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5183 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5184 { |
4359 | 5185 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5186 |
11338 | 5187 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5188 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5189 |
4359 | 5190 gaim_gtkconv_update_buttons_by_protocol(conv); |
5191 | |
11734 | 5192 update_send_to_selection(win); |
4359 | 5193 |
11525 | 5194 gaim_gtkthemes_smiley_themeize(gtkconv->imhtml); |
6394 | 5195 |
6395 | 5196 update_tab_icon(conv); |
4359 | 5197 } |
5198 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5199 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5200 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5201 { |
9472 | 5202 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5203 GaimConvIm *im = NULL; |
12131
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5204 GaimAccount *account = gaim_conversation_get_account(conv); |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5205 /* I think this is a little longer than it needs to be but I'm lazy. */ |
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5206 char style[51]; |
4736 | 5207 |
11338 | 5208 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5209 im = GAIM_CONV_IM(conv); |
4359 | 5210 |
12131
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5211 if (!gaim_account_is_connected(account) |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5212 || ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
9472 | 5213 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) |
5214 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5215 else | |
5216 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5217 |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5218 *style = '\0'; |
4359 | 5219 |
5220 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5221 gtk_widget_realize(gtkconv->tab_label); | |
5222 | |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5223 if (im != NULL && |
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5224 gaim_conv_im_get_typing_state(im) == GAIM_TYPING) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5225 { |
11759 | 5226 strncpy(style, "color=\"#47A046\"", sizeof(style)); |
4359 | 5227 } |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5228 else if (im != NULL && |
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5229 gaim_conv_im_get_typing_state(im) == GAIM_TYPED) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5230 { |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5231 strncpy(style, "color=\"#D1940C\"", sizeof(style)); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5232 } |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
5233 else if (gtkconv->unseen_state == GAIM_UNSEEN_NICK) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5234 { |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5235 strncpy(style, "color=\"#0D4E91\" style=\"italic\" weight=\"bold\"", sizeof(style)); |
4359 | 5236 } |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
5237 else if (gtkconv->unseen_state == GAIM_UNSEEN_TEXT) |
8252 | 5238 { |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5239 strncpy(style, "color=\"#DF421E\" weight=\"bold\"", sizeof(style)); |
8252 | 5240 } |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
5241 else if (gtkconv->unseen_state == GAIM_UNSEEN_EVENT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5242 { |
11758 | 5243 strncpy(style, "color=\"#868272\" style=\"italic\"", sizeof(style)); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5244 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5245 |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5246 if (*style != '\0') |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5247 { |
8536 | 5248 char *html_title,*label; |
5249 | |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10698
diff
changeset
|
5250 html_title = g_markup_escape_text(title, -1); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5251 |
11737
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5252 label = g_strdup_printf("<span %s>%s</span>", |
3959c29f340f
[gaim-migrate @ 14028]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11734
diff
changeset
|
5253 style, html_title); |
8536 | 5254 g_free(html_title); |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5255 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5256 g_free(label); |
4359 | 5257 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5258 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5259 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5260 |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5261 if (gaim_gtk_conv_window_is_active_conversation(conv)) |
10810 | 5262 update_typing_icon(gtkconv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5263 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5264 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5265 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5266 if (gaim_gtk_conv_window_is_active_conversation(conv)) |
11581 | 5267 gtk_window_set_title(GTK_WINDOW(win->window), title); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5268 } |
9472 | 5269 |
5270 g_free(title); | |
4359 | 5271 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5272 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5273 { |
7154 | 5274 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5275 chat = GAIM_CONV_CHAT(conv); |
4359 | 5276 gtkchat = gtkconv->u.chat; |
5277 | |
7154 | 5278 topic = gaim_conv_chat_get_topic(chat); |
5279 | |
9554 | 5280 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
7154 | 5281 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
9554 | 5282 topic ? topic : "", NULL); |
4359 | 5283 } |
5284 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5285 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5286 { |
11581 | 5287 gray_stuff_out(GAIM_GTK_CONVERSATION(gaim_gtk_conv_window_get_active_conversation(win))); |
11594 | 5288 generate_send_to_items(win); |
8946 | 5289 update_tab_icon(conv); |
9472 | 5290 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5291 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5292 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5293 { |
8946 | 5294 update_tab_icon(conv); |
4359 | 5295 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5296 else if (type == GAIM_CONV_UPDATE_ADD || type == GAIM_CONV_UPDATE_REMOVE || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5297 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5298 { |
9472 | 5299 gaim_conversation_autoset_title(conv); |
10810 | 5300 gray_stuff_out(GAIM_GTK_CONVERSATION(conv)); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5301 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5302 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5303 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5304 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5305 } |
10665 | 5306 else if (type == GAIM_CONV_UPDATE_FEATURES) |
5307 { | |
10810 | 5308 gray_stuff_out(GAIM_GTK_CONVERSATION(conv)); |
10665 | 5309 } |
4359 | 5310 } |
5311 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5312 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5313 { |
11581 | 5314 gaim_gtkconv_new, |
4359 | 5315 gaim_gtkconv_destroy, /* destroy_conversation */ |
5316 gaim_gtkconv_write_chat, /* write_chat */ | |
5317 gaim_gtkconv_write_im, /* write_im */ | |
5318 gaim_gtkconv_write_conv, /* write_conv */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5319 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5320 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5321 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5322 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
9554 | 5323 gaim_gtkconv_chat_update_user, /* chat_update_user */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5324 gaim_gtkconv_has_focus, /* has_focus */ |
10526 | 5325 gaim_gtkconv_custom_smiley_add, /* custom_smiley_add */ |
5326 gaim_gtkconv_custom_smiley_write, /* custom_smiley_write */ | |
5327 gaim_gtkconv_custom_smiley_close, /* custom_smiley_close */ | |
4359 | 5328 gaim_gtkconv_updated /* updated */ |
5329 }; | |
5330 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5331 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5332 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5333 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5334 return &conversation_ui_ops; |
4359 | 5335 } |
5336 | |
5337 /************************************************************************** | |
5338 * Public conversation utility functions | |
5339 **************************************************************************/ | |
5340 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5341 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5342 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5343 GaimGtkConversation *gtkconv; |
11581 | 5344 GaimGtkWindow *win; |
4359 | 5345 |
10381 | 5346 GdkPixbufLoader *loader; |
5347 GdkPixbufAnimation *anim; | |
4359 | 5348 GError *err = NULL; |
5349 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5350 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5351 size_t len; |
4359 | 5352 |
5353 GdkPixbuf *buf; | |
5354 | |
5355 GtkWidget *event; | |
5356 GtkWidget *frame; | |
5357 GdkPixbuf *scale; | |
5358 GdkPixmap *pm; | |
5359 GdkBitmap *bm; | |
9318 | 5360 int scale_width, scale_height; |
5361 | |
5362 GaimAccount *account; | |
5363 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5364 |
9324 | 5365 GaimBuddyIcon *icon; |
5366 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5367 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5368 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
11338 | 5369 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); |
4359 | 5370 |
5371 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
11581 | 5372 win = gtkconv->win; |
10175 | 5373 |
9687 | 5374 if (!gtkconv->u.im->show_icon) |
5375 return; | |
5376 | |
9318 | 5377 account = gaim_conversation_get_account(conv); |
5378 if(account && account->gc) | |
5379 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5380 |
9845 | 5381 /* Remove the current icon stuff */ |
9885 | 5382 if (gtkconv->u.im->icon_container != NULL) |
5383 gtk_widget_destroy(gtkconv->u.im->icon_container); | |
5384 gtkconv->u.im->icon_container = NULL; | |
9845 | 5385 |
5386 if (gtkconv->u.im->anim != NULL) | |
5387 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5388 | |
9887 | 5389 gtkconv->u.im->anim = NULL; |
5390 | |
9845 | 5391 if (gtkconv->u.im->icon_timer != 0) |
5392 g_source_remove(gtkconv->u.im->icon_timer); | |
5393 | |
5394 gtkconv->u.im->icon_timer = 0; | |
5395 | |
5396 if (gtkconv->u.im->iter != NULL) | |
5397 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4359 | 5398 |
10116 | 5399 gtkconv->u.im->iter = NULL; |
5400 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5401 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5402 return; |
5403 | |
5404 if (gaim_conversation_get_gc(conv) == NULL) | |
5405 return; | |
5406 | |
9324 | 5407 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5408 | |
5409 if (icon == NULL) | |
5410 return; | |
5411 | |
5412 data = gaim_buddy_icon_get_data(icon, &len); | |
5413 | |
10381 | 5414 loader = gdk_pixbuf_loader_new(); |
5415 gdk_pixbuf_loader_write(loader, data, len, NULL); | |
5416 anim = gdk_pixbuf_loader_get_animation(loader); | |
5417 if (anim) | |
5418 g_object_ref(G_OBJECT(anim)); | |
5419 gdk_pixbuf_loader_close(loader, &err); | |
5420 g_object_unref(loader); | |
5421 | |
5422 if (!anim) | |
9324 | 5423 return; |
10381 | 5424 gtkconv->u.im->anim = anim; |
9324 | 5425 |
4359 | 5426 if (err) { |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5427 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5428 "Buddy icon error: %s\n", err->message); |
4359 | 5429 g_error_free(err); |
5430 } | |
5431 | |
5432 if (!gtkconv->u.im->anim) | |
5433 return; | |
5434 | |
5435 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { | |
5436 gtkconv->u.im->iter = NULL; | |
5437 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5438 } else { | |
5439 gtkconv->u.im->iter = | |
8496 | 5440 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5441 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5442 if (gtkconv->u.im->animate) |
10810 | 5443 start_anim(NULL, gtkconv); |
4359 | 5444 } |
5445 | |
10483 | 5446 gaim_gtk_buddy_icon_get_scale_size(buf, prpl_info ? &prpl_info->icon_spec : |
9318 | 5447 NULL, &scale_width, &scale_height); |
4359 | 5448 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5449 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5450 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5451 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5452 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
11324 | 5453 GDK_INTERP_BILINEAR); |
4359 | 5454 |
5455 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5456 g_object_unref(G_OBJECT(scale)); |
4359 | 5457 |
8821 | 5458 |
9885 | 5459 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0); |
8821 | 5460 |
4359 | 5461 frame = gtk_frame_new(NULL); |
5462 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5463 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
9885 | 5464 gtk_box_pack_start(GTK_BOX(gtkconv->u.im->icon_container), frame, |
5465 FALSE, FALSE, 0); | |
8821 | 5466 |
4359 | 5467 event = gtk_event_box_new(); |
5468 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5469 g_signal_connect(G_OBJECT(event), "button-press-event", |
10883
b0fdadf463d4
[gaim-migrate @ 12581]
Gary Kramlich <grim@reaperworld.com>
parents:
10879
diff
changeset
|
5470 G_CALLBACK(icon_menu), gtkconv); |
4359 | 5471 gtk_widget_show(event); |
5472 | |
4635 | 5473 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5474 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5475 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5476 gtk_widget_show(gtkconv->u.im->icon); | |
5477 | |
4793 | 5478 g_object_unref(G_OBJECT(pm)); |
4359 | 5479 |
5480 if (bm) | |
4793 | 5481 g_object_unref(G_OBJECT(bm)); |
7143 | 5482 |
10356 | 5483 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), |
5484 gtkconv->u.im->icon_container, FALSE, FALSE, 0); | |
9332 | 5485 |
9885 | 5486 gtk_widget_show(gtkconv->u.im->icon_container); |
9332 | 5487 gtk_widget_show(frame); |
5488 | |
7143 | 5489 /* The buddy icon code needs badly to be fixed. */ |
5490 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5491 if(gaim_gtk_conv_window_is_active_conversation(conv)) |
11581 | 5492 gtk_window_set_icon(GTK_WINDOW(win->window), buf); |
4359 | 5493 } |
5494 | |
5495 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5496 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5497 { |
11581 | 5498 GaimGtkWindow *win; |
4359 | 5499 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5500 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5501 return; |
5502 | |
11581 | 5503 win = GAIM_GTK_CONVERSATION(conv)->win; |
5504 | |
5505 if (win != NULL && gaim_gtk_conv_window_is_active_conversation(conv)) | |
10810 | 5506 gray_stuff_out(GAIM_GTK_CONVERSATION(conv)); |
4359 | 5507 } |
5508 | |
5509 int | |
11614 | 5510 gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right) |
11581 | 5511 { |
4359 | 5512 gint nb_x, nb_y, x_rel, y_rel; |
5513 GtkNotebook *notebook; | |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5514 GtkWidget *page, *tab; |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5515 gint i, page_num = -1; |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5516 gint count; |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5517 gboolean horiz; |
4359 | 5518 |
11614 | 5519 if (to_right) |
5520 *to_right = FALSE; | |
5521 | |
11581 | 5522 notebook = GTK_NOTEBOOK(win->notebook); |
5523 | |
5524 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); | |
4359 | 5525 x_rel = x - nb_x; |
5526 y_rel = y - nb_y; | |
5527 | |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5528 horiz = (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5529 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM); |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5530 |
11780 | 5531 #if GTK_CHECK_VERSION(2,2,0) |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5532 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); |
11780 | 5533 #else |
5534 /* this is hacky, but it's only for Gtk 2.0.0... */ | |
5535 count = g_list_length(GTK_NOTEBOOK(notebook)->children); | |
5536 #endif | |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5537 |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5538 for (i = 0; i < count; i++) { |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5539 |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5540 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i); |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5541 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5542 |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5543 if (horiz) { |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5544 if (x_rel >= tab->allocation.x - GAIM_HIG_BOX_SPACE && |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5545 x_rel <= tab->allocation.x + tab->allocation.width + GAIM_HIG_BOX_SPACE) { |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5546 page_num = i; |
11614 | 5547 |
5548 if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2) | |
5549 *to_right = TRUE; | |
5550 | |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5551 break; |
4359 | 5552 } |
11279
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5553 } else { |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5554 if (y_rel >= tab->allocation.y - GAIM_HIG_BOX_SPACE && |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5555 y_rel <= tab->allocation.y + tab->allocation.height + GAIM_HIG_BOX_SPACE) { |
ed5302df41b0
[gaim-migrate @ 13474]
Luke Schierer <lschiere@pidgin.im>
parents:
11276
diff
changeset
|
5556 page_num = i; |
11614 | 5557 |
5558 if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2) | |
5559 *to_right = TRUE; | |
5560 | |
4359 | 5561 break; |
5562 } | |
5563 } | |
5564 } | |
5565 | |
5566 return page_num; | |
5567 } | |
5568 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5569 static void |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5570 close_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5571 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5572 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5573 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5574 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5575 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5576 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5577 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5578 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5579 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5580 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5581 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5582 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5583 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5584 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5585 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5586 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5587 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5588 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5589 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5590 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5591 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5592 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5593 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5594 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5595 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5596 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5597 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5598 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5599 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5600 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5601 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5602 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5603 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5604 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5605 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5606 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5607 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5608 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5609 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5610 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5611 if (value) |
12067
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12064
diff
changeset
|
5612 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12064
diff
changeset
|
5613 else { |
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12064
diff
changeset
|
5614 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12064
diff
changeset
|
5615 gtkspell_detach(spell); |
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12064
diff
changeset
|
5616 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5617 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5618 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5619 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5620 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5621 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5622 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5623 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5624 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5625 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5626 GtkPositionType pos; |
11581 | 5627 GaimGtkWindow *win; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5628 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5629 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5630 |
11581 | 5631 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { |
5632 win = l->data; | |
5633 | |
11619 | 5634 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5635 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5636 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5637 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5638 static void |
12188 | 5639 show_timestamps_pref_cb(const char *name, GaimPrefType type, |
5640 gpointer value, gpointer data) | |
5641 { | |
5642 GList *l; | |
5643 GaimConversation *conv; | |
5644 GaimGtkConversation *gtkconv; | |
5645 GaimGtkWindow *win; | |
5646 | |
5647 for (l = gaim_get_conversations(); l != NULL; l = l->next) | |
5648 { | |
5649 conv = (GaimConversation *)l->data; | |
5650 | |
5651 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
5652 continue; | |
5653 | |
5654 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5655 win = gtkconv->win; | |
5656 | |
5657 gtk_check_menu_item_set_active( | |
5658 GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), | |
5659 (gboolean)GPOINTER_TO_INT(value)); | |
5660 | |
5661 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5662 (gboolean)GPOINTER_TO_INT(value)); | |
5663 } | |
5664 } | |
5665 | |
5666 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5667 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5668 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5669 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5670 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5671 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5672 GaimGtkConversation *gtkconv; |
11581 | 5673 GaimGtkWindow *win; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5674 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5675 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5676 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5677 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5678 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5679 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5680 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5681 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5682 gtkconv = GAIM_GTK_CONVERSATION(conv); |
11581 | 5683 win = gtkconv->win; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5684 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5685 gtk_check_menu_item_set_active( |
11581 | 5686 GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), |
5687 (gboolean)GPOINTER_TO_INT(value)); | |
10377 | 5688 |
5689 if ((gboolean)GPOINTER_TO_INT(value)) | |
8317 | 5690 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5691 else |
8317 | 5692 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5693 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5694 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5695 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5696 static void |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5697 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5698 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5699 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5700 GList *l; |
8189 | 5701 GaimConversation *conv; |
5702 GaimGtkConversation *gtkconv; | |
11581 | 5703 GaimGtkWindow *win; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5704 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5705 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5706 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5707 |
8189 | 5708 /* Set the "animate" flag for each icon based on the new preference */ |
5709 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5710 conv = (GaimConversation *)l->data; | |
5711 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
10112 | 5712 gtkconv->u.im->animate = GPOINTER_TO_INT(value); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5713 } |
8189 | 5714 |
5715 /* Now either stop or start animation for the active conversation in each window */ | |
11581 | 5716 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { |
5717 win = l->data; | |
5718 conv = gaim_gtk_conv_window_get_active_conversation(win); | |
8189 | 5719 gaim_gtkconv_update_buddy_icon(conv); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5720 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5721 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5722 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5723 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5724 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5725 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5726 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5727 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5728 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5729 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5730 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5731 |
11338 | 5732 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
12052 | 5733 gaim_gtkconv_update_buddy_icon(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5734 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5735 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5736 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5737 static void |
11936
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5738 conv_placement_usetabs_cb(const char *name, GaimPrefType type, |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5739 gpointer value, gpointer data) |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5740 { |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5741 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5742 } |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5743 |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5744 static void |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5745 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5746 GaimStatus *newstatus) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5747 { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5748 GList *l; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5749 GaimConversation *conv = NULL; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5750 GaimGtkConversation *gtkconv; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5751 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5752 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5753 return; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5754 |
12310 | 5755 if(gaim_status_is_available(oldstatus) || !gaim_status_is_available(newstatus)) |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5756 return; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5757 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5758 for (l = hidden_convwin->gtkconvs; l != NULL; l = l->next) { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5759 gtkconv = l->data; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5760 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5761 conv = gtkconv->active_conv; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5762 |
12310 | 5763 if(!gaim_status_is_available( |
5764 gaim_account_get_active_status( | |
5765 gaim_conversation_get_account(conv)))) | |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5766 continue; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5767 |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
5768 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5769 gaim_gtkconv_placement_place(gtkconv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5770 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5771 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5772 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5773 static void |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5774 hide_new_pref_cb(const char *name, GaimPrefType type, gpointer value, |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5775 gpointer data) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5776 { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5777 GList *l; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5778 GaimConversation *conv = NULL; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5779 GaimGtkConversation *gtkconv; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5780 gboolean when_away = FALSE; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5781 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5782 if(!hidden_convwin) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5783 return; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5784 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5785 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5786 return; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5787 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5788 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0) |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5789 when_away = TRUE; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5790 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5791 for (l = hidden_convwin->gtkconvs; l != NULL; l = l->next) { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5792 gtkconv = l->data; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5793 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5794 conv = gtkconv->active_conv; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5795 |
12310 | 5796 if(when_away && !gaim_status_is_available( |
5797 gaim_account_get_active_status( | |
5798 gaim_conversation_get_account(conv)))) | |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5799 continue; |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5800 |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
5801 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5802 gaim_gtkconv_placement_place(gtkconv); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5803 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5804 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5805 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5806 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5807 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5808 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5809 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5810 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5811 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5812 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5813 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5814 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5815 |
11581 | 5816 func = gaim_gtkconv_placement_get_fnc(value); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5817 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5818 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5819 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5820 |
11581 | 5821 gaim_gtkconv_placement_set_current_func(func); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5822 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5823 |
12131
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5824 static void |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5825 account_signed_off_cb(GaimConnection *gc, gpointer event) |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5826 { |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5827 GList *iter; |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5828 GaimAccount *account; |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5829 |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5830 account = gaim_connection_get_account(gc); |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5831 |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5832 for (iter = gaim_get_conversations(); iter; iter = iter->next) |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5833 { |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5834 GaimConversation *conv = iter->data; |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5835 |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5836 if (gaim_conversation_get_account(conv) == account) |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5837 gaim_conversation_update(conv, GPOINTER_TO_INT(event)); |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5838 } |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5839 } |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5840 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5841 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5842 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5843 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5844 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5845 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5846 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5847 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5848 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5849 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5850 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5851 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5852 void *handle = gaim_gtk_conversations_get_handle(); |
11856
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5853 void *blist_handle = gaim_blist_get_handle(); |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5854 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5855 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5856 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5857 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5858 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5859 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5860 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5861 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
11267
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
5862 gaim_prefs_add_bool("/gaim/gtk/conversations/show_incoming_formatting", TRUE); |
477e5cca8287
[gaim-migrate @ 13449]
Richard Laager <rlaager@wiktel.com>
parents:
11261
diff
changeset
|
5863 |
12264 | 5864 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5865 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9832 | 5866 gaim_prefs_add_bool("/gaim/gtk/conversations/passthrough_unknown_commands", FALSE); |
9130 | 5867 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5868 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 5869 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 5870 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
5871 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5872 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5873 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5874 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5875 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
11224
409d6a11da51
[gaim-migrate @ 13360]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11209
diff
changeset
|
5876 gaim_prefs_add_int("/gaim/gtk/conversations/scrollback_lines", 4000); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5877 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5878 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5879 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5880 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5881 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5882 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5883 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5884 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5885 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 5886 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5887 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 5888 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5889 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5890 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5891 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 5892 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5893 |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5894 /* convert old queuing prefs to hide_new 3-way pref */ |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5895 if(gaim_prefs_exists("/plugins/gtk/docklet/queue_messages") && |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5896 gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages")) { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5897 gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "always"); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5898 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5899 else if(gaim_prefs_exists("/gaim/gtk/away/queue_messages") && |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5900 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5901 gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "away"); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5902 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5903 else { |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5904 gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "never"); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5905 } |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5906 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5907 /* Connect callbacks. */ |
10087 | 5908 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs", |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5909 close_on_tabs_pref_cb, NULL); |
12188 | 5910 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_timestamps", |
5911 show_timestamps_pref_cb, NULL); | |
10087 | 5912 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_formatting_toolbar", |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5913 show_formatting_toolbar_pref_cb, NULL); |
10087 | 5914 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/spellcheck", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5915 spellcheck_pref_cb, NULL); |
10087 | 5916 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tab_side", |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5917 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5918 |
11936
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5919 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tabs", |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5920 conv_placement_usetabs_cb, NULL); |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
5921 |
10087 | 5922 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/placement", |
11856
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5923 conv_placement_pref_cb, NULL); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5924 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5925 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5926 /* IM callbacks */ |
10087 | 5927 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/animate_buddy_icons", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5928 animate_buddy_icons_pref_cb, NULL); |
10087 | 5929 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/show_buddy_icons", |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5930 show_buddy_icons_pref_cb, NULL); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5931 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/hide_new", |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5932 hide_new_pref_cb, NULL); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5933 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5934 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5935 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5936 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5937 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5938 **********************************************************************/ |
11447
ef6e94bdda08
[gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11338
diff
changeset
|
5939 gaim_signal_register(handle, "conversation-dragging", |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5940 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5941 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5942 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5943 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5944 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 5945 |
5946 /********************************************************************** | |
5947 * Register commands | |
5948 **********************************************************************/ | |
9829 | 5949 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
5950 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
5951 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); | |
9213 | 5952 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
5953 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 5954 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
9213 | 5955 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
5956 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9597 | 5957 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
11145
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
5958 gaim_cmd_register("clear", "", GAIM_CMD_P_DEFAULT, |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
5959 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
dbc518c453f2
[gaim-migrate @ 13209]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11137
diff
changeset
|
5960 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
9213 | 5961 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, |
9597 | 5962 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
5963 help_command_cb, _("help <command>: Help on a specific command."), NULL); | |
11581 | 5964 |
11856
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5965 /********************************************************************** |
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5966 * UI operations |
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5967 **********************************************************************/ |
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5968 |
12131
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5969 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", handle, |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5970 G_CALLBACK(account_signed_off_cb), |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5971 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_ONLINE)); |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5972 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", handle, |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5973 G_CALLBACK(account_signed_off_cb), |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5974 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_OFFLINE)); |
cb7ccb5048cf
[gaim-migrate @ 14431]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
5975 |
11856
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5976 gaim_signal_connect(blist_handle, "buddy-added", handle, |
11855 | 5977 G_CALLBACK(buddy_update_cb), NULL); |
11856
fa7b84231ece
[gaim-migrate @ 14147]
Richard Laager <rlaager@wiktel.com>
parents:
11855
diff
changeset
|
5978 gaim_signal_connect(blist_handle, "buddy-removed", handle, |
11855 | 5979 G_CALLBACK(buddy_update_cb), NULL); |
5980 | |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
5981 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
5982 handle, G_CALLBACK(received_im_msg_cb), NULL); |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
5983 |
11581 | 5984 gaim_conversations_set_ui_ops(&conversation_ui_ops); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5985 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5986 hidden_convwin = gaim_gtk_conv_window_new(); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5987 window_list = g_list_remove(window_list, hidden_convwin); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5988 |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5989 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5990 handle, GAIM_CALLBACK(account_status_changed_cb), NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5991 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5992 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5993 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5994 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5995 { |
10443 | 5996 gaim_prefs_disconnect_by_handle(gaim_gtk_conversations_get_handle()); |
11855 | 5997 gaim_signals_disconnect_by_handle(gaim_gtk_conversations_get_handle()); |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
5998 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
5999 gaim_gtk_conv_window_destroy(hidden_convwin); |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12101
diff
changeset
|
6000 hidden_convwin=NULL; |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6001 } |
11581 | 6002 |
6003 | |
6004 | |
6005 | |
6006 | |
6007 | |
6008 | |
6009 | |
6010 | |
6011 | |
6012 | |
6013 | |
6014 | |
6015 | |
6016 | |
6017 | |
6018 /* down here is where gtkconvwin.c ought to start. except they share like every freaking function, | |
6019 * and touch each others' private members all day long */ | |
6020 | |
6021 /** | |
6022 * @file gtkconvwin.c GTK+ Conversation Window API | |
6023 * @ingroup gtkui | |
6024 * | |
6025 * gaim | |
6026 * | |
6027 * Gaim is the legal property of its developers, whose names are too numerous | |
6028 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6029 * source distribution. | |
6030 * | |
6031 * This program is free software; you can redistribute it and/or modify | |
6032 * it under the terms of the GNU General Public License as published by | |
6033 * the Free Software Foundation; either version 2 of the License, or | |
6034 * (at your option) any later version. | |
6035 * | |
6036 * This program is distributed in the hope that it will be useful, | |
6037 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
6038 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
6039 * GNU General Public License for more details. | |
6040 * | |
6041 * You should have received a copy of the GNU General Public License | |
6042 * along with this program; if not, write to the Free Software | |
6043 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
6044 * | |
6045 */ | |
6046 #include "internal.h" | |
6047 #include "gtkgaim.h" | |
6048 | |
6049 | |
6050 #include <gdk/gdkkeysyms.h> | |
6051 | |
6052 #include "account.h" | |
6053 #include "cmds.h" | |
6054 #include "debug.h" | |
6055 #include "imgstore.h" | |
6056 #include "log.h" | |
6057 #include "notify.h" | |
6058 #include "prpl.h" | |
6059 #include "request.h" | |
6060 #include "util.h" | |
6061 | |
6062 #include "gtkdnd-hints.h" | |
6063 #include "gtkblist.h" | |
6064 #include "gtkconv.h" | |
6065 #include "gtkdialogs.h" | |
6066 #include "gtkmenutray.h" | |
6067 #include "gtkpounce.h" | |
6068 #include "gtkprefs.h" | |
6069 #include "gtkprivacy.h" | |
6070 #include "gtkutils.h" | |
6071 #include "gtkstock.h" | |
6072 #include "gtkimhtml.h" | |
6073 #include "gtkimhtmltoolbar.h" | |
6074 | |
6075 static void | |
6076 do_close(GtkWidget *w, int resp, GaimGtkWindow *win) | |
6077 { | |
6078 gtk_widget_destroy(warn_close_dialog); | |
6079 warn_close_dialog = NULL; | |
6080 | |
6081 if (resp == GTK_RESPONSE_OK) | |
6082 gaim_gtk_conv_window_destroy(win); | |
6083 } | |
6084 | |
6085 static void | |
6086 build_warn_close_dialog(GaimGtkWindow *gtkwin) | |
6087 { | |
6088 GtkWidget *label; | |
6089 GtkWidget *vbox, *hbox; | |
6090 GtkWidget *img; | |
6091 | |
6092 g_return_if_fail(warn_close_dialog == NULL); | |
6093 | |
6094 | |
6095 warn_close_dialog = gtk_dialog_new_with_buttons( | |
6096 _("Confirm close"), | |
6097 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL, | |
6098 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
6099 GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); | |
6100 | |
6101 gtk_dialog_set_default_response(GTK_DIALOG(warn_close_dialog), | |
6102 GTK_RESPONSE_OK); | |
6103 | |
6104 gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog), | |
6105 6); | |
6106 gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE); | |
6107 gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), | |
6108 FALSE); | |
6109 | |
6110 /* Setup the outside spacing. */ | |
6111 vbox = GTK_DIALOG(warn_close_dialog)->vbox; | |
6112 | |
6113 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
6114 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
6115 | |
6116 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, | |
6117 GTK_ICON_SIZE_DIALOG); | |
6118 /* Setup the inner hbox and put the dialog's icon in it. */ | |
6119 hbox = gtk_hbox_new(FALSE, 12); | |
6120 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
6121 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
6122 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
6123 | |
6124 /* Setup the right vbox. */ | |
6125 vbox = gtk_vbox_new(FALSE, 12); | |
6126 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
6127 | |
6128 label = gtk_label_new(_("You have unread messages. Are you sure you want to close the window?")); | |
6129 gtk_widget_set_size_request(label, 350, -1); | |
6130 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
6131 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
6132 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
6133 | |
6134 /* Connect the signals. */ | |
6135 g_signal_connect(G_OBJECT(warn_close_dialog), "response", | |
6136 G_CALLBACK(do_close), gtkwin); | |
6137 | |
6138 } | |
6139 | |
6140 /************************************************************************** | |
6141 * Callbacks | |
6142 **************************************************************************/ | |
6143 | |
6144 static gboolean | |
6145 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
6146 { | |
6147 GaimGtkWindow *win = d; | |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6148 GList *l; |
11581 | 6149 |
6150 /* If there are unread messages then show a warning dialog */ | |
6151 for (l = gaim_gtk_conv_window_get_gtkconvs(win); | |
6152 l != NULL; l = l->next) | |
6153 { | |
6154 GaimGtkConversation *gtkconv = l->data; | |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6155 if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM && |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6156 gtkconv->unseen_state >= GAIM_UNSEEN_TEXT) |
11664
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6157 { |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6158 build_warn_close_dialog(win); |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6159 gtk_widget_show_all(warn_close_dialog); |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6160 |
38bbb0f15453
[gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents:
11657
diff
changeset
|
6161 return TRUE; |
11581 | 6162 } |
6163 } | |
6164 | |
6165 gaim_gtk_conv_window_destroy(win); | |
6166 | |
6167 return TRUE; | |
6168 } | |
6169 | |
11604 | 6170 static void |
6171 gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state) | |
6172 { | |
12175
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6173 if (state == GAIM_UNSEEN_NONE) |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6174 { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6175 gtkconv->unseen_count = 0; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6176 gtkconv->unseen_state = GAIM_UNSEEN_NONE; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6177 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6178 else |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6179 { |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6180 gtkconv->unseen_count++; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6181 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6182 if (state > gtkconv->unseen_state) |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6183 gtkconv->unseen_state = state; |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6184 } |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6185 |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6186 /* emit update signal to notify of count and possible unseen state change */ |
a655bdeb561d
[gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents:
12171
diff
changeset
|
6187 gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
6188 } |
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12012
diff
changeset
|
6189 |
11581 | 6190 /* |
6191 * When a conversation window is focused, we know the user | |
6192 * has looked at it so we know there are no longer unseen | |
6193 * messages. | |
6194 */ | |
6195 static gint | |
6196 focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) | |
6197 { | |
6198 GaimGtkWindow *win = d; | |
11604 | 6199 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); |
6200 | |
6201 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); | |
11581 | 6202 |
6203 return FALSE; | |
6204 } | |
6205 | |
11851 | 6206 #if !GTK_CHECK_VERSION(2,6,0) |
11581 | 6207 /* Courtesy of Galeon! */ |
6208 static void | |
6209 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) | |
6210 { | |
6211 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) | |
6212 gtk_widget_set_state(widget, GTK_STATE_NORMAL); | |
6213 } | |
11851 | 6214 #endif |
11581 | 6215 |
6216 static void | |
6217 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) | |
6218 { | |
6219 static GdkCursor *cursor = NULL; | |
6220 | |
6221 gtkwin->in_drag = TRUE; | |
6222 | |
6223 if (gtkwin->drag_leave_signal) { | |
6224 g_signal_handler_disconnect(G_OBJECT(widget), | |
6225 gtkwin->drag_leave_signal); | |
6226 gtkwin->drag_leave_signal = 0; | |
6227 } | |
6228 | |
6229 if (cursor == NULL) | |
6230 cursor = gdk_cursor_new(GDK_FLEUR); | |
6231 | |
6232 /* Grab the pointer */ | |
6233 gtk_grab_add(gtkwin->notebook); | |
6234 #ifndef _WIN32 | |
6235 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will | |
6236 always be true after a button press. */ | |
6237 if (!gdk_pointer_is_grabbed()) | |
6238 #endif | |
6239 gdk_pointer_grab(gtkwin->notebook->window, FALSE, | |
6240 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, | |
6241 NULL, cursor, GDK_CURRENT_TIME); | |
6242 } | |
6243 | |
6244 static gboolean | |
6245 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) | |
6246 { | |
6247 | |
6248 /* | |
6249 * Make sure the user moved the mouse far enough for the | |
6250 * drag to be initiated. | |
6251 */ | |
6252 if (win->in_predrag) { | |
6253 if (e->x_root < win->drag_min_x || | |
6254 e->x_root >= win->drag_max_x || | |
6255 e->y_root < win->drag_min_y || | |
6256 e->y_root >= win->drag_max_y) { | |
6257 | |
6258 win->in_predrag = FALSE; | |
6259 notebook_init_grab(win, widget); | |
6260 } | |
6261 } | |
6262 else { /* Otherwise, draw the arrows. */ | |
6263 GaimGtkWindow *dest_win; | |
6264 GtkNotebook *dest_notebook; | |
6265 GtkWidget *tab; | |
6266 gint nb_x, nb_y, page_num; | |
6267 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
6268 gboolean horiz_tabs = FALSE; | |
11614 | 6269 GaimGtkConversation *gtkconv; |
6270 gboolean to_right = FALSE; | |
11581 | 6271 |
6272 /* Get the window that the cursor is over. */ | |
6273 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root); | |
6274 | |
6275 if (dest_win == NULL) { | |
6276 dnd_hints_hide_all(); | |
6277 | |
6278 return TRUE; | |
6279 } | |
6280 | |
6281 dest_notebook = GTK_NOTEBOOK(dest_win->notebook); | |
6282 | |
6283 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
6284 | |
6285 arrow1_x = arrow2_x = nb_x; | |
6286 arrow1_y = arrow2_y = nb_y; | |
6287 | |
6288 page_num = gaim_gtkconv_get_tab_at_xy(dest_win, | |
11614 | 6289 e->x_root, e->y_root, &to_right); |
6290 to_right = to_right && (win != dest_win); | |
11581 | 6291 |
6292 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
6293 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
6294 | |
6295 horiz_tabs = TRUE; | |
6296 } | |
6297 | |
11614 | 6298 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(dest_win, page_num); |
6299 tab = gtkconv->tabby; | |
11581 | 6300 |
6301 if (horiz_tabs) { | |
6302 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
6303 | |
11614 | 6304 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { |
11581 | 6305 arrow1_x += tab->allocation.width; |
6306 arrow2_x += tab->allocation.width; | |
6307 } | |
6308 | |
6309 arrow1_y = nb_y + tab->allocation.y; | |
6310 arrow2_y = nb_y + tab->allocation.y + | |
6311 tab->allocation.height; | |
6312 } else { | |
6313 arrow1_x = nb_x + tab->allocation.x; | |
6314 arrow2_x = nb_x + tab->allocation.x + | |
6315 tab->allocation.width; | |
6316 arrow1_y = arrow2_y = nb_y + tab->allocation.y + tab->allocation.height/2; | |
6317 | |
6318 if ((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) { | |
6319 arrow1_y += tab->allocation.height; | |
6320 arrow2_y += tab->allocation.height; | |
6321 } | |
6322 } | |
6323 | |
6324 if (horiz_tabs) { | |
6325 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
6326 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
6327 } else { | |
6328 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
6329 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
6330 } | |
6331 } | |
6332 | |
6333 return TRUE; | |
6334 } | |
6335 | |
6336 static gboolean | |
6337 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimGtkWindow *win) | |
6338 { | |
6339 if (win->in_drag) | |
6340 return FALSE; | |
6341 | |
6342 if (e->x_root < win->drag_min_x || | |
6343 e->x_root >= win->drag_max_x || | |
6344 e->y_root < win->drag_min_y || | |
6345 e->y_root >= win->drag_max_y) { | |
6346 | |
6347 win->in_predrag = FALSE; | |
6348 notebook_init_grab(win, widget); | |
6349 } | |
6350 | |
6351 return TRUE; | |
6352 } | |
6353 | |
6354 /* | |
6355 * THANK YOU GALEON! | |
6356 */ | |
6357 static gboolean | |
6358 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) | |
6359 { | |
6360 gint nb_x, nb_y, x_rel, y_rel; | |
6361 int tab_clicked; | |
6362 GtkWidget *page; | |
6363 GtkWidget *tab; | |
6364 | |
6365 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
6366 return FALSE; | |
6367 | |
6368 | |
6369 if (win->in_drag) { | |
6370 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
6371 "Already in the middle of a window drag at tab_press_cb\n"); | |
6372 return TRUE; | |
6373 } | |
6374 | |
6375 /* | |
6376 * Make sure a tab was actually clicked. The arrow buttons | |
6377 * mess things up. | |
6378 */ | |
11614 | 6379 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL); |
11581 | 6380 |
6381 if (tab_clicked == -1) | |
6382 return FALSE; | |
6383 | |
6384 /* | |
6385 * Get the relative position of the press event, with regards to | |
6386 * the position of the notebook. | |
6387 */ | |
6388 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); | |
6389 | |
6390 x_rel = e->x_root - nb_x; | |
6391 y_rel = e->y_root - nb_y; | |
6392 | |
6393 /* Reset the min/max x/y */ | |
6394 win->drag_min_x = 0; | |
6395 win->drag_min_y = 0; | |
6396 win->drag_max_x = 0; | |
6397 win->drag_max_y = 0; | |
6398 | |
6399 /* Find out which tab was dragged. */ | |
6400 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked); | |
6401 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page); | |
6402 | |
6403 win->drag_min_x = tab->allocation.x + nb_x; | |
6404 win->drag_min_y = tab->allocation.y + nb_y; | |
6405 win->drag_max_x = tab->allocation.width + win->drag_min_x; | |
6406 win->drag_max_y = tab->allocation.height + win->drag_min_y; | |
6407 | |
6408 /* Make sure the click occurred in the tab. */ | |
6409 if (e->x_root < win->drag_min_x || | |
6410 e->x_root >= win->drag_max_x || | |
6411 e->y_root < win->drag_min_y || | |
6412 e->y_root >= win->drag_max_y) { | |
6413 | |
6414 return FALSE; | |
6415 } | |
6416 | |
6417 win->in_predrag = TRUE; | |
6418 win->drag_tab = tab_clicked; | |
6419 | |
6420 /* Connect the new motion signals. */ | |
6421 win->drag_motion_signal = | |
6422 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
6423 G_CALLBACK(notebook_motion_cb), win); | |
6424 | |
6425 win->drag_leave_signal = | |
6426 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
6427 G_CALLBACK(notebook_leave_cb), win); | |
6428 | |
6429 return FALSE; | |
6430 } | |
6431 | |
6432 static gboolean | |
6433 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) | |
6434 { | |
6435 GaimGtkWindow *dest_win; | |
6436 GaimConversation *conv; | |
6437 GaimGtkConversation *gtkconv; | |
6438 gint dest_page_num = 0; | |
6439 gboolean new_window = FALSE; | |
11614 | 6440 gboolean to_right = FALSE; |
11581 | 6441 |
6442 /* | |
6443 * Don't check to make sure that the event's window matches the | |
6444 * widget's, because we may be getting an event passed on from the | |
6445 * close button. | |
6446 */ | |
6447 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
6448 return FALSE; | |
6449 | |
6450 if (gdk_pointer_is_grabbed()) { | |
6451 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
6452 gtk_grab_remove(widget); | |
6453 } | |
6454 | |
6455 if (!win->in_predrag && !win->in_drag) | |
6456 return FALSE; | |
6457 | |
6458 /* Disconnect the motion signal. */ | |
6459 if (win->drag_motion_signal) { | |
6460 g_signal_handler_disconnect(G_OBJECT(widget), | |
6461 win->drag_motion_signal); | |
6462 | |
6463 win->drag_motion_signal = 0; | |
6464 } | |
6465 | |
6466 /* | |
6467 * If we're in a pre-drag, we'll also need to disconnect the leave | |
6468 * signal. | |
6469 */ | |
6470 if (win->in_predrag) { | |
6471 win->in_predrag = FALSE; | |
6472 | |
6473 if (win->drag_leave_signal) { | |
6474 g_signal_handler_disconnect(G_OBJECT(widget), | |
6475 win->drag_leave_signal); | |
6476 | |
6477 win->drag_leave_signal = 0; | |
6478 } | |
6479 } | |
6480 | |
6481 /* If we're not in drag... */ | |
6482 /* We're perfectly normal people! */ | |
6483 if (!win->in_drag) | |
6484 return FALSE; | |
6485 | |
6486 win->in_drag = FALSE; | |
6487 | |
6488 dnd_hints_hide_all(); | |
6489 | |
6490 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root); | |
6491 | |
6492 conv = gaim_gtk_conv_window_get_active_conversation(win); | |
6493 | |
6494 if (dest_win == NULL) { | |
6495 /* If the current window doesn't have any other conversations, | |
6496 * there isn't much point transferring the conv to a new window. */ | |
6497 if (gaim_gtk_conv_window_get_gtkconv_count(win) > 1) { | |
6498 /* Make a new window to stick this to. */ | |
6499 dest_win = gaim_gtk_conv_window_new(); | |
6500 new_window = TRUE; | |
6501 } | |
6502 } | |
6503 | |
6504 if (dest_win == NULL) | |
6505 return FALSE; | |
6506 | |
6507 gaim_signal_emit(gaim_gtk_conversations_get_handle(), | |
6508 "conversation-dragging", win, dest_win); | |
6509 | |
6510 /* Get the destination page number. */ | |
6511 if (!new_window) | |
6512 dest_page_num = gaim_gtkconv_get_tab_at_xy(dest_win, | |
11614 | 6513 e->x_root, e->y_root, &to_right); |
11581 | 6514 |
6515 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6516 | |
6517 if (win == dest_win) { | |
6518 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num); | |
6519 } else { | |
6520 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv); | |
6521 gaim_gtk_conv_window_add_gtkconv(dest_win, gtkconv); | |
11614 | 6522 gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right); |
11581 | 6523 gaim_gtk_conv_window_switch_gtkconv(dest_win, gtkconv); |
6524 if (new_window) { | |
6525 gint win_width, win_height; | |
6526 | |
6527 gtk_window_get_size(GTK_WINDOW(dest_win->window), | |
6528 &win_width, &win_height); | |
6529 | |
6530 gtk_window_move(GTK_WINDOW(dest_win->window), | |
6531 e->x_root - (win_width / 2), | |
6532 e->y_root - (win_height / 2)); | |
6533 | |
6534 gaim_gtk_conv_window_show(dest_win); | |
6535 } | |
6536 } | |
6537 | |
6538 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
6539 | |
6540 return TRUE; | |
6541 } | |
6542 | |
6543 | |
6544 static void | |
6545 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
6546 gpointer user_data) | |
6547 { | |
6548 GaimGtkWindow *win; | |
6549 GaimConversation *conv; | |
6550 GaimGtkConversation *gtkconv; | |
6551 | |
6552 win = user_data; | |
6553 conv = gaim_gtk_conv_window_get_active_conversation(win); | |
6554 | |
6555 g_return_if_fail(conv != NULL); | |
6556 | |
6557 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | |
6558 return; | |
6559 | |
6560 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6561 | |
6562 stop_anim(NULL, gtkconv); | |
6563 } | |
12085
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6564 static void |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6565 close_window(GtkWidget *w, GaimGtkWindow *win) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6566 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6567 close_win_cb(w, NULL, win); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6568 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6569 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6570 static void |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6571 detach_tab_cb(GtkWidget *w, GObject *menu) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6572 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6573 GaimGtkWindow *win, *new_window; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6574 GaimGtkConversation *gtkconv; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6575 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6576 gtkconv = g_object_get_data(menu, "clicked_tab"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6577 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6578 if (!gtkconv) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6579 return; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6580 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6581 win = gaim_gtkconv_get_window(gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6582 /* Nothing to do if there's only one tab in the window */ |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6583 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6584 return; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6585 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6586 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6587 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6588 new_window = gaim_gtk_conv_window_new(); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6589 gaim_gtk_conv_window_add_gtkconv(new_window, gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6590 gaim_gtk_conv_window_show(new_window); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6591 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6592 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6593 static void |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6594 close_others_cb(GtkWidget *w, GObject *menu) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6595 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6596 GList *iter; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6597 GaimGtkConversation *gtkconv; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6598 GaimGtkWindow *win; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6599 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6600 gtkconv = g_object_get_data(menu, "clicked_tab"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6601 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6602 if (!gtkconv) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6603 return; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6604 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6605 win = gaim_gtkconv_get_window(gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6606 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6607 for (iter = gaim_gtk_conv_window_get_gtkconvs(win); iter; ) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6608 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6609 GaimGtkConversation *gconv = iter->data; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6610 iter = iter->next; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6611 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6612 if (gconv != gtkconv) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6613 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6614 close_conv_cb(NULL, gconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6615 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6616 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6617 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6618 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6619 static void close_tab_cb(GtkWidget *w, GObject *menu) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6620 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6621 GaimGtkConversation *gtkconv; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6622 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6623 gtkconv = g_object_get_data(menu, "clicked_tab"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6624 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6625 if (gtkconv) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6626 close_conv_cb(NULL, gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6627 } |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6628 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6629 static gboolean |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6630 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, GaimGtkWindow *win) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6631 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6632 GtkWidget *item, *menu; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6633 GaimGtkConversation *gtkconv; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6634 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6635 if (event->type != GDK_BUTTON_PRESS || event->button != 3) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6636 return FALSE; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6637 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6638 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, |
12140
ed6c64e5e0ed
[gaim-migrate @ 14441]
Richard Laager <rlaager@wiktel.com>
parents:
12136
diff
changeset
|
6639 gaim_gtkconv_get_tab_at_xy(win, event->x_root, event->y_root, NULL)); |
12085
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6640 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6641 if (g_object_get_data(G_OBJECT(notebook->menu), "clicked_tab")) |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6642 { |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6643 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6644 return FALSE; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6645 } |
12188 | 6646 |
12085
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6647 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6648 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6649 menu = notebook->menu; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6650 gaim_separator(GTK_WIDGET(menu)); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6651 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6652 item = gtk_menu_item_new_with_label("Detach this tab"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6653 gtk_widget_show(item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6654 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6655 g_signal_connect(G_OBJECT(item), "activate", |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6656 G_CALLBACK(detach_tab_cb), menu); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6657 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6658 item = gtk_menu_item_new_with_label("Close this tab"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6659 gtk_widget_show(item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6660 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6661 g_signal_connect(G_OBJECT(item), "activate", |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6662 G_CALLBACK(close_tab_cb), menu); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6663 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6664 gaim_separator(menu); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6665 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6666 item = gtk_menu_item_new_with_label("Close other tabs"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6667 gtk_widget_show(item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6668 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6669 g_signal_connect(G_OBJECT(item), "activate", |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6670 G_CALLBACK(close_others_cb), menu); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6671 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6672 item = gtk_menu_item_new_with_label("Close all tabs"); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6673 gtk_widget_show(item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6674 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6675 g_signal_connect(G_OBJECT(item), "activate", |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6676 G_CALLBACK(close_window), win); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6677 |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6678 return FALSE; |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6679 } |
11581 | 6680 |
6681 static void | |
6682 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
6683 gpointer user_data) | |
6684 { | |
6685 GaimGtkWindow *win; | |
6686 GaimConversation *conv; | |
6687 GaimGtkConversation *gtkconv; | |
6688 | |
6689 win = user_data; | |
6690 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, page_num); | |
6691 conv = gtkconv->active_conv; | |
6692 | |
6693 g_return_if_fail(conv != NULL); | |
6694 | |
6695 /* | |
6696 * Only set "unseen" to "none" if the window has focus | |
6697 */ | |
6698 if (gaim_gtk_conv_window_has_focus(win)) | |
11604 | 6699 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); |
11581 | 6700 |
6701 /* Update the menubar */ | |
6702 | |
11672
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
6703 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
6704 gaim_conversation_is_logging(conv)); |
04e0189bb519
[gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents:
11671
diff
changeset
|
6705 |
11594 | 6706 generate_send_to_items(win); |
6707 | |
11604 | 6708 gaim_gtkconv_switch_active_conversation(conv); |
11581 | 6709 |
6710 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), | |
6711 gtkconv->make_sound); | |
6712 | |
6713 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), | |
6714 gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
6715 | |
6716 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), | |
12188 | 6717 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
11581 | 6718 |
6719 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | |
6720 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), | |
6721 gtkconv->u.im->show_icon); | |
11604 | 6722 |
11581 | 6723 /* |
6724 * We pause icons when they are not visible. If this icon should | |
6725 * be animated then start it back up again. | |
6726 */ | |
6727 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && | |
6728 (gtkconv->u.im->animate)) | |
6729 start_anim(NULL, gtkconv); | |
6730 } | |
6731 | |
6732 /************************************************************************** | |
6733 * GTK+ window ops | |
6734 **************************************************************************/ | |
6735 | |
6736 GList * | |
6737 gaim_gtk_conv_windows_get_list() | |
6738 { | |
6739 return window_list; | |
6740 } | |
6741 | |
6742 GaimGtkWindow * | |
6743 gaim_gtk_conv_window_new() | |
6744 { | |
6745 GaimGtkWindow *win; | |
6746 GtkPositionType pos; | |
6747 GtkWidget *testidea; | |
6748 GtkWidget *menubar; | |
6749 | |
6750 win = g_malloc0(sizeof(GaimGtkWindow)); | |
6751 | |
6752 window_list = g_list_append(window_list, win); | |
6753 | |
6754 /* Create the window. */ | |
6755 win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
6756 gtk_window_set_role(GTK_WINDOW(win->window), "conversation"); | |
6757 gtk_window_set_resizable(GTK_WINDOW(win->window), TRUE); | |
6758 gtk_container_set_border_width(GTK_CONTAINER(win->window), 0); | |
6759 GTK_WINDOW(win->window)->allow_shrink = TRUE; | |
6760 | |
6761 g_signal_connect(G_OBJECT(win->window), "delete_event", | |
6762 G_CALLBACK(close_win_cb), win); | |
6763 | |
6764 g_signal_connect(G_OBJECT(win->window), "focus_in_event", | |
6765 G_CALLBACK(focus_win_cb), win); | |
6766 | |
6767 /* Create the notebook. */ | |
6768 win->notebook = gtk_notebook_new(); | |
6769 | |
6770 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); | |
6771 | |
6772 #if 0 | |
6773 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(win->notebook), 0); | |
6774 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(win->notebook), 0); | |
6775 #endif | |
6776 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos); | |
6777 gtk_notebook_set_scrollable(GTK_NOTEBOOK(win->notebook), TRUE); | |
6778 gtk_notebook_popup_enable(GTK_NOTEBOOK(win->notebook)); | |
6779 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); | |
6780 gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), FALSE); | |
6781 | |
12085
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6782 g_signal_connect(G_OBJECT(win->notebook), "button-press-event", |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6783 G_CALLBACK(right_click_menu_cb), win); |
9b886b6e3002
[gaim-migrate @ 14382]
Gary Kramlich <grim@reaperworld.com>
parents:
12084
diff
changeset
|
6784 |
11581 | 6785 gtk_widget_show(win->notebook); |
6786 | |
6787 g_signal_connect(G_OBJECT(win->notebook), "switch_page", | |
6788 G_CALLBACK(before_switch_conv_cb), win); | |
6789 g_signal_connect_after(G_OBJECT(win->notebook), "switch_page", | |
6790 G_CALLBACK(switch_conv_cb), win); | |
6791 | |
6792 /* Setup the tab drag and drop signals. */ | |
6793 gtk_widget_add_events(win->notebook, | |
6794 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
6795 g_signal_connect(G_OBJECT(win->notebook), "button_press_event", | |
6796 G_CALLBACK(notebook_press_cb), win); | |
6797 g_signal_connect(G_OBJECT(win->notebook), "button_release_event", | |
6798 G_CALLBACK(notebook_release_cb), win); | |
6799 | |
6800 testidea = gtk_vbox_new(FALSE, 0); | |
6801 | |
6802 /* Setup the menubar. */ | |
6803 menubar = setup_menubar(win); | |
6804 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
6805 | |
6806 gtk_box_pack_start(GTK_BOX(testidea), win->notebook, TRUE, TRUE, 0); | |
6807 | |
6808 gtk_container_add(GTK_CONTAINER(win->window), testidea); | |
6809 | |
6810 gtk_widget_show(testidea); | |
6811 | |
6812 return win; | |
6813 } | |
6814 | |
6815 void | |
6816 gaim_gtk_conv_window_destroy(GaimGtkWindow *win) | |
6817 { | |
6818 window_list = g_list_remove(window_list, win); | |
6819 | |
11611 | 6820 if (win->gtkconvs) { |
6821 while (win->gtkconvs) { | |
6822 GList *nextgtk = win->gtkconvs->next; | |
6823 GaimGtkConversation *gtkconv = win->gtkconvs->data; | |
6824 GList *nextcore = gtkconv->convs->next; | |
6825 GaimConversation *conv = gtkconv->convs->data; | |
6826 gaim_conversation_destroy(conv); | |
6827 if (!nextgtk && !nextcore) | |
6828 /* we'll end up invoking ourselves when we destroy our last child */ | |
6829 /* so don't destroy ourselves right now */ | |
6830 return; | |
6831 } | |
6832 return; | |
6833 } | |
11581 | 6834 gtk_widget_destroy(win->window); |
6835 | |
6836 g_object_unref(G_OBJECT(win->menu.item_factory)); | |
6837 | |
6838 g_free(win); | |
6839 } | |
6840 | |
6841 void | |
6842 gaim_gtk_conv_window_show(GaimGtkWindow *win) | |
6843 { | |
6844 gtk_widget_show(win->window); | |
6845 } | |
6846 | |
6847 void | |
6848 gaim_gtk_conv_window_hide(GaimGtkWindow *win) | |
6849 { | |
6850 gtk_widget_hide(win->window); | |
6851 } | |
6852 | |
6853 void | |
6854 gaim_gtk_conv_window_raise(GaimGtkWindow *win) | |
6855 { | |
12084
d4728e1abe7b
[gaim-migrate @ 14381]
Gary Kramlich <grim@reaperworld.com>
parents:
12080
diff
changeset
|
6856 gtk_window_present(GTK_WINDOW(win->window)); |
11581 | 6857 } |
6858 | |
6859 void | |
6860 gaim_gtk_conv_window_switch_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) | |
6861 { | |
6862 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), | |
6863 gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), | |
6864 gtkconv->tab_cont)); | |
6865 } | |
6866 | |
6867 void | |
6868 gaim_gtk_conv_window_add_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) | |
6869 { | |
6870 GaimConversation *conv = gtkconv->active_conv; | |
6871 GaimGtkConversation *focus_gtkconv; | |
6872 GtkWidget *tabby, *menu_tabby; | |
6873 GtkWidget *tab_cont = gtkconv->tab_cont; | |
6874 GtkWidget *close_image; | |
6875 GaimConversationType conv_type; | |
6876 const char *name; | |
6877 const gchar *tmp_lab; | |
6878 gint close_button_width, close_button_height, focus_width, focus_pad; | |
11619 | 6879 gboolean tabs_side = FALSE; |
6880 gint angle = 0; | |
11581 | 6881 |
6882 name = gaim_conversation_get_name(conv); | |
6883 conv_type = gaim_conversation_get_type(conv); | |
6884 | |
6885 | |
6886 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); | |
6887 gtkconv->win = win; | |
6888 | |
11619 | 6889 if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_LEFT || |
6890 gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_RIGHT) | |
6891 tabs_side = TRUE; | |
6892 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_LEFT|8)) | |
6893 angle = 90; | |
6894 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_RIGHT|8)) | |
6895 angle = 270; | |
6896 | |
6897 if (angle) | |
6898 gtkconv->tabby = tabby = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); | |
6899 else | |
6900 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); | |
11581 | 6901 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
6902 | |
6903 /* Close button. */ | |
6904 gtkconv->close = gtk_button_new(); | |
6905 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height); | |
6906 if (gtk_check_version(2, 4, 2) == NULL) { | |
6907 /* Need to account for extra padding around the gtkbutton */ | |
6908 gtk_widget_style_get(GTK_WIDGET(gtkconv->close), | |
6909 "focus-line-width", &focus_width, | |
6910 "focus-padding", &focus_pad, | |
6911 NULL); | |
6912 close_button_width += (focus_width + focus_pad) * 2; | |
6913 close_button_height += (focus_width + focus_pad) * 2; | |
6914 } | |
6915 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), | |
6916 close_button_width, close_button_height); | |
6917 | |
6918 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); | |
6919 close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); | |
6920 gtk_widget_show(close_image); | |
6921 gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image); | |
6922 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, | |
6923 _("Close conversation"), NULL); | |
6924 | |
6925 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
6926 G_CALLBACK(close_conv_cb), gtkconv); | |
6927 | |
11851 | 6928 #if !GTK_CHECK_VERSION(2,6,0) |
11581 | 6929 /* |
6930 * I love Galeon. They have a fix for that stupid annoying visible | |
6931 * border bug. I love you guys! -- ChipX86 | |
6932 */ | |
11851 | 6933 /* This is fixed properly in some version of Gtk before 2.6.0 */ |
11581 | 6934 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
6935 G_CALLBACK(tab_close_button_state_changed_cb), NULL); | |
11851 | 6936 #endif |
11581 | 6937 |
6938 /* Status icon. */ | |
6939 gtkconv->icon = gtk_image_new(); | |
6940 gtkconv->menu_icon = gtk_image_new(); | |
6941 update_tab_icon(conv); | |
6942 | |
6943 /* Tab label. */ | |
6944 gtkconv->tab_label = gtk_label_new(tmp_lab = gaim_conversation_get_title(conv)); | |
11619 | 6945 |
11581 | 6946 #if GTK_CHECK_VERSION(2,6,0) |
11619 | 6947 if (!angle) |
6948 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |
11581 | 6949 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); |
11619 | 6950 if (tabs_side) { |
6951 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), MIN(g_utf8_strlen(tmp_lab, -1), 18)); | |
6952 } | |
6953 if (angle) | |
6954 gtk_label_set_angle(GTK_LABEL(gtkconv->tab_label), angle); | |
11581 | 6955 #endif |
6956 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
6957 #if 0 | |
6958 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
6959 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
6960 #endif | |
6961 | |
6962 /* Pack it all together. */ | |
11619 | 6963 if (angle == 90) |
6964 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); | |
6965 else | |
6966 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); | |
11581 | 6967 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
6968 FALSE, FALSE, 0); | |
6969 | |
6970 gtk_widget_show_all(gtkconv->icon); | |
6971 gtk_widget_show_all(gtkconv->menu_icon); | |
6972 | |
6973 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); | |
6974 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); | |
6975 gtk_widget_show(gtkconv->tab_label); | |
6976 gtk_widget_show(gtkconv->menu_label); | |
6977 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0); | |
6978 | |
11619 | 6979 if (angle == 90) |
6980 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); | |
6981 else | |
6982 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); | |
11581 | 6983 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
6984 gtk_widget_show(gtkconv->close); | |
6985 | |
6986 gtk_widget_show(tabby); | |
6987 gtk_widget_show(menu_tabby); | |
6988 | |
6989 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | |
6990 gaim_gtkconv_update_buddy_icon(conv); | |
6991 | |
6992 /* Add this pane to the conversation's notebook. */ | |
6993 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby); | |
11619 | 6994 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); |
11581 | 6995 |
6996 | |
6997 gtk_widget_show(tab_cont); | |
6998 | |
6999 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) { | |
7000 /* Er, bug in notebooks? Switch to the page manually. */ | |
7001 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); | |
7002 | |
7003 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), | |
7004 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); | |
7005 } else | |
7006 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); | |
7007 | |
7008 focus_gtkconv = g_list_nth_data(gaim_gtk_conv_window_get_gtkconvs(win), | |
7009 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); | |
7010 gtk_widget_grab_focus(focus_gtkconv->entry); | |
7011 | |
7012 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) | |
11734 | 7013 update_send_to_selection(win); |
11581 | 7014 } |
7015 | |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
7016 void |
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
7017 gaim_gtk_conv_window_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) |
11581 | 7018 { |
7019 unsigned int index; | |
7020 GaimConversationType conv_type; | |
7021 | |
7022 conv_type = gaim_conversation_get_type(gtkconv->active_conv); | |
7023 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); | |
7024 | |
7025 g_object_ref(gtkconv->tab_cont); | |
7026 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
7027 | |
7028 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); | |
7029 | |
7030 /* go back to tabless if need be */ | |
7031 if (gaim_gtk_conv_window_get_gtkconv_count(win) <= 2) { | |
7032 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), | |
7033 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); | |
7034 } | |
7035 | |
7036 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); | |
11582 | 7037 |
12288
3897229ccb33
[gaim-migrate @ 14592]
Luke Schierer <lschiere@pidgin.im>
parents:
12286
diff
changeset
|
7038 if (!win->gtkconvs && win != hidden_convwin) |
11582 | 7039 gaim_gtk_conv_window_destroy(win); |
11581 | 7040 } |
7041 | |
7042 GaimGtkConversation * | |
7043 gaim_gtk_conv_window_get_gtkconv_at_index(const GaimGtkWindow *win, int index) | |
7044 { | |
7045 GtkWidget *tab_cont; | |
7046 | |
7047 if (index == -1) | |
7048 index = 0; | |
7049 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index); | |
11604 | 7050 return tab_cont ? g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation") : NULL; |
11581 | 7051 } |
7052 | |
7053 GaimGtkConversation * | |
7054 gaim_gtk_conv_window_get_active_gtkconv(const GaimGtkWindow *win) | |
7055 { | |
7056 int index; | |
7057 GtkWidget *tab_cont; | |
7058 | |
7059 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); | |
7060 if (index == -1) | |
7061 index = 0; | |
7062 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index); | |
7063 if (!tab_cont) | |
7064 return NULL; | |
7065 return g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation"); | |
7066 } | |
7067 | |
7068 | |
7069 GaimConversation * | |
7070 gaim_gtk_conv_window_get_active_conversation(const GaimGtkWindow *win) | |
7071 { | |
7072 GaimGtkConversation *gtkconv; | |
7073 | |
7074 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); | |
7075 return gtkconv ? gtkconv->active_conv : NULL; | |
7076 } | |
7077 | |
7078 gboolean | |
7079 gaim_gtk_conv_window_is_active_conversation(const GaimConversation *conv) | |
7080 { | |
7081 return conv == gaim_gtk_conv_window_get_active_conversation(GAIM_GTK_CONVERSATION(conv)->win); | |
7082 } | |
7083 | |
7084 gboolean | |
7085 gaim_gtk_conv_window_has_focus(GaimGtkWindow *win) | |
7086 { | |
7087 gboolean has_focus = FALSE; | |
7088 | |
7089 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL); | |
7090 | |
7091 return has_focus; | |
7092 } | |
7093 | |
7094 GaimGtkWindow * | |
7095 gaim_gtk_conv_window_get_at_xy(int x, int y) | |
7096 { | |
7097 GaimGtkWindow *win; | |
7098 GdkWindow *gdkwin; | |
7099 GList *l; | |
7100 | |
7101 gdkwin = gdk_window_at_pointer(&x, &y); | |
7102 | |
7103 if (gdkwin) | |
7104 gdkwin = gdk_window_get_toplevel(gdkwin); | |
7105 | |
7106 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { | |
7107 win = l->data; | |
7108 | |
7109 if (gdkwin == win->window->window) | |
7110 return win; | |
7111 } | |
7112 | |
7113 return NULL; | |
7114 } | |
7115 | |
7116 GList * | |
7117 gaim_gtk_conv_window_get_gtkconvs(GaimGtkWindow *win) | |
7118 { | |
7119 return win->gtkconvs; | |
7120 } | |
7121 | |
7122 guint | |
7123 gaim_gtk_conv_window_get_gtkconv_count(GaimGtkWindow *win) | |
7124 { | |
7125 return g_list_length(win->gtkconvs); | |
7126 } | |
7127 | |
7128 GaimGtkWindow * | |
7129 gaim_gtk_conv_window_first_with_type(GaimConversationType type) | |
7130 { | |
7131 GList *wins, *convs; | |
7132 GaimGtkWindow *win; | |
7133 GaimGtkConversation *conv; | |
7134 | |
7135 if (type == GAIM_CONV_TYPE_UNKNOWN) | |
7136 return NULL; | |
7137 | |
7138 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) { | |
7139 win = wins->data; | |
7140 | |
7141 for (convs = win->gtkconvs; | |
7142 convs != NULL; | |
7143 convs = convs->next) { | |
7144 | |
7145 conv = convs->data; | |
7146 | |
7147 if (gaim_conversation_get_type(conv->active_conv) == type) | |
7148 return win; | |
7149 } | |
7150 } | |
7151 | |
7152 return NULL; | |
7153 } | |
7154 | |
7155 GaimGtkWindow * | |
7156 gaim_gtk_conv_window_last_with_type(GaimConversationType type) | |
7157 { | |
7158 GList *wins, *convs; | |
7159 GaimGtkWindow *win; | |
7160 GaimGtkConversation *conv; | |
7161 | |
7162 if (type == GAIM_CONV_TYPE_UNKNOWN) | |
7163 return NULL; | |
7164 | |
7165 for (wins = g_list_last(gaim_gtk_conv_windows_get_list()); | |
7166 wins != NULL; | |
7167 wins = wins->prev) { | |
7168 | |
7169 win = wins->data; | |
7170 | |
7171 for (convs = win->gtkconvs; | |
7172 convs != NULL; | |
7173 convs = convs->next) { | |
7174 | |
7175 conv = convs->data; | |
7176 | |
7177 if (gaim_conversation_get_type(conv->active_conv) == type) | |
7178 return win; | |
7179 } | |
7180 } | |
7181 | |
7182 return NULL; | |
7183 } | |
7184 | |
7185 | |
7186 /************************************************************************** | |
7187 * Conversation placement functions | |
7188 **************************************************************************/ | |
7189 typedef struct | |
7190 { | |
7191 char *id; | |
7192 char *name; | |
7193 GaimConvPlacementFunc fnc; | |
7194 | |
7195 } ConvPlacementData; | |
7196 | |
7197 static GList *conv_placement_fncs = NULL; | |
7198 static GaimConvPlacementFunc place_conv = NULL; | |
7199 | |
7200 /* This one places conversations in the last made window. */ | |
7201 static void | |
7202 conv_placement_last_created_win(GaimGtkConversation *conv) | |
7203 { | |
7204 GaimGtkWindow *win; | |
7205 | |
7206 GList *l = g_list_last(gaim_gtk_conv_windows_get_list()); | |
7207 win = l ? l->data : NULL;; | |
7208 | |
7209 if (win == NULL) { | |
7210 win = gaim_gtk_conv_window_new(); | |
7211 | |
7212 gaim_gtk_conv_window_add_gtkconv(win, conv); | |
7213 gaim_gtk_conv_window_show(win); | |
7214 } else { | |
7215 gaim_gtk_conv_window_add_gtkconv(win, conv); | |
7216 } | |
7217 } | |
7218 | |
7219 /* This one places conversations in the last made window of the same type. */ | |
7220 static void | |
7221 conv_placement_last_created_win_type(GaimGtkConversation *conv) | |
7222 { | |
7223 GaimGtkWindow *win; | |
7224 | |
7225 win = gaim_gtk_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); | |
7226 | |
7227 if (win == NULL) { | |
7228 win = gaim_gtk_conv_window_new(); | |
7229 | |
7230 gaim_gtk_conv_window_add_gtkconv(win, conv); | |
7231 gaim_gtk_conv_window_show(win); | |
7232 } else | |
7233 gaim_gtk_conv_window_add_gtkconv(win, conv); | |
7234 } | |
7235 | |
7236 /* This one places each conversation in its own window. */ | |
7237 static void | |
7238 conv_placement_new_window(GaimGtkConversation *conv) | |
7239 { | |
7240 GaimGtkWindow *win; | |
7241 | |
7242 win = gaim_gtk_conv_window_new(); | |
7243 | |
7244 gaim_gtk_conv_window_add_gtkconv(win, conv); | |
7245 | |
7246 gaim_gtk_conv_window_show(win); | |
7247 } | |
7248 | |
7249 static GaimGroup * | |
7250 conv_get_group(GaimGtkConversation *conv) | |
7251 { | |
7252 GaimGroup *group = NULL; | |
7253 | |
7254 if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_IM) { | |
7255 GaimBuddy *buddy; | |
7256 | |
7257 buddy = gaim_find_buddy(gaim_conversation_get_account(conv->active_conv), | |
7258 gaim_conversation_get_name(conv->active_conv)); | |
7259 | |
7260 if (buddy != NULL) | |
12088 | 7261 group = gaim_buddy_get_group(buddy); |
11581 | 7262 |
7263 } else if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_CHAT) { | |
7264 GaimChat *chat; | |
7265 | |
7266 chat = gaim_blist_find_chat(gaim_conversation_get_account(conv->active_conv), | |
7267 gaim_conversation_get_name(conv->active_conv)); | |
7268 | |
7269 if (chat != NULL) | |
7270 group = gaim_chat_get_group(chat); | |
7271 } | |
7272 | |
7273 return group; | |
7274 } | |
7275 | |
7276 /* | |
7277 * This groups things by, well, group. Buddies from groups will always be | |
7278 * grouped together, and a buddy from a group not belonging to any currently | |
7279 * open windows will get a new window. | |
7280 */ | |
7281 static void | |
7282 conv_placement_by_group(GaimGtkConversation *conv) | |
7283 { | |
7284 GaimConversationType type; | |
7285 GaimGroup *group = NULL; | |
7286 GList *wl, *cl; | |
7287 | |
7288 type = gaim_conversation_get_type(conv->active_conv); | |
7289 | |
7290 group = conv_get_group(conv); | |
7291 | |
7292 /* Go through the list of IMs and find one with this group. */ | |
7293 for (wl = gaim_gtk_conv_windows_get_list(); wl != NULL; wl = wl->next) { | |
7294 GaimGtkWindow *win2; | |
7295 GaimGtkConversation *conv2; | |
7296 GaimGroup *group2 = NULL; | |
7297 | |
7298 win2 = wl->data; | |
7299 | |
7300 for (cl = win2->gtkconvs; | |
7301 cl != NULL; | |
7302 cl = cl->next) { | |
7303 conv2 = cl->data; | |
7304 | |
7305 group2 = conv_get_group(conv2); | |
7306 | |
7307 if (group == group2) { | |
7308 gaim_gtk_conv_window_add_gtkconv(win2, conv); | |
7309 | |
7310 return; | |
7311 } | |
7312 } | |
7313 } | |
7314 | |
7315 /* Make a new window. */ | |
7316 conv_placement_new_window(conv); | |
7317 } | |
7318 | |
7319 /* This groups things by account. Otherwise, the same semantics as above */ | |
7320 static void | |
7321 conv_placement_by_account(GaimGtkConversation *conv) | |
7322 { | |
7323 GaimConversationType type; | |
7324 GList *wins, *convs; | |
7325 GaimAccount *account; | |
7326 | |
7327 account = gaim_conversation_get_account(conv->active_conv); | |
7328 type = gaim_conversation_get_type(conv->active_conv); | |
7329 | |
7330 /* Go through the list of IMs and find one with this group. */ | |
7331 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) { | |
7332 GaimGtkWindow *win2; | |
7333 GaimGtkConversation *conv2; | |
7334 | |
7335 win2 = wins->data; | |
7336 | |
7337 for (convs = win2->gtkconvs; | |
7338 convs != NULL; | |
7339 convs = convs->next) { | |
7340 conv2 = convs->data; | |
7341 | |
7342 if (account == gaim_conversation_get_account(conv2->active_conv)) { | |
7343 gaim_gtk_conv_window_add_gtkconv(win2, conv); | |
7344 return; | |
7345 } | |
7346 } | |
7347 } | |
7348 | |
7349 /* Make a new window. */ | |
7350 conv_placement_new_window(conv); | |
7351 } | |
7352 | |
7353 static ConvPlacementData * | |
7354 get_conv_placement_data(const char *id) | |
7355 { | |
7356 ConvPlacementData *data = NULL; | |
7357 GList *n; | |
7358 | |
7359 for (n = conv_placement_fncs; n; n = n->next) { | |
7360 data = n->data; | |
7361 if (!strcmp(data->id, id)) | |
7362 return data; | |
7363 } | |
7364 | |
7365 return NULL; | |
7366 } | |
7367 | |
7368 static void | |
7369 add_conv_placement_fnc(const char *id, const char *name, | |
7370 GaimConvPlacementFunc fnc) | |
7371 { | |
7372 ConvPlacementData *data; | |
7373 | |
7374 data = g_new(ConvPlacementData, 1); | |
7375 | |
7376 data->id = g_strdup(id); | |
7377 data->name = g_strdup(name); | |
7378 data->fnc = fnc; | |
7379 | |
7380 conv_placement_fncs = g_list_append(conv_placement_fncs, data); | |
7381 } | |
7382 | |
7383 static void | |
7384 ensure_default_funcs(void) | |
7385 { | |
7386 if (conv_placement_fncs == NULL) { | |
7387 add_conv_placement_fnc("last", _("Last created window"), | |
7388 conv_placement_last_created_win); | |
7389 add_conv_placement_fnc("im_chat", _("Separate IM and Chat windows"), | |
7390 conv_placement_last_created_win_type); | |
7391 add_conv_placement_fnc("new", _("New window"), | |
7392 conv_placement_new_window); | |
7393 add_conv_placement_fnc("group", _("By group"), | |
7394 conv_placement_by_group); | |
7395 add_conv_placement_fnc("account", _("By account"), | |
7396 conv_placement_by_account); | |
7397 } | |
7398 } | |
7399 | |
7400 GList * | |
7401 gaim_gtkconv_placement_get_options(void) | |
7402 { | |
7403 GList *n, *list = NULL; | |
7404 ConvPlacementData *data; | |
7405 | |
7406 ensure_default_funcs(); | |
7407 | |
7408 for (n = conv_placement_fncs; n; n = n->next) { | |
7409 data = n->data; | |
7410 list = g_list_append(list, data->name); | |
7411 list = g_list_append(list, data->id); | |
7412 } | |
7413 | |
7414 return list; | |
7415 } | |
7416 | |
7417 | |
7418 void | |
7419 gaim_gtkconv_placement_add_fnc(const char *id, const char *name, | |
7420 GaimConvPlacementFunc fnc) | |
7421 { | |
7422 g_return_if_fail(id != NULL); | |
7423 g_return_if_fail(name != NULL); | |
7424 g_return_if_fail(fnc != NULL); | |
7425 | |
7426 ensure_default_funcs(); | |
7427 | |
7428 add_conv_placement_fnc(id, name, fnc); | |
7429 } | |
7430 | |
7431 void | |
7432 gaim_gtkconv_placement_remove_fnc(const char *id) | |
7433 { | |
7434 ConvPlacementData *data = get_conv_placement_data(id); | |
7435 | |
7436 if (data == NULL) | |
7437 return; | |
7438 | |
7439 conv_placement_fncs = g_list_remove(conv_placement_fncs, data); | |
7440 | |
7441 g_free(data->id); | |
7442 g_free(data->name); | |
7443 g_free(data); | |
7444 } | |
7445 | |
7446 const char * | |
7447 gaim_gtkconv_placement_get_name(const char *id) | |
7448 { | |
7449 ConvPlacementData *data; | |
7450 | |
7451 ensure_default_funcs(); | |
7452 | |
7453 data = get_conv_placement_data(id); | |
7454 | |
7455 if (data == NULL) | |
7456 return NULL; | |
7457 | |
7458 return data->name; | |
7459 } | |
7460 | |
7461 GaimConvPlacementFunc | |
7462 gaim_gtkconv_placement_get_fnc(const char *id) | |
7463 { | |
7464 ConvPlacementData *data; | |
7465 | |
7466 ensure_default_funcs(); | |
7467 | |
7468 data = get_conv_placement_data(id); | |
7469 | |
7470 if (data == NULL) | |
7471 return NULL; | |
7472 | |
7473 return data->fnc; | |
7474 } | |
7475 | |
7476 void | |
7477 gaim_gtkconv_placement_set_current_func(GaimConvPlacementFunc func) | |
7478 { | |
7479 g_return_if_fail(func != NULL); | |
7480 | |
11936
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7481 /* If tabs are enabled, set the function, otherwise, NULL it out. */ |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7482 if (gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7483 place_conv = func; |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7484 else |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7485 place_conv = NULL; |
11581 | 7486 } |
7487 | |
7488 GaimConvPlacementFunc | |
7489 gaim_gtkconv_placement_get_current_func(void) | |
7490 { | |
7491 return place_conv; | |
7492 } | |
7493 | |
7494 void | |
7495 gaim_gtkconv_placement_place(GaimGtkConversation *gtkconv) | |
7496 { | |
7497 if (place_conv) | |
7498 place_conv(gtkconv); | |
11936
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7499 else |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7500 conv_placement_new_window(gtkconv); |
2af814f836e6
[gaim-migrate @ 14227]
Gary Kramlich <grim@reaperworld.com>
parents:
11911
diff
changeset
|
7501 } |
12239 | 7502 |
7503 gboolean | |
7504 gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv) | |
7505 { | |
7506 g_return_val_if_fail(gtkconv != NULL, FALSE); | |
7507 | |
7508 return (gtkconv->win == hidden_convwin); | |
7509 } | |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7510 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7511 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7512 /* Algorithm from http://www.w3.org/TR/AERT#color-contrast */ |
12351
af152afe7bac
[gaim-migrate @ 14655]
Richard Laager <rlaager@wiktel.com>
parents:
12346
diff
changeset
|
7513 static gboolean |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7514 color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast) |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7515 { |
12346
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7516 gulong fg_brightness; |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7517 gulong bg_brightness; |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7518 gulong br_diff; |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7519 gulong col_diff; |
12352
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7520 int fred, fgreen, fblue, bred, bgreen, bblue; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7521 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7522 /* this algorithm expects colors between 0 and 255 for each of red green and blue. |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7523 * GTK on the other hand has values between 0 and 65535 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7524 * Err suggested I >> 8, which grabbed the high bits. |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7525 */ |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7526 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7527 fred = foreground.red >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7528 fgreen = foreground.green >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7529 fblue = foreground.blue >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7530 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7531 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7532 bred = background.red >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7533 bgreen = background.green >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7534 bblue = background.blue >> 8 ; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7535 |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7536 fg_brightness = (fred * 299 + fgreen * 587 + fblue * 114) / 1000; |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7537 bg_brightness = (bred * 299 + bgreen * 587 + bblue * 114) / 1000; |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7538 br_diff = abs(fg_brightness - bg_brightness); |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7539 |
12352
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7540 col_diff = abs(fred - bred) + abs(fgreen - bgreen) + abs(fblue - bblue); |
e3fefd3ebc72
[gaim-migrate @ 14656]
Luke Schierer <lschiere@pidgin.im>
parents:
12351
diff
changeset
|
7541 |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7542 return ((col_diff > color_contrast) && (br_diff > brightness_contrast)); |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7543 } |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7544 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7545 |
12351
af152afe7bac
[gaim-migrate @ 14655]
Richard Laager <rlaager@wiktel.com>
parents:
12346
diff
changeset
|
7546 static GdkColor* |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7547 generate_nick_colors(guint numcolors, GdkColor background) |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7548 { |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7549 guint i; |
12346
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7550 GdkColor *colors = g_new(GdkColor, numcolors); |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7551 GdkColor nick_highlight; |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7552 GdkColor send_color; |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7553 |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7554 gdk_color_parse(HIGHLIGHT_COLOR, &nick_highlight); |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7555 gdk_color_parse(SEND_COLOR, &send_color); |
12346
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7556 |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7557 srand(background.red + background.green + background.blue + 1); |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7558 |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7559 for (i = 0; i < numcolors; ) |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7560 { |
f81d458aba18
[gaim-migrate @ 14650]
Richard Laager <rlaager@wiktel.com>
parents:
12345
diff
changeset
|
7561 GdkColor color = { 0, rand() % 65536, rand() % 65536, rand() % 65536 }; |
12356
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7562 if (color_is_visible(color, background, MIN_COLOR_CONTRAST, MIN_BRIGHTNESS_CONTRAST) && |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7563 color_is_visible(color, nick_highlight, MIN_COLOR_CONTRAST / 2, 0) && |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7564 color_is_visible(color, send_color, MIN_COLOR_CONTRAST / 4, 0)) |
4b8c20fcecd6
[gaim-migrate @ 14660]
Richard Laager <rlaager@wiktel.com>
parents:
12354
diff
changeset
|
7565 { |
12345
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7566 colors[i] = color; |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7567 i++; |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7568 } |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7569 } |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7570 |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7571 return colors; |
f6fa5d742c76
[gaim-migrate @ 14649]
Luke Schierer <lschiere@pidgin.im>
parents:
12335
diff
changeset
|
7572 } |