Mercurial > pidgin
annotate src/gtkconv.c @ 9479:fababc25f270
[gaim-migrate @ 10304]
a few updates
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 22:06:44 +0000 |
parents | e7b312e90abb |
children | c23f7045357c |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
9130 | 39 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "debug.h" |
6982 | 41 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
112 typedef struct |
4359 | 113 { |
114 GtkWidget *window; | |
115 | |
116 GtkWidget *entry; | |
117 GtkWidget *message; | |
118 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 } InviteBuddyInfo; |
4359 | 122 |
123 static GtkWidget *invite_dialog = NULL; | |
124 | |
125 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
127 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 129 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
132 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
133 static char *item_factory_translate_func (const char *path, gpointer func_data); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
134 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 135 |
136 /************************************************************************** | |
137 * Callbacks | |
138 **************************************************************************/ | |
139 static void | |
6038 | 140 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
141 { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
142 GaimConversation *conv; |
8557 | 143 const char *name; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
144 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
145 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
146 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
147 conv = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
148 "gaim_conversation"); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
149 |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
150 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
151 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
152 if (!((gaim_conversation_get_type(conv) != GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
153 g_list_find(gaim_get_ims(), conv)) || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
154 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
155 g_list_find(gaim_get_chats(), conv)))) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
156 filename = NULL; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 |
8557 | 166 name = gaim_conversation_get_name(conv); |
167 | |
168 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
169 fprintf(fp, "%s", conv->history->str); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
170 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
172 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
173 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 static void |
6038 | 175 do_check_save_convo(GObject *obj, GtkWidget *wid) |
176 { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
177 const char *filename; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
178 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
179 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
6038 | 180 |
181 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
182 return; | |
183 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
184 if (g_file_test(filename, G_FILE_TEST_EXISTS)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
185 { |
6038 | 186 gaim_request_yes_no(NULL, NULL, _("That file already exists"), |
187 _("Would you like to overwrite it?"), 1, wid, | |
188 G_CALLBACK(do_save_convo), NULL); | |
189 } | |
190 else | |
191 do_save_convo(wid); | |
192 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
193 |
4359 | 194 |
195 static gint | |
196 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
197 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
198 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
199 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
200 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
201 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
202 return TRUE; |
4359 | 203 } |
204 | |
205 static gint | |
206 close_conv_cb(GtkWidget *w, gpointer d) | |
207 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
208 GaimConversation *conv = (GaimConversation *)d; |
4359 | 209 |
210 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
211 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
212 return TRUE; |
4359 | 213 } |
214 | |
8914 | 215 static gboolean |
216 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
217 { | |
218 GaimGtkConversation *gtkconv; | |
9048 | 219 GaimConvWindow *win = gaim_conversation_get_window(conv); |
9459 | 220 gboolean saveheight; |
8914 | 221 |
222 if (!GTK_WIDGET_VISIBLE(w)) | |
223 return FALSE; | |
224 | |
225 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
226 return FALSE; | |
227 | |
228 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
229 | |
9459 | 230 /* we only save the new height if the formatting toolbar visibility matches the pref */ |
231 saveheight = (gtkconv->show_formatting_toolbar == gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | |
232 | |
9048 | 233 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
234 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
235 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
236 | |
8914 | 237 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
238 { | |
9048 | 239 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 240 { |
241 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
9459 | 242 if (saveheight) |
243 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
8914 | 244 } |
245 if (w == gtkconv->entry) | |
246 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
247 } | |
248 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
249 { | |
9048 | 250 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 251 { |
252 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
9459 | 253 if (saveheight) |
254 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
8914 | 255 } |
256 if (w == gtkconv->entry) | |
257 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
258 } | |
259 | |
260 return FALSE; | |
261 } | |
262 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
263 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
264 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
265 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
266 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
267 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
268 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
269 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
270 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
271 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
273 { |
8061 | 274 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
275 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
276 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
277 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
278 { |
9025 | 279 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
280 { |
9025 | 281 char *color; |
282 GdkColor fg_color, bg_color; | |
283 | |
284 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
285 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
286 | |
287 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
288 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
289 | |
290 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
291 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
292 | |
293 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
294 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
295 | |
296 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
297 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
298 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 299 |
300 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
301 { | |
302 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
303 &fg_color); | |
304 color = g_strdup_printf("#%02x%02x%02x", | |
305 fg_color.red / 256, | |
306 fg_color.green / 256, | |
307 fg_color.blue / 256); | |
308 } | |
309 else | |
310 color = g_strdup(""); | |
311 | |
8061 | 312 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
313 g_free(color); | |
9025 | 314 |
315 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
316 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
317 { | |
318 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
319 &bg_color); | |
320 color = g_strdup_printf("#%02x%02x%02x", | |
321 bg_color.red / 256, | |
322 bg_color.green / 256, | |
323 bg_color.blue / 256); | |
324 } | |
325 else | |
326 color = g_strdup(""); | |
327 | |
8061 | 328 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
329 g_free(color); |
8061 | 330 } |
8677 | 331 |
9025 | 332 |
8677 | 333 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
334 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
335 else | |
336 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 337 } |
338 } | |
9130 | 339 |
340 static const char * | |
341 gaim_gtk_get_cmd_prefix(void) | |
342 { | |
343 return "/"; | |
344 } | |
345 | |
9167 | 346 static GaimCmdRet |
347 me_command_cb(GaimConversation *conv, | |
348 const char *cmd, char **args, char **error) | |
349 { | |
350 char *tmp; | |
351 | |
352 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 353 |
9167 | 354 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
355 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
356 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
357 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
358 | |
359 g_free(tmp); | |
360 return GAIM_CMD_RET_OK; | |
361 } | |
362 | |
9212 | 363 static GaimCmdRet |
364 debug_command_cb(GaimConversation *conv, | |
365 const char *cmd, char **args, char **error) | |
366 { | |
367 char *tmp, *markup; | |
368 GaimCmdStatus status; | |
369 | |
370 if (!g_ascii_strcasecmp(args[0], "version")) { | |
371 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
372 markup = gaim_escape_html(tmp); | |
373 | |
374 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
375 | |
376 g_free(tmp); | |
377 g_free(markup); | |
378 return status; | |
379 } else { | |
380 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
381 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
382 return GAIM_CMD_STATUS_OK; | |
383 } | |
384 } | |
385 | |
9213 | 386 static GaimCmdRet |
387 help_command_cb(GaimConversation *conv, | |
388 const char *cmd, char **args, char **error) | |
389 { | |
390 GString *s; | |
391 GList *cmds, *l; | |
392 | |
393 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
394 "The following commands are available in this context:\n")); | |
395 | |
396 cmds = gaim_cmd_list(conv); | |
397 for (l = cmds; l; l = l->next) | |
398 if (l->next) | |
399 g_string_append_printf(s, "%s, ", (char *)l->data); | |
400 else | |
401 g_string_append_printf(s, "%s.", (char *)l->data); | |
402 | |
403 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
404 g_string_free(s, TRUE); | |
405 g_list_free(cmds); | |
406 | |
407 return GAIM_CMD_STATUS_OK; | |
408 } | |
409 | |
410 static GaimCmdRet | |
411 help_arg_command_cb(GaimConversation *conv, | |
412 const char *cmd, char **args, char **error) | |
413 { | |
414 GList *help, *l; | |
415 GString *s; | |
416 | |
417 s = g_string_new(""); | |
418 help = gaim_cmd_help(conv, args[0]); | |
419 | |
420 if (help) { | |
421 for (l = help; l; l = l->next) | |
422 if (l->next) | |
9247 | 423 g_string_append_printf(s, "/%s\n", (char *)l->data); |
9213 | 424 else |
9247 | 425 g_string_append_printf(s, "/%s", (char *)l->data); |
9213 | 426 } else { |
427 g_string_append(s, _("No such command (in this context).")); | |
428 } | |
429 | |
430 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
431 g_string_free(s, TRUE); | |
432 g_list_free(help); | |
433 | |
434 return GAIM_CMD_STATUS_OK; | |
435 } | |
436 | |
4359 | 437 static void |
9374 | 438 send_history_add(GaimConversation *conv, const char *message) |
439 { | |
440 GList *first; | |
441 | |
442 first = g_list_first(conv->send_history); | |
443 | |
444 if (first->data) | |
445 g_free(first->data); | |
446 | |
447 first->data = g_strdup(message); | |
448 | |
449 conv->send_history = g_list_prepend(first, NULL); | |
450 } | |
451 | |
452 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
453 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 454 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
455 GaimGtkConversation *gtkconv; |
9130 | 456 char *cmd; |
457 const char *prefix; | |
8655 | 458 GaimAccount *account; |
8677 | 459 GaimConnection *gc; |
8448 | 460 char *buf, *clean; |
4359 | 461 |
462 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 463 account = gaim_conversation_get_account(conv); |
9130 | 464 prefix = gaim_gtk_get_cmd_prefix(); |
465 | |
9471 | 466 if (!gaim_account_is_connected(account)) |
467 return; | |
468 | |
9474 | 469 if ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
470 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | |
9471 | 471 return; |
472 | |
9130 | 473 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { |
474 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
475 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) { | |
476 GaimCmdStatus status; | |
9374 | 477 char *error, *cmdline, *markup, *send_history; |
9175 | 478 GtkTextIter start, end; |
9130 | 479 |
9374 | 480 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
481 send_history_add(conv, send_history); | |
482 g_free(send_history); | |
483 | |
9130 | 484 cmdline = cmd + strlen(prefix); |
9175 | 485 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
486 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
487 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
488 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
489 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 490 g_free(cmd); |
9175 | 491 g_free(markup); |
9130 | 492 |
493 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
494 default_formatize(conv); | |
495 | |
496 switch(status) { | |
497 case GAIM_CMD_STATUS_OK: | |
498 return; | |
499 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 500 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
501 "to type a command, you can turn " | |
502 "commands off from Tools->" | |
503 "Preferences->Interface->Conversation" | |
504 "->Enable \"slash\" commands."), | |
9213 | 505 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 506 return; |
507 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 508 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
509 "to that command. If you didn't mean to type a command, " | |
510 "you can turn commands off from Tools->Preferences->" | |
511 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 512 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 513 return; |
514 case GAIM_CMD_STATUS_FAILED: | |
9212 | 515 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 516 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 517 if(error) |
518 g_free(error); | |
519 return; | |
520 case GAIM_CMD_STATUS_WRONG_TYPE: | |
521 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
522 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 523 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 524 else |
525 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 526 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 527 return; |
528 case GAIM_CMD_STATUS_WRONG_PRPL: | |
529 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 530 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 531 return; |
532 } | |
533 } | |
534 | |
535 g_free(cmd); | |
536 } | |
537 | |
8655 | 538 |
8442 | 539 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 540 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 541 |
4359 | 542 gtk_widget_grab_focus(gtkconv->entry); |
543 | |
8448 | 544 if (strlen(clean) == 0) { |
545 g_free(clean); | |
4359 | 546 return; |
547 } | |
548 | |
8677 | 549 gc = gaim_account_get_connection(account); |
550 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
551 char **bufs; | |
552 int i; | |
553 | |
554 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
555 for (i = 0; bufs[i]; i++) { | |
9374 | 556 send_history_add(conv, bufs[i]); |
8677 | 557 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
558 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
559 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
560 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
561 } | |
562 | |
563 g_strfreev(bufs); | |
564 | |
565 } else { | |
9374 | 566 send_history_add(conv, buf); |
8677 | 567 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
568 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
569 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
570 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
571 } | |
4359 | 572 |
8677 | 573 g_free(clean); |
4359 | 574 g_free(buf); |
575 | |
8061 | 576 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
577 default_formatize(conv); | |
4359 | 578 } |
579 | |
580 static void | |
7928 | 581 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 582 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
583 GaimAccount *account; |
4359 | 584 const char *name; |
585 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
586 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
587 name = gaim_conversation_get_name(conv); |
7879 | 588 |
589 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 590 GaimBuddy *b; |
591 | |
592 b = gaim_find_buddy(account, name); | |
593 if (b != NULL) | |
594 show_confirm_del(b); | |
595 else if (account != NULL && gaim_account_is_connected(account)) | |
596 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 597 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 598 GaimChat *c; |
599 | |
600 c = gaim_blist_find_chat(account, name); | |
601 if (c != NULL) | |
602 show_confirm_del_blist_chat(c); | |
603 else if (account != NULL && gaim_account_is_connected(account)) | |
604 gaim_blist_request_add_chat(account, NULL, NULL); | |
605 } | |
4359 | 606 |
607 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
608 } | |
609 | |
7975 | 610 static void chat_do_info(GaimConversation *conv, const char *who) |
611 { | |
612 GaimPluginProtocolInfo *prpl_info = NULL; | |
613 GaimConnection *gc; | |
614 | |
615 if ((gc = gaim_conversation_get_gc(conv))) { | |
616 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
617 | |
618 /* | |
619 * If there are special needs for getting info on users in | |
620 * buddy chat "rooms"... | |
621 */ | |
622 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
623 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
624 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
625 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
626 } |
7975 | 627 else |
628 prpl_info->get_info(gc, who); | |
629 } | |
630 } | |
631 | |
632 | |
4359 | 633 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
634 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 635 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
636 GaimGtkConversation *gtkconv; |
4359 | 637 |
638 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
639 | |
7879 | 640 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
641 serv_get_info(gaim_conversation_get_gc(conv), | |
642 gaim_conversation_get_name(conv)); | |
643 | |
644 gtk_widget_grab_focus(gtkconv->entry); | |
645 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
646 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
647 GaimGtkChatPane *gtkchat; |
4359 | 648 GtkTreeIter iter; |
649 GtkTreeModel *model; | |
650 GtkTreeSelection *sel; | |
651 const char *name; | |
652 | |
653 gtkchat = gtkconv->u.chat; | |
654 | |
655 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
656 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
657 | |
658 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
659 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
660 else | |
661 return; | |
662 | |
7975 | 663 chat_do_info(conv, name); |
4359 | 664 } |
665 } | |
666 | |
667 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
668 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 669 { |
670 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 671 gaim_conversation_get_name(conv)); |
4359 | 672 |
673 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
674 } | |
675 | |
676 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
677 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 678 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
679 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
680 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
681 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
682 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
683 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
684 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 685 |
686 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
687 } | |
688 | |
689 static void | |
9468 | 690 send_file_cb(GtkWidget *widget, GaimConversation *conv) |
691 { | |
692 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
693 | |
694 } | |
695 | |
696 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
697 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 698 { |
699 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
700 GaimGtkConversation *gtkconv; |
4359 | 701 |
702 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
703 | |
704 if (resp == GTK_RESPONSE_OK) { | |
705 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
706 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
707 | |
4793 | 708 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 709 g_free(info); |
710 | |
711 return; | |
712 } | |
713 | |
714 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
715 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 716 message, buddy); |
717 } | |
718 | |
719 gtk_widget_destroy(invite_dialog); | |
720 invite_dialog = NULL; | |
721 | |
722 g_free(info); | |
723 } | |
724 | |
725 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
726 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 727 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
728 InviteBuddyInfo *info = NULL; |
4359 | 729 |
730 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
731 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
732 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
733 GaimGtkWindow *gtkwin; |
4359 | 734 GtkWidget *label; |
735 GtkWidget *vbox, *hbox; | |
736 GtkWidget *table; | |
737 GtkWidget *img; | |
738 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
739 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
740 GTK_ICON_SIZE_DIALOG); |
4359 | 741 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
742 info = g_new0(InviteBuddyInfo, 1); |
4359 | 743 info->conv = conv; |
744 | |
745 gc = gaim_conversation_get_gc(conv); | |
746 win = gaim_conversation_get_window(conv); | |
747 gtkwin = GAIM_GTK_WINDOW(win); | |
748 | |
749 /* Create the new dialog. */ | |
750 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 751 _("Invite Buddy Into Chat Room"), |
7879 | 752 GTK_WINDOW(gtkwin->window), 0, |
753 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
754 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 755 |
756 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
757 GTK_RESPONSE_OK); | |
758 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
759 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
760 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
761 | |
762 /* Setup the outside spacing. */ | |
763 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
764 | |
765 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
766 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
767 | |
768 /* Setup the inner hbox and put the dialog's icon in it. */ | |
769 hbox = gtk_hbox_new(FALSE, 12); | |
770 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
771 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
772 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
773 | |
774 /* Setup the right vbox. */ | |
775 vbox = gtk_vbox_new(FALSE, 0); | |
776 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
777 | |
778 /* Put our happy label in it. */ | |
779 label = gtk_label_new(_("Please enter the name of the user you wish " | |
780 "to invite, along with an optional invite " | |
781 "message.")); | |
782 gtk_widget_set_size_request(label, 350, -1); | |
783 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
784 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
785 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
786 | |
787 /* hbox for the table, and to give it some spacing on the left. */ | |
788 hbox = gtk_hbox_new(FALSE, 6); | |
789 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
790 | |
791 /* Setup the table we're going to use to lay stuff out. */ | |
792 table = gtk_table_new(2, 2, FALSE); | |
793 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
794 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
795 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
796 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
797 | |
798 /* Now the Buddy label */ | |
799 label = gtk_label_new(NULL); | |
800 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
801 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
802 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
803 | |
804 /* Now the Buddy drop-down entry field. */ | |
805 info->entry = gtk_combo_new(); | |
806 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
807 gtk_entry_set_activates_default( | |
808 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
809 | |
810 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
811 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
812 | |
813 /* Fill in the names. */ | |
814 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
815 generate_invite_user_names(gc)); | |
816 | |
817 | |
818 /* Now the label for "Message" */ | |
819 label = gtk_label_new(NULL); | |
820 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
821 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
822 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
823 | |
824 | |
825 /* And finally, the Message entry field. */ | |
826 info->message = gtk_entry_new(); | |
827 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
828 | |
829 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
830 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
831 | |
832 /* Connect the signals. */ | |
833 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
834 G_CALLBACK(do_invite), info); | |
835 } | |
836 | |
837 gtk_widget_show_all(invite_dialog); | |
838 | |
839 if (info != NULL) | |
840 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
841 } | |
842 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
843 static void |
7748 | 844 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
845 { | |
846 show_im_dialog(); | |
847 } | |
848 | |
849 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
852 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
853 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
854 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
857 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
860 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
863 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
865 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
866 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
868 |
8974 | 869 static void |
870 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
871 { | |
872 GaimConvWindow *win = (GaimConvWindow *)data; | |
873 GaimConversation *conv; | |
874 GaimGtkConversation *gtkconv; | |
875 | |
876 conv = gaim_conv_window_get_active_conversation(win); | |
877 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
878 | |
879 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
880 g_string_free(conv->history, TRUE); | |
881 conv->history = g_string_new(""); | |
882 } | |
883 | |
7295 | 884 struct _search { |
885 GaimGtkConversation *gtkconv; | |
886 GtkWidget *entry; | |
887 }; | |
888 | |
7929 | 889 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 890 { |
7929 | 891 switch (resp) { |
892 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
893 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
894 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 895 break; |
896 | |
897 case GTK_RESPONSE_DELETE_EVENT: | |
898 case GTK_RESPONSE_CLOSE: | |
899 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
900 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
901 s->gtkconv->dialogs.search = NULL; | |
902 g_free(s); | |
903 break; | |
904 } | |
7295 | 905 } |
906 | |
907 static void | |
7751 | 908 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 909 { |
910 GaimConvWindow *win = (GaimConvWindow *)data; | |
911 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
912 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
913 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 914 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
915 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
916 GTK_ICON_SIZE_DIALOG); |
7929 | 917 GtkWidget *label; |
7295 | 918 struct _search *s; |
919 | |
7798 | 920 if (gtkconv->dialogs.search) { |
921 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 922 return; |
7798 | 923 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
924 |
7295 | 925 s = g_malloc(sizeof(struct _search)); |
926 s->gtkconv = gtkconv; | |
7929 | 927 |
928 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
929 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
930 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
931 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
932 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
933 GTK_RESPONSE_OK); |
7929 | 934 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
935 G_CALLBACK(do_search_cb), s); | |
936 | |
937 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
938 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
939 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
940 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
941 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
942 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 943 |
944 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
945 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
946 hbox); |
7929 | 947 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
948 | |
949 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
950 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
951 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
952 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
953 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
954 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 955 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
956 | |
957 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
958 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
959 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 960 g_signal_connect(G_OBJECT(s->entry), "changed", |
961 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
962 gtkconv->dialogs.search); | |
963 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
|
964 |
7295 | 965 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 966 gtk_widget_grab_focus(s->entry); |
7295 | 967 } |
968 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 static void |
9468 | 970 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
971 { | |
972 GaimConvWindow *win = (GaimConvWindow *)data; | |
973 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
974 | |
975 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
976 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | |
977 } | |
978 | |
979 } | |
980 | |
981 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
984 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
985 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
987 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
988 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
989 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
990 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
991 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
992 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
996 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 GaimGtkConversation *gtkconv; |
8756 | 999 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1001 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 1003 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1004 | |
1005 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
1006 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1012 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 1013 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 GaimGtkConversation *gtkconv; |
8756 | 1015 GtkIMHtmlToolbar *toolbar; |
1016 | |
1017 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1018 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 1019 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
1020 | |
1021 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
1022 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1024 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1028 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 GaimConversation *conv; |
7879 | 1030 GaimAccount *account; |
1031 const char *name; | |
1032 | |
1033 conv = gaim_conv_window_get_active_conversation(win); | |
1034 account = gaim_conversation_get_account(conv); | |
1035 name = gaim_conversation_get_name(conv); | |
1036 | |
1037 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1038 GaimBuddy *b; | |
1039 | |
1040 b = gaim_find_buddy(account, name); | |
1041 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 alias_dialog_bud(b); |
7879 | 1043 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1044 GaimChat *c; | |
1045 | |
1046 c = gaim_blist_find_chat(account, name); | |
1047 if (c != NULL) | |
1048 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1055 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1058 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1066 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1069 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1071 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1077 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1080 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1088 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1091 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1099 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1102 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1103 |
7928 | 1104 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1105 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1106 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1107 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1110 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1111 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1112 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1114 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1117 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1118 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1119 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1120 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1121 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1131 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1132 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1133 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1134 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1135 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1136 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1137 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1138 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1139 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1140 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1141 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1142 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1143 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1144 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1145 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1146 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1147 if (gtkconv->show_formatting_toolbar) |
8317 | 1148 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1149 else |
8317 | 1150 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1151 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1152 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1153 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1156 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1157 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1160 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1161 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1167 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 |
7961 | 1171 static void |
9188 | 1172 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1173 { | |
1174 GaimConvWindow *win = (GaimConvWindow *)data; | |
1175 GaimConversation *conv; | |
1176 GaimGtkConversation *gtkconv; | |
1177 | |
1178 conv = gaim_conv_window_get_active_conversation(win); | |
1179 | |
1180 if (!conv) | |
1181 return; | |
1182 | |
1183 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1184 | |
1185 gtkconv->show_timestamps = | |
1186 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1187 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1188 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1189 } | |
1190 | |
1191 static void | |
7961 | 1192 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 { |
7961 | 1194 GaimPluginProtocolInfo *prpl_info = NULL; |
1195 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 GaimConversation *conv2; |
7961 | 1197 GaimAccount *account; |
1198 | |
1199 account = gaim_conversation_get_account(conv); | |
1200 | |
1201 if(account && account->gc) | |
1202 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1203 | |
1204 if(prpl_info && prpl_info->get_cb_real_name) | |
1205 real_who = prpl_info->get_cb_real_name(account->gc, | |
1206 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1207 else | |
1208 real_who = g_strdup(who); | |
1209 | |
1210 if(!real_who) | |
1211 return; | |
1212 | |
1213 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1214 | |
1215 if (conv2 != NULL) | |
1216 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1217 else | |
1218 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1219 | |
1220 g_free(real_who); | |
1221 } | |
1222 | |
1223 | |
1224 static void | |
1225 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1226 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
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 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 |
7961 | 1245 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1253 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1260 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1274 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1275 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1276 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1277 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1278 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1279 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 static void |
7398 | 1285 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1286 { | |
1287 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1288 | |
1289 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1291 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1292 static void |
9468 | 1293 menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) |
1294 { | |
1295 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1296 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
1297 | |
1298 serv_send_file(gc, who, NULL); | |
1299 } | |
1300 | |
1301 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1302 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1303 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1304 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1305 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1306 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1307 |
7975 | 1308 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1310 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1311 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1312 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1315 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1317 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1318 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1319 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1320 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1321 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1322 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1323 |
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 * 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
|
1326 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1327 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1328 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1329 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1330 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1331 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1332 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1333 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1334 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1335 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1336 static void |
7928 | 1337 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1338 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1339 GaimAccount *account; |
6695 | 1340 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1341 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1342 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1343 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1344 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1345 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1346 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1347 if (b != NULL) |
5975 | 1348 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1349 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1350 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1351 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1352 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1353 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1354 |
8143 | 1355 static GtkWidget * |
1356 create_chat_menu(GaimConversation *conv, gchar *who, | |
1357 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1358 { | |
1359 static GtkWidget *menu = NULL; | |
1360 GtkWidget *button; | |
1361 | |
1362 /* | |
1363 * If a menu already exists, destroy it before creating a new one, | |
1364 * thus freeing-up the memory it occupied. | |
1365 */ | |
1366 if (menu) | |
1367 gtk_widget_destroy(menu); | |
1368 | |
1369 menu = gtk_menu_new(); | |
1370 | |
1371 button = gtk_menu_item_new_with_label(_("IM")); | |
1372 g_signal_connect(G_OBJECT(button), "activate", | |
1373 G_CALLBACK(menu_chat_im_cb), conv); | |
1374 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1375 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1376 gtk_widget_show(button); | |
1377 | |
9468 | 1378 if (gc && prpl_info && prpl_info->send_file |
1379 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { | |
1380 button = gtk_menu_item_new_with_label(_("Send File")); | |
1381 g_signal_connect(G_OBJECT(button), "activate", | |
1382 G_CALLBACK(menu_chat_send_file_cb), conv); | |
1383 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1384 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1385 gtk_widget_show(button); | |
1386 } | |
1387 | |
8143 | 1388 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
1389 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1390 else | |
1391 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1392 | |
1393 g_signal_connect(G_OBJECT(button), "activate", | |
1394 G_CALLBACK(ignore_cb), conv); | |
1395 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1396 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1397 gtk_widget_show(button); | |
1398 | |
8170 | 1399 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1400 button = gtk_menu_item_new_with_label(_("Info")); |
1401 g_signal_connect(G_OBJECT(button), "activate", | |
1402 G_CALLBACK(menu_chat_info_cb), conv); | |
1403 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1404 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1405 gtk_widget_show(button); | |
1406 } | |
1407 | |
1408 if (gc && prpl_info->get_cb_away) { | |
1409 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1410 g_signal_connect(G_OBJECT(button), "activate", | |
1411 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1412 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1413 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1414 gtk_widget_show(button); | |
1415 } | |
1416 | |
8170 | 1417 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1418 /* Added by Jonas <jonas@birme.se> */ |
1419 if (gc) { | |
1420 if (gaim_find_buddy(gc->account, who)) | |
1421 button = gtk_menu_item_new_with_label(_("Remove")); | |
1422 else | |
1423 button = gtk_menu_item_new_with_label(_("Add")); | |
1424 | |
1425 g_signal_connect(G_OBJECT(button), "activate", | |
1426 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1427 | |
1428 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1429 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1430 gtk_widget_show(button); | |
1431 } | |
1432 /* End Jonas */ | |
1433 | |
1434 return menu; | |
1435 } | |
1436 | |
1437 | |
1438 static gint | |
1439 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1440 { | |
1441 GaimGtkConversation *gtkconv; | |
1442 GaimPluginProtocolInfo *prpl_info = NULL; | |
1443 GaimGtkChatPane *gtkchat; | |
1444 GaimConnection *gc; | |
1445 GaimAccount *account; | |
1446 GtkTreeSelection *sel; | |
1447 GtkTreeIter iter; | |
1448 GtkTreeModel *model; | |
1449 GtkWidget *menu; | |
1450 gchar *who; | |
1451 | |
1452 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1453 gtkchat = gtkconv->u.chat; | |
1454 account = gaim_conversation_get_account(conv); | |
1455 gc = account->gc; | |
1456 | |
1457 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1458 | |
1459 if (gc != NULL) | |
1460 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1461 | |
1462 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1463 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1464 return FALSE; | |
1465 | |
1466 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
1467 menu = create_chat_menu (conv, who, prpl_info, gc); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1468 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1469 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1470 0, GDK_CURRENT_TIME); |
8143 | 1471 |
1472 return TRUE; | |
1473 } | |
1474 | |
1475 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1477 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1478 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1479 { |
8143 | 1480 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1481 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1482 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1483 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1484 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1485 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1486 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1487 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1488 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1489 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1490 int x, y; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1493 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1494 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1495 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1496 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1497 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1498 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1499 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
|
1500 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1501 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1502 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1503 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1504 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1505 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1506 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1507 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1508 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1509 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
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 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1512 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1513 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1514 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1515 chat_do_im(conv, who); |
1516 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1517 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1518 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1519 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1520 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1521 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1522 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1523 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1524 |
8133 | 1525 static void |
1526 move_to_next_unread_tab(GaimConversation *conv) | |
1527 { | |
1528 GaimConversation *next_conv = NULL; | |
1529 GaimConvWindow *win; | |
1530 GList *l; | |
1531 int index, i; | |
1532 | |
1533 win = gaim_conversation_get_window(conv); | |
1534 index = gaim_conversation_get_index(conv); | |
1535 | |
1536 /* First check the tabs after this position. */ | |
1537 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1538 l != NULL; | |
1539 l = l->next) { | |
1540 | |
1541 next_conv = (GaimConversation *)l->data; | |
1542 | |
1543 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1544 break; | |
1545 | |
1546 next_conv = NULL; | |
1547 } | |
1548 | |
1549 if (next_conv == NULL) { | |
1550 | |
1551 /* Now check before this position. */ | |
1552 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1553 l != NULL && i < index; | |
1554 l = l->next) { | |
1555 | |
1556 next_conv = (GaimConversation *)l->data; | |
1557 | |
1558 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1559 break; | |
1560 | |
1561 next_conv = NULL; | |
1562 } | |
1563 | |
1564 if (next_conv == NULL) { | |
1565 /* Okay, just grab the next conversation tab. */ | |
1566 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1567 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1568 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1569 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1570 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1571 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1572 } |
8133 | 1573 } |
1574 } | |
1575 | |
1576 if (next_conv != NULL && next_conv != conv) { | |
1577 gaim_conv_window_switch_conversation(win, | |
1578 gaim_conversation_get_index(next_conv)); | |
1579 } | |
1580 } | |
1581 | |
4359 | 1582 static gboolean |
8105 | 1583 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1584 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1585 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1586 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1587 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1588 GaimGtkWindow *gtkwin; |
8105 | 1589 int numconvs; |
1590 int curconv; | |
1591 | |
1592 conv = (GaimConversation *)data; | |
1593 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1594 win = gaim_conversation_get_window(conv); | |
1595 gtkwin = GAIM_GTK_WINDOW(win); | |
1596 numconvs = gaim_conv_window_get_conversation_count(win); | |
1597 curconv = gaim_conversation_get_index(conv); | |
1598 | |
1599 /* If CTRL was held down... */ | |
1600 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1601 switch (event->keyval) { |
8105 | 1602 case GDK_Return: |
1603 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1604 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1605 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1606 { |
8105 | 1607 send_cb(NULL, conv); |
1608 | |
1609 return TRUE; | |
1610 } | |
1611 break; | |
1612 | |
4359 | 1613 case GDK_Up: |
1614 if (!conv->send_history) | |
1615 break; | |
1616 | |
1617 if (!conv->send_history->prev) { | |
1618 GtkTextIter start, end; | |
1619 | |
1620 if (conv->send_history->data) | |
1621 g_free(conv->send_history->data); | |
1622 | |
1623 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1624 &start); | |
1625 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1626 | |
1627 conv->send_history->data = | |
8506 | 1628 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1629 } |
8677 | 1630 |
4359 | 1631 if (conv->send_history->next && |
1632 conv->send_history->next->data) { | |
8677 | 1633 GtkTextIter iter; |
1634 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1635 |
1636 conv->send_history = conv->send_history->next; | |
8061 | 1637 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1638 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1639 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1640 0, NULL); |
8677 | 1641 /* this is mainly just a hack so the formatting at the |
1642 * cursor gets picked up. */ | |
1643 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1644 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1645 } |
1646 | |
8105 | 1647 return TRUE; |
4359 | 1648 break; |
1649 | |
1650 case GDK_Down: | |
1651 if (!conv->send_history) | |
1652 break; | |
1653 | |
8105 | 1654 if (conv->send_history->prev && |
1655 conv->send_history->prev->data) { | |
8677 | 1656 GtkTextIter iter; |
1657 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1658 |
4359 | 1659 conv->send_history = conv->send_history->prev; |
8105 | 1660 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1661 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1662 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1663 0, NULL); |
8677 | 1664 /* this is mainly just a hack so the formatting at the |
1665 * cursor gets picked up. */ | |
1666 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1667 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1668 } |
1669 | |
8105 | 1670 return TRUE; |
4359 | 1671 break; |
8105 | 1672 |
8108 | 1673 case GDK_Page_Down: |
8143 | 1674 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1675 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1676 (curconv + 1) % numconvs); |
8105 | 1677 |
1678 return TRUE; | |
1679 break; | |
1680 | |
8108 | 1681 case GDK_Page_Up: |
8143 | 1682 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1683 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1684 (curconv + numconvs - 1) % numconvs); |
8133 | 1685 |
1686 return TRUE; | |
1687 break; | |
1688 | |
8108 | 1689 case GDK_Tab: |
8133 | 1690 move_to_next_unread_tab(conv); |
8108 | 1691 |
1692 return TRUE; | |
1693 break; | |
1694 | |
1695 case 'z': | |
1696 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1697 |
1698 return TRUE; | |
1699 break; | |
1700 | |
1701 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1702 } |
8758 | 1703 |
8105 | 1704 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1705 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1706 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1707 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1708 if (event->keyval > '0' && event->keyval <= '9') { |
1709 int switchto = event->keyval - '1'; | |
1710 if (switchto < numconvs) | |
1711 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1712 |
1713 return TRUE; | |
1714 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1715 } |
8758 | 1716 |
8105 | 1717 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1718 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1719 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1720 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1721 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1722 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1723 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1724 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1725 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1726 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1727 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1728 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1729 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1730 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1731 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1732 case GDK_Tab: |
8941 | 1733 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1734 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1735 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1736 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1737 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1738 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1739 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1740 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1741 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1742 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1743 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1744 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1745 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1746 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1747 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1748 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1749 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1750 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1751 } |
4359 | 1752 |
1753 return FALSE; | |
1754 } | |
1755 | |
1756 /* | |
1757 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1758 * 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
|
1759 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1760 * 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
|
1761 * going all the way down to the notebook. I suspect a bug in |
4359 | 1762 * GtkTextView, but I'm not ready to point any fingers yet. |
1763 */ | |
1764 static gboolean | |
1765 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1766 { | |
1767 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1768 /* Right single click */ | |
1769 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1770 | |
1771 return TRUE; | |
1772 } | |
1773 | |
1774 return FALSE; | |
1775 } | |
1776 | |
8173 | 1777 /* |
1778 * If someone tries to type into the conversation backlog of a | |
1779 * conversation window then we yank focus from the conversation backlog | |
1780 * and give it to the text entry box so that people can type | |
1781 * all the live long day and it will get entered into the entry box. | |
1782 */ | |
6057 | 1783 static gboolean |
8105 | 1784 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1785 { |
1786 GaimGtkConversation *gtkconv = data; | |
1787 | |
8237 | 1788 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1789 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1790 (event->keyval == GDK_F10) || |
1791 (event->keyval == GDK_Shift_L) || | |
1792 (event->keyval == GDK_Shift_R) || | |
1793 (event->keyval == GDK_Escape) || | |
8177 | 1794 (event->keyval == GDK_Up) || |
1795 (event->keyval == GDK_Down) || | |
1796 (event->keyval == GDK_Left) || | |
8191 | 1797 (event->keyval == GDK_Right) || |
1798 (event->keyval == GDK_Home) || | |
9297 | 1799 (event->keyval == GDK_End) || |
1800 (event->keyval == GDK_Tab) || | |
1801 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1802 return FALSE; |
1803 | |
1804 if (event->type == GDK_KEY_RELEASE) | |
1805 gtk_widget_grab_focus(gtkconv->entry); | |
1806 | |
1807 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1808 | |
1809 return TRUE; | |
6057 | 1810 } |
1811 | |
4359 | 1812 static void |
4673 | 1813 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1814 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1815 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1816 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1817 GaimConversation *conv; |
8456 | 1818 GaimGtkConversation *gtkconv; |
1819 GaimPlugin *protocol; | |
4359 | 1820 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1821 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1822 |
4491 | 1823 gaim_conversation_set_account(conv, account); |
8456 | 1824 |
1825 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1826 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1827 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1828 protocol->info->name); | |
4359 | 1829 } |
1830 | |
1831 static void | |
1832 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1833 gchar *new_text, gint new_text_length, gpointer user_data) | |
1834 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1835 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1836 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1837 g_return_if_fail(conv != NULL); |
4359 | 1838 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1839 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1840 return; |
1841 | |
1842 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1843 gtk_text_iter_is_end(position))); | |
1844 } | |
1845 | |
1846 static void | |
1847 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1848 GtkTextIter *end_pos, gpointer user_data) | |
1849 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1850 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1851 GaimConvIm *im; |
4359 | 1852 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1853 g_return_if_fail(conv != NULL); |
4359 | 1854 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1855 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1856 return; |
1857 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1858 im = GAIM_CONV_IM(conv); |
4359 | 1859 |
1860 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1861 | |
1862 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1863 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1864 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1865 |
1866 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1867 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1868 GAIM_NOT_TYPING); |
4359 | 1869 } |
1870 else { | |
1871 /* We're deleting, but not all of it, so it counts as typing. */ | |
1872 got_typing_keypress(conv, FALSE); | |
1873 } | |
1874 } | |
1875 | |
1876 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1877 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1878 { |
1879 static GdkCursor *cursor = NULL; | |
1880 | |
1881 gtkwin->in_drag = TRUE; | |
1882 | |
1883 if (gtkwin->drag_leave_signal) { | |
1884 g_signal_handler_disconnect(G_OBJECT(widget), | |
1885 gtkwin->drag_leave_signal); | |
1886 | |
1887 gtkwin->drag_leave_signal = 0; | |
1888 } | |
1889 | |
1890 if (cursor == NULL) | |
1891 cursor = gdk_cursor_new(GDK_FLEUR); | |
1892 | |
1893 /* Grab the pointer */ | |
1894 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1895 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1896 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1897 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1898 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1899 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1900 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1901 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1902 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1903 } |
1904 | |
1905 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1906 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1907 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1908 GaimGtkWindow *gtkwin; |
4359 | 1909 |
1910 gtkwin = GAIM_GTK_WINDOW(win); | |
1911 | |
1912 /* | |
1913 * Make sure the user moved the mouse far enough for the | |
1914 * drag to be initiated. | |
1915 */ | |
1916 if (gtkwin->in_predrag) { | |
1917 if (e->x_root < gtkwin->drag_min_x || | |
1918 e->x_root >= gtkwin->drag_max_x || | |
1919 e->y_root < gtkwin->drag_min_y || | |
1920 e->y_root >= gtkwin->drag_max_y) { | |
1921 | |
1922 gtkwin->in_predrag = FALSE; | |
1923 notebook_init_grab(gtkwin, widget); | |
1924 } | |
1925 } | |
1926 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1927 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1928 GaimGtkWindow *dest_gtkwin; |
4359 | 1929 GtkNotebook *dest_notebook; |
1930 GtkWidget *tab, *last_vis_tab = NULL; | |
1931 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1932 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1933 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1934 GList *l; | |
1935 | |
1936 /* Get the window that the cursor is over. */ | |
1937 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1938 | |
1939 if (dest_win == NULL) { | |
1940 dnd_hints_hide_all(); | |
1941 | |
1942 return TRUE; | |
1943 } | |
1944 | |
1945 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1946 | |
1947 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1948 | |
1949 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1950 | |
1951 arrow1_x = arrow2_x = nb_x; | |
1952 arrow1_y = arrow2_y = nb_y; | |
1953 | |
1954 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1955 e->x_root, e->y_root); | |
1956 | |
1957 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1958 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1959 | |
1960 horiz_tabs = TRUE; | |
1961 } | |
1962 | |
1963 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1964 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1965 l != NULL; |
1966 l = l->next, i++) { | |
1967 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1968 GaimConversation *conv = l->data; |
4359 | 1969 |
1970 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1971 | |
1972 /* | |
1973 * If this is the correct tab, record the positions | |
1974 * for the arrows. | |
1975 */ | |
1976 if (i == page_num) { | |
1977 if (horiz_tabs) { | |
1978 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1979 arrow1_y = nb_y + tab->allocation.y; | |
1980 arrow2_y = nb_y + tab->allocation.y + | |
1981 tab->allocation.height; | |
1982 } | |
1983 else { | |
1984 arrow1_x = nb_x + tab->allocation.x; | |
1985 arrow2_x = nb_x + tab->allocation.x + | |
1986 tab->allocation.width; | |
1987 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1988 } | |
1989 | |
1990 tab_found = TRUE; | |
1991 break; | |
1992 } | |
1993 else { /* Keep track of the right-most tab that we see. */ | |
1994 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1995 last_vis_tab = tab; | |
1996 last_vis_tab_loc = tab->allocation.x; | |
1997 } | |
1998 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1999 last_vis_tab = tab; | |
2000 last_vis_tab_loc = tab->allocation.y; | |
2001 } | |
2002 } | |
2003 } | |
2004 | |
2005 /* | |
2006 * If we didn't find the tab, then we'll just place the | |
2007 * arrows to the right/bottom of the last visible tab. | |
2008 */ | |
2009 if (!tab_found && last_vis_tab) { | |
2010 if (horiz_tabs) { | |
2011 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2012 last_vis_tab->allocation.width; | |
2013 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
2014 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2015 last_vis_tab->allocation.height; | |
2016 } | |
2017 else { | |
2018 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
2019 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
2020 last_vis_tab->allocation.width; | |
2021 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
2022 last_vis_tab->allocation.height; | |
2023 } | |
2024 } | |
2025 | |
2026 if (horiz_tabs) { | |
2027 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
2028 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
2029 } | |
2030 else { | |
2031 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
2032 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
2033 } | |
2034 } | |
2035 | |
2036 return TRUE; | |
2037 } | |
2038 | |
2039 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2040 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 2041 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2042 GaimGtkWindow *gtkwin; |
4359 | 2043 |
2044 gtkwin = GAIM_GTK_WINDOW(win); | |
2045 | |
2046 if (gtkwin->in_drag) | |
2047 return FALSE; | |
2048 | |
2049 if (e->x_root < gtkwin->drag_min_x || | |
2050 e->x_root >= gtkwin->drag_max_x || | |
2051 e->y_root < gtkwin->drag_min_y || | |
2052 e->y_root >= gtkwin->drag_max_y) { | |
2053 | |
2054 gtkwin->in_predrag = FALSE; | |
2055 notebook_init_grab(gtkwin, widget); | |
2056 } | |
2057 | |
2058 return TRUE; | |
2059 } | |
2060 | |
2061 /* | |
2062 * THANK YOU GALEON! | |
2063 */ | |
2064 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2065 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2066 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2067 GaimGtkWindow *gtkwin; |
4359 | 2068 gint nb_x, nb_y, x_rel, y_rel; |
2069 GList *l; | |
2070 int tab_clicked; | |
2071 | |
2072 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2073 return FALSE; | |
2074 | |
2075 gtkwin = GAIM_GTK_WINDOW(win); | |
2076 | |
2077 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2078 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2079 "Already in the middle of a window drag at tab_press_cb\n"); |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2080 return TRUE; |
4359 | 2081 } |
2082 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2083 /* |
4359 | 2084 * Make sure a tab was actually clicked. The arrow buttons |
2085 * mess things up. | |
2086 */ | |
2087 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2088 | |
2089 if (tab_clicked == -1) | |
2090 return FALSE; | |
2091 | |
2092 /* | |
2093 * Get the relative position of the press event, with regards to | |
2094 * the position of the notebook. | |
2095 */ | |
2096 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2097 | |
2098 x_rel = e->x_root - nb_x; | |
2099 y_rel = e->y_root - nb_y; | |
2100 | |
2101 /* Reset the min/max x/y */ | |
2102 gtkwin->drag_min_x = 0; | |
2103 gtkwin->drag_min_y = 0; | |
2104 gtkwin->drag_max_x = 0; | |
2105 gtkwin->drag_max_y = 0; | |
2106 | |
2107 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2108 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2109 GaimConversation *conv = l->data; |
4359 | 2110 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2111 | |
2112 if (!GTK_WIDGET_VISIBLE(tab)) | |
2113 continue; | |
2114 | |
2115 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2116 break; | |
2117 | |
2118 /* Save the borders of the tab. */ | |
2119 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2120 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2121 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2122 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2123 } | |
2124 | |
2125 /* Make sure the click occurred in the tab. */ | |
2126 if (e->x_root < gtkwin->drag_min_x || | |
2127 e->x_root >= gtkwin->drag_max_x || | |
2128 e->y_root < gtkwin->drag_min_y || | |
2129 e->y_root >= gtkwin->drag_max_y) { | |
2130 | |
2131 return FALSE; | |
2132 } | |
2133 | |
2134 gtkwin->in_predrag = TRUE; | |
2135 | |
2136 /* Connect the new motion signals. */ | |
2137 gtkwin->drag_motion_signal = | |
2138 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2139 G_CALLBACK(notebook_motion_cb), win); | |
2140 | |
2141 gtkwin->drag_leave_signal = | |
2142 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2143 G_CALLBACK(notebook_leave_cb), win); | |
2144 | |
2145 return FALSE; | |
2146 } | |
2147 | |
2148 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2149 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2150 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2151 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2152 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2153 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2154 GaimConversation *conv; |
4359 | 2155 GtkNotebook *dest_notebook; |
2156 gint dest_page_num; | |
2157 | |
2158 /* | |
2159 * Don't check to make sure that the event's window matches the | |
2160 * widget's, because we may be getting an event passed on from the | |
2161 * close button. | |
2162 */ | |
2163 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2164 return FALSE; | |
2165 | |
2166 if (gdk_pointer_is_grabbed()) { | |
2167 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2168 gtk_grab_remove(widget); | |
2169 } | |
2170 | |
2171 gtkwin = GAIM_GTK_WINDOW(win); | |
2172 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2173 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2174 return FALSE; |
4359 | 2175 |
2176 /* Disconnect the motion signal. */ | |
2177 if (gtkwin->drag_motion_signal) { | |
2178 g_signal_handler_disconnect(G_OBJECT(widget), | |
2179 gtkwin->drag_motion_signal); | |
2180 | |
2181 gtkwin->drag_motion_signal = 0; | |
2182 } | |
2183 | |
2184 /* | |
2185 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2186 * signal. | |
2187 */ | |
2188 if (gtkwin->in_predrag) { | |
2189 gtkwin->in_predrag = FALSE; | |
2190 | |
2191 if (gtkwin->drag_leave_signal) { | |
2192 g_signal_handler_disconnect(G_OBJECT(widget), | |
2193 gtkwin->drag_leave_signal); | |
2194 | |
2195 gtkwin->drag_leave_signal = 0; | |
2196 } | |
2197 } | |
2198 | |
2199 /* If we're not in drag... */ | |
2200 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2201 if (!gtkwin->in_drag) |
4359 | 2202 return FALSE; |
2203 | |
2204 gtkwin->in_drag = FALSE; | |
2205 | |
2206 dnd_hints_hide_all(); | |
2207 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2208 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2209 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2210 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2211 |
2212 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2213 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2214 return FALSE; |
2215 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2216 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2217 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2218 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2219 gint win_width, win_height; |
5121 | 2220 |
2221 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2222 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2223 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2224 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2225 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2226 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2227 gaim_conversation_get_index(conv))); |
5121 | 2228 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2229 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2230 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2231 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2232 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2233 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2234 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2235 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2236 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2237 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2238 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2239 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2240 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2241 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2242 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2243 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2244 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2245 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2246 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2247 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2248 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2249 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2250 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2251 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2252 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2253 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2254 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2255 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2256 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2257 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2258 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2259 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2260 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2261 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2262 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2263 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2264 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2265 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2266 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2267 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2268 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2269 } |
2270 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2271 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2272 win, dest_win); |
4359 | 2273 |
2274 return TRUE; | |
2275 } | |
2276 | |
8189 | 2277 /************************************************************************** |
2278 * A bunch of buddy icon functions | |
2279 **************************************************************************/ | |
2280 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2281 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2282 { |
2283 GaimAccount *account = gaim_conversation_get_account(conv); | |
2284 const char *name = gaim_conversation_get_name(conv); | |
2285 GdkPixbuf *status = NULL; | |
2286 | |
2287 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2288 GaimBuddy *b = gaim_find_buddy(account, name); | |
2289 if (b != NULL) { | |
2290 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2291 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2292 } |
2293 } | |
2294 | |
2295 if (!status) { | |
2296 GdkPixbuf *pixbuf; | |
2297 pixbuf = create_prpl_icon(account); | |
2298 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2299 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2300 { |
7143 | 2301 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2302 GDK_INTERP_BILINEAR); | |
2303 g_object_unref(pixbuf); | |
2304 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2305 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2306 status = pixbuf; |
7143 | 2307 } |
2308 return status; | |
2309 } | |
2310 | |
8189 | 2311 static void |
2312 update_tab_icon(GaimConversation *conv) | |
2313 { | |
2314 GaimGtkConversation *gtkconv; | |
2315 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2316 GaimAccount *account; | |
2317 const char *name; | |
2318 GdkPixbuf *status = NULL; | |
2319 | |
2320 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2321 name = gaim_conversation_get_name(conv); | |
2322 account = gaim_conversation_get_account(conv); | |
2323 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2324 status = get_tab_icon(conv, TRUE); |
8189 | 2325 |
2326 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2327 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2328 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2329 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2330 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2331 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2332 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2333 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2334 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2335 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2336 |
8189 | 2337 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2338 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2339 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2340 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2341 } |
8189 | 2342 } |
2343 | |
9318 | 2344 static void |
2345 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2346 { | |
2347 *width = gdk_pixbuf_animation_get_width(icon); | |
2348 *height = gdk_pixbuf_animation_get_height(icon); | |
2349 | |
2350 /* this should eventually get smarter about preserving the aspect | |
2351 * ratio when scaling, but gimmie a break, I just woke up */ | |
2352 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2353 if(*width < spec->min_width) | |
2354 *width = spec->min_width; | |
2355 else if(*width > spec->max_width) | |
2356 *width = spec->max_width; | |
2357 | |
2358 if(*height < spec->min_height) | |
2359 *height = spec->min_height; | |
9319 | 2360 else if(*height > spec->max_height) |
9318 | 2361 *height = spec->max_height; |
2362 } | |
2363 | |
2364 /* and now for some arbitrary sanity checks */ | |
2365 if(*width > 100) | |
2366 *width = 100; | |
2367 if(*height > 100) | |
2368 *height = 100; | |
2369 } | |
2370 | |
8189 | 2371 static gboolean |
2372 redraw_icon(gpointer data) | |
2373 { | |
2374 GaimConversation *conv = (GaimConversation *)data; | |
2375 GaimGtkConversation *gtkconv; | |
9318 | 2376 GaimAccount *account; |
2377 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2378 |
2379 GdkPixbuf *buf; | |
2380 GdkPixbuf *scale; | |
2381 GdkPixmap *pm; | |
2382 GdkBitmap *bm; | |
2383 gint delay; | |
9318 | 2384 int scale_width, scale_height; |
8189 | 2385 |
2386 if (!g_list_find(gaim_get_ims(), conv)) { | |
2387 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2388 "Conversation not found in redraw_icon. I think this " | |
2389 "is a bug.\n"); | |
2390 return FALSE; | |
2391 } | |
2392 | |
2393 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2394 account = gaim_conversation_get_account(conv); |
2395 if(account && account->gc) | |
2396 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2397 |
2398 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2399 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2400 | |
9318 | 2401 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2402 NULL, &scale_width, &scale_height); | |
2403 | |
2404 /* this code is ugly, and scares me */ | |
8189 | 2405 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2406 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2407 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2408 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2409 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2410 GDK_INTERP_NEAREST); | |
2411 | |
2412 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2413 g_object_unref(G_OBJECT(scale)); | |
2414 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2415 g_object_unref(G_OBJECT(pm)); | |
2416 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2417 | |
2418 if (bm) | |
2419 g_object_unref(G_OBJECT(bm)); | |
2420 | |
9131 | 2421 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2422 if (delay <= 0) | |
2423 delay = 100; | |
2424 | |
2425 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2426 |
2427 return FALSE; | |
2428 } | |
2429 | |
2430 static void | |
2431 start_anim(GtkObject *obj, GaimConversation *conv) | |
2432 { | |
2433 GaimGtkConversation *gtkconv; | |
2434 int delay; | |
2435 | |
2436 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2437 return; | |
2438 | |
2439 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2440 | |
8228 | 2441 if (gtkconv->u.im->anim == NULL) |
2442 return; | |
2443 | |
8202 | 2444 if (gtkconv->u.im->icon_timer != 0) |
2445 return; | |
2446 | |
8189 | 2447 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2448 return; | |
2449 | |
2450 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2451 | |
8758 | 2452 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2453 } |
2454 | |
2455 static void | |
2456 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2457 { | |
2458 GaimGtkConversation *gtkconv; | |
2459 | |
2460 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2461 return; | |
2462 | |
2463 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2464 | |
2465 if (gtkconv->u.im->icon_timer != 0) | |
2466 g_source_remove(gtkconv->u.im->icon_timer); | |
2467 | |
2468 gtkconv->u.im->icon_timer = 0; | |
2469 } | |
2470 | |
2471 static void | |
2472 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2473 { | |
2474 GaimGtkConversation *gtkconv; | |
2475 | |
2476 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2477 return; | |
2478 | |
2479 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2480 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2481 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2482 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2483 |
2484 if (gtkconv->u.im->animate) | |
2485 start_anim(NULL, conv); | |
2486 else | |
2487 stop_anim(NULL, conv); | |
2488 } | |
2489 static void | |
2490 remove_icon(GaimGtkConversation *gtkconv) | |
2491 { | |
2492 g_return_if_fail(gtkconv != NULL); | |
2493 | |
2494 if (gtkconv->u.im->icon != NULL) | |
8821 | 2495 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2496 |
2497 if (gtkconv->u.im->anim != NULL) | |
2498 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2499 | |
2500 if (gtkconv->u.im->icon_timer != 0) | |
2501 g_source_remove(gtkconv->u.im->icon_timer); | |
2502 | |
2503 if (gtkconv->u.im->iter != NULL) | |
2504 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2505 | |
2506 gtkconv->u.im->icon_timer = 0; | |
2507 gtkconv->u.im->icon = NULL; | |
2508 gtkconv->u.im->anim = NULL; | |
2509 gtkconv->u.im->iter = NULL; | |
2510 } | |
2511 | |
2512 static gboolean | |
2513 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2514 { | |
2515 GaimGtkConversation *gtkconv; | |
2516 static GtkWidget *menu = NULL; | |
2517 GtkWidget *button; | |
2518 | |
2519 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2520 return FALSE; | |
2521 | |
2522 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2523 | |
2524 /* | |
2525 * If a menu already exists, destroy it before creating a new one, | |
2526 * thus freeing-up the memory it occupied. | |
2527 */ | |
2528 if (menu != NULL) | |
2529 gtk_widget_destroy(menu); | |
2530 | |
2531 menu = gtk_menu_new(); | |
2532 | |
2533 if (gtkconv->u.im->anim && | |
2534 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2535 { | |
2536 gaim_new_check_item(menu, _("Animate"), | |
2537 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2538 gtkconv->u.im->icon_timer); | |
2539 } | |
2540 | |
2541 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2542 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2543 G_CALLBACK(remove_icon), gtkconv); | |
2544 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2545 gtk_widget_show(button); | |
2546 | |
2547 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
2548 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, | |
2549 0, 0, NULL); | |
2550 | |
2551 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2552 | |
2553 return TRUE; | |
2554 } | |
2555 /************************************************************************** | |
2556 * End of the bunch of buddy icon functions | |
2557 **************************************************************************/ | |
2558 | |
7887 | 2559 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2560 * Makes sure all the menu items and all the buttons are hidden/shown and |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2561 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2562 * account signs on or off. |
2563 */ | |
4359 | 2564 static void |
7887 | 2565 gray_stuff_out(GaimConversation *conv) |
4359 | 2566 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2567 GaimConvWindow *win; |
7887 | 2568 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2569 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2570 GaimConnection *gc; |
7887 | 2571 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2572 GdkPixbuf *window_icon = NULL; |
8439 | 2573 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2574 |
7887 | 2575 win = gaim_conversation_get_window(conv); |
4359 | 2576 gtkwin = GAIM_GTK_WINDOW(win); |
2577 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2578 gc = gaim_conversation_get_gc(conv); |
8439 | 2579 |
7879 | 2580 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2581 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2582 |
7887 | 2583 if (gtkwin->menu.send_as != NULL) |
2584 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2585 | |
2586 /* | |
2587 * Handle hiding and showing stuff based on what type of conv this is. | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2588 * Stuff that Gaim IMs support in general should be shown for IM |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2589 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2590 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2591 * supports it or not--that only affects if the button or menu item |
7929 | 2592 * is sensitive or not. |
7887 | 2593 */ |
4359 | 2594 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2595 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2596 | |
2597 /* Deal with buttons */ | |
2598 gtk_widget_show(gtkconv->info); | |
2599 gtk_widget_show(gtkconv->send); | |
2600 gtk_widget_show(gtkconv->u.im->warn); | |
2601 gtk_widget_show(gtkconv->u.im->block); | |
9468 | 2602 gtk_widget_show(gtkconv->u.im->send_file); |
7887 | 2603 |
2604 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2605 gtk_widget_show(gtkwin->menu.view_log); |
9468 | 2606 gtk_widget_show(gtkwin->menu.send_file); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2607 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2608 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2609 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2610 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2611 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2612 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2613 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2614 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2615 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2616 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2617 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2618 gtk_widget_show(gtkconv->add); |
2619 gtk_widget_hide(gtkconv->remove); | |
7859 | 2620 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2621 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2622 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2623 gtk_widget_hide(gtkconv->add); |
2624 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2625 } |
7887 | 2626 |
2627 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2628 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2629 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
9470 | 2630 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
7887 | 2631 |
2632 /* Deal with buttons */ | |
7952 | 2633 gtk_widget_show(gtkconv->info); |
7887 | 2634 gtk_widget_show(gtkconv->send); |
2635 gtk_widget_show(gtkconv->u.chat->invite); | |
2636 | |
2637 /* Deal with menu items */ | |
7859 | 2638 gtk_widget_hide(gtkwin->menu.view_log); |
9468 | 2639 gtk_widget_hide(gtkwin->menu.send_file); |
7859 | 2640 gtk_widget_hide(gtkwin->menu.add_pounce); |
2641 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2642 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2643 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2644 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2645 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2646 |
7879 | 2647 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2648 gaim_conversation_get_name(conv)) == NULL) { | |
9470 | 2649 /* If the chat is NOT in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2650 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2651 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2652 gtk_widget_show(gtkconv->add); |
2653 gtk_widget_hide(gtkconv->remove); | |
7859 | 2654 } else { |
9470 | 2655 /* If the chat IS in the buddy list */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2656 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2657 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2658 gtk_widget_hide(gtkconv->add); |
2659 gtk_widget_show(gtkconv->remove); | |
7887 | 2660 } |
2661 | |
2662 gtk_widget_show(gtkwin->menu.insert_link); | |
2663 gtk_widget_hide(gtkwin->menu.insert_image); | |
2664 } | |
2665 | |
2666 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2667 * Handle graying stuff out based on whether an account is connected |
7887 | 2668 * and what features that account supports. |
2669 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2670 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2671 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2672 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2673 /* Account is online */ |
2674 | |
2675 /* Deal with buttons */ | |
7929 | 2676 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2677 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2678 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2679 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2680 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2681 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2682 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2683 (prpl_info->send_im != NULL)); |
7887 | 2684 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2685 (prpl_info->warn != NULL)); | |
2686 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2687 (prpl_info->add_deny != NULL)); | |
9468 | 2688 gtk_widget_set_sensitive(gtkconv->u.im->send_file, |
2689 (prpl_info->send_file | |
2690 && (!prpl_info->can_receive_file | |
2691 || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2692 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2693 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2694 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2695 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2696 (prpl_info->chat_send != NULL)); |
7887 | 2697 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2698 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2699 } |
7887 | 2700 |
2701 /* Deal with the toolbar */ | |
8422 | 2702 |
8420 | 2703 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2704 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2705 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2706 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2707 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2708 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2709 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2710 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2711 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2712 } |
9041 | 2713 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2714 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2715 } else { |
8422 | 2716 buttons = GTK_IMHTML_SMILEY; |
8420 | 2717 } |
2718 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2719 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2720 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2721 /* Deal with menu items */ |
7887 | 2722 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2723 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2724 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2725 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2726 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2727 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2728 |
7887 | 2729 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
9468 | 2730 gtk_widget_set_sensitive(gtkwin->menu.send_file, |
9470 | 2731 (gc && prpl_info->send_file != NULL |
9468 | 2732 && (!prpl_info->can_receive_file |
2733 || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | |
7887 | 2734 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
2735 gaim_conversation_get_name(conv)) == NULL) | |
2736 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2737 else | |
2738 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2739 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2740 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2741 gaim_conversation_get_name(conv)) == NULL) | |
2742 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2743 else | |
2744 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2745 } | |
2746 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2747 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2748 (prpl_info->add_deny != NULL)); |
7887 | 2749 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2750 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2751 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2752 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2753 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2754 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2755 } else { | |
2756 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2757 /* Or it's a chat where we left. */ |
7887 | 2758 |
2759 /* Deal with buttons */ | |
7929 | 2760 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2761 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2762 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2763 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2764 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2765 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2766 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
9468 | 2767 gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); |
7887 | 2768 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2769 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2770 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2771 |
7887 | 2772 /* Then deal with menu items */ |
2773 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
9468 | 2774 gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); |
7887 | 2775 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); |
2776 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2777 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2778 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2779 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2780 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2781 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2782 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2783 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2784 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2785 } | |
2786 | |
2787 /* | |
2788 * Update the window's icon | |
2789 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2790 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2791 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2792 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2793 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2794 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2795 g_object_ref(window_icon); |
2796 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2797 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2798 } |
7887 | 2799 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2800 g_object_unref(G_OBJECT(window_icon)); | |
2801 } | |
2802 | |
2803 static void | |
8189 | 2804 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2805 gpointer user_data) | |
2806 { | |
2807 GaimConvWindow *win; | |
2808 GaimConversation *conv; | |
2809 GaimGtkConversation *gtkconv; | |
2810 | |
2811 win = (GaimConvWindow *)user_data; | |
2812 conv = gaim_conv_window_get_active_conversation(win); | |
2813 | |
2814 g_return_if_fail(conv != NULL); | |
2815 | |
8192 | 2816 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2817 return; | |
2818 | |
8189 | 2819 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2820 | |
2821 stop_anim(NULL, conv); | |
2822 } | |
2823 | |
2824 static void | |
7887 | 2825 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2826 gpointer user_data) | |
2827 { | |
2828 GaimConvWindow *win; | |
2829 GaimConversation *conv; | |
2830 GaimGtkConversation *gtkconv; | |
2831 GaimGtkWindow *gtkwin; | |
2832 | |
2833 win = (GaimConvWindow *)user_data; | |
2834 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2835 | |
2836 g_return_if_fail(conv != NULL); | |
2837 | |
2838 gtkwin = GAIM_GTK_WINDOW(win); | |
2839 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2840 | |
2841 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2842 | |
2843 /* Update the menubar */ | |
2844 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2845 |
4736 | 2846 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2847 |
4359 | 2848 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2849 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2850 |
4359 | 2851 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2852 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2853 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2854 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2855 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2856 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2857 |
9188 | 2858 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2859 gtkconv->show_timestamps); | |
2860 | |
8189 | 2861 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2862 * We pause icons when they are not visible. If this icon should |
9297 | 2863 * be animated then start it back up again. |
8189 | 2864 */ |
8192 | 2865 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2866 (gtkconv->u.im->animate)) | |
8189 | 2867 start_anim(NULL, conv); |
2868 | |
4965 | 2869 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2870 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2871 } |
2872 | |
2873 /************************************************************************** | |
2874 * Utility functions | |
2875 **************************************************************************/ | |
2876 | |
2877 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2878 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2879 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2880 GaimConvIm *im; |
4685 | 2881 |
4359 | 2882 /* |
2883 * 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
|
2884 * send GAIM_TYPED any time soon. |
4359 | 2885 */ |
2886 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2887 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2888 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2889 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2890 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2891 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2892 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2893 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2894 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2895 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2896 |
2897 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2898 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2899 GAIM_TYPING); |
4359 | 2900 |
2901 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2902 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2903 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2904 gaim_conv_im_set_type_again(im, 0); |
4359 | 2905 } |
2906 } | |
2907 | |
4736 | 2908 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2909 update_typing_icon(GaimConversation *conv) |
4736 | 2910 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2911 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2912 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2913 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2914 |
2915 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2916 | |
2917 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2918 im = GAIM_CONV_IM(conv); |
4736 | 2919 |
2920 if(gtkwin->menu.typing_icon) { | |
2921 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2922 gtkwin->menu.typing_icon = NULL; | |
2923 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2924 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2925 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2926 gtk_image_menu_item_set_image( | |
2927 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2928 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2929 GTK_ICON_SIZE_MENU)); | |
4757 | 2930 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2931 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2932 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2933 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2934 gtk_image_menu_item_set_image( | |
2935 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2936 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2937 GTK_ICON_SIZE_MENU)); | |
4757 | 2938 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2939 _("User has typed something and paused"), NULL); |
2940 } | |
2941 | |
2942 if(gtkwin->menu.typing_icon) { | |
2943 gtk_menu_item_set_right_justified( | |
2944 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2945 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2946 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2947 gtkwin->menu.typing_icon); | |
2948 } | |
2949 } | |
2950 | |
4685 | 2951 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2952 update_send_as_selection(GaimConvWindow *win) |
4359 | 2953 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2954 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2955 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2956 GaimGtkWindow *gtkwin; |
4359 | 2957 GtkWidget *menu; |
2958 GList *child; | |
2959 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2960 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2961 return FALSE; |
4849 | 2962 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2963 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2964 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2965 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2966 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2967 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2968 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2969 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2970 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2971 if (gtkwin->menu.send_as == NULL) |
4685 | 2972 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2973 |
4359 | 2974 gtk_widget_show(gtkwin->menu.send_as); |
2975 | |
2976 menu = gtk_menu_item_get_submenu( | |
2977 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2978 | |
2979 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2980 child != NULL; | |
2981 child = child->next) { | |
2982 | |
2983 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2984 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2985 "gaim_account"); |
2986 | |
2987 if (account == item_account) { | |
4359 | 2988 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2989 break; | |
2990 } | |
2991 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2992 |
4685 | 2993 return FALSE; |
4359 | 2994 } |
2995 | |
2996 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2997 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2998 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2999 GaimGtkWindow *gtkwin; |
4359 | 3000 GtkWidget *menu; |
3001 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3002 GList *gcs; |
4359 | 3003 GList *convs; |
3004 GSList *group = NULL; | |
3005 gboolean first_offline = TRUE; | |
3006 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3007 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 3008 |
3009 gtkwin = GAIM_GTK_WINDOW(win); | |
3010 | |
3011 if (gtkwin->menu.send_as != NULL) | |
3012 gtk_widget_destroy(gtkwin->menu.send_as); | |
3013 | |
3014 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3015 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 3016 /* Now make sure we don't have any Offline entries. */ |
3017 gboolean found_offline = FALSE; | |
3018 | |
3019 for (convs = gaim_get_conversations(); | |
3020 convs != NULL; | |
3021 convs = convs->next) { | |
3022 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3023 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3024 GaimAccount *account; |
4491 | 3025 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3026 conv = (GaimConversation *)convs->data; |
4491 | 3027 account = gaim_conversation_get_account(conv); |
3028 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3029 if (account != NULL && account->gc == NULL) { |
4359 | 3030 found_offline = TRUE; |
3031 break; | |
3032 } | |
3033 } | |
3034 | |
3035 if (!found_offline) { | |
3036 gtkwin->menu.send_as = NULL; | |
3037 return; | |
3038 } | |
3039 } | |
3040 | |
3041 /* Build the Send As menu */ | |
3042 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
3043 gtk_widget_show(gtkwin->menu.send_as); | |
3044 | |
3045 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3046 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
3047 gtkwin->menu.send_as, 2); |
4359 | 3048 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
3049 | |
3050 gtk_widget_show(menu); | |
3051 | |
3052 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3053 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3054 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3055 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3056 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3057 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3058 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3059 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3060 GdkPixbuf *pixbuf, *scale; |
4359 | 3061 |
3062 found_online = TRUE; | |
3063 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3064 gc = (GaimConnection *)gcs->data; |
4359 | 3065 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3066 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3067 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3068 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3069 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3070 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3071 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3072 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3073 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3074 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3075 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3076 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3077 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3078 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3079 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3080 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3081 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3082 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3083 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3084 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3085 gaim_account_get_username(account)); |
4793 | 3086 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3087 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3088 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3089 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3090 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3091 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3092 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3093 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3094 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3095 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3096 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3097 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3098 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3099 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3100 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3101 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3102 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3103 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3104 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3105 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3106 /* Set our data and callbacks. */ |
4359 | 3107 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3108 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3109 |
4786 | 3110 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3111 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3112 |
3113 gtk_widget_show(menuitem); | |
3114 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3115 } | |
3116 | |
3117 /* | |
3118 * Fill it with any accounts that still has an open (yet disabled) window | |
3119 * (signed off accounts with a window open). | |
3120 */ | |
3121 for (convs = gaim_get_conversations(); | |
3122 convs != NULL; | |
3123 convs = convs->next) { | |
3124 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3125 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3126 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3127 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3128 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3129 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3130 GdkPixbuf *pixbuf, *scale; |
4359 | 3131 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3132 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3133 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3134 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3135 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3136 |
4491 | 3137 account = gaim_conversation_get_account(conv); |
3138 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3139 if (account != NULL && account->gc == NULL) { |
4359 | 3140 if (first_offline && found_online) { |
3141 menuitem = gtk_separator_menu_item_new(); | |
3142 gtk_widget_show(menuitem); | |
3143 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3144 | |
3145 first_offline = FALSE; | |
3146 } | |
3147 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3148 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3149 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3150 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3151 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3152 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3153 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3154 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3155 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3156 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3157 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3158 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3159 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3160 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3161 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3162 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3163 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3164 /* Make our menu item */ |
4359 | 3165 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3166 account->username); |
4793 | 3167 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3168 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3169 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3170 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3171 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3172 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3173 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3174 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3175 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3176 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3177 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3178 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3179 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3180 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3181 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3182 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3183 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3184 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3185 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3186 |
4359 | 3187 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3188 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3189 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3190 |
4786 | 3191 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3192 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3193 |
4359 | 3194 gtk_widget_show(menuitem); |
3195 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3196 } | |
3197 } | |
3198 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3199 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3200 |
4359 | 3201 gtk_widget_show(gtkwin->menu.send_as); |
3202 update_send_as_selection(win); | |
3203 } | |
3204 | |
3205 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3206 generate_invite_user_names(GaimConnection *gc) |
4359 | 3207 { |
6695 | 3208 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3209 static GList *tmp = NULL; |
3210 | |
3211 if (tmp) | |
3212 g_list_free(tmp); | |
3213 | |
3214 tmp = g_list_append(NULL, ""); | |
3215 | |
3216 if (gc != NULL) { | |
4785 | 3217 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3218 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3219 continue; | |
6695 | 3220 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3221 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3222 continue; |
6695 | 3223 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3224 GaimBuddy *buddy; | |
3225 | |
3226 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3227 continue; | |
3228 | |
3229 buddy = (GaimBuddy *)bnode; | |
3230 | |
3231 if (buddy->account == gc->account && | |
3232 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3233 tmp = g_list_append(tmp, buddy->name); | |
3234 } | |
4359 | 3235 } |
3236 } | |
3237 } | |
3238 | |
3239 return tmp; | |
3240 } | |
3241 | |
3242 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3243 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 3244 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3245 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3246 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3247 GaimConvChat *chat; |
4359 | 3248 GtkTreeIter iter; |
3249 GtkListStore *ls; | |
3250 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3251 chat = GAIM_CONV_CHAT(conv); |
4359 | 3252 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3253 gtkchat = gtkconv->u.chat; | |
3254 | |
3255 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3256 | |
3257 gtk_list_store_append(ls, &iter); | |
3258 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3259 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 3260 1, name, -1); |
3261 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3262 GTK_SORT_ASCENDING); | |
3263 } | |
3264 | |
3265 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3266 tab_complete(GaimConversation *conv) |
4359 | 3267 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3268 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3269 GaimConvChat *chat; |
4359 | 3270 GtkTextIter cursor, word_start, start_buffer; |
3271 int start; | |
3272 int most_matched = -1; | |
3273 char *entered, *partial = NULL; | |
3274 char *text; | |
8021 | 3275 char *nick_partial; |
4359 | 3276 GList *matches = NULL; |
3277 GList *nicks = NULL; | |
3278 | |
3279 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3280 chat = GAIM_CONV_CHAT(conv); |
4359 | 3281 |
3282 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3283 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3284 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3285 | |
3286 word_start = cursor; | |
3287 | |
3288 /* if there's nothing there just return */ | |
3289 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
3290 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3291 |
4359 | 3292 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3293 &cursor, FALSE); | |
3294 | |
3295 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3296 start = strlen(text) - 1; | |
3297 | |
8021 | 3298 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3299 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3300 start-=2; |
3301 } | |
4359 | 3302 |
3303 /* find the start of the word that we're tabbing */ | |
3304 while (start >= 0 && text[start] != ' ') { | |
3305 gtk_text_iter_backward_char(&word_start); | |
3306 start--; | |
3307 } | |
3308 | |
3309 g_free(text); | |
3310 | |
3311 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3312 &cursor, FALSE); | |
3313 | |
8021 | 3314 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3315 g_free(entered); |
3316 return; | |
3317 } | |
3318 | |
8021 | 3319 nick_partial = g_malloc(strlen(entered)+1); |
3320 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3321 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3322 nicks != NULL; |
3323 nicks = nicks->next) { | |
3324 | |
3325 char *nick = nicks->data; | |
8021 | 3326 |
8159 | 3327 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 3328 nick_partial[strlen(entered)] = '\0'; |
8021 | 3329 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3330 continue; | |
4359 | 3331 |
3332 /* if we're here, it's a possible completion */ | |
3333 | |
3334 if (most_matched == -1) { | |
3335 /* | |
3336 * this will only get called once, since from now | |
3337 * on most_matched is >= 0 | |
3338 */ | |
3339 most_matched = strlen(nick); | |
3340 partial = g_strdup(nick); | |
3341 } | |
3342 else if (most_matched) { | |
8021 | 3343 char *tmp = g_strdup(nick); |
3344 | |
3345 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3346 partial[most_matched] = '\0'; | |
3347 if(most_matched < strlen(tmp)) | |
3348 tmp[most_matched] = '\0'; | |
4359 | 3349 most_matched--; |
8021 | 3350 } |
8079 | 3351 most_matched++; |
8021 | 3352 |
3353 g_free(tmp); | |
4359 | 3354 } |
3355 | |
3356 matches = g_list_append(matches, nick); | |
3357 } | |
3358 | |
8021 | 3359 g_free(nick_partial); |
3360 | |
4359 | 3361 /* we're only here if we're doing new style */ |
3362 | |
3363 /* if there weren't any matches, return */ | |
3364 if (!matches) { | |
3365 /* if matches isn't set partials won't be either */ | |
3366 g_free(entered); | |
3367 return; | |
3368 } | |
3369 | |
3370 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3371 | |
3372 if (!matches->next) { | |
3373 /* there was only one match. fill it in. */ | |
3374 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3375 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3376 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3377 | |
3378 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3379 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3380 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3381 g_free(tmp); | |
3382 } | |
3383 else | |
3384 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3385 matches->data, -1); | |
3386 | |
3387 matches = g_list_remove(matches, matches->data); | |
3388 } | |
3389 else { | |
3390 /* | |
3391 * there were lots of matches, fill in as much as possible | |
3392 * and display all of them | |
3393 */ | |
3394 char *addthis = g_malloc0(1); | |
3395 | |
3396 while (matches) { | |
3397 char *tmp = addthis; | |
3398 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3399 g_free(tmp); | |
3400 matches = g_list_remove(matches, matches->data); | |
3401 } | |
3402 | |
6982 | 3403 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3404 time(NULL)); |
3405 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3406 g_free(addthis); | |
3407 } | |
3408 | |
3409 g_free(entered); | |
3410 g_free(partial); | |
3411 } | |
3412 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3413 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3414 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3415 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3416 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3417 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3418 |
7859 | 3419 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3420 |
8557 | 3421 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.html", |
7261 | 3422 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3423 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3424 g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3425 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3426 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3427 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3428 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3429 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3430 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3431 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3432 |
4359 | 3433 static GtkItemFactoryEntry menu_items[] = |
3434 { | |
3435 /* Conversation menu */ | |
4596 | 3436 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3437 |
7887 | 3438 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3439 0, "<StockItem>", GAIM_STOCK_IM }, |
3440 | |
3441 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3442 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3443 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3444 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3445 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3446 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3447 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3448 { N_("/Conversation/Clear"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3449 |
4359 | 3450 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3451 |
9468 | 3452 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3453 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3454 0, NULL }, |
7859 | 3455 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3456 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3457 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3458 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3459 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3460 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3461 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3462 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3463 |
7859 | 3464 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3465 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3466 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3467 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3468 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3469 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3470 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3471 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3472 |
7859 | 3473 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3474 | |
8756 | 3475 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3476 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3477 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3478 "<StockItem>", GAIM_STOCK_IMAGE }, |
3479 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3480 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3481 |
4596 | 3482 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3483 "<StockItem>", GTK_STOCK_CLOSE }, |
3484 | |
3485 /* Options */ | |
4596 | 3486 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3487 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3488 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3489 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3490 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3491 }; |
3492 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3493 static const int menu_item_count = |
4359 | 3494 sizeof(menu_items) / sizeof(*menu_items); |
3495 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3496 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3497 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3498 { |
7386 | 3499 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3500 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3501 |
4359 | 3502 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3503 setup_menubar(GaimConvWindow *win) |
4359 | 3504 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3505 GaimGtkWindow *gtkwin; |
5116 | 3506 GtkAccelGroup *accel_group; |
4359 | 3507 gtkwin = GAIM_GTK_WINDOW(win); |
3508 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3509 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3510 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3511 g_object_unref (accel_group); |
5116 | 3512 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3513 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3514 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3515 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3516 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3517 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3518 NULL, NULL); |
4630 | 3519 |
3520 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3521 menu_items, win); |
7420 | 3522 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3523 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3524 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3525 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3526 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3527 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3528 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3529 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3530 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3531 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3532 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3533 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3534 |
9468 | 3535 gtkwin->menu.send_file = |
3536 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3537 N_("/Conversation/Send File...")); | |
3538 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3539 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3540 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3541 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3542 |
7879 | 3543 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3544 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3545 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3546 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3547 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3548 |
7879 | 3549 gtkwin->menu.warn = |
3550 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3551 N_("/Conversation/Warn...")); | |
3552 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3553 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3554 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3555 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3556 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3557 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3558 |
7879 | 3559 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3560 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3561 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3562 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3563 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3564 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3565 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3566 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3567 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3568 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3569 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3570 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3571 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3572 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3573 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3574 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3575 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3576 |
7879 | 3577 gtkwin->menu.insert_link = |
3578 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3579 N_("/Conversation/Insert Link...")); | |
3580 | |
3581 gtkwin->menu.insert_image = | |
3582 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3583 N_("/Conversation/Insert Image...")); | |
3584 | |
3585 /* --- */ | |
3586 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3587 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3588 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3589 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3590 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3591 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3592 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3593 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3594 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3595 N_("/Options/Show Formatting Toolbar")); |
9188 | 3596 gtkwin->menu.show_timestamps = |
3597 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3598 N_("/Options/Show Timestamps")); | |
4359 | 3599 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3600 generate_send_as_items(win, NULL); |
4359 | 3601 |
3602 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3603 |
3604 return gtkwin->menu.menubar; | |
4359 | 3605 } |
3606 | |
3607 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3608 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3609 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3610 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3611 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3612 GaimGtkImPane *gtkim; |
8811 | 3613 GaimButtonStyle button_type; |
4359 | 3614 |
3615 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3616 gtkim = gtkconv->u.im; | |
3617 gc = gaim_conversation_get_gc(conv); | |
3618 | |
3619 /* From right to left... */ | |
3620 | |
3621 /* Send button */ | |
3622 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3623 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3624 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3625 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3626 | |
3627 /* Separator */ | |
3628 if (gtkim->sep2 != NULL) | |
3629 gtk_widget_destroy(gtkim->sep2); | |
3630 | |
3631 gtkim->sep2 = gtk_vseparator_new(); | |
3632 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3633 gtk_widget_show(gtkim->sep2); | |
3634 | |
3635 /* Now, um, just kind of all over the place. Huh? */ | |
3636 | |
3637 /* Warn button */ | |
3638 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3639 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3640 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3641 _("Warn the user"), NULL); |
7929 | 3642 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3643 | |
3644 /* Block button */ | |
3645 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3646 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3647 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3648 _("Block the user"), NULL); | |
3649 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3650 | |
9468 | 3651 /* Block button */ |
3652 gtkim->send_file = gaim_gtk_change_text(_("Send File"), gtkim->send_file, | |
3653 GAIM_STOCK_FILE_TRANSFER, GAIM_CONV_IM); | |
3654 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->send_file, | |
3655 _("Send a file to the user"), NULL); | |
3656 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, FALSE, FALSE, 0); | |
3657 | |
7929 | 3658 /* Add button */ |
3659 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3660 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3661 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3662 _("Add the user to your buddy list"), NULL); | |
3663 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3664 | |
3665 /* Remove button */ | |
3666 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3667 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3668 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3669 _("Remove the user from your buddy list"), NULL); | |
3670 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3671 |
3672 /* Info button */ | |
3673 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3674 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3675 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3676 _("Get the user's information"), NULL); |
7929 | 3677 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3678 | |
3679 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3680 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
9468 | 3681 gtk_button_set_relief(GTK_BUTTON(gtkim->send_file), GTK_RELIEF_NONE); |
7929 | 3682 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3683 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3684 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3685 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3686 |
3687 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3688 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
9468 | 3689 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
7929 | 3690 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3691 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3692 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3693 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3694 |
3695 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3696 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
9468 | 3697 gtk_box_reorder_child(GTK_BOX(parent), gtkim->send_file,3); |
3698 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 4); | |
3699 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 5); | |
3700 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 6); | |
4359 | 3701 |
3702 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3703 | |
8811 | 3704 /* Check if the buttons should be visible or not */ |
9150 | 3705 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3706 if (button_type == GAIM_BUTTON_NONE) |
3707 gtk_widget_hide(gtkconv->bbox); | |
3708 else | |
3709 gtk_widget_show(gtkconv->bbox); | |
3710 | |
4359 | 3711 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3712 G_CALLBACK(warn_cb), conv); | |
3713 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3714 G_CALLBACK(block_cb), conv); | |
9468 | 3715 g_signal_connect(G_OBJECT(gtkim->send_file), "clicked", |
3716 G_CALLBACK(send_file_cb), conv); | |
7929 | 3717 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3718 G_CALLBACK(add_remove_cb), conv); | |
3719 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3720 G_CALLBACK(add_remove_cb), conv); | |
3721 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3722 G_CALLBACK(info_cb), conv); | |
3723 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3724 G_CALLBACK(send_cb), conv); | |
4359 | 3725 } |
3726 | |
3727 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3728 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3729 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3730 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3731 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3732 GaimGtkChatPane *gtkchat; |
8811 | 3733 GaimButtonStyle button_type; |
4359 | 3734 |
3735 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3736 gtkchat = gtkconv->u.chat; | |
3737 gc = gaim_conversation_get_gc(conv); | |
3738 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3739 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3740 |
4359 | 3741 /* Send button */ |
3742 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3743 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3744 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3745 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3746 | |
3747 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3748 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3749 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3750 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3751 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3752 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3753 gtk_widget_show(gtkchat->sep); |
4359 | 3754 |
3755 /* Invite */ | |
3756 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3757 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3758 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3759 _("Invite a user"), NULL); | |
7931 | 3760 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3761 |
7929 | 3762 /* Add button */ |
3763 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3764 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3765 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3766 _("Add the chat to your buddy list"), NULL); | |
3767 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3768 | |
3769 /* Remove button */ | |
3770 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3771 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3772 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3773 _("Remove the chat from your buddy list"), NULL); | |
3774 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3775 | |
4359 | 3776 /* Set the relief on these. */ |
3777 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3778 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3779 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3780 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3781 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3782 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3783 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3784 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3785 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3786 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3787 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3788 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3789 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3790 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3791 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3792 |
8811 | 3793 /* Check if the buttons should be visible or not */ |
9150 | 3794 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3795 if (button_type == GAIM_BUTTON_NONE) |
3796 gtk_widget_hide(gtkconv->bbox); | |
3797 else | |
3798 gtk_widget_show(gtkconv->bbox); | |
3799 | |
4359 | 3800 /* Callbacks */ |
7929 | 3801 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3802 G_CALLBACK(invite_cb), conv); | |
3803 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3804 G_CALLBACK(add_remove_cb), conv); | |
3805 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3806 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3807 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3808 G_CALLBACK(send_cb), conv); | |
3809 } | |
3810 | |
3811 | |
7971 | 3812 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3813 { | |
3814 GaimPluginProtocolInfo *prpl_info = NULL; | |
3815 GaimConnection *gc; | |
3816 GaimGtkConversation *gtkconv; | |
3817 GaimGtkChatPane *gtkchat; | |
8858 | 3818 const char *new_topic; |
3819 const char *current_topic; | |
7971 | 3820 |
3821 gc = gaim_conversation_get_gc(conv); | |
3822 | |
3823 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3824 return; | |
3825 | |
3826 if(prpl_info->set_chat_topic == NULL) | |
3827 return; | |
3828 | |
3829 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3830 gtkchat = gtkconv->u.chat; | |
8858 | 3831 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3832 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3833 | |
3834 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3835 return; |
3836 | |
8858 | 3837 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3838 new_topic); | |
7971 | 3839 } |
3840 | |
4359 | 3841 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3842 setup_chat_pane(GaimConversation *conv) |
4359 | 3843 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3844 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3845 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3846 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3847 GaimConnection *gc; |
8456 | 3848 GaimPlugin *protocol; |
4359 | 3849 GtkWidget *vpaned, *hpaned; |
3850 GtkWidget *vbox, *hbox; | |
3851 GtkWidget *lbox, *bbox; | |
3852 GtkWidget *label; | |
3853 GtkWidget *list; | |
3854 GtkWidget *button; | |
7949 | 3855 GtkWidget *sw; |
4359 | 3856 GtkListStore *ls; |
3857 GtkCellRenderer *rend; | |
3858 GtkTreeViewColumn *col; | |
9080 | 3859 GList *focus_chain = NULL; |
4359 | 3860 |
3861 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3862 gtkchat = gtkconv->u.chat; | |
3863 gc = gaim_conversation_get_gc(conv); | |
3864 | |
3865 /* Setup the outer pane. */ | |
3866 vpaned = gtk_vpaned_new(); | |
3867 gtk_widget_show(vpaned); | |
3868 | |
3869 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3870 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3871 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3872 gtk_widget_show(vbox); |
3873 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3874 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3875 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3876 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3877 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3878 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3879 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3880 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3881 gtk_widget_show(hbox); |
3882 | |
3883 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3884 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3885 gtk_widget_show(label); |
3886 | |
3887 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3888 |
7971 | 3889 if(prpl_info->set_chat_topic == NULL) { |
3890 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3891 } else { | |
3892 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3893 G_CALLBACK(topic_callback), conv); | |
3894 } | |
3895 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3896 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3897 gtk_widget_show(gtkchat->topic_text); |
3898 } | |
3899 | |
3900 /* Setup the horizontal pane. */ | |
3901 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3902 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3903 gtk_widget_show(hpaned); |
3904 | |
3905 /* Setup the scrolled window to put gtkimhtml in. */ | |
3906 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3907 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3908 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3909 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3910 GTK_SHADOW_IN); | |
3911 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3912 | |
3913 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3914 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3915 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3916 |
8914 | 3917 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3918 G_CALLBACK(size_allocate_cb), conv); | |
3919 | |
4359 | 3920 gtk_widget_show(gtkconv->sw); |
3921 | |
3922 /* Setup gtkihmtml. */ | |
3923 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3924 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3925 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3926 | |
3927 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3928 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3929 |
3930 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3931 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3932 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3933 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3934 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3935 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3936 |
3937 gaim_setup_imhtml(gtkconv->imhtml); | |
3938 gtk_widget_show(gtkconv->imhtml); | |
3939 | |
3940 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3941 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3942 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3943 gtk_widget_show(lbox); |
3944 | |
3945 /* Setup the label telling how many people are in the room. */ | |
3946 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3947 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3948 gtk_widget_show(gtkchat->count); | |
3949 | |
3950 /* Setup the list of users. */ | |
7949 | 3951 sw = gtk_scrolled_window_new(NULL, NULL); |
3952 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3953 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3954 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3955 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3956 gtk_widget_show(sw); | |
4359 | 3957 |
3958 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3959 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3960 GTK_SORT_ASCENDING); | |
3961 | |
3962 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3963 | |
3964 rend = gtk_cell_renderer_text_new(); | |
3965 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3966 "text", 0, NULL); | |
3967 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3968 | |
3969 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3970 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3971 g_signal_connect(G_OBJECT(list), "popup-menu", |
3972 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3973 |
3974 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3975 | |
3976 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3977 "text", 1, NULL); | |
3978 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3979 | |
3980 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3981 | |
3982 gtk_widget_set_size_request(list, 150, -1); | |
3983 | |
3984 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3985 gtk_widget_show(list); | |
3986 | |
3987 gtkchat->list = list; | |
3988 | |
7949 | 3989 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3990 |
3991 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3992 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 3993 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3994 gtk_widget_show(bbox); | |
3995 | |
3996 /* IM */ | |
3997 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3998 GAIM_BUTTON_VERTICAL); | |
3999 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4000 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
|
4001 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 4002 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 4003 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 4004 |
4005 gtk_widget_show(button); | |
4006 | |
4007 /* Ignore */ | |
4008 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
4009 GAIM_BUTTON_VERTICAL); | |
4010 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4011 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
|
4012 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4013 _("Ignore the user"), NULL); |
4359 | 4014 g_signal_connect(G_OBJECT(button), "clicked", |
4015 G_CALLBACK(ignore_cb), conv); | |
4016 gtk_widget_show(button); | |
4017 | |
4018 /* Info */ | |
4019 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
4020 GAIM_BUTTON_VERTICAL); | |
4021 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4022 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
4023 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
4024 _("Get the user's information"), NULL); |
4359 | 4025 g_signal_connect(G_OBJECT(button), "clicked", |
4026 G_CALLBACK(info_cb), conv); | |
4027 | |
4028 gtk_widget_show(button); | |
4029 | |
4030 gtkconv->info = button; | |
4031 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4032 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4033 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 4034 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4035 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4036 |
8317 | 4037 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4038 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4039 |
9332 | 4040 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4041 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4042 gtk_widget_show(gtkconv->lower_hbox); | |
4043 | |
4044 vbox = gtk_vbox_new(FALSE, 6); | |
4045 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
4046 gtk_widget_show(vbox); | |
4047 | |
8123 | 4048 /* Setup the entry widget. |
4049 * We never show the horizontal scrollbar because it was causing weird | |
4050 * lockups when typing text just as you type the character that would | |
4051 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
4052 */ | |
7949 | 4053 sw = gtk_scrolled_window_new(NULL, NULL); |
4054 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4055 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4056 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4057 GTK_SHADOW_IN); | |
9332 | 4058 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 4059 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4060 |
8061 | 4061 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4062 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4063 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
4064 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4065 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4066 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4067 | |
4068 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4069 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4070 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4071 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4072 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4073 gaim_setup_imhtml(gtkconv->entry); |
4074 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
4075 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4076 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4077 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4078 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4079 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4080 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4081 | |
4082 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4083 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4084 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4085 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4086 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4087 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4088 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4089 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4090 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4091 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4092 gtkconv->entry); |
4359 | 4093 |
7949 | 4094 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4095 gtk_widget_show(gtkconv->entry); |
4096 | |
4097 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4098 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4099 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4100 gtk_widget_show(gtkconv->bbox); | |
4101 | |
4102 setup_chat_buttons(conv, gtkconv->bbox); | |
4103 | |
9080 | 4104 /* |
4105 * Focus for chat windows should be as follows: | |
4106 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4107 * user list buttons -> entry -> buttons at bottom | |
4108 */ | |
4109 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4110 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4111 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4112 | |
4359 | 4113 return vpaned; |
4114 } | |
4115 | |
4116 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4117 setup_im_pane(GaimConversation *conv) |
4359 | 4118 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4119 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4120 GaimGtkImPane *gtkim; |
8456 | 4121 GaimPlugin *protocol; |
4359 | 4122 GtkWidget *paned; |
4123 GtkWidget *vbox; | |
4124 GtkWidget *vbox2; | |
7949 | 4125 GtkWidget *sw; |
9080 | 4126 GList *focus_chain = NULL; |
4359 | 4127 |
4128 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4129 gtkim = gtkconv->u.im; | |
4130 | |
4131 /* Setup the outer pane. */ | |
4132 paned = gtk_vpaned_new(); | |
4133 gtk_widget_show(paned); | |
4134 | |
4135 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4136 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4137 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4138 gtk_widget_show(vbox); |
4139 | |
4140 /* Setup the gtkimhtml widget. */ | |
4141 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4142 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4143 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4144 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4145 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4146 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4147 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4148 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4149 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4150 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4151 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4152 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4153 gtk_widget_show(gtkconv->sw); |
4154 | |
4155 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4156 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4157 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4158 | |
4159 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4160 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4161 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4162 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4163 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4164 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4165 |
4166 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4167 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4168 gaim_setup_imhtml(gtkconv->imhtml); |
4169 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4170 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4171 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4172 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4173 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4174 /* Build the toolbar. */ |
8317 | 4175 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4176 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4177 |
8123 | 4178 /* Setup the entry widget. |
4179 * We never show the horizontal scrollbar because it was causing weird | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4180 * lockups when typing text just as you type the character that would |
8123 | 4181 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4182 */ | |
9332 | 4183 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4184 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4185 gtk_widget_show(gtkconv->lower_hbox); | |
4186 | |
4187 vbox2 = gtk_vbox_new(FALSE, 6); | |
4188 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4189 gtk_widget_show(vbox2); | |
8821 | 4190 |
7949 | 4191 sw = gtk_scrolled_window_new(NULL, NULL); |
4192 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4193 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4194 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4195 GTK_SHADOW_IN); | |
9332 | 4196 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4197 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4198 |
8061 | 4199 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4200 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4201 |
4202 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4203 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4204 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4205 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4206 | |
4207 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4208 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4209 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4210 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4211 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4212 gaim_setup_imhtml(gtkconv->entry); |
4213 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4214 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4215 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4216 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4217 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4218 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4219 |
4359 | 4220 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4221 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4222 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4223 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4224 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4225 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4226 |
4227 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4228 G_CALLBACK(insert_text_cb), conv); | |
4229 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4230 G_CALLBACK(delete_text_cb), conv); | |
4231 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4232 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4233 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4234 |
7949 | 4235 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4236 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4237 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4238 gtkconv->entry); |
8481 | 4239 /* had to move this after the imtoolbar is attached so that the |
4240 * signals get fired to toggle the buttons on the toolbar as well. | |
4241 */ | |
4242 default_formatize(conv); | |
4359 | 4243 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4244 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4245 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4246 gtk_widget_show(gtkconv->bbox); | |
4247 | |
4248 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 4249 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 4250 |
9080 | 4251 /* |
4252 * Focus for IM windows should be as follows: | |
4253 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4254 */ | |
4255 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4256 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4257 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4258 |
4359 | 4259 return paned; |
4260 } | |
4261 | |
4262 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4263 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4264 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4265 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4266 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4267 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4268 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4269 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4270 { |
4781 | 4271 GaimBlistNode *n = NULL; |
6695 | 4272 GaimBuddy *b; |
4781 | 4273 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4274 |
6695 | 4275 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4276 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4277 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4278 b = (GaimBuddy*)n; | |
4279 else | |
4781 | 4280 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4281 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
4282 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4283 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4284 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4285 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4286 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4287 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4288 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
|
4289 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4290 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4291 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4292 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4293 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4294 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4295 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4296 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4297 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4298 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4299 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4300 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4301 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4302 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4303 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4304 { |
7718 | 4305 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4306 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4307 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4308 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4309 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4310 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4311 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4312 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4313 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4314 } |
9300 | 4315 gtk_drag_finish(dc, FALSE, FALSE, t); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4316 } |
4359 | 4317 |
4318 /************************************************************************** | |
4319 * GTK+ window ops | |
4320 **************************************************************************/ | |
4321 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4322 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4323 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4324 GaimGtkWindow *gtkwin; |
4359 | 4325 GtkPositionType pos; |
4326 GtkWidget *testidea; | |
4327 GtkWidget *menubar; | |
4328 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4329 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4330 |
4331 win->ui_data = gtkwin; | |
4332 | |
4333 /* Create the window. */ | |
4334 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4335 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4336 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4337 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4338 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4339 gtk_widget_realize(gtkwin->window); |
4340 | |
4341 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4342 G_CALLBACK(close_win_cb), win); | |
4343 | |
4344 /* Create the notebook. */ | |
4345 gtkwin->notebook = gtk_notebook_new(); | |
4346 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4347 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4348 |
4349 #if 0 | |
4350 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4351 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4352 #endif | |
4353 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4354 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4355 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4356 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4357 | |
4359 | 4358 gtk_widget_show(gtkwin->notebook); |
4359 | |
8189 | 4360 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4361 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4362 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4363 G_CALLBACK(switch_conv_cb), win); | |
4364 | |
4365 /* Setup the tab drag and drop signals. */ | |
4486 | 4366 gtk_widget_add_events(gtkwin->notebook, |
4367 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4368 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4369 G_CALLBACK(notebook_press_cb), win); |
4486 | 4370 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4371 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4372 |
4359 | 4373 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4374 |
4359 | 4375 /* Setup the menubar. */ |
4376 menubar = setup_menubar(win); | |
4377 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4378 | |
4379 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4380 | |
4381 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4382 | |
4383 gtk_widget_show(testidea); | |
4384 } | |
4385 | |
4386 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4387 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4388 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4389 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4390 |
4391 gtk_widget_destroy(gtkwin->window); | |
4392 | |
4630 | 4393 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4394 | |
4359 | 4395 g_free(gtkwin); |
4396 win->ui_data = NULL; | |
4397 } | |
4398 | |
4399 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4400 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4401 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4402 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4403 |
4404 gtk_widget_show(gtkwin->window); | |
7413 | 4405 |
4406 #ifdef _WIN32 | |
7415 | 4407 /* This works around a win32 gtk+ bug, where it can't handle |
4408 * creating the button correctly before the window is shown. | |
4409 * That's why we get the appearance of a button, without all | |
4410 * the normal button-like properties, like being able to click | |
7413 | 4411 * it. ;-) --Nathan */ |
7414 | 4412 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4413 GaimConversation *conv; | |
4414 GaimGtkConversation *gtkconv; | |
4415 | |
4416 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4417 if(conv) { | |
4418 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4419 gtk_widget_hide(gtkconv->close); |
7414 | 4420 gtk_widget_show_all(gtkconv->close); |
4421 } | |
4422 } | |
7413 | 4423 #endif |
4359 | 4424 } |
4425 | |
4426 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4427 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4428 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4429 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4430 |
4431 gtk_widget_hide(gtkwin->window); | |
4432 } | |
4433 | |
4434 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4435 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4436 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4437 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4438 |
5484 | 4439 gtk_widget_show(gtkwin->window); |
5103 | 4440 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4441 gdk_window_raise(gtkwin->window->window); |
4359 | 4442 } |
4443 | |
4444 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4445 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4446 { |
4447 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4448 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4449 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4450 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4451 #endif |
4452 } | |
4453 | |
4454 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4455 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4456 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4457 GaimGtkWindow *gtkwin; |
4359 | 4458 |
4459 gtkwin = GAIM_GTK_WINDOW(win); | |
4460 | |
4461 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4462 } | |
4463 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4464 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4465 { |
7695 | 4466 {"text/plain", 0, 0}, |
4467 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4468 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4469 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4470 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4471 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4472 |
4359 | 4473 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4474 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4475 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4476 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4477 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4478 GaimConversation *focus_conv; |
4359 | 4479 GtkWidget *pane = NULL; |
4480 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4481 GtkWidget *tabby, *menu_tabby; |
4359 | 4482 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4483 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4484 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4485 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4486 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4487 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4488 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4489 |
4490 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4491 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4492 |
4493 tab_cont = gtkconv->tab_cont; | |
4494 | |
4495 new_ui = FALSE; | |
4496 } | |
4497 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4498 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4499 conv->ui_data = gtkconv; |
4500 | |
4501 /* Setup some initial variables. */ | |
4502 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4503 gtkconv->tooltips = gtk_tooltips_new(); | |
4504 | |
7879 | 4505 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4506 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4507 gtkconv->u.im->a_virgin = TRUE; |
4508 | |
4509 pane = setup_im_pane(conv); | |
4510 } | |
7879 | 4511 else if (conv_type == GAIM_CONV_CHAT) { |
4512 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4513 | |
4514 pane = setup_chat_pane(conv); | |
4515 } | |
4359 | 4516 |
4517 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4518 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4519 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4520 |
4521 g_free(gtkconv); | |
4522 conv->ui_data = NULL; | |
4523 | |
4524 return; | |
4525 } | |
4526 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4527 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4528 gtk_drag_dest_set(pane, |
9300 | 4529 GTK_DEST_DEFAULT_MOTION | |
4530 GTK_DEST_DEFAULT_DROP, | |
4531 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4532 GDK_ACTION_COPY); | |
4533 gtk_drag_dest_set(pane, | |
4534 GTK_DEST_DEFAULT_MOTION | | |
4535 GTK_DEST_DEFAULT_DROP, | |
4536 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4537 GDK_ACTION_COPY); | |
4538 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4539 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4540 GDK_ACTION_COPY); | |
4541 | |
4542 gtk_drag_dest_set(gtkconv->entry, 0, | |
4543 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4544 GDK_ACTION_COPY); | |
4545 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4546 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4547 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4548 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4549 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4550 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4551 G_CALLBACK(conv_dnd_recv), conv); |
4552 | |
4359 | 4553 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4554 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4555 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4556 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4557 gtk_widget_show(pane); | |
4558 | |
4559 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4560 |
4359 | 4561 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4562 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4563 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4564 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4565 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4566 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4567 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4568 |
9188 | 4569 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4570 "/gaim/gtk/conversations/show_timestamps"); | |
4571 | |
4572 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4573 gtkconv->show_timestamps); | |
4574 | |
8176 | 4575 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4576 G_CALLBACK(gtk_widget_grab_focus), |
4577 gtkconv->entry); | |
4359 | 4578 } |
4579 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4580 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4581 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4582 |
4583 /* Close button. */ | |
4584 gtkconv->close = gtk_button_new(); | |
4585 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4586 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4587 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4588 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4589 GTK_ICON_SIZE_MENU)); | |
4359 | 4590 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4591 _("Close conversation"), NULL); |
4359 | 4592 |
4593 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4594 G_CALLBACK(close_conv_cb), conv); |
4359 | 4595 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4596 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4597 * I love Galeon. They have a fix for that stupid annoying visible |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4598 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4599 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4600 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4601 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4602 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4603 /* Status icon. */ |
6440 | 4604 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4605 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4606 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4607 |
4359 | 4608 /* Tab label. */ |
4609 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4610 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4611 #if 0 |
4612 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4613 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4614 #endif | |
4615 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4616 |
4359 | 4617 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4618 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4619 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4620 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4621 |
8946 | 4622 gtk_widget_show_all(gtkconv->icon); |
4623 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4624 |
4359 | 4625 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4626 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4627 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4628 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4629 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4630 |
4445 | 4631 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4632 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4633 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4634 |
4445 | 4635 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4636 gtk_widget_show(menu_tabby); |
4359 | 4637 |
7143 | 4638 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4639 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4640 |
9297 | 4641 /* Add this pane to the conversation's notebook. */ |
4359 | 4642 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4643 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4644 tab_cont, menu_tabby); |
4359 | 4645 |
4646 gtk_widget_show(tab_cont); | |
4647 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4648 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4649 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4650 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4651 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4652 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4653 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4654 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4655 else |
4818 | 4656 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4657 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4658 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4659 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4660 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4661 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4662 |
4663 if (!new_ui) | |
4664 g_object_unref(gtkconv->tab_cont); | |
4665 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4666 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4667 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4668 } |
4669 | |
4670 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4671 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4672 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4673 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4674 GaimGtkConversation *gtkconv; |
4359 | 4675 unsigned int index; |
4818 | 4676 GaimConversationType conv_type; |
4677 | |
4678 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4679 index = gaim_conversation_get_index(conv); |
4680 | |
4681 gtkwin = GAIM_GTK_WINDOW(win); | |
4682 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4683 | |
4684 g_object_ref(gtkconv->tab_cont); | |
4685 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4686 | |
4687 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4688 | |
4818 | 4689 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4690 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4691 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4692 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4693 } |
4694 | |
4695 | |
4359 | 4696 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4697 if (conv_type == GAIM_CONV_IM && |
4359 | 4698 gaim_conversation_get_gc(conv) == NULL) { |
4699 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4700 generate_send_as_items(win, conv); |
4359 | 4701 } |
4702 } | |
4703 | |
4704 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4705 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4706 unsigned int new_index) |
4707 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4708 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4709 GaimGtkConversation *gtkconv; |
4359 | 4710 |
4711 gtkwin = GAIM_GTK_WINDOW(win); | |
4712 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4713 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4714 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4715 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4716 |
4359 | 4717 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4718 gtkconv->tab_cont, new_index); | |
4719 } | |
4720 | |
4721 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4722 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4723 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4724 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4725 int index; |
4359 | 4726 |
4727 gtkwin = GAIM_GTK_WINDOW(win); | |
4728 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4729 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4730 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4731 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4732 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4733 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4734 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4735 return (index == -1 ? 0 : index); |
4359 | 4736 } |
4737 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4738 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4739 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4740 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4741 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4742 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4743 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4744 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4745 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4746 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4747 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4748 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4749 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4750 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4751 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4752 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4753 gaim_gtk_new_window, |
4754 gaim_gtk_destroy_window, | |
4755 gaim_gtk_show, | |
4756 gaim_gtk_hide, | |
4757 gaim_gtk_raise, | |
4758 gaim_gtk_flash, | |
4759 gaim_gtk_switch_conversation, | |
4760 gaim_gtk_add_conversation, | |
4761 gaim_gtk_remove_conversation, | |
4762 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4763 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4764 gaim_gtk_has_focus |
4359 | 4765 }; |
4766 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4767 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4768 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4769 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4770 return &window_ui_ops; |
4359 | 4771 } |
4772 | |
4773 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4774 * Conversation UI operations |
4359 | 4775 **************************************************************************/ |
4776 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4777 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4778 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4779 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4780 |
4781 if (gtkconv->dialogs.log != NULL) | |
4782 gtk_widget_destroy(gtkconv->dialogs.log); | |
4783 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4784 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4785 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4786 |
4359 | 4787 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4788 if (gtkconv->u.im->icon_timer != 0) |
4789 g_source_remove(gtkconv->u.im->icon_timer); | |
4790 | |
4359 | 4791 if (gtkconv->u.im->save_icon != NULL) |
4792 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4793 | |
4794 if (gtkconv->u.im->anim != NULL) | |
4793 | 4795 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4796 |
4797 g_free(gtkconv->u.im); | |
4798 } | |
4799 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4800 g_free(gtkconv->u.chat); | |
4801 } | |
4802 | |
4633 | 4803 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4804 | |
4359 | 4805 g_free(gtkconv); |
4806 } | |
4807 | |
4808 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4809 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4810 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4811 time_t mtime) |
4359 | 4812 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4813 GaimGtkConversation *gtkconv; |
8630 | 4814 GaimConvWindow *gaimwin; |
4815 GaimGtkWindow *gtkwin; | |
4816 gboolean has_focus; | |
4359 | 4817 |
4818 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4819 gaimwin = gaim_conversation_get_window(conv); |
4820 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4821 | |
4822 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4823 |
6621 | 4824 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4825 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4826 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4827 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4828 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4829 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4830 /* Play a sound, if specified in prefs. */ |
8630 | 4831 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4832 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4833 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4834 if (gtkconv->u.im->a_virgin && |
5820 | 4835 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4836 |
4561 | 4837 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4838 } |
4839 else | |
4561 | 4840 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4841 } |
4842 else { | |
4561 | 4843 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4844 } |
4845 } | |
4846 | |
4847 gtkconv->u.im->a_virgin = FALSE; | |
4848 | |
6982 | 4849 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4850 } |
4851 | |
4852 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4853 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4854 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4855 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4856 GaimGtkConversation *gtkconv; |
8630 | 4857 GaimConvWindow *gaimwin; |
4858 GaimGtkWindow *gtkwin; | |
4859 gboolean has_focus; | |
4359 | 4860 |
4861 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4862 gaimwin = gaim_conversation_get_window(conv); |
4863 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4864 | |
4865 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4866 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4867 /* Play a sound, if specified in prefs. */ |
8630 | 4868 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4869 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4870 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4871 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4872 else if (flags & GAIM_MESSAGE_RECV) { |
4873 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4874 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4875 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4876 |
4561 | 4877 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4878 } |
4359 | 4879 else |
4561 | 4880 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4881 } |
4882 } | |
4883 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4884 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4885 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4886 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4887 /* Raise the window, if specified in prefs. */ |
6621 | 4888 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4889 /* we may want to change this */ |
9301 | 4890 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4891 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4892 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4893 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4894 |
6982 | 4895 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4896 } |
4897 | |
4898 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4899 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4900 const char *message, GaimMessageFlags flags, |
4359 | 4901 time_t mtime) |
4902 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4903 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4904 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4905 GaimConnection *gc; |
4359 | 4906 int gtk_font_options = 0; |
7440 | 4907 char buf[BUF_LONG]; |
4359 | 4908 char buf2[BUF_LONG]; |
4909 char mdate[64]; | |
4910 char color[10]; | |
4911 char *str; | |
4912 char *with_font_tag; | |
4896 | 4913 char *sml_attrib = NULL; |
6982 | 4914 size_t length = strlen(message) + 1; |
4895 | 4915 |
4359 | 4916 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4917 gc = gaim_conversation_get_gc(conv); | |
4918 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4919 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4920 |
9301 | 4921 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4922 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
4923 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4924 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4925 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4926 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4927 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4928 |
8677 | 4929 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4930 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4931 | |
5133 | 4932 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4933 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4934 else | |
4935 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4936 |
4896 | 4937 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4938 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4939 |
4359 | 4940 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4941 | |
9049 | 4942 #if 1 /* PREFSLASH04 */ |
4943 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
4944 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
4945 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
4946 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4947 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
4948 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4949 #else | |
8944 | 4950 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 4951 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4952 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4953 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 4954 } |
9049 | 4955 #endif |
4359 | 4956 |
7956 | 4957 /* this is gonna crash one day, I can feel it. */ |
4958 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4959 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4960 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4961 } |
4359 | 4962 |
6621 | 4963 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4964 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4965 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4966 mdate, message); |
4359 | 4967 else |
4968 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4969 |
4359 | 4970 g_snprintf(buf2, sizeof(buf2), |
8690 | 4971 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 4972 sml_attrib, mdate, message); |
7440 | 4973 |
8962 | 4974 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 4975 |
7583 | 4976 /* Add the message to a conversations scrollback buffer */ |
4977 conv->history = g_string_append(conv->history, buf); | |
4978 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4979 |
8722 | 4980 } else if (flags & GAIM_MESSAGE_ERROR) { |
4981 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
4982 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
4983 mdate, message); | |
4984 else | |
4985 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
4986 | |
4987 g_snprintf(buf2, sizeof(buf2), | |
4988 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
4989 sml_attrib, mdate, message); | |
4990 | |
8962 | 4991 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
4992 | |
8722 | 4993 /* Add the message to a conversations scrollback buffer */ |
4994 conv->history = g_string_append(conv->history, buf); | |
4995 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 4996 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4997 g_snprintf(buf, BUF_LONG, |
8690 | 4998 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 4999 sml_attrib, message); |
7440 | 5000 |
8962 | 5001 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 5002 } |
5003 else { | |
4895 | 5004 char *new_message = g_memdup(message, length); |
8908 | 5005 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 5006 |
6621 | 5007 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 5008 str = g_malloc(1024); |
7440 | 5009 |
4359 | 5010 /* If we're whispering, it's not an autoresponse. */ |
7564 | 5011 if (gaim_message_meify(new_message, length)) { |
8908 | 5012 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 5013 strcpy(color, "#6C2585"); |
5014 } | |
5015 else { | |
8908 | 5016 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 5017 strcpy(color, "#00FF00"); |
5018 } | |
7440 | 5019 } |
4359 | 5020 else { |
7564 | 5021 if (gaim_message_meify(new_message, length)) { |
4359 | 5022 str = g_malloc(1024); |
7440 | 5023 |
6621 | 5024 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5025 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 5026 else |
8908 | 5027 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 5028 |
6621 | 5029 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5030 strcpy(color, "#AF7F00"); |
5031 else | |
5032 strcpy(color, "#062585"); | |
5033 } | |
5034 else { | |
5035 str = g_malloc(1024); | |
6621 | 5036 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 5037 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 5038 else |
8908 | 5039 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 5040 if (flags & GAIM_MESSAGE_NICK) |
4359 | 5041 strcpy(color, "#AF7F00"); |
6621 | 5042 else if (flags & GAIM_MESSAGE_RECV) { |
5043 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 5044 const char *u; |
5045 int m = 0; | |
7440 | 5046 |
4359 | 5047 for (u = who; *u != '\0'; u++) |
5048 m += *u; | |
7440 | 5049 |
4359 | 5050 m = m % NUM_NICK_COLORS; |
7440 | 5051 |
4359 | 5052 strcpy(color, nick_colors[m]); |
5053 } | |
5054 else | |
7854 | 5055 strcpy(color, RECV_COLOR); |
4359 | 5056 } |
6621 | 5057 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 5058 strcpy(color, SEND_COLOR); |
4359 | 5059 } |
8908 | 5060 |
5061 if(who_escaped) | |
5062 g_free(who_escaped); | |
4359 | 5063 } |
7440 | 5064 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5065 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 5066 g_snprintf(buf, BUF_LONG, |
8380 | 5067 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 5068 "<B>%s</B></FONT> ", color, |
5069 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 5070 else |
5071 g_snprintf(buf, BUF_LONG, | |
7431 | 5072 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
5073 sml_attrib ? sml_attrib : "", str); | |
7440 | 5074 |
4359 | 5075 g_snprintf(buf2, BUF_LONG, |
8380 | 5076 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 5077 "<B>%s</B></FONT> ", |
5078 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 5079 |
4359 | 5080 g_free(str); |
5081 | |
8962 | 5082 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5083 buf2, 0); | |
4359 | 5084 |
4895 | 5085 if(gc){ |
4896 | 5086 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5087 char *post = "</font>"; |
5088 int pre_len = strlen(pre); | |
5089 int post_len = strlen(post); | |
7440 | 5090 |
4895 | 5091 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5092 |
4895 | 5093 strcpy(with_font_tag, pre); |
5094 memcpy(with_font_tag + pre_len, new_message, length); | |
5095 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5096 |
4895 | 5097 length += pre_len + post_len; |
5098 g_free(pre); | |
5099 } | |
4608 | 5100 else |
4895 | 5101 with_font_tag = g_memdup(new_message, length); |
7440 | 5102 |
8962 | 5103 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5104 with_font_tag, gtk_font_options); | |
7440 | 5105 |
8557 | 5106 conv->history = g_string_append(conv->history, buf); |
5107 conv->history = g_string_append(conv->history, new_message); | |
5108 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5109 |
5110 g_free(with_font_tag); | |
7447 | 5111 g_free(new_message); |
7440 | 5112 } |
5113 | |
6062 | 5114 |
5012 | 5115 if(sml_attrib) |
5116 g_free(sml_attrib); | |
4359 | 5117 } |
5118 | |
5119 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5120 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 5121 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5122 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5123 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5124 GaimGtkChatPane *gtkchat; |
4359 | 5125 char tmp[BUF_LONG]; |
5126 int num_users; | |
5127 int pos; | |
5128 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5129 chat = GAIM_CONV_CHAT(conv); |
4359 | 5130 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5131 gtkchat = gtkconv->u.chat; | |
5132 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5133 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5134 |
5135 g_snprintf(tmp, sizeof(tmp), | |
5136 ngettext("%d person in room", "%d people in room", | |
5137 num_users), | |
5138 num_users); | |
5139 | |
5140 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5141 | |
5142 if (gtkconv->make_sound) | |
4561 | 5143 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5144 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5145 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 5146 |
5147 add_chat_buddy_common(conv, user, pos); | |
5148 } | |
5149 | |
5150 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5151 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5152 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5153 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5154 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5155 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5156 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5157 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5158 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5159 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5160 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5161 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5162 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5163 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5164 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5165 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
|
5166 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5167 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5168 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5169 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5170 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5171 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5172 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5173 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5174 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5175 pos = g_list_index(gaim_conv_chat_get_users(chat), (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5176 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5177 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5178 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5179 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5180 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5181 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5182 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5183 const char *new_name) |
4359 | 5184 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5185 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5186 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5187 GaimGtkChatPane *gtkchat; |
4359 | 5188 GtkTreeIter iter; |
5189 GtkTreeModel *model; | |
5190 GList *names; | |
5191 int pos; | |
5192 int f = 1; | |
5193 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5194 chat = GAIM_CONV_CHAT(conv); |
4359 | 5195 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5196 gtkchat = gtkconv->u.chat; | |
5197 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5198 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5199 names != NULL; |
5200 names = names->next) { | |
5201 | |
5202 char *u = (char *)names->data; | |
5203 | |
4793 | 5204 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 5205 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5206 | |
5207 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5208 break; | |
5209 | |
5210 while (f != 0) { | |
5211 char *val; | |
5212 | |
5213 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5214 | |
4793 | 5215 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 5216 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 5217 break; |
5218 } | |
4359 | 5219 |
5220 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5221 | |
5222 g_free(val); | |
5223 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5224 |
4359 | 5225 break; |
5226 } | |
5227 } | |
5228 | |
5229 if (!names) | |
5230 return; | |
5231 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5232 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 5233 |
5234 add_chat_buddy_common(conv, new_name, pos); | |
5235 } | |
5236 | |
5237 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5238 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5239 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5240 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5241 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5242 GaimGtkChatPane *gtkchat; |
4359 | 5243 GtkTreeIter iter; |
5244 GtkTreeModel *model; | |
5245 GList *names; | |
5246 char tmp[BUF_LONG]; | |
5247 int num_users; | |
5248 int f = 1; | |
5249 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5250 chat = GAIM_CONV_CHAT(conv); |
4359 | 5251 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5252 gtkchat = gtkconv->u.chat; | |
5253 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5254 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
|
5255 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5256 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5257 names != NULL; |
5258 names = names->next) { | |
5259 | |
5260 char *u = (char *)names->data; | |
5261 | |
4793 | 5262 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 5263 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5264 | |
5265 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5266 break; | |
5267 | |
5268 while (f != 0) { | |
5269 char *val; | |
5270 | |
5271 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5272 | |
4793 | 5273 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 5274 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5275 | |
5276 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5277 | |
5278 g_free(val); | |
5279 } | |
5280 | |
5281 break; | |
5282 } | |
5283 } | |
5284 | |
5285 if (names == NULL) | |
5286 return; | |
5287 | |
5288 g_snprintf(tmp, sizeof(tmp), | |
5289 ngettext("%d person in room", "%d people in room", | |
5290 num_users), num_users); | |
5291 | |
5292 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5293 | |
5294 if (gtkconv->make_sound) | |
4561 | 5295 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5296 } |
5297 | |
5298 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5299 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5300 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5301 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5302 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5303 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5304 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5305 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5306 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5307 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5308 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5309 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5310 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5311 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5312 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5313 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5314 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5315 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5316 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
|
5317 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5318 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5319 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5320 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5321 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5322 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5323 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5324 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5325 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5326 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5327 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5328 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5329 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5330 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5331 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5332 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5333 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5334 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5335 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5336 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5337 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5338 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5339 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5340 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5341 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5342 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5343 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5344 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5345 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5346 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5347 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5348 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5349 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5350 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5351 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5352 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5353 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5354 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5355 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5356 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5357 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5358 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5359 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5360 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5361 |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5362 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5363 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5364 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5365 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5366 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5367 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5368 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5369 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5370 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5371 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5372 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5373 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5374 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5375 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5376 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5377 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5378 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5379 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5380 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5381 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5382 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5383 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5384 GaimConvChat *chat; |
4359 | 5385 |
5386 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5387 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5388 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5389 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5390 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5391 { |
4359 | 5392 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5393 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5394 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5395 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5396 |
4359 | 5397 gaim_gtkconv_update_buttons_by_protocol(conv); |
5398 | |
4685 | 5399 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5400 |
5401 smiley_themeize(gtkconv->imhtml); | |
6394 | 5402 |
6395 | 5403 update_tab_icon(conv); |
4359 | 5404 } |
5405 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5406 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5407 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5408 { |
9472 | 5409 char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5410 GaimConvIm *im = NULL; |
9472 | 5411 GaimConnection *gc = gaim_conversation_get_gc(conv); |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5412 char color[8]; |
4736 | 5413 |
4359 | 5414 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5415 im = GAIM_CONV_IM(conv); |
4359 | 5416 |
9472 | 5417 if (!gc || ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
5418 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | |
5419 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | |
5420 | |
5421 else | |
5422 title = g_strdup(gaim_conversation_get_title(conv)); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5423 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5424 *color = '\0'; |
4359 | 5425 |
5426 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5427 gtk_widget_realize(gtkconv->tab_label); | |
5428 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5429 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5430 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5431 strcpy(color, "#47A046"); |
4359 | 5432 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5433 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5434 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5435 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5436 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5437 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5438 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5439 strcpy(color, "#314E6C"); |
4359 | 5440 } |
8252 | 5441 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5442 { | |
5443 strcpy(color, "#DF421E"); | |
5444 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5445 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5446 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5447 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5448 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5449 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5450 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5451 { |
8536 | 5452 char *html_title,*label; |
5453 | |
5454 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5455 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5456 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5457 color, html_title); |
5458 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5459 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5460 g_free(label); |
4359 | 5461 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5462 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5463 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5464 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5465 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5466 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5467 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5468 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5469 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5470 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5471 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5472 } |
9472 | 5473 |
5474 g_free(title); | |
4359 | 5475 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5476 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5477 { |
7154 | 5478 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5479 chat = GAIM_CONV_CHAT(conv); |
4359 | 5480 gtkchat = gtkconv->u.chat; |
5481 | |
7154 | 5482 topic = gaim_conv_chat_get_topic(chat); |
5483 | |
5484 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5485 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5486 topic, NULL); |
4359 | 5487 } |
5488 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5489 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5490 { |
7929 | 5491 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5492 generate_send_as_items(win, NULL); |
8946 | 5493 update_tab_icon(conv); |
9472 | 5494 gaim_conversation_autoset_title(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5495 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5496 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5497 { |
8946 | 5498 update_tab_icon(conv); |
4359 | 5499 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5500 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
|
5501 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5502 { |
9472 | 5503 gaim_conversation_autoset_title(conv); |
7929 | 5504 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5505 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5506 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5507 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5508 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5509 } |
4359 | 5510 } |
5511 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5512 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5513 { |
5514 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5515 gaim_gtkconv_write_chat, /* write_chat */ | |
5516 gaim_gtkconv_write_im, /* write_im */ | |
5517 gaim_gtkconv_write_conv, /* write_conv */ | |
5518 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5519 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5520 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5521 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5522 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5523 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5524 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5525 gaim_gtkconv_updated /* updated */ |
5526 }; | |
5527 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5528 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5529 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5530 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5531 return &conversation_ui_ops; |
4359 | 5532 } |
5533 | |
5534 /************************************************************************** | |
5535 * Public conversation utility functions | |
5536 **************************************************************************/ | |
5537 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5538 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5539 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5540 GaimGtkConversation *gtkconv; |
7143 | 5541 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5542 |
5543 char filename[256]; | |
5544 FILE *file; | |
5545 GError *err = NULL; | |
5546 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5547 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5548 size_t len; |
4359 | 5549 |
5550 GdkPixbuf *buf; | |
5551 | |
8821 | 5552 GtkWidget *vbox; |
4359 | 5553 GtkWidget *event; |
5554 GtkWidget *frame; | |
5555 GdkPixbuf *scale; | |
5556 GdkPixmap *pm; | |
5557 GdkBitmap *bm; | |
9318 | 5558 int scale_width, scale_height; |
9332 | 5559 GtkRequisition requisition; |
9318 | 5560 |
5561 GaimAccount *account; | |
5562 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5563 |
8821 | 5564 GaimButtonStyle button_type; |
5565 | |
9324 | 5566 GaimBuddyIcon *icon; |
5567 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5568 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5569 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5570 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5571 |
5572 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 5573 account = gaim_conversation_get_account(conv); |
5574 if(account && account->gc) | |
5575 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5576 |
5577 remove_icon(gtkconv); | |
5578 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5579 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5580 return; |
5581 | |
5582 if (gaim_conversation_get_gc(conv) == NULL) | |
5583 return; | |
5584 | |
8189 | 5585 if (gtkconv->u.im->anim) |
4793 | 5586 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5587 | |
9324 | 5588 |
5589 | |
5590 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
5591 | |
5592 if (icon == NULL) | |
5593 return; | |
5594 | |
5595 data = gaim_buddy_icon_get_data(icon, &len); | |
5596 | |
5597 /* this is such an evil hack, i don't know why i'm even considering it. | |
5598 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5599 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5600 g_snprintf(filename, sizeof(filename), | |
5601 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5602 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5603 | |
5604 if (!(file = fopen(filename, "wb"))) | |
5605 return; | |
5606 | |
5607 fwrite(data, 1, len, file); | |
5608 fclose(file); | |
5609 | |
5610 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5611 /* make sure we remove the file as soon as possible */ | |
5612 unlink(filename); | |
5613 | |
4359 | 5614 |
5615 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5616 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5617 "Buddy icon error: %s\n", err->message); |
4359 | 5618 g_error_free(err); |
5619 } | |
5620 | |
5621 if (!gtkconv->u.im->anim) | |
5622 return; | |
5623 | |
4793 | 5624 if(gtkconv->u.im->iter) |
5625 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5626 | |
4359 | 5627 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5628 gtkconv->u.im->iter = NULL; | |
5629 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5630 } else { | |
5631 gtkconv->u.im->iter = | |
8496 | 5632 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5633 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5634 if (gtkconv->u.im->animate) |
5635 start_anim(NULL, conv); | |
4359 | 5636 } |
5637 | |
9318 | 5638 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5639 NULL, &scale_width, &scale_height); | |
4359 | 5640 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5641 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5642 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5643 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5644 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5645 GDK_INTERP_NEAREST); | |
5646 | |
5647 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5648 g_object_unref(G_OBJECT(scale)); |
4359 | 5649 |
8821 | 5650 |
5651 vbox = gtk_vbox_new(FALSE, 0); | |
5652 | |
4359 | 5653 frame = gtk_frame_new(NULL); |
5654 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5655 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5656 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5657 | |
4359 | 5658 event = gtk_event_box_new(); |
5659 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5660 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5661 G_CALLBACK(icon_menu), conv); |
5662 gtk_widget_show(event); | |
5663 | |
4635 | 5664 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5665 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5666 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5667 gtk_widget_show(gtkconv->u.im->icon); | |
5668 | |
4793 | 5669 g_object_unref(G_OBJECT(pm)); |
4359 | 5670 |
5671 if (bm) | |
4793 | 5672 g_object_unref(G_OBJECT(bm)); |
7143 | 5673 |
9332 | 5674 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
5675 gtk_widget_size_request(gtkconv->bbox, &requisition); | |
5676 if(button_type == GAIM_BUTTON_NONE || requisition.height < scale_height) { | |
5677 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); | |
5678 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ | |
5679 } else { | |
5680 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5681 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5682 } | |
5683 | |
5684 gtk_widget_show(vbox); | |
5685 gtk_widget_show(frame); | |
5686 | |
7143 | 5687 /* The buddy icon code needs badly to be fixed. */ |
5688 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5689 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5690 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5691 } |
5692 | |
5693 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5694 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5695 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5696 GaimConvWindow *win; |
4359 | 5697 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5698 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5699 return; |
5700 | |
7887 | 5701 win = gaim_conversation_get_window(conv); |
5702 | |
5703 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5704 gray_stuff_out(conv); | |
4359 | 5705 } |
5706 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5707 GaimConvWindow * |
4359 | 5708 gaim_gtkwin_get_at_xy(int x, int y) |
5709 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5710 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5711 GaimGtkWindow *gtkwin; |
4359 | 5712 GdkWindow *gdkwin; |
5713 GList *l; | |
5714 | |
5715 gdkwin = gdk_window_at_pointer(&x, &y); | |
5716 | |
5717 if (gdkwin) | |
5718 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5719 | |
5720 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5721 win = (GaimConvWindow *)l->data; |
4359 | 5722 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5723 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5724 continue; |
5725 | |
5726 gtkwin = GAIM_GTK_WINDOW(win); | |
5727 | |
5728 if (gdkwin == gtkwin->window->window) | |
5729 return win; | |
5730 } | |
5731 | |
5732 return NULL; | |
5733 } | |
5734 | |
5735 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5736 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5737 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5738 GaimGtkWindow *gtkwin; |
4359 | 5739 GList *l; |
5740 gint nb_x, nb_y, x_rel, y_rel; | |
5741 GtkNotebook *notebook; | |
5742 GtkWidget *tab; | |
5743 gint i, page_num = 0; | |
5744 gboolean first_visible = TRUE; | |
5745 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5746 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5747 return -1; |
5748 | |
5749 gtkwin = GAIM_GTK_WINDOW(win); | |
5750 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5751 | |
5752 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5753 x_rel = x - nb_x; | |
5754 y_rel = y - nb_y; | |
5755 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5756 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5757 l != NULL; |
5758 l = l->next, i++) { | |
5759 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5760 GaimConversation *conv = l->data; |
4359 | 5761 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5762 | |
5763 if (!GTK_WIDGET_MAPPED(tab)) | |
5764 continue; | |
5765 | |
5766 if (first_visible) { | |
5767 first_visible = FALSE; | |
5768 | |
5769 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5770 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5771 } | |
5772 | |
5773 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5774 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5775 | |
5776 if (tab->allocation.x <= x_rel) { | |
5777 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5778 page_num = i + 1; | |
5779 else | |
5780 page_num = i; | |
5781 } | |
5782 else | |
5783 break; | |
5784 } | |
5785 else { | |
5786 if (tab->allocation.y <= y_rel) { | |
5787 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5788 page_num = i + 1; | |
5789 else | |
5790 page_num = i; | |
5791 } | |
5792 else | |
5793 break; | |
5794 } | |
5795 } | |
5796 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5797 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5798 return -1; |
5799 | |
5800 return page_num; | |
5801 } | |
5802 | |
5803 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5804 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5805 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5806 GaimGtkWindow *gtkwin; |
4359 | 5807 GList *l; |
5808 gint nb_x, nb_y, x_rel, y_rel; | |
5809 GtkNotebook *notebook; | |
5810 GtkWidget *tab; | |
5811 gint i, page_num = 0; | |
5812 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5813 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5814 return -1; |
5815 | |
5816 gtkwin = GAIM_GTK_WINDOW(win); | |
5817 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5818 | |
5819 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5820 x_rel = x - nb_x; | |
5821 y_rel = y - nb_y; | |
5822 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5823 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5824 l != NULL; |
5825 l = l->next, i++) { | |
5826 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5827 GaimConversation *conv = l->data; |
4359 | 5828 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5829 | |
5830 if (!GTK_WIDGET_MAPPED(tab)) | |
5831 continue; | |
5832 | |
5833 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5834 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5835 | |
5836 if (tab->allocation.x <= x_rel) { | |
5837 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5838 page_num = i + 1; | |
5839 else | |
5840 page_num = i; | |
5841 } | |
5842 else | |
5843 break; | |
5844 } | |
5845 else { | |
5846 if (tab->allocation.y <= y_rel) { | |
5847 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5848 page_num = i + 1; | |
5849 else | |
5850 page_num = i; | |
5851 } | |
5852 else | |
5853 break; | |
5854 } | |
5855 } | |
5856 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5857 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5858 return -1; |
5859 | |
5860 return page_num; | |
5861 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5862 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5863 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5864 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5865 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5866 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5867 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5868 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5869 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5870 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5871 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5872 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5873 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5874 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5875 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5876 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
|
5877 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5878 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5879 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5880 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5881 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5882 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5883 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5884 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5885 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5886 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5887 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5888 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5889 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5890 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5891 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5892 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5893 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5894 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5895 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5896 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5897 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5898 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5899 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5900 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5901 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5902 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5903 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5904 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5905 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5906 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5907 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5908 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5909 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5910 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5911 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5912 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5913 |
7386 | 5914 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5915 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5916 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5917 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5918 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5919 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5920 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5921 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5922 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5923 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5924 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5925 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5926 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5927 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5928 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5929 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5930 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5931 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5932 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5933 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5934 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5935 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5936 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5937 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5938 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5939 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5940 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5941 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5942 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5943 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5944 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5945 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5946 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5947 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5948 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5949 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5950 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5951 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5952 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5953 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5954 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5955 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5956 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5957 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5959 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5960 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5962 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5963 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5964 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5965 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5966 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5967 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5968 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5969 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5970 static void |
8456 | 5971 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
5972 gpointer value, gpointer data) | |
5973 { | |
5974 GList *l; | |
5975 GaimConversation *conv; | |
5976 GaimGtkConversation *gtkconv; | |
5977 | |
5978 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5979 conv = (GaimConversation *)l->data; | |
5980 | |
5981 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5982 continue; | |
5983 | |
5984 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5985 | |
5986 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5987 (gboolean)GPOINTER_TO_INT(value)); | |
5988 } | |
5989 } | |
5990 | |
5991 static void | |
5992 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
5993 gpointer value, gpointer data) | |
5994 { | |
5995 GList *l; | |
5996 GaimConversation *conv; | |
5997 GaimGtkConversation *gtkconv; | |
5998 | |
5999 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
6000 conv = (GaimConversation *)l->data; | |
6001 | |
6002 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
6003 continue; | |
6004 | |
6005 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6006 | |
6007 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
6008 (gboolean)GPOINTER_TO_INT(value)); | |
6009 } | |
6010 } | |
6011 | |
6012 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6013 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6014 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6015 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6016 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6017 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6018 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6019 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6020 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6021 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6022 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6023 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6024 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6025 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6026 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6027 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6028 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6029 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6030 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6031 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6032 |
7386 | 6033 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6034 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6035 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6036 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6037 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6038 if (gtkconv->show_formatting_toolbar) |
8317 | 6039 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6040 else |
8317 | 6041 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6042 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6043 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6044 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6045 static void |
9150 | 6046 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6047 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6048 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6049 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6050 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6051 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6052 |
9150 | 6053 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6054 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6055 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 6056 switch (conv->type) { |
6057 case GAIM_CONV_IM: | |
6058 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6059 gaim_gtkconv_update_buddy_icon(conv); | |
6060 break; | |
6061 case GAIM_CONV_CHAT: | |
6062 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
6063 break; | |
6064 default: | |
6065 break; | |
6066 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6067 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6068 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6069 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6070 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6071 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6072 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6073 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6074 GList *l; |
8189 | 6075 GaimConversation *conv; |
6076 GaimGtkConversation *gtkconv; | |
6077 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6078 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6079 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
|
6080 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6081 |
8189 | 6082 /* Set the "animate" flag for each icon based on the new preference */ |
6083 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
6084 conv = (GaimConversation *)l->data; | |
6085 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
6086 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6087 } |
8189 | 6088 |
6089 /* Now either stop or start animation for the active conversation in each window */ | |
6090 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6091 win = (GaimConvWindow *)l->data; | |
6092 conv = gaim_conv_window_get_active_conversation(win); | |
6093 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6094 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6095 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6096 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6097 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6098 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
|
6099 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6100 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6101 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6102 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6103 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6104 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6105 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6106 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6107 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6108 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6109 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6110 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6111 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6112 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6113 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6114 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6115 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6116 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6117 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6118 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6119 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6120 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6121 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6122 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6123 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6124 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6125 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6126 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6127 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6128 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6129 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6130 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6131 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6132 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6133 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6134 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6135 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6136 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6137 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6138 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6139 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6140 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6141 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6142 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6143 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6144 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6145 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6146 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6147 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6148 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6149 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6150 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6151 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6152 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6153 #if 1 |
6154 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6155 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6156 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6157 #else | |
8944 | 6158 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6159 #endif |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6160 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6161 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6162 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6163 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6164 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6165 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6166 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6167 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6168 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6169 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6170 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6171 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6172 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6173 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6174 GAIM_BUTTON_TEXT_IMAGE); | |
6175 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6176 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6177 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6178 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6179 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6180 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6181 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6182 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6183 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6184 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6185 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6186 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6187 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6188 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6189 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6190 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6191 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6192 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6193 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6194 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
|
6195 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6196 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6197 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6198 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6199 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6200 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6201 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6202 show_timestamps_pref_cb, NULL); |
8456 | 6203 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6204 html_shortcuts_pref_cb, NULL); | |
6205 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6206 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6207 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6208 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6209 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6210 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6211 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6212 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6213 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6214 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6215 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6216 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6217 |
9150 | 6218 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6219 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6220 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6221 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6222 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6223 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6224 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6225 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6226 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6227 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6228 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6229 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6230 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6231 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6232 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6233 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6234 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6235 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6236 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6237 |
6238 /********************************************************************** | |
6239 * Register commands | |
6240 **********************************************************************/ | |
9213 | 6241 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6242 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6243 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat.")); |
9213 | 6244 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6245 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6246 debug_command_cb, _("debug <option>: Send various debug information to the current conversation.")); |
9213 | 6247 |
6248 gaim_cmd_register("help", "", GAIM_CMD_P_DEFAULT, | |
6249 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6250 help_command_cb, _("help: List available commands.")); |
9213 | 6251 |
6252 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
6253 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6254 help_arg_command_cb, _("help <command>: Help on a specific command.")); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6255 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6256 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6257 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6258 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6259 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6260 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6261 } |