Mercurial > pidgin
annotate src/gtkconv.c @ 8422:a34fe3117877
[gaim-migrate @ 9152]
i think sean may have meant something closer to this
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 10 Mar 2004 16:05:19 +0000 |
parents | c25c697525b7 |
children | 2e18099ded93 |
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> |
6982 | 38 #include <locale.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 |
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" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
43 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
44 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
45 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "prpl.h" |
6038 | 47 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "gtkblist.h" |
5717 | 53 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
54 #include "gtkimhtml.h" |
8317 | 55 #include "gtkimhtmltoolbar.h" |
7431 | 56 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
57 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
58 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 |
5717 | 62 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 #include "gaim.h" |
4359 | 66 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
68 |
7990 | 69 #define SEND_COLOR "#16569E" |
7855 | 70 #define RECV_COLOR "#A82F2F" |
7854 | 71 |
4359 | 72 static char nick_colors[][8] = { |
73 "#ba55d3", /* Medium Orchid */ | |
74 "#ee82ee", /* Violet */ | |
75 "#c715b4", /* Medium Violet Red */ | |
76 "#ff69b4", /* Hot Pink */ | |
77 "#ff6347", /* Tomato */ | |
78 "#fa8c00", /* Dark Orange */ | |
79 "#fa8072", /* Salmon */ | |
80 "#b22222", /* Fire Brick */ | |
81 "#f4a460", /* Sandy Brown */ | |
82 "#cd5c5c", /* Indian Red */ | |
83 "#bc8f8f", /* Rosy Brown */ | |
84 "#f0e68c", /* Khaki */ | |
85 "#bdb76b", /* Dark Khaki */ | |
86 "#228b22", /* Forest Green */ | |
87 "#9acd32", /* Yellow Green */ | |
88 "#32cd32", /* Lime Green */ | |
7755 | 89 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 90 "#2e8b57", /* Sea Green */ |
91 "#8fbc8f", /* Dark Sea Green */ | |
92 "#66cdaa", /* Medium Aquamarine */ | |
93 "#5f9ea0", /* Cadet Blue */ | |
94 "#48d1cc", /* Medium Turquoise */ | |
95 "#00ced1", /* Dark Turquoise */ | |
96 "#4682b4", /* Stell Blue */ | |
97 "#00bfff", /* Deep Sky Blue */ | |
98 "#1690ff", /* Dodger Blue */ | |
99 "#4169ff", /* Royal Blue */ | |
100 "#6a5acd", /* Slate Blue */ | |
101 "#6495ed", /* Cornflower Blue */ | |
102 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
104 "#ff8c00", /* Dark Orange */ |
4359 | 105 }; |
6291 | 106 |
4359 | 107 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
108 | |
109 #define SCALE(x) \ | |
110 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
111 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
112 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
113 typedef struct |
4359 | 114 { |
115 GtkWidget *window; | |
116 | |
117 GtkWidget *entry; | |
118 GtkWidget *message; | |
119 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
122 } InviteBuddyInfo; |
4359 | 123 |
124 static GtkWidget *invite_dialog = NULL; | |
125 | |
126 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
128 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 130 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
133 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
134 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
|
135 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 136 |
137 /************************************************************************** | |
138 * Callbacks | |
139 **************************************************************************/ | |
140 static void | |
6038 | 141 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
142 { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
143 GaimConversation *conv; |
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 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
166 fprintf(fp, "%s", conv->history->str); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 } |
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 static void |
6038 | 172 do_check_save_convo(GObject *obj, GtkWidget *wid) |
173 { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
174 const char *filename; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
175 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
176 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
6038 | 177 |
178 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
179 return; | |
180 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
181 if (g_file_test(filename, G_FILE_TEST_EXISTS)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
182 { |
6038 | 183 gaim_request_yes_no(NULL, NULL, _("That file already exists"), |
184 _("Would you like to overwrite it?"), 1, wid, | |
185 G_CALLBACK(do_save_convo), NULL); | |
186 } | |
187 else | |
188 do_save_convo(wid); | |
189 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
190 |
4359 | 191 |
192 static gint | |
193 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
194 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
195 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
196 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
197 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
198 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
199 return TRUE; |
4359 | 200 } |
201 | |
202 static gint | |
203 close_conv_cb(GtkWidget *w, gpointer d) | |
204 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
205 GaimConversation *conv = (GaimConversation *)d; |
4359 | 206 |
207 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
208 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
209 return TRUE; |
4359 | 210 } |
211 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
212 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
213 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
214 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
215 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
216 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
217 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
218 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
219 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
220 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
221 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
222 { |
8061 | 223 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
224 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
225 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
226 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
227 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
228 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
8061 | 229 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
230 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
231 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) |
8061 | 232 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
233 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
234 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) |
8061 | 235 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
236 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
237 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
238 { |
8061 | 239 /* Tell me noone uses <s> by default ... maybe I won't do |
240 _toggle_strikethrough and not let them */ | |
241 /* g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); | |
242 strcpy(buf, buf2); */ | |
243 } | |
244 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
245 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
246 c->has_font) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
247 { |
8061 | 248 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface); |
249 } | |
250 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
251 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
252 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
253 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
254 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
8061 | 255 } |
256 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
257 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
258 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
259 char *color = g_strdup_printf("#%02x%02x%02x", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
260 c->fg_color.red / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
261 c->fg_color.green / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
262 c->fg_color.blue / 256); |
8061 | 263 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
264 g_free(color); | |
265 } | |
266 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
267 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
268 gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
269 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
270 char *color = g_strdup_printf("#%02x%02x%02x", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
271 c->bg_color.red / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 c->bg_color.green / 256, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
273 c->bg_color.blue / 256); |
8061 | 274 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
275 g_free(color); |
8061 | 276 } |
277 } | |
278 } | |
279 | |
4359 | 280 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
281 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 282 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
283 GaimGtkConversation *gtkconv; |
8061 | 284 char *buf; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
285 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 286 |
287 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
288 |
8061 | 289 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
290 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); | |
291 else | |
292 buf = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry)); | |
293 | |
294 /* set_toggle(gtkconv->toolbar.bold, FALSE); | |
4685 | 295 set_toggle(gtkconv->toolbar.italic, FALSE); |
296 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 297 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 298 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 299 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 300 set_toggle(gtkconv->toolbar.font, FALSE); |
301 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
302 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
303 set_toggle(gtkconv->toolbar.link, FALSE); | |
8061 | 304 */ |
4359 | 305 gtk_widget_grab_focus(gtkconv->entry); |
306 | |
307 if (strlen(buf) == 0) { | |
308 g_free(buf); | |
309 | |
310 return; | |
311 } | |
312 | |
313 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
314 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); |
8061 | 315 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
316 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); |
4359 | 317 |
5629 | 318 if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send")) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
319 gaim_conv_window_hide(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
320 |
4359 | 321 g_free(buf); |
322 | |
8061 | 323 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
324 default_formatize(conv); | |
4359 | 325 } |
326 | |
327 static void | |
7928 | 328 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 329 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
330 GaimAccount *account; |
4359 | 331 const char *name; |
332 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
333 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
334 name = gaim_conversation_get_name(conv); |
7879 | 335 |
336 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 337 GaimBuddy *b; |
338 | |
339 b = gaim_find_buddy(account, name); | |
340 if (b != NULL) | |
341 show_confirm_del(b); | |
342 else if (account != NULL && gaim_account_is_connected(account)) | |
343 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 344 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 345 GaimChat *c; |
346 | |
347 c = gaim_blist_find_chat(account, name); | |
348 if (c != NULL) | |
349 show_confirm_del_blist_chat(c); | |
350 else if (account != NULL && gaim_account_is_connected(account)) | |
351 gaim_blist_request_add_chat(account, NULL, NULL); | |
352 } | |
4359 | 353 |
354 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
355 } | |
356 | |
7975 | 357 static void chat_do_info(GaimConversation *conv, const char *who) |
358 { | |
359 GaimPluginProtocolInfo *prpl_info = NULL; | |
360 GaimConnection *gc; | |
361 | |
362 if ((gc = gaim_conversation_get_gc(conv))) { | |
363 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
364 | |
365 /* | |
366 * If there are special needs for getting info on users in | |
367 * buddy chat "rooms"... | |
368 */ | |
369 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
370 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
371 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
372 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
373 } |
7975 | 374 else |
375 prpl_info->get_info(gc, who); | |
376 } | |
377 } | |
378 | |
379 | |
4359 | 380 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
381 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 382 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
383 GaimGtkConversation *gtkconv; |
4359 | 384 |
385 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
386 | |
7879 | 387 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
388 serv_get_info(gaim_conversation_get_gc(conv), | |
389 gaim_conversation_get_name(conv)); | |
390 | |
391 gtk_widget_grab_focus(gtkconv->entry); | |
392 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
393 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
394 GaimGtkChatPane *gtkchat; |
4359 | 395 GtkTreeIter iter; |
396 GtkTreeModel *model; | |
397 GtkTreeSelection *sel; | |
398 const char *name; | |
399 | |
400 gtkchat = gtkconv->u.chat; | |
401 | |
402 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
403 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
404 | |
405 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
406 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
407 else | |
408 return; | |
409 | |
7975 | 410 chat_do_info(conv, name); |
4359 | 411 } |
412 } | |
413 | |
414 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
415 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 416 { |
417 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 418 gaim_conversation_get_name(conv)); |
4359 | 419 |
420 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
421 } | |
422 | |
423 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
424 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 425 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
426 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
427 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
428 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
429 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
430 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
431 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 432 |
433 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
434 } | |
435 | |
436 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
437 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 438 { |
439 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
440 GaimGtkConversation *gtkconv; |
4359 | 441 |
442 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
443 | |
444 if (resp == GTK_RESPONSE_OK) { | |
445 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
446 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
447 | |
4793 | 448 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 449 g_free(info); |
450 | |
451 return; | |
452 } | |
453 | |
454 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
455 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 456 message, buddy); |
457 } | |
458 | |
459 gtk_widget_destroy(invite_dialog); | |
460 invite_dialog = NULL; | |
461 | |
462 g_free(info); | |
463 } | |
464 | |
465 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
466 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 467 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
468 InviteBuddyInfo *info = NULL; |
4359 | 469 |
470 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
471 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
472 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
473 GaimGtkWindow *gtkwin; |
4359 | 474 GtkWidget *label; |
475 GtkWidget *vbox, *hbox; | |
476 GtkWidget *table; | |
477 GtkWidget *img; | |
478 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
479 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
480 GTK_ICON_SIZE_DIALOG); |
4359 | 481 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
482 info = g_new0(InviteBuddyInfo, 1); |
4359 | 483 info->conv = conv; |
484 | |
485 gc = gaim_conversation_get_gc(conv); | |
486 win = gaim_conversation_get_window(conv); | |
487 gtkwin = GAIM_GTK_WINDOW(win); | |
488 | |
489 /* Create the new dialog. */ | |
490 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 491 _("Invite Buddy Into Chat Room"), |
7879 | 492 GTK_WINDOW(gtkwin->window), 0, |
493 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 494 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
495 | |
496 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
497 GTK_RESPONSE_OK); | |
498 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
499 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
500 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
501 | |
502 /* Setup the outside spacing. */ | |
503 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
504 | |
505 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
506 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
507 | |
508 /* Setup the inner hbox and put the dialog's icon in it. */ | |
509 hbox = gtk_hbox_new(FALSE, 12); | |
510 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
511 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
512 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
513 | |
514 /* Setup the right vbox. */ | |
515 vbox = gtk_vbox_new(FALSE, 0); | |
516 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
517 | |
518 /* Put our happy label in it. */ | |
519 label = gtk_label_new(_("Please enter the name of the user you wish " | |
520 "to invite, along with an optional invite " | |
521 "message.")); | |
522 gtk_widget_set_size_request(label, 350, -1); | |
523 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
524 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
525 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
526 | |
527 /* hbox for the table, and to give it some spacing on the left. */ | |
528 hbox = gtk_hbox_new(FALSE, 6); | |
529 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
530 | |
531 /* Setup the table we're going to use to lay stuff out. */ | |
532 table = gtk_table_new(2, 2, FALSE); | |
533 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
534 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
535 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
536 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
537 | |
538 /* Now the Buddy label */ | |
539 label = gtk_label_new(NULL); | |
540 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
541 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
542 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
543 | |
544 /* Now the Buddy drop-down entry field. */ | |
545 info->entry = gtk_combo_new(); | |
546 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
547 gtk_entry_set_activates_default( | |
548 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
549 | |
550 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
551 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
552 | |
553 /* Fill in the names. */ | |
554 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
555 generate_invite_user_names(gc)); | |
556 | |
557 | |
558 /* Now the label for "Message" */ | |
559 label = gtk_label_new(NULL); | |
560 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
561 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
562 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
563 | |
564 | |
565 /* And finally, the Message entry field. */ | |
566 info->message = gtk_entry_new(); | |
567 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
568 | |
569 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
570 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
571 | |
572 /* Connect the signals. */ | |
573 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
574 G_CALLBACK(do_invite), info); | |
575 } | |
576 | |
577 gtk_widget_show_all(invite_dialog); | |
578 | |
579 if (info != NULL) | |
580 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
581 } | |
582 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
583 static void |
7748 | 584 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
585 { | |
586 show_im_dialog(); | |
587 } | |
588 | |
589 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
590 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
591 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
592 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
593 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
594 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
595 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
596 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
597 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
598 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
599 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
600 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
601 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
602 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
603 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
604 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
605 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
606 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
607 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
608 |
7295 | 609 struct _search { |
610 GaimGtkConversation *gtkconv; | |
611 GtkWidget *entry; | |
612 }; | |
613 | |
7929 | 614 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 615 { |
7929 | 616 switch (resp) { |
617 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
618 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
619 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 620 break; |
621 | |
622 case GTK_RESPONSE_DELETE_EVENT: | |
623 case GTK_RESPONSE_CLOSE: | |
624 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
625 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
626 s->gtkconv->dialogs.search = NULL; | |
627 g_free(s); | |
628 break; | |
629 } | |
7295 | 630 } |
631 | |
632 static void | |
7751 | 633 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 634 { |
635 GaimConvWindow *win = (GaimConvWindow *)data; | |
636 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
637 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
638 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 639 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
640 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
641 GTK_ICON_SIZE_DIALOG); |
7929 | 642 GtkWidget *label; |
7295 | 643 struct _search *s; |
644 | |
7798 | 645 if (gtkconv->dialogs.search) { |
646 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 647 return; |
7798 | 648 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
649 |
7295 | 650 s = g_malloc(sizeof(struct _search)); |
651 s->gtkconv = gtkconv; | |
7929 | 652 |
653 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
654 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
655 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
656 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
657 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
658 GTK_RESPONSE_OK); |
7929 | 659 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
660 G_CALLBACK(do_search_cb), s); | |
661 | |
662 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
663 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
664 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
665 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
|
666 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
667 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 668 |
669 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
670 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
671 hbox); |
7929 | 672 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
673 | |
674 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
675 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
676 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
677 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
678 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
679 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 680 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
681 | |
682 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
683 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
684 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 685 g_signal_connect(G_OBJECT(s->entry), "changed", |
686 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
687 gtkconv->dialogs.search); | |
688 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
|
689 |
7295 | 690 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 691 gtk_widget_grab_focus(s->entry); |
7295 | 692 } |
693 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
694 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
695 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
696 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
697 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
698 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
699 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
700 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
701 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
702 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
703 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
704 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
705 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
706 #if 0 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
707 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
708 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
709 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
710 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
711 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
712 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
713 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
714 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
715 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
716 |
7927 | 717 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
718 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
719 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
720 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
721 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
722 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
723 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
724 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
725 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
726 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
727 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
728 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
729 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
730 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
731 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
732 #endif |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
733 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
734 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
735 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
736 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
737 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
738 GaimConversation *conv; |
7879 | 739 GaimAccount *account; |
740 const char *name; | |
741 | |
742 conv = gaim_conv_window_get_active_conversation(win); | |
743 account = gaim_conversation_get_account(conv); | |
744 name = gaim_conversation_get_name(conv); | |
745 | |
746 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
747 GaimBuddy *b; | |
748 | |
749 b = gaim_find_buddy(account, name); | |
750 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
751 alias_dialog_bud(b); |
7879 | 752 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
753 GaimChat *c; | |
754 | |
755 c = gaim_blist_find_chat(account, name); | |
756 if (c != NULL) | |
757 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
758 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
759 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
760 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
761 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
762 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
763 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
764 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
765 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
766 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
767 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
768 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
769 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
770 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
771 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
772 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
773 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
774 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
775 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
776 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
777 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
778 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
779 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
780 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
781 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
782 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
783 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
784 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
785 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
786 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
787 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
788 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
789 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
790 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
791 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
792 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
793 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
794 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
795 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
796 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
797 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
798 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
799 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
800 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
801 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
802 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
803 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
804 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
805 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
806 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
807 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
808 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
809 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
810 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
811 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
812 |
7928 | 813 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
814 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
818 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
819 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
820 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 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
|
822 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
827 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
830 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
832 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
837 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
838 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
839 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
840 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
841 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
842 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
843 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
844 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
845 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
846 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
847 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
848 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
849 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
850 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
851 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
852 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
853 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
854 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
855 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
856 if (gtkconv->show_formatting_toolbar) |
8317 | 857 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
858 else |
8317 | 859 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
860 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
861 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
862 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
865 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
868 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
869 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
870 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
871 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
873 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
874 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
875 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
876 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
877 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
878 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
879 |
7961 | 880 static void |
881 chat_do_im(GaimConversation *conv, const char *who) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
882 { |
7961 | 883 GaimPluginProtocolInfo *prpl_info = NULL; |
884 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 GaimConversation *conv2; |
7961 | 886 GaimAccount *account; |
887 | |
888 account = gaim_conversation_get_account(conv); | |
889 | |
890 if(account && account->gc) | |
891 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
892 | |
893 if(prpl_info && prpl_info->get_cb_real_name) | |
894 real_who = prpl_info->get_cb_real_name(account->gc, | |
895 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
896 else | |
897 real_who = g_strdup(who); | |
898 | |
899 if(!real_who) | |
900 return; | |
901 | |
902 conv2 = gaim_find_conversation_with_account(real_who, account); | |
903 | |
904 if (conv2 != NULL) | |
905 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
906 else | |
907 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
908 | |
909 g_free(real_who); | |
910 } | |
911 | |
912 | |
913 static void | |
914 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
915 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
916 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
920 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
929 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 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
|
931 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
933 |
7961 | 934 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
935 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
936 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
937 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
938 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
940 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
941 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
942 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
944 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
945 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
946 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
947 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
948 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
949 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
952 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
953 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
955 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 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
|
958 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
963 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
964 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
965 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
966 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
968 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
971 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
972 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
973 static void |
7398 | 974 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
975 { | |
976 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
977 | |
978 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
984 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
985 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
987 |
7975 | 988 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
989 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
990 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
991 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1003 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1005 * 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
|
1006 */ |
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 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1009 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1010 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1011 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1012 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 static void |
7928 | 1017 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1019 GaimAccount *account; |
6695 | 1020 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1023 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1024 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1025 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 if (b != NULL) |
5975 | 1028 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1029 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1030 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 |
8143 | 1035 static GtkWidget * |
1036 create_chat_menu(GaimConversation *conv, gchar *who, | |
1037 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1038 { | |
1039 static GtkWidget *menu = NULL; | |
1040 GtkWidget *button; | |
1041 | |
1042 /* | |
1043 * If a menu already exists, destroy it before creating a new one, | |
1044 * thus freeing-up the memory it occupied. | |
1045 */ | |
1046 if (menu) | |
1047 gtk_widget_destroy(menu); | |
1048 | |
1049 menu = gtk_menu_new(); | |
1050 | |
1051 button = gtk_menu_item_new_with_label(_("IM")); | |
1052 g_signal_connect(G_OBJECT(button), "activate", | |
1053 G_CALLBACK(menu_chat_im_cb), conv); | |
1054 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1055 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1056 gtk_widget_show(button); | |
1057 | |
1058 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) | |
1059 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1060 else | |
1061 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1062 | |
1063 g_signal_connect(G_OBJECT(button), "activate", | |
1064 G_CALLBACK(ignore_cb), conv); | |
1065 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1066 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1067 gtk_widget_show(button); | |
1068 | |
8170 | 1069 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1070 button = gtk_menu_item_new_with_label(_("Info")); |
1071 g_signal_connect(G_OBJECT(button), "activate", | |
1072 G_CALLBACK(menu_chat_info_cb), conv); | |
1073 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1074 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1075 gtk_widget_show(button); | |
1076 } | |
1077 | |
1078 if (gc && prpl_info->get_cb_away) { | |
1079 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1080 g_signal_connect(G_OBJECT(button), "activate", | |
1081 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1082 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1083 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1084 gtk_widget_show(button); | |
1085 } | |
1086 | |
8170 | 1087 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1088 /* Added by Jonas <jonas@birme.se> */ |
1089 if (gc) { | |
1090 if (gaim_find_buddy(gc->account, who)) | |
1091 button = gtk_menu_item_new_with_label(_("Remove")); | |
1092 else | |
1093 button = gtk_menu_item_new_with_label(_("Add")); | |
1094 | |
1095 g_signal_connect(G_OBJECT(button), "activate", | |
1096 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1097 | |
1098 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1099 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1100 gtk_widget_show(button); | |
1101 } | |
1102 /* End Jonas */ | |
1103 | |
1104 return menu; | |
1105 } | |
1106 | |
1107 | |
1108 static gint | |
1109 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1110 { | |
1111 GaimGtkConversation *gtkconv; | |
1112 GaimPluginProtocolInfo *prpl_info = NULL; | |
1113 GaimGtkChatPane *gtkchat; | |
1114 GaimConnection *gc; | |
1115 GaimAccount *account; | |
1116 GtkTreeSelection *sel; | |
1117 GtkTreeIter iter; | |
1118 GtkTreeModel *model; | |
1119 GtkWidget *menu; | |
1120 gchar *who; | |
1121 | |
1122 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1123 gtkchat = gtkconv->u.chat; | |
1124 account = gaim_conversation_get_account(conv); | |
1125 gc = account->gc; | |
1126 | |
1127 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1128 | |
1129 if (gc != NULL) | |
1130 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1131 | |
1132 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1133 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1134 return FALSE; | |
1135 | |
1136 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
1137 menu = create_chat_menu (conv, who, prpl_info, gc); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1138 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1139 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1140 0, GDK_CURRENT_TIME); |
8143 | 1141 |
1142 return TRUE; | |
1143 } | |
1144 | |
1145 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1146 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1149 { |
8143 | 1150 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1156 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1157 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1160 int x, y; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 gc = account->gc; |
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 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 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
|
1170 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1178 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 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
|
1183 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1185 chat_do_im(conv, who); |
1186 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1187 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 |
8133 | 1195 static void |
1196 move_to_next_unread_tab(GaimConversation *conv) | |
1197 { | |
1198 GaimConversation *next_conv = NULL; | |
1199 GaimConvWindow *win; | |
1200 GList *l; | |
1201 int index, i; | |
1202 | |
1203 win = gaim_conversation_get_window(conv); | |
1204 index = gaim_conversation_get_index(conv); | |
1205 | |
1206 /* First check the tabs after this position. */ | |
1207 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1208 l != NULL; | |
1209 l = l->next) { | |
1210 | |
1211 next_conv = (GaimConversation *)l->data; | |
1212 | |
1213 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1214 break; | |
1215 | |
1216 next_conv = NULL; | |
1217 } | |
1218 | |
1219 if (next_conv == NULL) { | |
1220 | |
1221 /* Now check before this position. */ | |
1222 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1223 l != NULL && i < index; | |
1224 l = l->next) { | |
1225 | |
1226 next_conv = (GaimConversation *)l->data; | |
1227 | |
1228 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1229 break; | |
1230 | |
1231 next_conv = NULL; | |
1232 } | |
1233 | |
1234 if (next_conv == NULL) { | |
1235 /* Okay, just grab the next conversation tab. */ | |
1236 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1237 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1238 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1239 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1240 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1241 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1242 } |
8133 | 1243 } |
1244 } | |
1245 | |
1246 if (next_conv != NULL && next_conv != conv) { | |
1247 gaim_conv_window_switch_conversation(win, | |
1248 gaim_conversation_get_index(next_conv)); | |
1249 } | |
1250 } | |
1251 | |
4359 | 1252 static gboolean |
8105 | 1253 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1254 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1255 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1256 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1257 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1258 GaimGtkWindow *gtkwin; |
8105 | 1259 int numconvs; |
1260 int curconv; | |
1261 | |
1262 conv = (GaimConversation *)data; | |
1263 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1264 win = gaim_conversation_get_window(conv); | |
1265 gtkwin = GAIM_GTK_WINDOW(win); | |
1266 numconvs = gaim_conv_window_get_conversation_count(win); | |
1267 curconv = gaim_conversation_get_index(conv); | |
1268 | |
1269 /* If CTRL was held down... */ | |
1270 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1271 switch (event->keyval) { |
8105 | 1272 case GDK_Return: |
1273 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1274 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1275 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1276 { |
8105 | 1277 send_cb(NULL, conv); |
1278 | |
1279 return TRUE; | |
1280 } | |
1281 break; | |
1282 | |
4359 | 1283 case GDK_Up: |
1284 if (!conv->send_history) | |
1285 break; | |
1286 | |
1287 if (!conv->send_history->prev) { | |
1288 GtkTextIter start, end; | |
1289 | |
1290 if (conv->send_history->data) | |
1291 g_free(conv->send_history->data); | |
1292 | |
1293 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1294 &start); | |
1295 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1296 | |
1297 conv->send_history->data = | |
1298 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1299 &start, &end, FALSE); | |
1300 } | |
1301 | |
1302 if (conv->send_history->next && | |
1303 conv->send_history->next->data) { | |
1304 | |
1305 conv->send_history = conv->send_history->next; | |
8061 | 1306 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1307 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1308 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1309 0, NULL); |
4359 | 1310 } |
1311 | |
8105 | 1312 return TRUE; |
4359 | 1313 break; |
1314 | |
1315 case GDK_Down: | |
1316 if (!conv->send_history) | |
1317 break; | |
1318 | |
8105 | 1319 if (conv->send_history->prev && |
1320 conv->send_history->prev->data) { | |
1321 | |
4359 | 1322 conv->send_history = conv->send_history->prev; |
8105 | 1323 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1324 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1325 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1326 0, NULL); |
4359 | 1327 } |
1328 | |
8105 | 1329 return TRUE; |
4359 | 1330 break; |
8105 | 1331 |
8108 | 1332 case GDK_Page_Down: |
8143 | 1333 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1334 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1335 (curconv + 1) % numconvs); |
8105 | 1336 |
1337 return TRUE; | |
1338 break; | |
1339 | |
8108 | 1340 case GDK_Page_Up: |
8143 | 1341 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1342 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1343 (curconv + numconvs - 1) % numconvs); |
8133 | 1344 |
1345 return TRUE; | |
1346 break; | |
1347 | |
8108 | 1348 case GDK_Tab: |
8133 | 1349 move_to_next_unread_tab(conv); |
8108 | 1350 |
1351 return TRUE; | |
1352 break; | |
1353 | |
1354 case 'l': | |
1355 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1356 g_string_free(conv->history, TRUE); | |
8229 | 1357 conv->history = NULL; |
8108 | 1358 |
1359 return TRUE; | |
1360 break; | |
1361 | |
1362 case 'z': | |
1363 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1364 |
1365 return TRUE; | |
1366 break; | |
1367 | |
1368 } /* End of switch */ | |
4359 | 1369 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1370 #if 0 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1371 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1372 switch (event->keyval) { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1373 |
8317 | 1374 |
4359 | 1375 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1376 } /* End of switch */ |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1377 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1378 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1379 char buf[7]; |
1380 | |
1381 *buf = '\0'; | |
1382 | |
1383 switch (event->keyval) { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1384 |
4359 | 1385 } |
1386 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1387 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1388 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1389 #endif |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1390 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1391 } |
8105 | 1392 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1393 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1394 { |
8105 | 1395 /* XXX - Make sure the conv exists befeore switching to it */ |
1396 if (event->keyval > '0' && event->keyval <= '9') { | |
1397 int switchto = event->keyval - '1'; | |
1398 if (switchto < numconvs) | |
1399 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1400 |
1401 return TRUE; | |
1402 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1403 } |
8105 | 1404 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1405 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1406 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1407 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1408 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1409 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1410 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1411 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1412 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1413 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1414 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1415 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1416 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1417 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1418 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1419 case GDK_Tab: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1420 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1421 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1422 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1423 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1424 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1425 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1426 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1427 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1428 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1429 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1430 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1431 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1432 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1433 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1434 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1435 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1436 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1437 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1438 case GDK_F2: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1439 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1440 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1441 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1442 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1443 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1444 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1445 } |
4359 | 1446 |
1447 return FALSE; | |
1448 } | |
1449 | |
1450 /* | |
1451 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1452 * 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
|
1453 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1454 * 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
|
1455 * going all the way down to the notebook. I suspect a bug in |
4359 | 1456 * GtkTextView, but I'm not ready to point any fingers yet. |
1457 */ | |
1458 static gboolean | |
1459 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1460 { | |
1461 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1462 /* Right single click */ | |
1463 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1464 | |
1465 return TRUE; | |
1466 } | |
1467 | |
1468 return FALSE; | |
1469 } | |
1470 | |
8173 | 1471 /* |
1472 * If someone tries to type into the conversation backlog of a | |
1473 * conversation window then we yank focus from the conversation backlog | |
1474 * and give it to the text entry box so that people can type | |
1475 * all the live long day and it will get entered into the entry box. | |
1476 */ | |
6057 | 1477 static gboolean |
8105 | 1478 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1479 { |
1480 GaimGtkConversation *gtkconv = data; | |
1481 | |
8237 | 1482 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1483 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1484 (event->keyval == GDK_F10) || |
1485 (event->keyval == GDK_Shift_L) || | |
1486 (event->keyval == GDK_Shift_R) || | |
1487 (event->keyval == GDK_Escape) || | |
8177 | 1488 (event->keyval == GDK_Up) || |
1489 (event->keyval == GDK_Down) || | |
1490 (event->keyval == GDK_Left) || | |
8191 | 1491 (event->keyval == GDK_Right) || |
1492 (event->keyval == GDK_Home) || | |
1493 (event->keyval == GDK_End)) | |
8177 | 1494 return FALSE; |
1495 | |
1496 if (event->type == GDK_KEY_RELEASE) | |
1497 gtk_widget_grab_focus(gtkconv->entry); | |
1498 | |
1499 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1500 | |
1501 return TRUE; | |
6057 | 1502 } |
1503 | |
4359 | 1504 static void |
4673 | 1505 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1506 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1507 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1508 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1509 GaimConversation *conv; |
4359 | 1510 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1511 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1512 |
4491 | 1513 gaim_conversation_set_account(conv, account); |
4359 | 1514 } |
1515 | |
1516 static void | |
1517 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1518 gchar *new_text, gint new_text_length, gpointer user_data) | |
1519 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1520 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1521 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1522 g_return_if_fail(conv != NULL); |
4359 | 1523 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1524 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1525 return; |
1526 | |
1527 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1528 gtk_text_iter_is_end(position))); | |
1529 } | |
1530 | |
1531 static void | |
1532 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1533 GtkTextIter *end_pos, gpointer user_data) | |
1534 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1535 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1536 GaimConvIm *im; |
4359 | 1537 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1538 g_return_if_fail(conv != NULL); |
4359 | 1539 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1540 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1541 return; |
1542 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1543 im = GAIM_CONV_IM(conv); |
4359 | 1544 |
1545 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1546 | |
1547 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1548 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1549 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1550 |
1551 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1552 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1553 GAIM_NOT_TYPING); |
4359 | 1554 } |
1555 else { | |
1556 /* We're deleting, but not all of it, so it counts as typing. */ | |
1557 got_typing_keypress(conv, FALSE); | |
1558 } | |
1559 } | |
1560 | |
1561 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1562 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1563 { |
1564 static GdkCursor *cursor = NULL; | |
1565 | |
1566 gtkwin->in_drag = TRUE; | |
1567 | |
1568 if (gtkwin->drag_leave_signal) { | |
1569 g_signal_handler_disconnect(G_OBJECT(widget), | |
1570 gtkwin->drag_leave_signal); | |
1571 | |
1572 gtkwin->drag_leave_signal = 0; | |
1573 } | |
1574 | |
1575 if (cursor == NULL) | |
1576 cursor = gdk_cursor_new(GDK_FLEUR); | |
1577 | |
1578 /* Grab the pointer */ | |
1579 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1580 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1581 /* 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
|
1582 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1583 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1584 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1585 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1586 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1587 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1588 } |
1589 | |
1590 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1591 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1592 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1593 GaimGtkWindow *gtkwin; |
4359 | 1594 |
1595 gtkwin = GAIM_GTK_WINDOW(win); | |
1596 | |
1597 /* | |
1598 * Make sure the user moved the mouse far enough for the | |
1599 * drag to be initiated. | |
1600 */ | |
1601 if (gtkwin->in_predrag) { | |
1602 if (e->x_root < gtkwin->drag_min_x || | |
1603 e->x_root >= gtkwin->drag_max_x || | |
1604 e->y_root < gtkwin->drag_min_y || | |
1605 e->y_root >= gtkwin->drag_max_y) { | |
1606 | |
1607 gtkwin->in_predrag = FALSE; | |
1608 notebook_init_grab(gtkwin, widget); | |
1609 } | |
1610 } | |
1611 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1612 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1613 GaimGtkWindow *dest_gtkwin; |
4359 | 1614 GtkNotebook *dest_notebook; |
1615 GtkWidget *tab, *last_vis_tab = NULL; | |
1616 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1617 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1618 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1619 GList *l; | |
1620 | |
1621 /* Get the window that the cursor is over. */ | |
1622 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1623 | |
1624 if (dest_win == NULL) { | |
1625 dnd_hints_hide_all(); | |
1626 | |
1627 return TRUE; | |
1628 } | |
1629 | |
1630 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1631 | |
1632 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1633 | |
1634 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1635 | |
1636 arrow1_x = arrow2_x = nb_x; | |
1637 arrow1_y = arrow2_y = nb_y; | |
1638 | |
1639 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1640 e->x_root, e->y_root); | |
1641 | |
1642 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1643 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1644 | |
1645 horiz_tabs = TRUE; | |
1646 } | |
1647 | |
1648 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1649 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1650 l != NULL; |
1651 l = l->next, i++) { | |
1652 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1653 GaimConversation *conv = l->data; |
4359 | 1654 |
1655 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1656 | |
1657 /* | |
1658 * If this is the correct tab, record the positions | |
1659 * for the arrows. | |
1660 */ | |
1661 if (i == page_num) { | |
1662 if (horiz_tabs) { | |
1663 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1664 arrow1_y = nb_y + tab->allocation.y; | |
1665 arrow2_y = nb_y + tab->allocation.y + | |
1666 tab->allocation.height; | |
1667 } | |
1668 else { | |
1669 arrow1_x = nb_x + tab->allocation.x; | |
1670 arrow2_x = nb_x + tab->allocation.x + | |
1671 tab->allocation.width; | |
1672 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1673 } | |
1674 | |
1675 tab_found = TRUE; | |
1676 break; | |
1677 } | |
1678 else { /* Keep track of the right-most tab that we see. */ | |
1679 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1680 last_vis_tab = tab; | |
1681 last_vis_tab_loc = tab->allocation.x; | |
1682 } | |
1683 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1684 last_vis_tab = tab; | |
1685 last_vis_tab_loc = tab->allocation.y; | |
1686 } | |
1687 } | |
1688 } | |
1689 | |
1690 /* | |
1691 * If we didn't find the tab, then we'll just place the | |
1692 * arrows to the right/bottom of the last visible tab. | |
1693 */ | |
1694 if (!tab_found && last_vis_tab) { | |
1695 if (horiz_tabs) { | |
1696 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1697 last_vis_tab->allocation.width; | |
1698 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1699 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1700 last_vis_tab->allocation.height; | |
1701 } | |
1702 else { | |
1703 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1704 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1705 last_vis_tab->allocation.width; | |
1706 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1707 last_vis_tab->allocation.height; | |
1708 } | |
1709 } | |
1710 | |
1711 if (horiz_tabs) { | |
1712 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1713 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1714 } | |
1715 else { | |
1716 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1717 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1718 } | |
1719 } | |
1720 | |
1721 return TRUE; | |
1722 } | |
1723 | |
1724 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1725 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1726 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1727 GaimGtkWindow *gtkwin; |
4359 | 1728 |
1729 gtkwin = GAIM_GTK_WINDOW(win); | |
1730 | |
1731 if (gtkwin->in_drag) | |
1732 return FALSE; | |
1733 | |
1734 if (e->x_root < gtkwin->drag_min_x || | |
1735 e->x_root >= gtkwin->drag_max_x || | |
1736 e->y_root < gtkwin->drag_min_y || | |
1737 e->y_root >= gtkwin->drag_max_y) { | |
1738 | |
1739 gtkwin->in_predrag = FALSE; | |
1740 notebook_init_grab(gtkwin, widget); | |
1741 } | |
1742 | |
1743 return TRUE; | |
1744 } | |
1745 | |
1746 /* | |
1747 * THANK YOU GALEON! | |
1748 */ | |
1749 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1750 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1751 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1752 GaimGtkWindow *gtkwin; |
4359 | 1753 gint nb_x, nb_y, x_rel, y_rel; |
1754 GList *l; | |
1755 int tab_clicked; | |
1756 | |
1757 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1758 return FALSE; | |
1759 | |
1760 gtkwin = GAIM_GTK_WINDOW(win); | |
1761 | |
1762 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1763 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1764 "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
|
1765 return TRUE; |
4359 | 1766 } |
1767 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1768 /* |
4359 | 1769 * Make sure a tab was actually clicked. The arrow buttons |
1770 * mess things up. | |
1771 */ | |
1772 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1773 | |
1774 if (tab_clicked == -1) | |
1775 return FALSE; | |
1776 | |
1777 /* | |
1778 * Get the relative position of the press event, with regards to | |
1779 * the position of the notebook. | |
1780 */ | |
1781 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1782 | |
1783 x_rel = e->x_root - nb_x; | |
1784 y_rel = e->y_root - nb_y; | |
1785 | |
1786 /* Reset the min/max x/y */ | |
1787 gtkwin->drag_min_x = 0; | |
1788 gtkwin->drag_min_y = 0; | |
1789 gtkwin->drag_max_x = 0; | |
1790 gtkwin->drag_max_y = 0; | |
1791 | |
1792 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1793 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
|
1794 GaimConversation *conv = l->data; |
4359 | 1795 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1796 | |
1797 if (!GTK_WIDGET_VISIBLE(tab)) | |
1798 continue; | |
1799 | |
1800 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1801 break; | |
1802 | |
1803 /* Save the borders of the tab. */ | |
1804 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1805 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1806 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1807 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1808 } | |
1809 | |
1810 /* Make sure the click occurred in the tab. */ | |
1811 if (e->x_root < gtkwin->drag_min_x || | |
1812 e->x_root >= gtkwin->drag_max_x || | |
1813 e->y_root < gtkwin->drag_min_y || | |
1814 e->y_root >= gtkwin->drag_max_y) { | |
1815 | |
1816 return FALSE; | |
1817 } | |
1818 | |
1819 gtkwin->in_predrag = TRUE; | |
1820 | |
1821 /* Connect the new motion signals. */ | |
1822 gtkwin->drag_motion_signal = | |
1823 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1824 G_CALLBACK(notebook_motion_cb), win); | |
1825 | |
1826 gtkwin->drag_leave_signal = | |
1827 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1828 G_CALLBACK(notebook_leave_cb), win); | |
1829 | |
1830 return FALSE; | |
1831 } | |
1832 | |
1833 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1834 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1835 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1836 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1837 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1838 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1839 GaimConversation *conv; |
4359 | 1840 GtkNotebook *dest_notebook; |
1841 gint dest_page_num; | |
1842 | |
1843 /* | |
1844 * Don't check to make sure that the event's window matches the | |
1845 * widget's, because we may be getting an event passed on from the | |
1846 * close button. | |
1847 */ | |
1848 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1849 return FALSE; | |
1850 | |
1851 if (gdk_pointer_is_grabbed()) { | |
1852 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1853 gtk_grab_remove(widget); | |
1854 } | |
1855 | |
1856 gtkwin = GAIM_GTK_WINDOW(win); | |
1857 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1858 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1859 return FALSE; |
4359 | 1860 |
1861 /* Disconnect the motion signal. */ | |
1862 if (gtkwin->drag_motion_signal) { | |
1863 g_signal_handler_disconnect(G_OBJECT(widget), | |
1864 gtkwin->drag_motion_signal); | |
1865 | |
1866 gtkwin->drag_motion_signal = 0; | |
1867 } | |
1868 | |
1869 /* | |
1870 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1871 * signal. | |
1872 */ | |
1873 if (gtkwin->in_predrag) { | |
1874 gtkwin->in_predrag = FALSE; | |
1875 | |
1876 if (gtkwin->drag_leave_signal) { | |
1877 g_signal_handler_disconnect(G_OBJECT(widget), | |
1878 gtkwin->drag_leave_signal); | |
1879 | |
1880 gtkwin->drag_leave_signal = 0; | |
1881 } | |
1882 } | |
1883 | |
1884 /* If we're not in drag... */ | |
1885 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1886 if (!gtkwin->in_drag) |
4359 | 1887 return FALSE; |
1888 | |
1889 gtkwin->in_drag = FALSE; | |
1890 | |
1891 dnd_hints_hide_all(); | |
1892 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1893 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1894 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1895 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1896 |
1897 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1898 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1899 return FALSE; |
1900 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1901 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1902 /* Make a new window to stick this to. */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1903 GaimConvWindow *new_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1904 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1905 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1906 gint win_width, win_height; |
5121 | 1907 |
1908 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1909 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1910 new_win = gaim_conv_window_new(); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1911 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1912 gaim_conv_window_add_conversation(new_win, |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1913 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1914 gaim_conversation_get_index(conv))); |
5121 | 1915 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1916 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1917 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1918 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1919 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1920 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1921 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1922 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1923 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1924 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1925 gaim_conv_window_show(new_win); |
4359 | 1926 } |
1927 | |
1928 return TRUE; | |
1929 } | |
1930 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1931 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1932 |
4359 | 1933 /* Get the destination notebook. */ |
1934 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1935 | |
1936 /* Get the destination page number. */ | |
1937 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
7143 | 1938 e->x_root, e->y_root); |
4359 | 1939 |
1940 if (win == dest_win) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1941 gaim_conv_window_move_conversation(win, |
4359 | 1942 gaim_conversation_get_index(conv), dest_page_num); |
1943 } | |
1944 else { | |
1945 size_t pos; | |
1946 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1947 gaim_conv_window_remove_conversation(win, |
4359 | 1948 gaim_conversation_get_index(conv)); |
1949 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1950 pos = gaim_conv_window_add_conversation(dest_win, conv); |
4359 | 1951 |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
1952 if (pos != dest_page_num) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1953 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1954 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1955 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
4359 | 1956 } |
1957 | |
1958 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
1959 | |
1960 return TRUE; | |
1961 } | |
1962 | |
8189 | 1963 /************************************************************************** |
1964 * A bunch of buddy icon functions | |
1965 **************************************************************************/ | |
1966 static GdkPixbuf * | |
1967 get_tab_icon(GaimConversation *conv) | |
7143 | 1968 { |
1969 GaimAccount *account = gaim_conversation_get_account(conv); | |
1970 const char *name = gaim_conversation_get_name(conv); | |
1971 GdkPixbuf *status = NULL; | |
1972 | |
1973 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1974 GaimBuddy *b = gaim_find_buddy(account, name); | |
1975 if (b != NULL) { | |
1976 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
1977 GAIM_STATUS_ICON_SMALL); | |
1978 } | |
1979 } | |
1980 | |
1981 if (!status) { | |
1982 GdkPixbuf *pixbuf; | |
1983 pixbuf = create_prpl_icon(account); | |
1984 | |
1985 if (pixbuf) { | |
1986 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
1987 GDK_INTERP_BILINEAR); | |
1988 g_object_unref(pixbuf); | |
1989 } | |
1990 } | |
1991 return status; | |
1992 } | |
1993 | |
8189 | 1994 static void |
1995 update_tab_icon(GaimConversation *conv) | |
1996 { | |
1997 GaimGtkConversation *gtkconv; | |
1998 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
1999 GaimAccount *account; | |
2000 const char *name; | |
2001 GdkPixbuf *status = NULL; | |
2002 | |
2003 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2004 name = gaim_conversation_get_name(conv); | |
2005 account = gaim_conversation_get_account(conv); | |
2006 | |
2007 status = get_tab_icon(conv); | |
2008 | |
2009 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2010 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2011 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2012 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2013 gtkconv->u.im->anim == NULL) |
8189 | 2014 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2015 | |
2016 if(status) | |
2017 g_object_unref(status); | |
2018 } | |
2019 | |
2020 static gboolean | |
2021 redraw_icon(gpointer data) | |
2022 { | |
2023 GaimConversation *conv = (GaimConversation *)data; | |
2024 GaimGtkConversation *gtkconv; | |
2025 | |
2026 GdkPixbuf *buf; | |
2027 GdkPixbuf *scale; | |
2028 GdkPixmap *pm; | |
2029 GdkBitmap *bm; | |
2030 gint delay; | |
2031 | |
2032 if (!g_list_find(gaim_get_ims(), conv)) { | |
2033 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2034 "Conversation not found in redraw_icon. I think this " | |
2035 "is a bug.\n"); | |
2036 return FALSE; | |
2037 } | |
2038 | |
2039 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2040 | |
2041 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2042 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2043 | |
2044 scale = gdk_pixbuf_scale_simple(buf, | |
2045 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
2046 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
2047 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
2048 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
2049 GDK_INTERP_NEAREST); | |
2050 | |
2051 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2052 g_object_unref(G_OBJECT(scale)); | |
2053 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2054 g_object_unref(G_OBJECT(pm)); | |
2055 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2056 | |
2057 if (bm) | |
2058 g_object_unref(G_OBJECT(bm)); | |
2059 | |
2060 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2061 | |
2062 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
2063 | |
2064 return FALSE; | |
2065 } | |
2066 | |
2067 static void | |
2068 start_anim(GtkObject *obj, GaimConversation *conv) | |
2069 { | |
2070 GaimGtkConversation *gtkconv; | |
2071 int delay; | |
2072 | |
2073 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2074 return; | |
2075 | |
2076 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2077 | |
8228 | 2078 if (gtkconv->u.im->anim == NULL) |
2079 return; | |
2080 | |
8202 | 2081 if (gtkconv->u.im->icon_timer != 0) |
2082 return; | |
2083 | |
8189 | 2084 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2085 return; | |
2086 | |
2087 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2088 | |
2089 if (gtkconv->u.im->anim) | |
2090 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
2091 conv); | |
2092 } | |
2093 | |
2094 static void | |
2095 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2096 { | |
2097 GaimGtkConversation *gtkconv; | |
2098 | |
2099 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2100 return; | |
2101 | |
2102 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2103 | |
2104 if (gtkconv->u.im->icon_timer != 0) | |
2105 g_source_remove(gtkconv->u.im->icon_timer); | |
2106 | |
2107 gtkconv->u.im->icon_timer = 0; | |
2108 } | |
2109 | |
2110 static void | |
2111 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2112 { | |
2113 GaimGtkConversation *gtkconv; | |
2114 | |
2115 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2116 return; | |
2117 | |
2118 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2119 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2120 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2121 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2122 |
2123 if (gtkconv->u.im->animate) | |
2124 start_anim(NULL, conv); | |
2125 else | |
2126 stop_anim(NULL, conv); | |
2127 } | |
2128 static void | |
2129 remove_icon(GaimGtkConversation *gtkconv) | |
2130 { | |
2131 g_return_if_fail(gtkconv != NULL); | |
2132 | |
2133 if (gtkconv->u.im->icon != NULL) | |
2134 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
2135 gtkconv->u.im->icon->parent->parent); | |
2136 | |
2137 if (gtkconv->u.im->anim != NULL) | |
2138 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2139 | |
2140 if (gtkconv->u.im->icon_timer != 0) | |
2141 g_source_remove(gtkconv->u.im->icon_timer); | |
2142 | |
2143 if (gtkconv->u.im->iter != NULL) | |
2144 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2145 | |
2146 gtkconv->u.im->icon_timer = 0; | |
2147 gtkconv->u.im->icon = NULL; | |
2148 gtkconv->u.im->anim = NULL; | |
2149 gtkconv->u.im->iter = NULL; | |
2150 } | |
2151 | |
2152 static gboolean | |
2153 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2154 { | |
2155 GaimGtkConversation *gtkconv; | |
2156 static GtkWidget *menu = NULL; | |
2157 GtkWidget *button; | |
2158 | |
2159 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2160 return FALSE; | |
2161 | |
2162 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2163 | |
2164 /* | |
2165 * If a menu already exists, destroy it before creating a new one, | |
2166 * thus freeing-up the memory it occupied. | |
2167 */ | |
2168 if (menu != NULL) | |
2169 gtk_widget_destroy(menu); | |
2170 | |
2171 menu = gtk_menu_new(); | |
2172 | |
2173 if (gtkconv->u.im->anim && | |
2174 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2175 { | |
2176 gaim_new_check_item(menu, _("Animate"), | |
2177 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2178 gtkconv->u.im->icon_timer); | |
2179 } | |
2180 | |
2181 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2182 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2183 G_CALLBACK(remove_icon), gtkconv); | |
2184 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2185 gtk_widget_show(button); | |
2186 | |
2187 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
2188 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, | |
2189 0, 0, NULL); | |
2190 | |
2191 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2192 | |
2193 return TRUE; | |
2194 } | |
2195 /************************************************************************** | |
2196 * End of the bunch of buddy icon functions | |
2197 **************************************************************************/ | |
2198 | |
7887 | 2199 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2200 * Makes sure all the menu items and all the buttons are hidden/shown and |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2201 * sensitive/insensitve. This is called after changing tabs and when an |
7887 | 2202 * account signs on or off. |
2203 */ | |
4359 | 2204 static void |
7887 | 2205 gray_stuff_out(GaimConversation *conv) |
4359 | 2206 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2207 GaimConvWindow *win; |
7887 | 2208 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2209 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2210 GaimConnection *gc; |
7887 | 2211 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2212 GdkPixbuf *window_icon = NULL; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2213 |
7887 | 2214 win = gaim_conversation_get_window(conv); |
4359 | 2215 gtkwin = GAIM_GTK_WINDOW(win); |
2216 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2217 gc = gaim_conversation_get_gc(conv); |
8420 | 2218 GtkIMHtmlButtons buttons; |
2219 | |
7879 | 2220 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2221 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2222 |
7887 | 2223 if (gtkwin->menu.send_as != NULL) |
2224 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2225 | |
2226 /* | |
2227 * 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
|
2228 * Stuff that Gaim IMs support in general should be shown for IM |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2229 * conversations. Stuff that Gaim chats support in gerneal should be |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2230 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2231 * supports it or not--that only affects if the button or menu item |
7929 | 2232 * is sensitive or not. |
7887 | 2233 */ |
4359 | 2234 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2235 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2236 | |
2237 /* Deal with buttons */ | |
2238 gtk_widget_show(gtkconv->info); | |
2239 gtk_widget_show(gtkconv->send); | |
2240 gtk_widget_show(gtkconv->u.im->warn); | |
2241 gtk_widget_show(gtkconv->u.im->block); | |
2242 | |
2243 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2244 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2245 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2246 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2247 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2248 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2249 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2250 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2251 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2252 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2253 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2254 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2255 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2256 gtk_widget_show(gtkconv->add); |
2257 gtk_widget_hide(gtkconv->remove); | |
7859 | 2258 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2259 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2260 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2261 gtk_widget_hide(gtkconv->add); |
2262 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2263 } |
7887 | 2264 |
2265 gtk_widget_show(gtkwin->menu.insert_link); | |
2266 gtk_widget_show(gtkwin->menu.insert_image); | |
2267 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2268 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2269 | |
2270 /* Deal with buttons */ | |
7952 | 2271 gtk_widget_show(gtkconv->info); |
7887 | 2272 gtk_widget_show(gtkconv->send); |
2273 gtk_widget_show(gtkconv->u.chat->invite); | |
2274 | |
2275 /* Deal with menu items */ | |
7859 | 2276 gtk_widget_hide(gtkwin->menu.view_log); |
2277 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2278 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2279 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2280 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2281 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2282 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2283 |
7879 | 2284 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2285 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2286 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2287 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2288 gtk_widget_show(gtkconv->add); |
2289 gtk_widget_hide(gtkconv->remove); | |
7859 | 2290 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2291 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2292 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2293 gtk_widget_hide(gtkconv->add); |
2294 gtk_widget_show(gtkconv->remove); | |
7887 | 2295 } |
2296 | |
2297 gtk_widget_show(gtkwin->menu.insert_link); | |
2298 gtk_widget_hide(gtkwin->menu.insert_image); | |
2299 } | |
2300 | |
2301 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2302 * Handle graying stuff out based on whether an account is connected |
7887 | 2303 * and what features that account supports. |
2304 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2305 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2306 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2307 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2308 /* Account is online */ |
2309 | |
2310 /* Deal with buttons */ | |
7929 | 2311 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2312 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2313 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2314 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2315 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2316 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2317 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2318 (prpl_info->send_im != NULL)); |
7887 | 2319 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2320 (prpl_info->warn != NULL)); | |
2321 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2322 (prpl_info->add_deny != NULL)); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2323 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2324 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2325 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2326 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2327 (prpl_info->chat_send != NULL)); |
7887 | 2328 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2329 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2330 } |
7887 | 2331 |
2332 /* Deal with the toolbar */ | |
8422 | 2333 |
8420 | 2334 if (gc->flags & GAIM_CONNECTION_HTML) { |
2335 buttons = -1; /* Everything on */ | |
2336 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) | |
8422 | 2337 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2338 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2339 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8420 | 2340 } else { |
8422 | 2341 buttons = GTK_IMHTML_SMILEY; |
8420 | 2342 } |
2343 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8422 | 2344 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2345 #if 0 |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2346 /* Deal with menu items */ |
7887 | 2347 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2348 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2349 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2350 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2351 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2352 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2353 #endif |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2354 |
7887 | 2355 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
2356 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2357 gaim_conversation_get_name(conv)) == NULL) | |
2358 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2359 else | |
2360 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2361 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2362 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2363 gaim_conversation_get_name(conv)) == NULL) | |
2364 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2365 else | |
2366 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2367 } | |
2368 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2369 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2370 (prpl_info->add_deny != NULL)); |
7887 | 2371 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2372 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
7887 | 2373 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
2374 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
2375 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2376 } else { | |
2377 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2378 /* Or it's a chat where we left. */ |
7887 | 2379 |
2380 /* Deal with buttons */ | |
7929 | 2381 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2382 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2383 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2384 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2385 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2386 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2387 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2388 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2389 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2390 } | |
8420 | 2391 |
7887 | 2392 /* Then deal with menu items */ |
2393 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2394 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2395 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2396 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2397 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2398 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2399 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2400 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2401 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2402 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2403 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2404 } | |
2405 | |
2406 /* | |
2407 * Update the window's icon | |
2408 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2409 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2410 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2411 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2412 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2413 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2414 g_object_ref(window_icon); |
2415 } else { | |
7219 | 2416 window_icon = get_tab_icon(conv); |
4359 | 2417 } |
7887 | 2418 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2419 g_object_unref(G_OBJECT(window_icon)); | |
2420 } | |
2421 | |
2422 static void | |
8189 | 2423 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2424 gpointer user_data) | |
2425 { | |
2426 GaimConvWindow *win; | |
2427 GaimConversation *conv; | |
2428 GaimGtkConversation *gtkconv; | |
2429 | |
2430 win = (GaimConvWindow *)user_data; | |
2431 conv = gaim_conv_window_get_active_conversation(win); | |
2432 | |
2433 g_return_if_fail(conv != NULL); | |
2434 | |
8192 | 2435 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2436 return; | |
2437 | |
8189 | 2438 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2439 | |
2440 stop_anim(NULL, conv); | |
2441 } | |
2442 | |
2443 static void | |
7887 | 2444 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2445 gpointer user_data) | |
2446 { | |
2447 GaimConvWindow *win; | |
2448 GaimConversation *conv; | |
2449 GaimGtkConversation *gtkconv; | |
2450 GaimGtkWindow *gtkwin; | |
2451 | |
2452 win = (GaimConvWindow *)user_data; | |
2453 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2454 | |
2455 g_return_if_fail(conv != NULL); | |
2456 | |
2457 gtkwin = GAIM_GTK_WINDOW(win); | |
2458 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2459 | |
2460 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2461 | |
2462 /* Update the menubar */ | |
2463 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2464 |
4736 | 2465 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2466 |
4359 | 2467 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2468 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2469 |
4359 | 2470 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2471 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2472 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2473 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2474 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2475 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2476 |
8189 | 2477 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2478 * We pause icons when they are not visible. If this icon should |
8189 | 2479 * be animated then start it back up again.lll |
2480 */ | |
8192 | 2481 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2482 (gtkconv->u.im->animate)) | |
8189 | 2483 start_anim(NULL, conv); |
2484 | |
4359 | 2485 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2486 |
4965 | 2487 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2488 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2489 } |
2490 | |
2491 /************************************************************************** | |
2492 * Utility functions | |
2493 **************************************************************************/ | |
2494 | |
2495 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2496 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2497 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2498 GaimConvIm *im; |
4685 | 2499 |
4359 | 2500 /* |
2501 * 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
|
2502 * send GAIM_TYPED any time soon. |
4359 | 2503 */ |
2504 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2505 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2506 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2507 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2508 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2509 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2510 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2511 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2512 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2513 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2514 |
2515 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2516 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2517 GAIM_TYPING); |
4359 | 2518 |
2519 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2520 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2521 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2522 gaim_conv_im_set_type_again(im, 0); |
4359 | 2523 } |
2524 } | |
2525 | |
4736 | 2526 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2527 update_typing_icon(GaimConversation *conv) |
4736 | 2528 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2529 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2530 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2531 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2532 |
2533 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2534 | |
2535 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2536 im = GAIM_CONV_IM(conv); |
4736 | 2537 |
2538 if(gtkwin->menu.typing_icon) { | |
2539 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2540 gtkwin->menu.typing_icon = NULL; | |
2541 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2542 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2543 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2544 gtk_image_menu_item_set_image( | |
2545 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2546 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2547 GTK_ICON_SIZE_MENU)); | |
4757 | 2548 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2549 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2550 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2551 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2552 gtk_image_menu_item_set_image( | |
2553 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2554 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2555 GTK_ICON_SIZE_MENU)); | |
4757 | 2556 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2557 _("User has typed something and paused"), NULL); |
2558 } | |
2559 | |
2560 if(gtkwin->menu.typing_icon) { | |
2561 gtk_menu_item_set_right_justified( | |
2562 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2563 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2564 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2565 gtkwin->menu.typing_icon); | |
2566 } | |
2567 } | |
2568 | |
4685 | 2569 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2570 update_send_as_selection(GaimConvWindow *win) |
4359 | 2571 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2572 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2573 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2574 GaimGtkWindow *gtkwin; |
4359 | 2575 GtkWidget *menu; |
2576 GList *child; | |
2577 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2578 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2579 return FALSE; |
4849 | 2580 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2581 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2582 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2583 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2584 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2585 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2586 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2587 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2588 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2589 if (gtkwin->menu.send_as == NULL) |
4685 | 2590 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2591 |
4359 | 2592 gtk_widget_show(gtkwin->menu.send_as); |
2593 | |
2594 menu = gtk_menu_item_get_submenu( | |
2595 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2596 | |
2597 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2598 child != NULL; | |
2599 child = child->next) { | |
2600 | |
2601 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2602 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2603 "gaim_account"); |
2604 | |
2605 if (account == item_account) { | |
4359 | 2606 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2607 break; | |
2608 } | |
2609 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2610 |
4685 | 2611 return FALSE; |
4359 | 2612 } |
2613 | |
2614 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2615 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2616 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2617 GaimGtkWindow *gtkwin; |
4359 | 2618 GtkWidget *menu; |
2619 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2620 GList *gcs; |
4359 | 2621 GList *convs; |
2622 GSList *group = NULL; | |
2623 gboolean first_offline = TRUE; | |
2624 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2625 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2626 |
2627 gtkwin = GAIM_GTK_WINDOW(win); | |
2628 | |
2629 if (gtkwin->menu.send_as != NULL) | |
2630 gtk_widget_destroy(gtkwin->menu.send_as); | |
2631 | |
2632 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2633 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2634 /* Now make sure we don't have any Offline entries. */ |
2635 gboolean found_offline = FALSE; | |
2636 | |
2637 for (convs = gaim_get_conversations(); | |
2638 convs != NULL; | |
2639 convs = convs->next) { | |
2640 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2641 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2642 GaimAccount *account; |
4491 | 2643 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2644 conv = (GaimConversation *)convs->data; |
4491 | 2645 account = gaim_conversation_get_account(conv); |
2646 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2647 if (account != NULL && account->gc == NULL) { |
4359 | 2648 found_offline = TRUE; |
2649 break; | |
2650 } | |
2651 } | |
2652 | |
2653 if (!found_offline) { | |
2654 gtkwin->menu.send_as = NULL; | |
2655 return; | |
2656 } | |
2657 } | |
2658 | |
2659 /* Build the Send As menu */ | |
2660 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2661 gtk_widget_show(gtkwin->menu.send_as); | |
2662 | |
2663 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2664 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2665 gtkwin->menu.send_as, 2); |
4359 | 2666 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2667 | |
2668 gtk_widget_show(menu); | |
2669 | |
2670 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2671 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2672 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2673 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2674 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2675 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2676 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2677 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2678 GdkPixbuf *pixbuf, *scale; |
4359 | 2679 |
2680 found_online = TRUE; | |
2681 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2682 gc = (GaimConnection *)gcs->data; |
4359 | 2683 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2684 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2685 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2686 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
|
2687 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2688 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2689 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2690 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2691 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2692 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2693 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2694 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2695 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2696 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2697 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2698 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2699 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2700 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2701 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2702 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2703 gaim_account_get_username(account)); |
4793 | 2704 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2705 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2706 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2707 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2708 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2709 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2710 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2711 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2712 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2713 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2714 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2715 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2716 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2717 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2718 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2719 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2720 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2721 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2722 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2723 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2724 /* Set our data and callbacks. */ |
4359 | 2725 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2726 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2727 |
4786 | 2728 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2729 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2730 |
2731 gtk_widget_show(menuitem); | |
2732 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2733 } | |
2734 | |
2735 /* | |
2736 * Fill it with any accounts that still has an open (yet disabled) window | |
2737 * (signed off accounts with a window open). | |
2738 */ | |
2739 for (convs = gaim_get_conversations(); | |
2740 convs != NULL; | |
2741 convs = convs->next) { | |
2742 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2743 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2744 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2745 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2746 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2747 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2748 GdkPixbuf *pixbuf, *scale; |
4359 | 2749 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2750 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2751 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2752 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2753 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2754 |
4491 | 2755 account = gaim_conversation_get_account(conv); |
2756 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2757 if (account != NULL && account->gc == NULL) { |
4359 | 2758 if (first_offline && found_online) { |
2759 menuitem = gtk_separator_menu_item_new(); | |
2760 gtk_widget_show(menuitem); | |
2761 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2762 | |
2763 first_offline = FALSE; | |
2764 } | |
2765 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2766 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2767 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2768 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2769 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2770 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2771 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2772 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2773 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2774 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2775 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2776 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2777 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2778 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2779 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2780 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2781 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2782 /* Make our menu item */ |
4359 | 2783 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2784 account->username); |
4793 | 2785 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2786 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2787 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2788 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2789 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2790 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2791 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2792 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2793 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2794 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2795 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2796 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2797 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2798 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2799 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2800 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2801 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2802 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2803 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2804 |
4359 | 2805 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2806 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2807 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2808 |
4786 | 2809 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2810 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2811 |
4359 | 2812 gtk_widget_show(menuitem); |
2813 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2814 } | |
2815 } | |
2816 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2817 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2818 |
4359 | 2819 gtk_widget_show(gtkwin->menu.send_as); |
2820 update_send_as_selection(win); | |
2821 } | |
2822 | |
2823 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2824 generate_invite_user_names(GaimConnection *gc) |
4359 | 2825 { |
6695 | 2826 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2827 static GList *tmp = NULL; |
2828 | |
2829 if (tmp) | |
2830 g_list_free(tmp); | |
2831 | |
2832 tmp = g_list_append(NULL, ""); | |
2833 | |
2834 if (gc != NULL) { | |
4785 | 2835 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2836 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2837 continue; | |
6695 | 2838 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2839 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2840 continue; |
6695 | 2841 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2842 GaimBuddy *buddy; | |
2843 | |
2844 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2845 continue; | |
2846 | |
2847 buddy = (GaimBuddy *)bnode; | |
2848 | |
2849 if (buddy->account == gc->account && | |
2850 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2851 tmp = g_list_append(tmp, buddy->name); | |
2852 } | |
4359 | 2853 } |
2854 } | |
2855 } | |
2856 | |
2857 return tmp; | |
2858 } | |
2859 | |
2860 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2861 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2862 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2863 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2864 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2865 GaimConvChat *chat; |
4359 | 2866 GtkTreeIter iter; |
2867 GtkListStore *ls; | |
2868 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2869 chat = GAIM_CONV_CHAT(conv); |
4359 | 2870 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2871 gtkchat = gtkconv->u.chat; | |
2872 | |
2873 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2874 | |
2875 gtk_list_store_append(ls, &iter); | |
2876 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2877 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2878 1, name, -1); |
2879 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2880 GTK_SORT_ASCENDING); | |
2881 } | |
2882 | |
2883 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2884 tab_complete(GaimConversation *conv) |
4359 | 2885 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2886 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2887 GaimConvChat *chat; |
4359 | 2888 GtkTextIter cursor, word_start, start_buffer; |
2889 int start; | |
2890 int most_matched = -1; | |
2891 char *entered, *partial = NULL; | |
2892 char *text; | |
8021 | 2893 char *nick_partial; |
4359 | 2894 GList *matches = NULL; |
2895 GList *nicks = NULL; | |
2896 | |
2897 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2898 chat = GAIM_CONV_CHAT(conv); |
4359 | 2899 |
2900 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2901 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2902 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2903 | |
2904 word_start = cursor; | |
2905 | |
2906 /* if there's nothing there just return */ | |
2907 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2908 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2909 |
4359 | 2910 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2911 &cursor, FALSE); | |
2912 | |
2913 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2914 start = strlen(text) - 1; | |
2915 | |
8021 | 2916 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 2917 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 2918 start-=2; |
2919 } | |
4359 | 2920 |
2921 /* find the start of the word that we're tabbing */ | |
2922 while (start >= 0 && text[start] != ' ') { | |
2923 gtk_text_iter_backward_char(&word_start); | |
2924 start--; | |
2925 } | |
2926 | |
2927 g_free(text); | |
2928 | |
2929 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2930 &cursor, FALSE); | |
2931 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2932 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2933 if (strlen(entered) >= 2 && |
2934 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2935 | |
2936 entered[strlen(entered) - 2] = 0; | |
2937 } | |
2938 } | |
2939 | |
8021 | 2940 if (!g_utf8_strlen(entered, -1)) { |
4359 | 2941 g_free(entered); |
2942 return; | |
2943 } | |
2944 | |
8021 | 2945 nick_partial = g_malloc(strlen(entered)+1); |
2946 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2947 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 2948 nicks != NULL; |
2949 nicks = nicks->next) { | |
2950 | |
2951 char *nick = nicks->data; | |
8021 | 2952 |
8159 | 2953 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 2954 nick_partial[strlen(entered)] = '\0'; |
8021 | 2955 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
2956 continue; | |
4359 | 2957 |
2958 /* if we're here, it's a possible completion */ | |
2959 | |
2960 /* if we're doing old-style, just fill in the completion */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2961 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2962 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2963 &word_start, &cursor); | |
2964 | |
2965 if (strlen(nick) == strlen(entered)) { | |
2966 nicks = (nicks->next | |
2967 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2968 : gaim_conv_chat_get_users(chat)); |
4359 | 2969 |
2970 nick = nicks->data; | |
2971 } | |
2972 | |
2973 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2974 &start_buffer); | |
2975 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2976 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2977 | |
2978 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2979 char *tmp = g_strdup_printf("%s: ", nick); | |
2980 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2981 tmp, -1); | |
2982 g_free(tmp); | |
2983 } | |
2984 else | |
2985 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2986 nick, -1); | |
2987 | |
8021 | 2988 g_free(nick_partial); |
4359 | 2989 g_free(entered); |
2990 | |
2991 return; | |
2992 } | |
2993 | |
2994 /* we're only here if we're doing new style */ | |
2995 if (most_matched == -1) { | |
2996 /* | |
2997 * this will only get called once, since from now | |
2998 * on most_matched is >= 0 | |
2999 */ | |
3000 most_matched = strlen(nick); | |
3001 partial = g_strdup(nick); | |
3002 } | |
3003 else if (most_matched) { | |
8021 | 3004 char *tmp = g_strdup(nick); |
3005 | |
3006 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3007 partial[most_matched] = '\0'; | |
3008 if(most_matched < strlen(tmp)) | |
3009 tmp[most_matched] = '\0'; | |
4359 | 3010 most_matched--; |
8021 | 3011 } |
8079 | 3012 most_matched++; |
8021 | 3013 |
3014 g_free(tmp); | |
4359 | 3015 } |
3016 | |
3017 matches = g_list_append(matches, nick); | |
3018 } | |
3019 | |
8021 | 3020 g_free(nick_partial); |
3021 | |
4359 | 3022 /* we're only here if we're doing new style */ |
3023 | |
3024 /* if there weren't any matches, return */ | |
3025 if (!matches) { | |
3026 /* if matches isn't set partials won't be either */ | |
3027 g_free(entered); | |
3028 return; | |
3029 } | |
3030 | |
3031 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3032 | |
3033 if (!matches->next) { | |
3034 /* there was only one match. fill it in. */ | |
3035 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3036 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3037 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3038 | |
3039 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3040 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3041 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3042 g_free(tmp); | |
3043 } | |
3044 else | |
3045 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3046 matches->data, -1); | |
3047 | |
3048 matches = g_list_remove(matches, matches->data); | |
3049 } | |
3050 else { | |
3051 /* | |
3052 * there were lots of matches, fill in as much as possible | |
3053 * and display all of them | |
3054 */ | |
3055 char *addthis = g_malloc0(1); | |
3056 | |
3057 while (matches) { | |
3058 char *tmp = addthis; | |
3059 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3060 g_free(tmp); | |
3061 matches = g_list_remove(matches, matches->data); | |
3062 } | |
3063 | |
6982 | 3064 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3065 time(NULL)); |
3066 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3067 g_free(addthis); | |
3068 } | |
3069 | |
3070 g_free(entered); | |
3071 g_free(partial); | |
3072 } | |
3073 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3074 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3075 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3076 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3077 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3078 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3079 |
7859 | 3080 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3081 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3082 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", |
7261 | 3083 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3084 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3085 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
|
3086 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3087 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3088 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3089 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
|
3090 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3091 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3092 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3093 |
4359 | 3094 static GtkItemFactoryEntry menu_items[] = |
3095 { | |
3096 /* Conversation menu */ | |
4596 | 3097 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3098 |
7887 | 3099 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3100 0, "<StockItem>", GAIM_STOCK_IM }, |
3101 | |
3102 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3103 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3104 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3105 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3106 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3107 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3108 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3109 |
4359 | 3110 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3111 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3112 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3113 0, NULL }, |
7859 | 3114 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3115 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3116 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3117 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3118 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3119 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3120 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3121 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3122 |
7859 | 3123 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3124 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3125 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3126 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3127 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3128 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3129 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3130 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3131 |
7859 | 3132 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3133 | |
8330
80915fd16349
[gaim-migrate @ 9054]
Christian Hammond <chipx86@chipx86.com>
parents:
8329
diff
changeset
|
3134 { N_("/Conversation/Insert Lin_k..."), NULL, NULL, 0, /* menu_insert_link_cb, 0, */ |
7859 | 3135 "<StockItem>", GAIM_STOCK_LINK }, |
8330
80915fd16349
[gaim-migrate @ 9054]
Christian Hammond <chipx86@chipx86.com>
parents:
8329
diff
changeset
|
3136 { N_("/Conversation/Insert Imag_e..."), NULL, NULL, 0, /* menu_insert_image_cb, 0, */ |
7859 | 3137 "<StockItem>", GAIM_STOCK_IMAGE }, |
3138 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3139 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3140 |
4596 | 3141 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3142 "<StockItem>", GTK_STOCK_CLOSE }, |
3143 | |
3144 /* Options */ | |
4596 | 3145 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3146 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3147 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3148 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 3149 }; |
3150 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3151 static const int menu_item_count = |
4359 | 3152 sizeof(menu_items) / sizeof(*menu_items); |
3153 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3154 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3155 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3156 { |
7386 | 3157 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3158 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3159 |
4359 | 3160 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3161 setup_menubar(GaimConvWindow *win) |
4359 | 3162 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3163 GaimGtkWindow *gtkwin; |
5116 | 3164 GtkAccelGroup *accel_group; |
4359 | 3165 gtkwin = GAIM_GTK_WINDOW(win); |
3166 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3167 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3168 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3169 g_object_unref (accel_group); |
5116 | 3170 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3171 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3172 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3173 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3174 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3175 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3176 NULL, NULL); |
4630 | 3177 |
3178 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3179 menu_items, win); |
7420 | 3180 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3181 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3182 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3183 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3184 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3185 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3186 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3187 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3188 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3189 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3190 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3191 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3192 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3193 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3194 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3195 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3196 |
7879 | 3197 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3198 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3199 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3200 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3201 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3202 |
7879 | 3203 gtkwin->menu.warn = |
3204 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3205 N_("/Conversation/Warn...")); | |
3206 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3207 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3208 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3209 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3210 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3211 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3212 |
7879 | 3213 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3214 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3215 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3216 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3217 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3218 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3219 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3220 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3221 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3222 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3223 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3224 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3225 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3226 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3227 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3228 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3229 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3230 |
7879 | 3231 gtkwin->menu.insert_link = |
3232 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3233 N_("/Conversation/Insert Link...")); | |
3234 | |
3235 gtkwin->menu.insert_image = | |
3236 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3237 N_("/Conversation/Insert Image...")); | |
3238 | |
3239 /* --- */ | |
3240 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3241 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3242 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3243 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3244 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3245 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3246 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3247 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3248 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3249 N_("/Options/Show Formatting Toolbar")); |
4359 | 3250 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3251 generate_send_as_items(win, NULL); |
4359 | 3252 |
3253 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3254 |
3255 return gtkwin->menu.menubar; | |
4359 | 3256 } |
3257 | |
3258 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3259 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3260 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3261 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3262 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3263 GaimGtkImPane *gtkim; |
4359 | 3264 |
3265 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3266 gtkim = gtkconv->u.im; | |
3267 gc = gaim_conversation_get_gc(conv); | |
3268 | |
3269 /* From right to left... */ | |
3270 | |
3271 /* Send button */ | |
3272 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3273 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3274 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3275 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3276 | |
3277 /* Separator */ | |
3278 if (gtkim->sep2 != NULL) | |
3279 gtk_widget_destroy(gtkim->sep2); | |
3280 | |
3281 gtkim->sep2 = gtk_vseparator_new(); | |
3282 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3283 gtk_widget_show(gtkim->sep2); | |
3284 | |
3285 /* Now, um, just kind of all over the place. Huh? */ | |
3286 | |
3287 /* Warn button */ | |
3288 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3289 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3290 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3291 _("Warn the user"), NULL); |
7929 | 3292 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3293 | |
3294 /* Block button */ | |
3295 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3296 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3297 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3298 _("Block the user"), NULL); | |
3299 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3300 | |
3301 /* Add button */ | |
3302 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3303 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3304 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3305 _("Add the user to your buddy list"), NULL); | |
3306 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3307 | |
3308 /* Remove button */ | |
3309 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3310 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3311 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3312 _("Remove the user from your buddy list"), NULL); | |
3313 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3314 |
3315 /* Info button */ | |
3316 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3317 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3318 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3319 _("Get the user's information"), NULL); |
7929 | 3320 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3321 | |
3322 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3323 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3324 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3325 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3326 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3327 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3328 |
3329 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3330 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3331 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3332 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3333 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3334 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3335 |
3336 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3337 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3338 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3339 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3340 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3341 |
3342 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3343 | |
3344 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3345 G_CALLBACK(warn_cb), conv); | |
3346 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3347 G_CALLBACK(block_cb), conv); | |
7929 | 3348 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3349 G_CALLBACK(add_remove_cb), conv); | |
3350 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3351 G_CALLBACK(add_remove_cb), conv); | |
3352 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3353 G_CALLBACK(info_cb), conv); | |
3354 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3355 G_CALLBACK(send_cb), conv); | |
4359 | 3356 } |
3357 | |
3358 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3359 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3360 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3361 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3362 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3363 GaimGtkChatPane *gtkchat; |
4359 | 3364 |
3365 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3366 gtkchat = gtkconv->u.chat; | |
3367 gc = gaim_conversation_get_gc(conv); | |
3368 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3369 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3370 |
4359 | 3371 /* Send button */ |
3372 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3373 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3374 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3375 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3376 | |
3377 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3378 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3379 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3380 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3381 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3382 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
|
3383 gtk_widget_show(gtkchat->sep); |
4359 | 3384 |
3385 /* Invite */ | |
3386 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3387 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3388 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3389 _("Invite a user"), NULL); | |
7931 | 3390 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3391 |
7929 | 3392 /* Add button */ |
3393 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3394 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3395 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3396 _("Add the chat to your buddy list"), NULL); | |
3397 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3398 | |
3399 /* Remove button */ | |
3400 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3401 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3402 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3403 _("Remove the chat from your buddy list"), NULL); | |
3404 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3405 | |
4359 | 3406 /* Set the relief on these. */ |
3407 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3408 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3409 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3410 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3411 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3412 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3413 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3414 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3415 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3416 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3417 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3418 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3419 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3420 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3421 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3422 |
4359 | 3423 /* Callbacks */ |
7929 | 3424 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3425 G_CALLBACK(invite_cb), conv); | |
3426 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3427 G_CALLBACK(add_remove_cb), conv); | |
3428 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3429 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3430 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3431 G_CALLBACK(send_cb), conv); | |
3432 } | |
3433 | |
3434 | |
7971 | 3435 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3436 { | |
3437 GaimPluginProtocolInfo *prpl_info = NULL; | |
3438 GaimConnection *gc; | |
3439 GaimGtkConversation *gtkconv; | |
3440 GaimGtkChatPane *gtkchat; | |
3441 const char *topic; | |
3442 | |
3443 gc = gaim_conversation_get_gc(conv); | |
3444 | |
3445 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3446 return; | |
3447 | |
3448 if(prpl_info->set_chat_topic == NULL) | |
3449 return; | |
3450 | |
3451 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3452 gtkchat = gtkconv->u.chat; | |
3453 topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); | |
3454 | |
3455 if(!g_utf8_collate(topic, gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)))) | |
3456 return; | |
3457 | |
3458 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), topic); | |
3459 } | |
3460 | |
4359 | 3461 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3462 setup_chat_pane(GaimConversation *conv) |
4359 | 3463 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3464 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3465 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3466 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3467 GaimConnection *gc; |
4359 | 3468 GtkWidget *vpaned, *hpaned; |
3469 GtkWidget *vbox, *hbox; | |
3470 GtkWidget *lbox, *bbox; | |
3471 GtkWidget *label; | |
3472 GtkWidget *list; | |
3473 GtkWidget *button; | |
7949 | 3474 GtkWidget *sw; |
4359 | 3475 GtkListStore *ls; |
3476 GtkCellRenderer *rend; | |
3477 GtkTreeViewColumn *col; | |
8143 | 3478 GList *focus_chain; |
4359 | 3479 |
3480 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3481 gtkchat = gtkconv->u.chat; | |
3482 gc = gaim_conversation_get_gc(conv); | |
3483 | |
3484 /* Setup the outer pane. */ | |
3485 vpaned = gtk_vpaned_new(); | |
3486 gtk_widget_show(vpaned); | |
3487 | |
3488 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3489 vbox = gtk_vbox_new(FALSE, 6); |
4359 | 3490 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); |
3491 gtk_widget_show(vbox); | |
3492 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3493 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3494 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3495 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3496 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3497 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3498 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3499 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3500 gtk_widget_show(hbox); |
3501 | |
3502 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3503 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3504 gtk_widget_show(label); |
3505 | |
3506 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3507 |
7971 | 3508 if(prpl_info->set_chat_topic == NULL) { |
3509 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3510 } else { | |
3511 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3512 G_CALLBACK(topic_callback), conv); | |
3513 } | |
3514 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3515 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3516 gtk_widget_show(gtkchat->topic_text); |
3517 } | |
3518 | |
3519 /* Setup the horizontal pane. */ | |
3520 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3521 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3522 gtk_widget_show(hpaned); |
3523 | |
3524 /* Setup the scrolled window to put gtkimhtml in. */ | |
3525 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3526 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3527 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3528 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3529 GTK_SHADOW_IN); | |
3530 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3531 | |
3532 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3533 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3534 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3535 |
4359 | 3536 gtk_widget_show(gtkconv->sw); |
3537 | |
3538 /* Setup gtkihmtml. */ | |
3539 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3540 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3541 | |
3542 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3543 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3544 |
3545 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3546 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3547 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3548 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3549 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3550 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3551 |
3552 gaim_setup_imhtml(gtkconv->imhtml); | |
3553 | |
3554 gtk_widget_show(gtkconv->imhtml); | |
3555 | |
3556 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3557 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3558 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3559 gtk_widget_show(lbox); |
3560 | |
3561 /* Setup the label telling how many people are in the room. */ | |
3562 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3563 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3564 gtk_widget_show(gtkchat->count); | |
3565 | |
3566 /* Setup the list of users. */ | |
7949 | 3567 sw = gtk_scrolled_window_new(NULL, NULL); |
3568 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3569 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3570 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3571 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3572 gtk_widget_show(sw); | |
4359 | 3573 |
3574 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3575 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3576 GTK_SORT_ASCENDING); | |
3577 | |
3578 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3579 | |
3580 rend = gtk_cell_renderer_text_new(); | |
3581 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3582 "text", 0, NULL); | |
3583 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3584 | |
3585 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3586 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3587 g_signal_connect(G_OBJECT(list), "popup-menu", |
3588 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3589 |
3590 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3591 | |
3592 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3593 "text", 1, NULL); | |
3594 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3595 | |
3596 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3597 | |
3598 gtk_widget_set_size_request(list, 150, -1); | |
3599 | |
3600 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3601 gtk_widget_show(list); | |
3602 | |
3603 gtkchat->list = list; | |
3604 | |
7949 | 3605 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3606 |
3607 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3608 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 3609 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3610 gtk_widget_show(bbox); | |
3611 | |
3612 /* IM */ | |
3613 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3614 GAIM_BUTTON_VERTICAL); | |
3615 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3616 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
|
3617 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3618 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3619 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3620 |
3621 gtk_widget_show(button); | |
3622 | |
3623 /* Ignore */ | |
3624 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3625 GAIM_BUTTON_VERTICAL); | |
3626 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3627 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
|
3628 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3629 _("Ignore the user"), NULL); |
4359 | 3630 g_signal_connect(G_OBJECT(button), "clicked", |
3631 G_CALLBACK(ignore_cb), conv); | |
3632 gtk_widget_show(button); | |
3633 | |
3634 /* Info */ | |
3635 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3636 GAIM_BUTTON_VERTICAL); | |
3637 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3638 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3639 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3640 _("Get the user's information"), NULL); |
4359 | 3641 g_signal_connect(G_OBJECT(button), "clicked", |
3642 G_CALLBACK(info_cb), conv); | |
3643 | |
3644 gtk_widget_show(button); | |
3645 | |
3646 gtkconv->info = button; | |
3647 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3648 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3649 vbox = gtk_vbox_new(FALSE, 6); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3650 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3651 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3652 |
8317 | 3653 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3654 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
|
3655 |
8123 | 3656 /* Setup the entry widget. |
3657 * We never show the horizontal scrollbar because it was causing weird | |
3658 * lockups when typing text just as you type the character that would | |
3659 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
3660 */ | |
7949 | 3661 sw = gtk_scrolled_window_new(NULL, NULL); |
3662 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3663 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3664 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3665 GTK_SHADOW_IN); | |
7949 | 3666 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
3667 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3668 |
8061 | 3669 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3670 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3671 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3672 gaim_setup_imhtml(gtkconv->entry); |
3673 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
3674 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3675 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3676 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3677 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3678 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 3679 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3680 | |
3681 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 3682 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3683 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3684 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3685 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3686 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3687 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3688 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3689 gtkconv->entry); |
4359 | 3690 |
7949 | 3691 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3692 gtk_widget_show(gtkconv->entry); |
3693 | |
3694 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3695 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3696 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
3697 gtk_widget_show(gtkconv->bbox); | |
3698 | |
3699 setup_chat_buttons(conv, gtkconv->bbox); | |
3700 | |
8143 | 3701 focus_chain = g_list_prepend (NULL, sw); |
3702 gtk_container_set_focus_chain (GTK_CONTAINER(vbox), focus_chain); | |
4359 | 3703 return vpaned; |
3704 } | |
3705 | |
3706 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3707 setup_im_pane(GaimConversation *conv) |
4359 | 3708 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3709 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3710 GaimGtkImPane *gtkim; |
4359 | 3711 GtkWidget *paned; |
3712 GtkWidget *vbox; | |
3713 GtkWidget *vbox2; | |
7949 | 3714 GtkWidget *sw; |
8143 | 3715 GList *focus_chain; |
4359 | 3716 |
3717 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3718 gtkim = gtkconv->u.im; | |
3719 | |
3720 /* Setup the outer pane. */ | |
3721 paned = gtk_vpaned_new(); | |
3722 gtk_widget_show(paned); | |
3723 | |
3724 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3725 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3726 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3727 gtk_widget_show(vbox); |
3728 | |
3729 /* Setup the gtkimhtml widget. */ | |
3730 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3731 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3732 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3733 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3734 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3735 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3736 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3737 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3738 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3739 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3740 gtk_widget_show(gtkconv->sw); |
3741 | |
3742 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3743 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3744 | |
3745 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3746 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3747 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3748 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3749 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3750 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3751 |
3752 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3753 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3754 |
3755 gaim_setup_imhtml(gtkconv->imhtml); | |
3756 gtk_widget_show(gtkconv->imhtml); | |
3757 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3758 vbox2 = gtk_vbox_new(FALSE, 6); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3759 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3760 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3761 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3762 /* Build the toolbar. */ |
8317 | 3763 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3764 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
|
3765 |
8123 | 3766 /* Setup the entry widget. |
3767 * 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
|
3768 * lockups when typing text just as you type the character that would |
8123 | 3769 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
3770 */ | |
7949 | 3771 sw = gtk_scrolled_window_new(NULL, NULL); |
3772 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3773 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3774 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3775 GTK_SHADOW_IN); | |
7949 | 3776 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
3777 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3778 |
8061 | 3779 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3780 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3781 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3782 gaim_setup_imhtml(gtkconv->entry); |
3783 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
3784 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3785 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3786 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3787 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3788 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 3789 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
|
3790 |
4359 | 3791 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 3792 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 3793 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3794 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3795 | |
3796 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3797 G_CALLBACK(insert_text_cb), conv); | |
3798 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3799 G_CALLBACK(delete_text_cb), conv); | |
3800 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3801 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3802 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3803 |
7949 | 3804 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3805 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3806 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
3807 gtkconv->entry); |
4359 | 3808 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3809 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 3810 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
3811 gtk_widget_show(gtkconv->bbox); | |
3812 | |
3813 setup_im_buttons(conv, gtkconv->bbox); | |
3814 | |
8143 | 3815 focus_chain = g_list_prepend (NULL, sw); |
3816 gtk_container_set_focus_chain (GTK_CONTAINER(vbox2), focus_chain); | |
3817 | |
4359 | 3818 return paned; |
3819 } | |
3820 | |
3821 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3822 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
|
3823 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3824 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3825 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3826 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3827 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3828 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3829 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3830 { |
4781 | 3831 GaimBlistNode *n = NULL; |
6695 | 3832 GaimBuddy *b; |
4781 | 3833 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3834 |
6695 | 3835 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3836 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3837 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3838 b = (GaimBuddy*)n; | |
3839 else | |
4781 | 3840 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3841 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3842 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
|
3843 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3844 gaim_conv_window_add_conversation(win, c); |
4702 | 3845 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3846 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
|
3847 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3848 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3849 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3850 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3851 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3852 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3853 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3854 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3855 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3856 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3857 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3858 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3859 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3860 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3861 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3862 { |
7718 | 3863 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
3864 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3865 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3866 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3867 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3868 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3869 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3870 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3871 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3872 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3873 } |
4359 | 3874 |
3875 /************************************************************************** | |
3876 * GTK+ window ops | |
3877 **************************************************************************/ | |
3878 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3879 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 3880 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3881 GaimGtkWindow *gtkwin; |
4359 | 3882 GtkPositionType pos; |
3883 GtkWidget *testidea; | |
3884 GtkWidget *menubar; | |
3885 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3886 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3887 |
3888 win->ui_data = gtkwin; | |
3889 | |
3890 /* Create the window. */ | |
3891 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3892 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3893 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3894 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3895 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3896 gtk_widget_realize(gtkwin->window); |
3897 | |
3898 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3899 G_CALLBACK(close_win_cb), win); | |
3900 | |
3901 /* Create the notebook. */ | |
3902 gtkwin->notebook = gtk_notebook_new(); | |
3903 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3904 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3905 |
3906 #if 0 | |
3907 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3908 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3909 #endif | |
3910 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3911 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3912 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3913 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3914 | |
4359 | 3915 gtk_widget_show(gtkwin->notebook); |
3916 | |
8189 | 3917 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
3918 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 3919 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
3920 G_CALLBACK(switch_conv_cb), win); | |
3921 | |
3922 /* Setup the tab drag and drop signals. */ | |
4486 | 3923 gtk_widget_add_events(gtkwin->notebook, |
3924 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3925 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3926 G_CALLBACK(notebook_press_cb), win); |
4486 | 3927 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3928 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3929 |
4359 | 3930 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3931 |
4359 | 3932 /* Setup the menubar. */ |
3933 menubar = setup_menubar(win); | |
3934 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3935 | |
3936 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
3937 | |
3938 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
3939 | |
3940 gtk_widget_show(testidea); | |
3941 } | |
3942 | |
3943 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3944 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 3945 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3946 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3947 |
3948 gtk_widget_destroy(gtkwin->window); | |
3949 | |
4630 | 3950 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
3951 | |
4359 | 3952 g_free(gtkwin); |
3953 win->ui_data = NULL; | |
3954 } | |
3955 | |
3956 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3957 gaim_gtk_show(GaimConvWindow *win) |
4359 | 3958 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3959 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3960 |
3961 gtk_widget_show(gtkwin->window); | |
7413 | 3962 |
3963 #ifdef _WIN32 | |
7415 | 3964 /* This works around a win32 gtk+ bug, where it can't handle |
3965 * creating the button correctly before the window is shown. | |
3966 * That's why we get the appearance of a button, without all | |
3967 * the normal button-like properties, like being able to click | |
7413 | 3968 * it. ;-) --Nathan */ |
7414 | 3969 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
3970 GaimConversation *conv; | |
3971 GaimGtkConversation *gtkconv; | |
3972 | |
3973 conv = gaim_conv_window_get_conversation_at(win, 0); | |
3974 if(conv) { | |
3975 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 3976 gtk_widget_hide(gtkconv->close); |
7414 | 3977 gtk_widget_show_all(gtkconv->close); |
3978 } | |
3979 } | |
7413 | 3980 #endif |
4359 | 3981 } |
3982 | |
3983 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3984 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 3985 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3986 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3987 |
3988 gtk_widget_hide(gtkwin->window); | |
3989 } | |
3990 | |
3991 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3992 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 3993 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3994 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3995 |
5484 | 3996 gtk_widget_show(gtkwin->window); |
5103 | 3997 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 3998 gdk_window_raise(gtkwin->window->window); |
4359 | 3999 } |
4000 | |
4001 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4002 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4003 { |
4004 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4005 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4006 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4007 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4008 #endif |
4009 } | |
4010 | |
4011 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4012 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4013 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4014 GaimGtkWindow *gtkwin; |
4359 | 4015 |
4016 gtkwin = GAIM_GTK_WINDOW(win); | |
4017 | |
4018 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4019 } | |
4020 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4021 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4022 { |
7695 | 4023 {"text/plain", 0, 0}, |
4024 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4025 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4026 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4027 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4028 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4029 |
4359 | 4030 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4031 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4032 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4033 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4034 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4035 GaimConversation *focus_conv; |
4359 | 4036 GtkWidget *pane = NULL; |
4037 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4038 GtkWidget *tabby, *menu_tabby; |
4359 | 4039 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4040 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4041 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4042 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4043 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4044 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4045 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4046 |
4047 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4048 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4049 |
4050 tab_cont = gtkconv->tab_cont; | |
4051 | |
4052 new_ui = FALSE; | |
4053 } | |
4054 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4055 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4056 conv->ui_data = gtkconv; |
4057 | |
4058 /* Setup some initial variables. */ | |
4059 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4060 gtkconv->tooltips = gtk_tooltips_new(); | |
4061 | |
4421 | 4062 /* Setup the foreground and background colors */ |
4063 gaim_gtkconv_update_font_colors(conv); | |
4064 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4065 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4066 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4067 |
7879 | 4068 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4069 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4070 gtkconv->u.im->a_virgin = TRUE; |
4071 | |
4072 pane = setup_im_pane(conv); | |
4073 } | |
7879 | 4074 else if (conv_type == GAIM_CONV_CHAT) { |
4075 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4076 | |
4077 pane = setup_chat_pane(conv); | |
4078 } | |
4359 | 4079 |
4080 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4081 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4082 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4083 |
4084 g_free(gtkconv); | |
4085 conv->ui_data = NULL; | |
4086 | |
4087 return; | |
4088 } | |
4089 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4090 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4091 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4092 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4093 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4094 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4095 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4096 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4097 GTK_DEST_DEFAULT_MOTION | |
4702 | 4098 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4099 te, sizeof(te) / sizeof(GtkTargetEntry), |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4100 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4101 GDK_ACTION_MOVE); |
7695 | 4102 gtk_drag_dest_set(gtkconv->entry, |
4103 GTK_DEST_DEFAULT_MOTION | | |
4104 GTK_DEST_DEFAULT_DROP, | |
4105 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4106 GDK_ACTION_COPY); | |
4107 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4108 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4109 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4110 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4111 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4112 #if 0 |
4113 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", | |
4114 G_CALLBACK(conv_dnd_recv), conv); | |
4115 #endif | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4116 |
4359 | 4117 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4118 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4119 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4120 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4121 gtk_widget_show(pane); | |
4122 | |
4123 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4124 |
4359 | 4125 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4126 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4127 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4128 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4129 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4130 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4131 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4132 |
8176 | 4133 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
4134 G_CALLBACK(gtk_widget_grab_focus), | |
4135 gtkconv->entry); | |
4359 | 4136 } |
4137 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4138 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4139 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4140 |
4141 /* Close button. */ | |
4142 gtkconv->close = gtk_button_new(); | |
4143 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
|
4144 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4145 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4146 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4147 GTK_ICON_SIZE_MENU)); | |
4359 | 4148 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4149 _("Close conversation"), NULL); |
4359 | 4150 |
4151 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4152 G_CALLBACK(close_conv_cb), conv); |
4359 | 4153 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4154 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4155 * 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
|
4156 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4157 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4158 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4159 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4160 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4161 /* Status icon. */ |
6440 | 4162 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4163 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4164 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4165 |
4359 | 4166 /* Tab label. */ |
4167 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
|
4168 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4169 #if 0 |
4170 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4171 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4172 #endif | |
4173 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4174 |
4359 | 4175 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4176 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
|
4177 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4178 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4179 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4180 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4181 { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4182 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4183 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4184 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4185 |
4359 | 4186 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
|
4187 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4188 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4189 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4190 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
|
4191 |
4445 | 4192 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
|
4193 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4194 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4195 |
4445 | 4196 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4197 gtk_widget_show(menu_tabby); |
4359 | 4198 |
7143 | 4199 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4200 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4201 |
4359 | 4202 /* Add this pane to the conversations notebook. */ |
4203 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
|
4204 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4205 tab_cont, menu_tabby); |
4359 | 4206 |
4207 gtk_widget_show(tab_cont); | |
4208 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4209 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4210 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4211 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4212 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4213 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4214 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4215 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4216 else |
4818 | 4217 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4218 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4219 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4220 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4221 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4222 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4223 |
4224 if (!new_ui) | |
4225 g_object_unref(gtkconv->tab_cont); | |
4226 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4227 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4228 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4229 } |
4230 | |
4231 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4232 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4233 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4234 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4235 GaimGtkConversation *gtkconv; |
4359 | 4236 unsigned int index; |
4818 | 4237 GaimConversationType conv_type; |
4238 | |
4239 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4240 index = gaim_conversation_get_index(conv); |
4241 | |
4242 gtkwin = GAIM_GTK_WINDOW(win); | |
4243 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4244 | |
4245 g_object_ref(gtkconv->tab_cont); | |
4246 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4247 | |
4248 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4249 | |
4818 | 4250 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4251 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4252 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4253 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4254 } |
4255 | |
4256 | |
4359 | 4257 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4258 if (conv_type == GAIM_CONV_IM && |
4359 | 4259 gaim_conversation_get_gc(conv) == NULL) { |
4260 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4261 generate_send_as_items(win, conv); |
4359 | 4262 } |
4263 } | |
4264 | |
4265 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4266 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4267 unsigned int new_index) |
4268 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4269 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4270 GaimGtkConversation *gtkconv; |
4359 | 4271 |
4272 gtkwin = GAIM_GTK_WINDOW(win); | |
4273 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4274 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4275 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4276 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4277 |
4359 | 4278 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4279 gtkconv->tab_cont, new_index); | |
4280 } | |
4281 | |
4282 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4283 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4284 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4285 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4286 int index; |
4359 | 4287 |
4288 gtkwin = GAIM_GTK_WINDOW(win); | |
4289 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4290 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4291 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4292 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4293 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4294 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4295 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4296 return (index == -1 ? 0 : index); |
4359 | 4297 } |
4298 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4299 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4300 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4301 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4302 gaim_gtk_new_window, |
4303 gaim_gtk_destroy_window, | |
4304 gaim_gtk_show, | |
4305 gaim_gtk_hide, | |
4306 gaim_gtk_raise, | |
4307 gaim_gtk_flash, | |
4308 gaim_gtk_switch_conversation, | |
4309 gaim_gtk_add_conversation, | |
4310 gaim_gtk_remove_conversation, | |
4311 gaim_gtk_move_conversation, | |
4312 gaim_gtk_get_active_index | |
4313 }; | |
4314 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4315 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4316 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4317 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4318 return &window_ui_ops; |
4359 | 4319 } |
4320 | |
4321 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4322 * Conversation UI operations |
4359 | 4323 **************************************************************************/ |
4324 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4325 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4326 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4327 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4328 |
4329 if (gtkconv->dialogs.log != NULL) | |
4330 gtk_widget_destroy(gtkconv->dialogs.log); | |
4331 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4332 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4333 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4334 |
4359 | 4335 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4336 if (gtkconv->u.im->icon_timer != 0) |
4337 g_source_remove(gtkconv->u.im->icon_timer); | |
4338 | |
4359 | 4339 if (gtkconv->u.im->save_icon != NULL) |
4340 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4341 | |
4342 if (gtkconv->u.im->anim != NULL) | |
4793 | 4343 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4344 |
4345 g_free(gtkconv->u.im); | |
4346 } | |
4347 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4348 g_free(gtkconv->u.chat); | |
4349 } | |
4350 | |
4633 | 4351 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4352 | |
4359 | 4353 g_free(gtkconv); |
4354 } | |
4355 | |
4356 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4357 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4358 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4359 time_t mtime) |
4359 | 4360 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4361 GaimGtkConversation *gtkconv; |
4359 | 4362 |
4363 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4364 | |
6621 | 4365 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4366 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4367 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4368 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4369 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4370 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4371 /* Play a sound, if specified in prefs. */ |
4359 | 4372 if (gtkconv->make_sound) { |
6621 | 4373 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4374 if (gtkconv->u.im->a_virgin && |
5820 | 4375 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4376 |
4561 | 4377 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4378 } |
4379 else | |
4561 | 4380 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4381 } |
4382 else { | |
4561 | 4383 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4384 } |
4385 } | |
4386 | |
4387 gtkconv->u.im->a_virgin = FALSE; | |
4388 | |
6982 | 4389 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4390 } |
4391 | |
4392 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4393 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4394 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4395 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4396 GaimGtkConversation *gtkconv; |
4359 | 4397 |
4398 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4399 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4400 /* Play a sound, if specified in prefs. */ |
4359 | 4401 if (gtkconv->make_sound) { |
6621 | 4402 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4403 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4404 else if (flags & GAIM_MESSAGE_RECV) { |
4405 if ((flags & GAIM_MESSAGE_NICK) && | |
6102 | 4406 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4407 |
4561 | 4408 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4409 } |
4359 | 4410 else |
4561 | 4411 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4412 } |
4413 } | |
4414 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4415 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4416 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4417 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4418 /* Raise the window, if specified in prefs. */ |
6621 | 4419 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4420 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4421 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4422 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4423 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4424 |
6982 | 4425 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4426 } |
4427 | |
4428 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4429 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4430 const char *message, GaimMessageFlags flags, |
4359 | 4431 time_t mtime) |
4432 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4433 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4434 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4435 GaimConnection *gc; |
4359 | 4436 int gtk_font_options = 0; |
6982 | 4437 GSList *images = NULL; |
7440 | 4438 char buf[BUF_LONG]; |
4359 | 4439 char buf2[BUF_LONG]; |
4440 char mdate[64]; | |
4441 char color[10]; | |
4442 char *str; | |
4443 char *with_font_tag; | |
4896 | 4444 char *sml_attrib = NULL; |
6982 | 4445 size_t length = strlen(message) + 1; |
4895 | 4446 |
4359 | 4447 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4448 gc = gaim_conversation_get_gc(conv); | |
4449 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4450 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4451 |
6621 | 4452 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4453 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4454 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4455 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4456 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || | |
4457 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4458 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4459 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4460 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4461 |
7078 | 4462 if (flags & GAIM_MESSAGE_IMAGES) |
4463 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4464 |
5133 | 4465 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4466 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4467 else | |
4468 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4469 |
4896 | 4470 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4471 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4472 |
4359 | 4473 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4474 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4475 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4476 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4477 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4478 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4479 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4480 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4481 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4482 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4483 | |
7956 | 4484 /* this is gonna crash one day, I can feel it. */ |
4485 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4486 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4487 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4488 } |
4359 | 4489 |
6621 | 4490 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4491 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4492 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4493 mdate, message); |
4359 | 4494 else |
4495 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4496 |
4359 | 4497 g_snprintf(buf2, sizeof(buf2), |
8408 | 4498 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT><BR>", |
7850 | 4499 sml_attrib, mdate, message); |
7440 | 4500 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4501 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4502 buf2, 0, images); |
7440 | 4503 |
7583 | 4504 /* Add the message to a conversations scrollback buffer */ |
4505 conv->history = g_string_append(conv->history, buf); | |
4506 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4507 |
7431 | 4508 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4509 g_snprintf(buf, BUF_LONG, |
7850 | 4510 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B><BR>", |
4511 sml_attrib, message); | |
7440 | 4512 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4513 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4514 buf, 0, images); |
4359 | 4515 } |
4516 else { | |
4895 | 4517 char *new_message = g_memdup(message, length); |
7440 | 4518 |
6621 | 4519 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4520 str = g_malloc(1024); |
7440 | 4521 |
4359 | 4522 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4523 if (gaim_message_meify(new_message, length)) { |
4359 | 4524 g_snprintf(str, 1024, "***%s", who); |
4525 strcpy(color, "#6C2585"); | |
4526 } | |
4527 else { | |
4528 g_snprintf(str, 1024, "*%s*:", who); | |
4529 strcpy(color, "#00FF00"); | |
4530 } | |
7440 | 4531 } |
4359 | 4532 else { |
7564 | 4533 if (gaim_message_meify(new_message, length)) { |
4359 | 4534 str = g_malloc(1024); |
7440 | 4535 |
6621 | 4536 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4537 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
4538 else | |
4539 g_snprintf(str, 1024, "***%s", who); | |
7440 | 4540 |
6621 | 4541 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4542 strcpy(color, "#AF7F00"); |
4543 else | |
4544 strcpy(color, "#062585"); | |
4545 } | |
4546 else { | |
4547 str = g_malloc(1024); | |
6621 | 4548 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4549 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
4550 else | |
4551 g_snprintf(str, 1024, "%s:", who); | |
6621 | 4552 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4553 strcpy(color, "#AF7F00"); |
6621 | 4554 else if (flags & GAIM_MESSAGE_RECV) { |
4555 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4556 const char *u; |
4557 int m = 0; | |
7440 | 4558 |
4359 | 4559 for (u = who; *u != '\0'; u++) |
4560 m += *u; | |
7440 | 4561 |
4359 | 4562 m = m % NUM_NICK_COLORS; |
7440 | 4563 |
4359 | 4564 strcpy(color, nick_colors[m]); |
4565 } | |
4566 else | |
7854 | 4567 strcpy(color, RECV_COLOR); |
4359 | 4568 } |
6621 | 4569 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4570 strcpy(color, SEND_COLOR); |
4359 | 4571 } |
4572 } | |
7440 | 4573 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4574 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4575 g_snprintf(buf, BUF_LONG, |
8380 | 4576 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 4577 "<B>%s</B></FONT> ", color, |
4578 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4579 else |
4580 g_snprintf(buf, BUF_LONG, | |
7431 | 4581 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4582 sml_attrib ? sml_attrib : "", str); | |
7440 | 4583 |
4359 | 4584 g_snprintf(buf2, BUF_LONG, |
8380 | 4585 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 4586 "<B>%s</B></FONT> ", |
4587 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4588 |
4359 | 4589 g_free(str); |
4590 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4591 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4592 buf2, 0, images); |
4359 | 4593 |
4895 | 4594 if(gc){ |
4896 | 4595 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4596 char *post = "</font>"; |
4597 int pre_len = strlen(pre); | |
4598 int post_len = strlen(post); | |
7440 | 4599 |
4895 | 4600 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4601 |
4895 | 4602 strcpy(with_font_tag, pre); |
4603 memcpy(with_font_tag + pre_len, new_message, length); | |
4604 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4605 |
4895 | 4606 length += pre_len + post_len; |
4607 g_free(pre); | |
4608 } | |
4608 | 4609 else |
4895 | 4610 with_font_tag = g_memdup(new_message, length); |
7440 | 4611 |
7589 | 4612 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4613 with_font_tag, gtk_font_options, images); |
7440 | 4614 |
6982 | 4615 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
7440 | 4616 |
7431 | 4617 /*conv->history = g_string_append(conv->history, t1); |
4618 conv->history = g_string_append(conv->history, t2); | |
4619 conv->history = g_string_append(conv->history, "\n"); | |
7440 | 4620 |
7431 | 4621 g_free(t1); |
4622 g_free(t2); */ | |
7440 | 4623 |
4624 g_free(with_font_tag); | |
7447 | 4625 g_free(new_message); |
7440 | 4626 } |
4627 | |
6062 | 4628 |
5012 | 4629 if(sml_attrib) |
4630 g_free(sml_attrib); | |
6982 | 4631 |
4632 if (images) { | |
7078 | 4633 GSList *tmp; |
4634 | |
4635 for (tmp = images; tmp; tmp = tmp->next) { | |
4636 GdkPixbuf *pixbuf = tmp->data; | |
4637 if(pixbuf) | |
4638 g_object_unref(pixbuf); | |
6982 | 4639 } |
7078 | 4640 |
6982 | 4641 g_slist_free(images); |
4642 } | |
4359 | 4643 } |
4644 | |
4645 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4646 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4647 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4648 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4649 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4650 GaimGtkChatPane *gtkchat; |
4359 | 4651 char tmp[BUF_LONG]; |
4652 int num_users; | |
4653 int pos; | |
4654 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4655 chat = GAIM_CONV_CHAT(conv); |
4359 | 4656 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4657 gtkchat = gtkconv->u.chat; | |
4658 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4659 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4660 |
4661 g_snprintf(tmp, sizeof(tmp), | |
4662 ngettext("%d person in room", "%d people in room", | |
4663 num_users), | |
4664 num_users); | |
4665 | |
4666 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4667 | |
4668 if (gtkconv->make_sound) | |
4561 | 4669 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4670 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4671 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4672 |
4673 add_chat_buddy_common(conv, user, pos); | |
4674 } | |
4675 | |
4676 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4677 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4678 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4679 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4680 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4681 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4682 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4683 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4684 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4685 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4686 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4687 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4688 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4689 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4690 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4691 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
|
4692 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4693 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4694 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4695 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4696 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4697 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4698 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4699 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4700 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4701 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
|
4702 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4703 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4704 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4705 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4706 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4707 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4708 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4709 const char *new_name) |
4359 | 4710 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4711 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4712 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4713 GaimGtkChatPane *gtkchat; |
4359 | 4714 GtkTreeIter iter; |
4715 GtkTreeModel *model; | |
4716 GList *names; | |
4717 int pos; | |
4718 int f = 1; | |
4719 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4720 chat = GAIM_CONV_CHAT(conv); |
4359 | 4721 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4722 gtkchat = gtkconv->u.chat; | |
4723 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4724 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4725 names != NULL; |
4726 names = names->next) { | |
4727 | |
4728 char *u = (char *)names->data; | |
4729 | |
4793 | 4730 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4731 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4732 | |
4733 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4734 break; | |
4735 | |
4736 while (f != 0) { | |
4737 char *val; | |
4738 | |
4739 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4740 | |
4793 | 4741 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4742 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4743 break; |
4744 } | |
4359 | 4745 |
4746 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4747 | |
4748 g_free(val); | |
4749 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4750 |
4359 | 4751 break; |
4752 } | |
4753 } | |
4754 | |
4755 if (!names) | |
4756 return; | |
4757 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4758 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4759 |
4760 add_chat_buddy_common(conv, new_name, pos); | |
4761 } | |
4762 | |
4763 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4764 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4765 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4766 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4767 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4768 GaimGtkChatPane *gtkchat; |
4359 | 4769 GtkTreeIter iter; |
4770 GtkTreeModel *model; | |
4771 GList *names; | |
4772 char tmp[BUF_LONG]; | |
4773 int num_users; | |
4774 int f = 1; | |
4775 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4776 chat = GAIM_CONV_CHAT(conv); |
4359 | 4777 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4778 gtkchat = gtkconv->u.chat; | |
4779 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4780 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
|
4781 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4782 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4783 names != NULL; |
4784 names = names->next) { | |
4785 | |
4786 char *u = (char *)names->data; | |
4787 | |
4793 | 4788 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4789 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4790 | |
4791 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4792 break; | |
4793 | |
4794 while (f != 0) { | |
4795 char *val; | |
4796 | |
4797 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4798 | |
4793 | 4799 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4800 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4801 | |
4802 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4803 | |
4804 g_free(val); | |
4805 } | |
4806 | |
4807 break; | |
4808 } | |
4809 } | |
4810 | |
4811 if (names == NULL) | |
4812 return; | |
4813 | |
4814 g_snprintf(tmp, sizeof(tmp), | |
4815 ngettext("%d person in room", "%d people in room", | |
4816 num_users), num_users); | |
4817 | |
4818 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4819 | |
4820 if (gtkconv->make_sound) | |
4561 | 4821 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4822 } |
4823 | |
4824 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4825 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4826 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4827 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4828 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4829 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4830 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4831 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4832 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4833 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4834 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4835 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4836 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4837 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4838 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4839 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4840 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4841 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4842 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
|
4843 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4844 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4845 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4846 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4847 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4848 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4849 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4850 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4851 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4852 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4853 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4854 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4855 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4856 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4857 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4858 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4859 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4860 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4861 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4862 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4863 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4864 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4865 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4866 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4867 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4868 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4869 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4870 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
4871 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4872 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4873 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4874 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4875 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4876 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4877 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4878 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4879 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4880 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4881 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4882 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4883 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4884 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4885 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4886 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4887 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4888 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4889 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4890 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4891 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4892 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4893 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4894 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4895 GaimConvChat *chat; |
4359 | 4896 |
4897 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4898 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4899 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4900 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4901 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4902 { |
4359 | 4903 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4904 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4905 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4906 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4907 |
4359 | 4908 gaim_gtkconv_update_buttons_by_protocol(conv); |
4909 | |
4685 | 4910 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4911 |
4912 smiley_themeize(gtkconv->imhtml); | |
6394 | 4913 |
6395 | 4914 update_tab_icon(conv); |
4359 | 4915 } |
4916 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4917 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4918 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4919 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4920 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4921 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4922 char color[8]; |
4736 | 4923 |
4359 | 4924 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4925 im = GAIM_CONV_IM(conv); |
4359 | 4926 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4927 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4928 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4929 *color = '\0'; |
4359 | 4930 |
4931 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
4932 gtk_widget_realize(gtkconv->tab_label); | |
4933 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4934 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
|
4935 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4936 strcpy(color, "#47A046"); |
4359 | 4937 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4938 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
|
4939 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4940 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4941 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4942 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4943 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4944 strcpy(color, "#314E6C"); |
4359 | 4945 } |
8252 | 4946 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
4947 { | |
4948 strcpy(color, "#DF421E"); | |
4949 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4950 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4951 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4952 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4953 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4954 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4955 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4956 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4957 char *label; |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4958 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4959 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4960 color, title); |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
4961 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
4962 g_free(label); |
4359 | 4963 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
4964 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4965 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4966 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4967 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 4968 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4969 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4970 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4971 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4972 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4973 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4974 } |
4359 | 4975 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4976 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4977 { |
7154 | 4978 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4979 chat = GAIM_CONV_CHAT(conv); |
4359 | 4980 gtkchat = gtkconv->u.chat; |
4981 | |
7154 | 4982 topic = gaim_conv_chat_get_topic(chat); |
4983 | |
4984 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
4985 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
4986 topic, NULL); |
4359 | 4987 } |
4988 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4989 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4990 { |
7929 | 4991 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4992 generate_send_as_items(win, NULL); |
6440 | 4993 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
4994 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4995 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4996 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
4997 { |
6440 | 4998 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
4999 update_tab_icon(conv); | |
4359 | 5000 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5001 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
|
5002 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5003 { |
7929 | 5004 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5005 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5006 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5007 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5008 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5009 } |
4359 | 5010 } |
5011 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5012 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5013 { |
5014 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5015 gaim_gtkconv_write_chat, /* write_chat */ | |
5016 gaim_gtkconv_write_im, /* write_im */ | |
5017 gaim_gtkconv_write_conv, /* write_conv */ | |
5018 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5019 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5020 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5021 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5022 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5023 NULL, /* update_progress */ |
5024 gaim_gtkconv_updated /* updated */ | |
5025 }; | |
5026 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5027 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5028 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5029 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5030 return &conversation_ui_ops; |
4359 | 5031 } |
5032 | |
5033 /************************************************************************** | |
5034 * Public conversation utility functions | |
5035 **************************************************************************/ | |
5036 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5037 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5038 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5039 GaimGtkConversation *gtkconv; |
7143 | 5040 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5041 |
5042 char filename[256]; | |
5043 FILE *file; | |
5044 GError *err = NULL; | |
5045 | |
6695 | 5046 GaimBuddy *buddy; |
4757 | 5047 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5048 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5049 size_t len; |
4359 | 5050 |
5051 GdkPixbuf *buf; | |
5052 | |
5053 GtkWidget *event; | |
5054 GtkWidget *frame; | |
5055 GdkPixbuf *scale; | |
5056 GdkPixmap *pm; | |
5057 GdkBitmap *bm; | |
5058 int sf = 0; | |
5059 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5060 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5061 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5062 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5063 |
5064 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5065 | |
5066 remove_icon(gtkconv); | |
5067 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5068 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5069 return; |
5070 | |
5071 if (gaim_conversation_get_gc(conv) == NULL) | |
5072 return; | |
5073 | |
8189 | 5074 if (gtkconv->u.im->anim) |
4793 | 5075 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
8189 | 5076 else |
5077 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); | |
4793 | 5078 |
4757 | 5079 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5080 gaim_conversation_get_name(conv))) != NULL) { | |
8374 | 5081 const char *iconfile; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5082 if((iconfile = gaim_blist_node_get_string((GaimBlistNode*)buddy, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5083 "buddy_icon"))) { |
8374 | 5084 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
5085 struct stat st; | |
5086 if ((icon == NULL) && (!stat(iconfile, &st))) { | |
5087 FILE *file = fopen(iconfile, "rb"); | |
5088 if (file) { | |
5089 char *data = g_malloc(st.st_size); | |
5090 fread(data, 1, st.st_size, file); | |
5091 fclose(file); | |
5092 gaim_buddy_icons_set_for_user(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv), data, st.st_size); | |
5093 g_free(data); | |
5094 } | |
5095 return; | |
5096 } | |
5097 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5098 gtkconv->u.im->anim = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5099 gdk_pixbuf_animation_new_from_file(iconfile, &err); |
8374 | 5100 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5101 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5102 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5103 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5104 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5105 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5106 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5107 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5108 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5109 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5110 |
5111 /* this is such an evil hack, i don't know why i'm even considering it. | |
5112 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5113 g_snprintf(filename, sizeof(filename), | |
5114 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5115 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5116 | |
5117 if (!(file = fopen(filename, "wb"))) | |
5118 return; | |
5119 | |
5120 fwrite(data, 1, len, file); | |
5121 fclose(file); | |
5122 | |
5123 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5124 /* make sure we remove the file as soon as possible */ | |
5125 unlink(filename); | |
5126 } | |
4359 | 5127 |
5128 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5129 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5130 "Buddy icon error: %s\n", err->message); |
4359 | 5131 g_error_free(err); |
5132 } | |
5133 | |
5134 if (!gtkconv->u.im->anim) | |
5135 return; | |
5136 | |
4793 | 5137 if(gtkconv->u.im->iter) |
5138 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5139 | |
4359 | 5140 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5141 gtkconv->u.im->iter = NULL; | |
5142 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5143 } else { | |
5144 gtkconv->u.im->iter = | |
5145 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5146 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
8189 | 5147 if (gtkconv->u.im->animate) |
5148 start_anim(NULL, conv); | |
4359 | 5149 } |
5150 | |
5151 sf = SCALE(gtkconv->u.im->anim); | |
5152 scale = gdk_pixbuf_scale_simple(buf, | |
5153 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5154 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5155 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5156 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5157 GDK_INTERP_NEAREST); | |
5158 | |
5159 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5160 g_object_unref(G_OBJECT(scale)); |
4359 | 5161 |
5162 frame = gtk_frame_new(NULL); | |
5163 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5164 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
5165 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 0); |
4359 | 5166 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); |
5167 gtk_widget_show(frame); | |
5168 | |
5169 event = gtk_event_box_new(); | |
5170 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5171 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5172 G_CALLBACK(icon_menu), conv); |
5173 gtk_widget_show(event); | |
5174 | |
4635 | 5175 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5176 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5177 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5178 gtk_widget_show(gtkconv->u.im->icon); | |
5179 | |
4793 | 5180 g_object_unref(G_OBJECT(pm)); |
4359 | 5181 |
5182 if (bm) | |
4793 | 5183 g_object_unref(G_OBJECT(bm)); |
7143 | 5184 |
5185 /* The buddy icon code needs badly to be fixed. */ | |
5186 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5187 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5188 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5189 } |
5190 | |
5191 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5192 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5193 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5194 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5195 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5196 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5197 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5198 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5199 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5200 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5201 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5202 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5203 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5204 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5205 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5206 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5207 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5208 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5209 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5210 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5211 GaimGtkConversation *gtkconv; |
6141 | 5212 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5213 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5214 return; |
6141 | 5215 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5216 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5217 |
6141 | 5218 strncpy(gtkconv->fontface, |
5219 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5220 sizeof(gtkconv->fontface)); | |
4421 | 5221 } |
5222 | |
5223 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5224 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5225 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5226 GaimConvWindow *win; |
4359 | 5227 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5228 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5229 return; |
5230 | |
7887 | 5231 win = gaim_conversation_get_window(conv); |
5232 | |
5233 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5234 gray_stuff_out(conv); | |
4359 | 5235 } |
5236 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5237 GaimConvWindow * |
4359 | 5238 gaim_gtkwin_get_at_xy(int x, int y) |
5239 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5240 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5241 GaimGtkWindow *gtkwin; |
4359 | 5242 GdkWindow *gdkwin; |
5243 GList *l; | |
5244 | |
5245 gdkwin = gdk_window_at_pointer(&x, &y); | |
5246 | |
5247 if (gdkwin) | |
5248 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5249 | |
5250 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5251 win = (GaimConvWindow *)l->data; |
4359 | 5252 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5253 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5254 continue; |
5255 | |
5256 gtkwin = GAIM_GTK_WINDOW(win); | |
5257 | |
5258 if (gdkwin == gtkwin->window->window) | |
5259 return win; | |
5260 } | |
5261 | |
5262 return NULL; | |
5263 } | |
5264 | |
5265 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5266 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5267 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5268 GaimGtkWindow *gtkwin; |
4359 | 5269 GList *l; |
5270 gint nb_x, nb_y, x_rel, y_rel; | |
5271 GtkNotebook *notebook; | |
5272 GtkWidget *tab; | |
5273 gint i, page_num = 0; | |
5274 gboolean first_visible = TRUE; | |
5275 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5276 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5277 return -1; |
5278 | |
5279 gtkwin = GAIM_GTK_WINDOW(win); | |
5280 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5281 | |
5282 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5283 x_rel = x - nb_x; | |
5284 y_rel = y - nb_y; | |
5285 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5286 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5287 l != NULL; |
5288 l = l->next, i++) { | |
5289 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5290 GaimConversation *conv = l->data; |
4359 | 5291 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5292 | |
5293 if (!GTK_WIDGET_MAPPED(tab)) | |
5294 continue; | |
5295 | |
5296 if (first_visible) { | |
5297 first_visible = FALSE; | |
5298 | |
5299 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5300 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5301 } | |
5302 | |
5303 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5304 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5305 | |
5306 if (tab->allocation.x <= x_rel) { | |
5307 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5308 page_num = i + 1; | |
5309 else | |
5310 page_num = i; | |
5311 } | |
5312 else | |
5313 break; | |
5314 } | |
5315 else { | |
5316 if (tab->allocation.y <= y_rel) { | |
5317 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5318 page_num = i + 1; | |
5319 else | |
5320 page_num = i; | |
5321 } | |
5322 else | |
5323 break; | |
5324 } | |
5325 } | |
5326 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5327 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5328 return -1; |
5329 | |
5330 return page_num; | |
5331 } | |
5332 | |
5333 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5334 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5335 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5336 GaimGtkWindow *gtkwin; |
4359 | 5337 GList *l; |
5338 gint nb_x, nb_y, x_rel, y_rel; | |
5339 GtkNotebook *notebook; | |
5340 GtkWidget *tab; | |
5341 gint i, page_num = 0; | |
5342 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5343 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5344 return -1; |
5345 | |
5346 gtkwin = GAIM_GTK_WINDOW(win); | |
5347 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5348 | |
5349 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5350 x_rel = x - nb_x; | |
5351 y_rel = y - nb_y; | |
5352 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5353 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5354 l != NULL; |
5355 l = l->next, i++) { | |
5356 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5357 GaimConversation *conv = l->data; |
4359 | 5358 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5359 | |
5360 if (!GTK_WIDGET_MAPPED(tab)) | |
5361 continue; | |
5362 | |
5363 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5364 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5365 | |
5366 if (tab->allocation.x <= x_rel) { | |
5367 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5368 page_num = i + 1; | |
5369 else | |
5370 page_num = i; | |
5371 } | |
5372 else | |
5373 break; | |
5374 } | |
5375 else { | |
5376 if (tab->allocation.y <= y_rel) { | |
5377 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5378 page_num = i + 1; | |
5379 else | |
5380 page_num = i; | |
5381 } | |
5382 else | |
5383 break; | |
5384 } | |
5385 } | |
5386 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5387 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5388 return -1; |
5389 | |
5390 return page_num; | |
5391 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5392 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5393 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5394 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5395 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5396 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5397 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5398 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5399 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5400 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5401 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5402 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5403 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5404 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5405 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5406 icons_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5407 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5408 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5409 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5410 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5411 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5412 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5413 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5414 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5415 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5416 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5417 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5418 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5419 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5420 |
6440 | 5421 if (value) { |
5422 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5423 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5424 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5425 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5426 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5427 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5428 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5429 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5430 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5431 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5432 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5433 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5434 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
|
5435 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5436 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5437 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5438 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5439 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5440 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5441 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5442 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5443 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5444 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5445 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5446 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5447 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5448 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5449 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5450 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5451 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5452 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5453 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5454 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5455 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5456 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5457 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5458 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5459 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5460 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5461 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5462 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5463 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5464 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5465 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5466 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5467 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5468 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5469 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5470 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5471 |
7386 | 5472 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
|
5473 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5474 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5475 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5476 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5477 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5478 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5479 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5480 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5481 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5482 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5483 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5484 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5485 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5486 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5487 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5488 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5489 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5490 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5491 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5492 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5493 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5494 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5495 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5496 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5497 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5498 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5499 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5500 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5501 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5502 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5503 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5504 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5505 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5506 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5507 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5508 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5509 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5510 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5511 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5512 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5513 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5514 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5515 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5516 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5517 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5518 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5519 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5520 |
7386 | 5521 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5522 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5523 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5524 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5525 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5526 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5527 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5528 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5529 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5530 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5531 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5532 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5533 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5534 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5535 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5536 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5537 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5538 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5539 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5540 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5541 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5542 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5543 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5544 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5545 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5546 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5547 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5548 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5549 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5550 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5551 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5552 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5553 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5554 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5555 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5556 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5557 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5558 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5559 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5560 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5561 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5562 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5563 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5564 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5565 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5566 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5567 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5568 |
7386 | 5569 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5570 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5571 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5572 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5573 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5574 if (gtkconv->show_formatting_toolbar) |
8317 | 5575 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5576 else |
8317 | 5577 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5578 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5579 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5580 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5581 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5582 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5583 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5584 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5585 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5586 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5587 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5588 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5589 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5590 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5591 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5592 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5593 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5594 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5595 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5596 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5597 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5598 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5599 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5600 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5601 GList *l; |
8189 | 5602 GaimConversation *conv; |
5603 GaimGtkConversation *gtkconv; | |
5604 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5605 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5606 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5607 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5608 |
8189 | 5609 /* Set the "animate" flag for each icon based on the new preference */ |
5610 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5611 conv = (GaimConversation *)l->data; | |
5612 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5613 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5614 } |
8189 | 5615 |
5616 /* Now either stop or start animation for the active conversation in each window */ | |
5617 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5618 win = (GaimConvWindow *)l->data; | |
5619 conv = gaim_conv_window_get_active_conversation(win); | |
5620 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5621 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5622 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5623 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5624 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5625 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
|
5626 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5627 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5628 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5629 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5630 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5631 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5632 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5633 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5634 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5635 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5636 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5637 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5638 static void |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5639 chat_button_type_pref_cb(const char *name, GaimPrefType type, |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5640 gpointer value, gpointer data) |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5641 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5642 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5643 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5644 GaimGtkConversation *gtkconv; |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5645 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5646 for (l = gaim_get_chats(); l != NULL; l = l->next) { |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5647 conv = (GaimConversation *)l->data; |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5648 gtkconv = GAIM_GTK_CONVERSATION(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5649 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
5650 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5651 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5652 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5653 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5654 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5655 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5656 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5657 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5658 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5659 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5660 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5661 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5662 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5663 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5664 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5665 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5666 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5667 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5668 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5669 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5670 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5671 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5672 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5673 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5674 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5675 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5676 gaim_prefs_add_bool("/gaim/gtk/conversations/icons_on_tabs", TRUE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5677 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5678 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5679 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5680 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5681 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5682 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5683 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5684 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5685 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5686 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5687 gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5688 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5689 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5690 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5691 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5692 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5693 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5694 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5695 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5696 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5697 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
5698 gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5699 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5700 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5701 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5702 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5703 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5704 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5705 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5706 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5707 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5708 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5709 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5710 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5711 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5712 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5713 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/old_tab_complete", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5714 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5715 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5716 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5717 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5718 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5719 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5720 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5721 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5722 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5723 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5724 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5725 gaim_prefs_add_bool("/gaim/gtk/conversations/im/hide_on_send", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5726 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5727 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5728 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5729 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5730 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5731 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5732 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5733 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5734 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5735 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5736 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5737 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5738 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5739 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5740 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5741 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5742 show_timestamps_pref_cb, NULL); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5743 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5744 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5745 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5746 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5747 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5748 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5749 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5750 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5751 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5752 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5753 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5754 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5755 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5756 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5757 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5758 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5759 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5760 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5761 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5762 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5763 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5764 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5765 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5766 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5767 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5768 } |