Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 7619:994b2d782711
[gaim-migrate @ 8243]
Juan Pablo Mendoza made file sending a little more generic, UI-wise, and
added drag-and-drop file sending, as well as a Send File in the
conversation menu. Congrats Juan on the $400 bounty.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 24 Nov 2003 02:35:27 +0000 |
parents | 59c1cee97cbb |
children | bfe3a796b2c2 |
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 * |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
5 * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org> |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6 * |
4359 | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
22 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
23 |
4359 | 24 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 |
4359 | 28 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
30 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
31 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # endif |
4359 | 33 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 |
4359 | 35 #include <gdk/gdkkeysyms.h> |
6982 | 36 #include <locale.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 #include "debug.h" |
6982 | 39 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
42 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
43 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "prpl.h" |
6038 | 45 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "gtkblist.h" |
5717 | 51 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "gtkimhtml.h" |
7431 | 53 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
54 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
55 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
57 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 |
5717 | 59 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "gaim.h" |
4359 | 63 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 |
4359 | 66 static char nick_colors[][8] = { |
67 "#ba55d3", /* Medium Orchid */ | |
68 "#ee82ee", /* Violet */ | |
69 "#c715b4", /* Medium Violet Red */ | |
70 "#ff69b4", /* Hot Pink */ | |
71 "#ff6347", /* Tomato */ | |
72 "#fa8c00", /* Dark Orange */ | |
73 "#fa8072", /* Salmon */ | |
74 "#b22222", /* Fire Brick */ | |
75 "#f4a460", /* Sandy Brown */ | |
76 "#cd5c5c", /* Indian Red */ | |
77 "#bc8f8f", /* Rosy Brown */ | |
78 "#f0e68c", /* Khaki */ | |
79 "#bdb76b", /* Dark Khaki */ | |
80 "#228b22", /* Forest Green */ | |
81 "#9acd32", /* Yellow Green */ | |
82 "#32cd32", /* Lime Green */ | |
83 "#3cb371", /* Medium Sea Green */ | |
84 "#2e8b57", /* Sea Green */ | |
85 "#8fbc8f", /* Dark Sea Green */ | |
86 "#66cdaa", /* Medium Aquamarine */ | |
87 "#5f9ea0", /* Cadet Blue */ | |
88 "#48d1cc", /* Medium Turquoise */ | |
89 "#00ced1", /* Dark Turquoise */ | |
90 "#4682b4", /* Stell Blue */ | |
91 "#00bfff", /* Deep Sky Blue */ | |
92 "#1690ff", /* Dodger Blue */ | |
93 "#4169ff", /* Royal Blue */ | |
94 "#6a5acd", /* Slate Blue */ | |
95 "#6495ed", /* Cornflower Blue */ | |
96 "#708090", /* Slate gray */ | |
6291 | 97 "#2f4f4f", /* Dark Slate Gray */ |
98 "#ff8c00", /* Dark Orange */ | |
4359 | 99 }; |
6291 | 100 |
4359 | 101 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
102 | |
103 #define SCALE(x) \ | |
104 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
105 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
106 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
107 typedef struct |
4359 | 108 { |
109 GtkWidget *window; | |
110 | |
111 GtkWidget *entry; | |
112 GtkWidget *message; | |
113 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
114 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
115 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
116 } InviteBuddyInfo; |
4359 | 117 |
118 static GtkWidget *invite_dialog = NULL; | |
119 | |
120 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
121 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 122 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
124 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
127 static void do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv); |
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
128 static void do_normal(GtkWidget *normal, GaimGtkConversation *gtkconv); |
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
129 static void do_big(GtkWidget *large, GaimGtkConversation *gtkconv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
133 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
134 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 136 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
137 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
138 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
139 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
140 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
|
141 static void save_convo(GtkWidget *save, GaimConversation *c); |
6440 | 142 static void update_tab_icon(GaimConversation *conv); |
4359 | 143 |
144 /************************************************************************** | |
145 * Callbacks | |
146 **************************************************************************/ | |
147 static void | |
6038 | 148 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
149 { |
6039 | 150 GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
6038 | 151 "gaim_conversation"); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
152 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
153 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
156 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 g_list_find(gaim_get_ims(), c)) || |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 (gaim_conversation_get_type(c) == GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 g_list_find(gaim_get_chats(), c)))) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 filename = NULL; |
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 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 return; |
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 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 return; |
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 fprintf(fp, "%s", c->history->str); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
172 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
173 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 static void |
6038 | 177 do_check_save_convo(GObject *obj, GtkWidget *wid) |
178 { | |
179 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
180 | |
181 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
182 return; | |
183 | |
184 if(g_file_test(filename, G_FILE_TEST_EXISTS)){ | |
185 gaim_request_yes_no(NULL, NULL, _("That file already exists"), | |
186 _("Would you like to overwrite it?"), 1, wid, | |
187 G_CALLBACK(do_save_convo), NULL); | |
188 } | |
189 else | |
190 do_save_convo(wid); | |
191 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
192 |
6038 | 193 static void |
4359 | 194 do_insert_image_cb(GObject *obj, GtkWidget *wid) |
195 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
196 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
197 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
198 GaimConvIm *im; |
6982 | 199 char *name, *filename; |
200 char *buf, *data; | |
201 size_t size; | |
202 GError *error; | |
4359 | 203 int id; |
204 | |
5106 | 205 conv = g_object_get_data(G_OBJECT(wid), "user_data"); |
4359 | 206 gtkconv = GAIM_GTK_CONVERSATION(conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
207 im = GAIM_CONV_IM(conv); |
6982 | 208 name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid))); |
209 | |
210 if (!name) { | |
211 gtk_widget_destroy(gtkconv->dialogs.image); | |
212 gtkconv->dialogs.image = NULL; | |
213 return; | |
214 } | |
215 | |
216 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(wid))) { | |
217 g_free(name); | |
4359 | 218 return; |
6982 | 219 } |
220 | |
221 gtk_widget_destroy(gtkconv->dialogs.image); | |
222 gtkconv->dialogs.image = NULL; | |
223 | |
224 if (!g_file_get_contents(name, &data, &size, &error)) { | |
225 gaim_notify_error(NULL, NULL, error->message, NULL); | |
226 | |
227 g_error_free(error); | |
228 g_free(name); | |
229 | |
4359 | 230 return; |
231 } | |
232 | |
233 filename = name; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
234 while (strchr(filename, '/')) |
4359 | 235 filename = strchr(filename, '/') + 1; |
236 | |
6982 | 237 id = gaim_imgstore_add(data, size, filename); |
238 g_free(data); | |
239 | |
240 if (!id) { | |
241 buf = g_strdup_printf(_("Failed to store image: %s\n"), name); | |
242 gaim_notify_error(NULL, NULL, buf, NULL); | |
243 | |
244 g_free(buf); | |
245 g_free(name); | |
246 | |
247 return; | |
248 } | |
249 | |
250 im->images = g_slist_append(im->images, GINT_TO_POINTER(id)); | |
251 | |
252 buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename); | |
253 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1); | |
4359 | 254 g_free(buf); |
5046 | 255 |
6982 | 256 g_free(name); |
257 | |
5046 | 258 set_toggle(gtkconv->toolbar.image, FALSE); |
4359 | 259 } |
260 | |
261 static gint | |
262 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
263 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
264 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
265 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
266 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
267 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
268 return TRUE; |
4359 | 269 } |
270 | |
271 static gint | |
272 close_conv_cb(GtkWidget *w, gpointer d) | |
273 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
274 GaimConversation *conv = (GaimConversation *)d; |
4359 | 275 |
276 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
277 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
278 return TRUE; |
4359 | 279 } |
280 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
281 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
282 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
283 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
284 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
285 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
286 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
287 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
288 |
4359 | 289 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
290 cancel_insert_image_cb(GtkWidget *unused, GaimGtkConversation *gtkconv) |
5106 | 291 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
292 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
293 FALSE); |
5106 | 294 |
295 if (gtkconv->dialogs.image) | |
296 gtk_widget_destroy(gtkconv->dialogs.image); | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
297 |
5106 | 298 gtkconv->dialogs.image = NULL; |
299 } | |
300 | |
301 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
302 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 303 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
304 GaimGtkConversation *gtkconv; |
4359 | 305 char buf[BUF_LONG]; |
306 GtkWidget *window; | |
307 | |
308 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
309 | |
5046 | 310 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
311 window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
312 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); | |
313 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
314 | |
5106 | 315 g_object_set_data(G_OBJECT(window), "user_data", conv); |
5046 | 316 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
317 "clicked", G_CALLBACK(do_insert_image_cb), window); | |
5106 | 318 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
319 "clicked", G_CALLBACK(cancel_insert_image_cb), gtkconv); | |
5046 | 320 |
321 gtk_widget_show(window); | |
5106 | 322 gtkconv->dialogs.image = window; |
5046 | 323 } else { |
324 gtk_widget_grab_focus(gtkconv->entry); | |
5106 | 325 if(gtkconv->dialogs.image) |
326 gtk_widget_destroy(gtkconv->dialogs.image); | |
327 gtkconv->dialogs.image = NULL; | |
5046 | 328 } |
4359 | 329 } |
330 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
331 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
332 insert_link_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
334 GaimGtkConversation *gtkconv; |
4359 | 335 |
336 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
337 | |
338 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))) | |
339 show_insert_link(gtkconv->toolbar.link, conv); | |
340 else if (gtkconv->dialogs.link) | |
341 cancel_link(gtkconv->toolbar.link, conv); | |
342 else | |
343 gaim_gtk_advance_past(gtkconv, "<A HREF>", "</A>"); | |
344 | |
345 gtk_widget_grab_focus(gtkconv->entry); | |
346 } | |
347 | |
348 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
349 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 350 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
351 GaimGtkConversation *gtkconv; |
4359 | 352 |
353 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
354 | |
355 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
356 show_smiley_dialog(conv, smiley); | |
357 else if (gtkconv->dialogs.smiley) | |
358 close_smiley_dialog(smiley, conv); | |
359 | |
360 gtk_widget_grab_focus(gtkconv->entry); | |
361 } | |
362 | |
363 static gboolean | |
364 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
365 { | |
366 check_everything(buffer); | |
367 | |
368 return FALSE; | |
369 } | |
370 | |
371 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
372 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 373 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
374 GaimGtkConversation *gtkconv; |
4359 | 375 char *buf, *buf2; |
376 GtkTextIter start_iter, end_iter; | |
377 int limit; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
378 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 379 |
380 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
381 | |
382 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_iter); | |
383 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end_iter); | |
384 buf2 = gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
385 &start_iter, &end_iter, FALSE); | |
386 | |
4685 | 387 set_toggle(gtkconv->toolbar.bold, FALSE); |
388 set_toggle(gtkconv->toolbar.italic, FALSE); | |
389 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 390 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 391 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 392 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 393 set_toggle(gtkconv->toolbar.font, FALSE); |
394 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
395 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
396 set_toggle(gtkconv->toolbar.link, FALSE); | |
4359 | 397 |
398 gtk_widget_grab_focus(gtkconv->entry); | |
399 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
400 limit = 32 * 1024; /* This will be done again in gaim_conv_im_send. *shrug* */ |
4359 | 401 |
402 buf = g_malloc(limit); | |
403 strncpy(buf, buf2, limit); | |
404 | |
405 g_free(buf2); | |
406 | |
407 if (strlen(buf) == 0) { | |
408 g_free(buf); | |
409 | |
410 return; | |
411 } | |
412 | |
413 buf2 = g_malloc(limit); | |
414 | |
6622 | 415 if (gc && gc->flags & GAIM_CONNECTION_HTML) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
416 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { |
4359 | 417 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
418 strcpy(buf, buf2); | |
419 } | |
420 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
421 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { |
4359 | 422 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
423 strcpy(buf, buf2); | |
424 } | |
425 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
426 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { |
4359 | 427 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
428 strcpy(buf, buf2); | |
429 } | |
430 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
431 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { |
4359 | 432 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
433 strcpy(buf, buf2); | |
434 } | |
435 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
436 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
437 gtkconv->has_font) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
438 |
4359 | 439 g_snprintf(buf2, limit, |
440 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); | |
441 strcpy(buf, buf2); | |
442 } | |
443 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
444 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { |
4359 | 445 g_snprintf(buf2, limit, |
6141 | 446 "<FONT SIZE=\"%d\">%s</FONT>", |
447 gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), | |
448 buf); | |
4359 | 449 strcpy(buf, buf2); |
450 } | |
451 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
452 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
4359 | 453 g_snprintf(buf2, limit, |
454 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", | |
455 gtkconv->fg_color.red / 256, | |
456 gtkconv->fg_color.green / 256, | |
457 gtkconv->fg_color.blue / 256, buf); | |
458 strcpy(buf, buf2); | |
459 } | |
460 | |
6629 | 461 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
4359 | 462 g_snprintf(buf2, limit, |
463 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", | |
4421 | 464 gtkconv->bg_color.red / 256, |
465 gtkconv->bg_color.green / 256, | |
466 gtkconv->bg_color.blue / 256, buf); | |
4359 | 467 strcpy(buf, buf2); |
468 } | |
469 } | |
470 | |
471 g_free(buf2); | |
472 | |
473 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
474 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); |
4359 | 475 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
476 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); |
4359 | 477 |
5629 | 478 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
|
479 gaim_conv_window_hide(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
480 |
4359 | 481 g_free(buf); |
482 | |
483 gtk_text_buffer_set_text(gtkconv->entry_buffer, "", -1); | |
484 } | |
485 | |
486 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
487 add_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 488 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
489 GaimAccount *account; |
6695 | 490 GaimBuddy *b; |
4359 | 491 const char *name; |
492 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
493 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
494 name = gaim_conversation_get_name(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
495 b = gaim_find_buddy(account, name); |
4359 | 496 |
497 if (b != NULL) | |
5975 | 498 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
499 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
500 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); |
4359 | 501 |
502 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
503 } | |
504 | |
505 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
506 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 507 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
508 GaimGtkConversation *gtkconv; |
4359 | 509 |
510 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
511 | |
512 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
513 GaimGtkChatPane *gtkchat; |
4359 | 514 GtkTreeIter iter; |
515 GtkTreeModel *model; | |
516 GtkTreeSelection *sel; | |
517 const char *name; | |
518 | |
519 gtkchat = gtkconv->u.chat; | |
520 | |
521 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
522 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
523 | |
524 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
525 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
526 else | |
527 return; | |
528 | |
529 serv_get_info(gaim_conversation_get_gc(conv), (char *)name); | |
530 } | |
531 else { | |
532 serv_get_info(gaim_conversation_get_gc(conv), | |
533 (char *)gaim_conversation_get_name(conv)); | |
534 | |
535 gtk_widget_grab_focus(gtkconv->entry); | |
536 } | |
537 } | |
538 | |
539 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
540 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 541 { |
542 show_warn_dialog(gaim_conversation_get_gc(conv), | |
543 (char *)gaim_conversation_get_name(conv)); | |
544 | |
545 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
546 } | |
547 | |
548 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
549 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 550 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
551 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
552 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
553 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
554 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
555 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
556 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 557 |
558 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
559 } | |
560 | |
561 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
562 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 563 { |
564 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
565 GaimGtkConversation *gtkconv; |
4359 | 566 |
567 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
568 | |
569 if (resp == GTK_RESPONSE_OK) { | |
570 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
571 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
572 | |
4793 | 573 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 574 g_free(info); |
575 | |
576 return; | |
577 } | |
578 | |
579 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
580 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 581 message, buddy); |
582 } | |
583 | |
584 gtk_widget_destroy(invite_dialog); | |
585 invite_dialog = NULL; | |
586 | |
587 g_free(info); | |
588 } | |
589 | |
590 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
591 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 592 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
593 InviteBuddyInfo *info = NULL; |
4359 | 594 |
595 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
596 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
597 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
598 GaimGtkWindow *gtkwin; |
4359 | 599 GtkWidget *label; |
600 GtkWidget *vbox, *hbox; | |
601 GtkWidget *table; | |
602 GtkWidget *img; | |
603 | |
5024 | 604 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 605 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
606 info = g_new0(InviteBuddyInfo, 1); |
4359 | 607 info->conv = conv; |
608 | |
609 gc = gaim_conversation_get_gc(conv); | |
610 win = gaim_conversation_get_window(conv); | |
611 gtkwin = GAIM_GTK_WINDOW(win); | |
612 | |
613 /* Create the new dialog. */ | |
614 invite_dialog = gtk_dialog_new_with_buttons( | |
615 _("Gaim - Invite Buddy Into Chat Room"), | |
616 GTK_WINDOW(gtkwin->window), | |
617 GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
618 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
619 | |
620 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
621 GTK_RESPONSE_OK); | |
622 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
623 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
624 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
625 | |
626 /* Setup the outside spacing. */ | |
627 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
628 | |
629 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
630 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
631 | |
632 /* Setup the inner hbox and put the dialog's icon in it. */ | |
633 hbox = gtk_hbox_new(FALSE, 12); | |
634 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
635 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
636 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
637 | |
638 /* Setup the right vbox. */ | |
639 vbox = gtk_vbox_new(FALSE, 0); | |
640 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
641 | |
642 /* Put our happy label in it. */ | |
643 label = gtk_label_new(_("Please enter the name of the user you wish " | |
644 "to invite, along with an optional invite " | |
645 "message.")); | |
646 gtk_widget_set_size_request(label, 350, -1); | |
647 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
648 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
649 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
650 | |
651 /* hbox for the table, and to give it some spacing on the left. */ | |
652 hbox = gtk_hbox_new(FALSE, 6); | |
653 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
654 | |
655 /* Setup the table we're going to use to lay stuff out. */ | |
656 table = gtk_table_new(2, 2, FALSE); | |
657 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
658 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
659 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
660 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
661 | |
662 /* Now the Buddy label */ | |
663 label = gtk_label_new(NULL); | |
664 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
665 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
666 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
667 | |
668 /* Now the Buddy drop-down entry field. */ | |
669 info->entry = gtk_combo_new(); | |
670 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
671 gtk_entry_set_activates_default( | |
672 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
673 | |
674 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
675 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
676 | |
677 /* Fill in the names. */ | |
678 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
679 generate_invite_user_names(gc)); | |
680 | |
681 | |
682 /* Now the label for "Message" */ | |
683 label = gtk_label_new(NULL); | |
684 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
685 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
686 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
687 | |
688 | |
689 /* And finally, the Message entry field. */ | |
690 info->message = gtk_entry_new(); | |
691 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
692 | |
693 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
694 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
695 | |
696 /* Connect the signals. */ | |
697 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
698 G_CALLBACK(do_invite), info); | |
699 } | |
700 | |
701 gtk_widget_show_all(invite_dialog); | |
702 | |
703 if (info != NULL) | |
704 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
705 } | |
706 | |
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_save_as_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; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
711 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
712 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
713 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
714 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
715 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
716 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
717 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
718 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
719 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
720 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
721 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
722 |
7431 | 723 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
724 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
725 |
7295 | 726 struct _search { |
727 GaimGtkConversation *gtkconv; | |
728 GtkWidget *entry; | |
729 }; | |
730 | |
731 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) | |
732 { | |
733 switch (resp) { | |
734 case GTK_RESPONSE_OK: | |
7298
caca74a75e4c
[gaim-migrate @ 7882]
Christian Hammond <chipx86@chipx86.com>
parents:
7295
diff
changeset
|
735 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7295 | 736 break; |
737 case GTK_RESPONSE_CLOSE: | |
7298
caca74a75e4c
[gaim-migrate @ 7882]
Christian Hammond <chipx86@chipx86.com>
parents:
7295
diff
changeset
|
738 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); |
7295 | 739 gtk_widget_destroy(s->gtkconv->dialogs.search); |
740 s->gtkconv->dialogs.search = NULL; | |
741 g_free(s); | |
742 break; | |
743 } | |
744 } | |
745 | |
746 static void | |
747 menu_search_cb(gpointer data, guint action, GtkWidget *widget) | |
748 { | |
749 GaimConvWindow *win = (GaimConvWindow *)data; | |
750 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
751 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
752 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
753 GtkWidget *hbox, *vbox; | |
754 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); | |
755 GtkWidget *label, *entry; | |
756 struct _search *s; | |
757 | |
758 if (gtkconv->dialogs.search) | |
759 return; | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
760 |
7295 | 761 gtkconv->dialogs.search = gtk_dialog_new_with_buttons("", GTK_WINDOW(gtkwin->window), |
762 GTK_DIALOG_DESTROY_WITH_PARENT, | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
763 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, |
7295 | 764 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); |
765 gtk_container_set_border_width (GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
766 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
767 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
768 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
769 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
770 |
7295 | 771 hbox = gtk_hbox_new(FALSE, 6); |
772 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), hbox); | |
773 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
774 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
775 | |
776 vbox = gtk_vbox_new(FALSE, 0); | |
777 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
778 | |
779 label = gtk_label_new(NULL); | |
780 gtk_label_set_markup(GTK_LABEL(label), _("<span weight='bold' size='larger'>Enter a search phrase\n</span>")); | |
781 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
782 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
783 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
784 |
7295 | 785 hbox = gtk_hbox_new(FALSE, 6); |
786 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
787 label = gtk_label_new(_("Search term: ")); | |
788 entry = gtk_entry_new(); | |
789 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
790 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
791 | |
792 s = g_malloc(sizeof(struct _search)); | |
793 s->gtkconv = gtkconv; | |
794 s->entry = entry; | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
795 |
7295 | 796 gtk_dialog_set_default_response (GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK); |
797 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", G_CALLBACK(do_search_cb), s); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
798 |
7295 | 799 gtk_widget_show_all(gtkconv->dialogs.search); |
800 } | |
801 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
802 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
803 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
804 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
805 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
806 GaimConversation *conv; |
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 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
809 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
810 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
811 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
812 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
813 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
814 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
817 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
818 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
819 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
820 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 gtkconv = GAIM_GTK_CONVERSATION(conv); |
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 show_insert_link(gtkconv->toolbar.link, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
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 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
832 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
833 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
|
834 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
840 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
841 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
842 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
843 GaimConversation *conv; |
6695 | 844 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
845 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
846 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
847 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
848 b = gaim_find_buddy(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
849 gaim_conversation_get_name(conv)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 if (b != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
853 alias_dialog_bud(b); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
854 #if 0 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 alias_dialog_chat((struct chat *)b); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
857 #endif |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
860 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
864 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
865 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
867 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
868 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
869 info_cb(NULL, conv); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
873 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
874 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
875 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
876 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
877 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
878 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
879 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
881 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
882 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
883 static void |
7619
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
884 menu_sendfile_cb(gpointer data, guint action, GtkWidget *widget) |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
885 { |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
886 GaimConvWindow *win = (GaimConvWindow *)data; |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
887 GaimConversation *conv; |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
888 GaimConnection *gc; |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
889 |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
890 conv = gaim_conv_window_get_active_conversation(win); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
891 |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
892 gc = gaim_conversation_get_gc(conv); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
893 |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
894 gaim_prpl_ask_send_file (gc, gaim_conversation_get_name (conv)); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
895 } |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
896 |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
897 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
898 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
899 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
900 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
901 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
902 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
903 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
904 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
905 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
906 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
907 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
908 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
909 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
911 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
912 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
913 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
914 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
915 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
916 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
920 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
922 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
925 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 add_cb(NULL, conv); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
931 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
933 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
934 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
935 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
|
936 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
937 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
938 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
940 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
941 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
942 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
944 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
945 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
946 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
947 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
948 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
949 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 } |
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 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
954 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
955 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
956 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
957 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
958 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
959 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
960 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
961 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
962 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
963 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
964 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
965 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
966 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
967 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
968 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
969 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
970 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
971 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
972 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
973 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
974 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
975 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
976 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
979 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
983 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
984 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
985 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
987 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
988 gtkconv = GAIM_GTK_CONVERSATION(conv); |
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 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
991 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 } |
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 void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 im_cb(GtkWidget *widget, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1003 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1005 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1006 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1012 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 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
|
1014 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 if (*name == '@') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 if (*name == '%') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 if (*name == '+') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1023 conv2 = gaim_find_conversation_with_account(name, account); |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1024 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1025 if (conv2 != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1026 gaim_conv_window_raise(gaim_conversation_get_window(conv2)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, name); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 ignore_cb(GtkWidget *w, GaimConversation *conv) |
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 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1036 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1043 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 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
|
1052 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1057 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1058 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1059 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1060 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1062 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 static void |
7398 | 1068 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 { |
7398 | 1070 GaimPluginProtocolInfo *prpl_info = NULL; |
1071 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 |
7398 | 1077 if(account && account->gc) |
1078 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1079 | |
1080 if(prpl_info && prpl_info->get_cb_real_name) | |
1081 real_who = prpl_info->get_cb_real_name(account->gc, | |
1082 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1083 else | |
1084 real_who = g_strdup(who); | |
1085 | |
1086 if(!real_who) | |
1087 return; | |
1088 | |
1089 conv2 = gaim_find_conversation_with_account(real_who, account); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 if (conv2 != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1092 gaim_conv_window_show(gaim_conversation_get_window(conv2)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 else |
7398 | 1094 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); |
1095 | |
1096 g_free(real_who); | |
1097 } | |
1098 | |
1099 static void | |
1100 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) | |
1101 { | |
1102 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1103 | |
1104 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1105 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1106 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1107 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1110 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1114 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1117 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1118 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1119 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1120 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 * If there are special needs for getting info on users in |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 * buddy chat "rooms"... |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 if (prpl_info->get_cb_info != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1125 prpl_info->get_cb_info(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 prpl_info->get_info(gc, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1143 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1144 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1145 * 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
|
1146 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 if (prpl_info->get_cb_away != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1149 prpl_info->get_cb_away(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 menu_chat_add_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1156 GaimAccount *account; |
6695 | 1157 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1160 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1161 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1162 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 if (b != NULL) |
5975 | 1165 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1166 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1167 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
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_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 } |
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 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1178 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1183 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 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
|
1196 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 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
|
1209 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 if (*who == '@') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 if (*who == '%') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 if (*who == '+') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1215 chat_do_im(conv, who); |
1216 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 static GtkWidget *menu = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 GtkWidget *button; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 * If a menu already exists, destroy it before creating a new one, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 * thus freeing-up the memory it occupied. |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 if (menu) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 gtk_widget_destroy(menu); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 menu = gtk_menu_new(); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 button = gtk_menu_item_new_with_label(_("IM")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 G_CALLBACK(menu_chat_im_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1237 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 button = gtk_menu_item_new_with_label(_("Un-Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 button = gtk_menu_item_new_with_label(_("Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 G_CALLBACK(ignore_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 if (gc && prpl_info->get_info) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 button = gtk_menu_item_new_with_label(_("Info")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 G_CALLBACK(menu_chat_info_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1253 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 if (gc && prpl_info->get_cb_away) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 G_CALLBACK(menu_chat_get_away_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 /* Added by Jonas <jonas@birme.se> */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 if (gc) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 if (gaim_find_buddy(gc->account, who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 button = gtk_menu_item_new_with_label(_("Remove")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 button = gtk_menu_item_new_with_label(_("Add")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1274 G_CALLBACK(menu_chat_add_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1276 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1277 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1278 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1279 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 /* End Jonas */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1285 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1288 |
4359 | 1289 static gboolean |
1290 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
1291 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1292 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1293 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1294 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1295 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1296 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1297 conv = (GaimConversation *)data; |
4359 | 1298 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1299 win = gaim_conversation_get_window(conv); | |
4362 | 1300 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 1301 |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
1302 if (event->keyval == GDK_Page_Up) { |
4359 | 1303 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1304 | |
1305 if (!(event->state & GDK_CONTROL_MASK)) | |
1306 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1307 } | |
1308 else if (event->keyval == GDK_Page_Down) { | |
1309 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1310 | |
1311 if (!(event->state & GDK_CONTROL_MASK)) | |
1312 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1313 } | |
6033 | 1314 else if (event->keyval == GDK_F2) { |
1315 | |
1316 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | |
1317 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
4359 | 1318 } |
1319 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1320 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1321 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1322 |
1323 send_cb(NULL, conv); | |
1324 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1325 | |
1326 return TRUE; | |
1327 } | |
1328 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1329 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1330 |
1331 send_cb(NULL, conv); | |
1332 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1333 | |
1334 return TRUE; | |
1335 } | |
1336 | |
1337 return FALSE; | |
1338 } | |
6014 | 1339 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm' || |
1340 event->keyval == 'M')) { | |
4359 | 1341 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1342 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1343 } | |
1344 else if (event->state & GDK_CONTROL_MASK) { | |
1345 switch (event->keyval) { | |
1346 case GDK_Up: | |
1347 if (!conv->send_history) | |
1348 break; | |
1349 | |
1350 if (!conv->send_history->prev) { | |
1351 GtkTextIter start, end; | |
1352 | |
1353 if (conv->send_history->data) | |
1354 g_free(conv->send_history->data); | |
1355 | |
1356 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1357 &start); | |
1358 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1359 | |
1360 conv->send_history->data = | |
1361 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1362 &start, &end, FALSE); | |
1363 } | |
1364 | |
1365 if (conv->send_history->next && | |
1366 conv->send_history->next->data) { | |
1367 | |
1368 conv->send_history = conv->send_history->next; | |
1369 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1370 conv->send_history->data, -1); | |
1371 } | |
1372 | |
1373 break; | |
1374 | |
1375 case GDK_Down: | |
1376 if (!conv->send_history) | |
1377 break; | |
1378 | |
1379 if (conv->send_history->prev) { | |
1380 conv->send_history = conv->send_history->prev; | |
1381 | |
1382 if (conv->send_history->data) | |
1383 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1384 conv->send_history->data, -1); | |
1385 } | |
1386 | |
1387 break; | |
1388 } | |
1389 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1390 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1391 switch (event->keyval) { |
1392 case 'i': | |
1393 case 'I': | |
4685 | 1394 set_toggle(gtkconv->toolbar.italic, |
4359 | 1395 !gtk_toggle_button_get_active( |
1396 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1397 | |
1398 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1399 "key_press_event"); | |
1400 break; | |
1401 | |
1402 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1403 case 'U': | |
4685 | 1404 set_toggle(gtkconv->toolbar.underline, |
4359 | 1405 !gtk_toggle_button_get_active( |
1406 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1407 | |
1408 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1409 "key_press_event"); | |
1410 break; | |
1411 | |
1412 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1413 case 'B': | |
4685 | 1414 set_toggle(gtkconv->toolbar.bold, |
4359 | 1415 !gtk_toggle_button_get_active( |
1416 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1417 | |
1418 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1419 "key_press_event"); | |
1420 break; | |
6014 | 1421 |
4359 | 1422 case '-': |
6015 | 1423 set_toggle(gtkconv->toolbar.smaller_size, |
1424 !gtk_toggle_button_get_active( | |
1425 GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size))); | |
6014 | 1426 |
4359 | 1427 g_signal_stop_emission_by_name(G_OBJECT(entry), |
1428 "key_press_event"); | |
1429 break; | |
1430 | |
1431 case '=': | |
1432 case '+': | |
6015 | 1433 set_toggle(gtkconv->toolbar.larger_size, |
1434 !gtk_toggle_button_get_active( | |
1435 GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size))); | |
4359 | 1436 |
1437 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1438 "key_press_event"); | |
1439 break; | |
1440 | |
1441 case '0': | |
4685 | 1442 set_toggle(gtkconv->toolbar.normal_size, |
1443 !gtk_toggle_button_get_active( | |
1444 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1445 |
1446 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1447 "key_press_event"); | |
1448 break; | |
1449 | |
1450 case 'f': | |
1451 case 'F': | |
4685 | 1452 set_toggle(gtkconv->toolbar.font, |
4359 | 1453 !gtk_toggle_button_get_active( |
4685 | 1454 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1455 |
1456 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1457 "key_press_event"); | |
1458 break; | |
1459 } | |
1460 } | |
1461 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1462 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1463 char buf[7]; |
1464 | |
1465 *buf = '\0'; | |
1466 | |
1467 switch (event->keyval) { | |
1468 case '1': strcpy(buf, ":-)"); break; | |
1469 case '2': strcpy(buf, ":-("); break; | |
1470 case '3': strcpy(buf, ";-)"); break; | |
1471 case '4': strcpy(buf, ":-P"); break; | |
1472 case '5': strcpy(buf, "=-O"); break; | |
1473 case '6': strcpy(buf, ":-*"); break; | |
1474 case '7': strcpy(buf, ">:o"); break; | |
1475 case '8': strcpy(buf, "8-)"); break; | |
1476 case '!': strcpy(buf, ":-$"); break; | |
1477 case '@': strcpy(buf, ":-!"); break; | |
1478 case '#': strcpy(buf, ":-["); break; | |
1479 case '$': strcpy(buf, "O:-)"); break; | |
1480 case '%': strcpy(buf, ":-/"); break; | |
1481 case '^': strcpy(buf, ":'("); break; | |
1482 case '&': strcpy(buf, ":-X"); break; | |
1483 case '*': strcpy(buf, ":-D"); break; | |
1484 default: break; | |
1485 } | |
1486 | |
1487 if (*buf) { | |
1488 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1489 buf, -1); | |
1490 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1491 } | |
1492 } | |
1493 | |
1494 if (event->keyval == 'l') { | |
1495 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1496 g_string_free(conv->history, TRUE); | |
1497 conv->history = g_string_new(""); | |
1498 } | |
1499 else if (event->keyval == 'n') { | |
1500 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1501 | |
1502 show_im_dialog(); | |
1503 } | |
1504 else if (event->keyval == 'z') { | |
1505 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1506 |
1507 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1508 } |
1509 else if (event->keyval == '[') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1510 gaim_conv_window_switch_conversation(win, |
4359 | 1511 gaim_conversation_get_index(conv) - 1); |
1512 | |
1513 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1514 } | |
1515 else if (event->keyval == ']') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1516 gaim_conv_window_switch_conversation(win, |
4359 | 1517 gaim_conversation_get_index(conv) + 1); |
1518 | |
1519 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1520 } | |
1521 else if (event->keyval == GDK_Tab) { | |
1522 move_next_tab(conv); | |
1523 | |
1524 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1525 | |
1526 return TRUE; | |
1527 } | |
1528 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1529 else if (event->keyval == GDK_Tab && |
4359 | 1530 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1531 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1532 |
1533 tab_complete(conv); | |
1534 | |
1535 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1536 | |
1537 return TRUE; | |
1538 } | |
1539 else if ((event->state & GDK_MOD1_MASK) && | |
1540 event->keyval > '0' && event->keyval <= '9') { | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1541 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1542 gaim_conv_window_switch_conversation(win, event->keyval - '1'); |
4359 | 1543 |
1544 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1545 } | |
1546 | |
1547 return FALSE; | |
1548 } | |
1549 | |
1550 /* | |
1551 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1552 * 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
|
1553 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1554 * 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
|
1555 * going all the way down to the notebook. I suspect a bug in |
4359 | 1556 * GtkTextView, but I'm not ready to point any fingers yet. |
1557 */ | |
1558 static gboolean | |
1559 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1560 { | |
1561 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1562 /* Right single click */ | |
1563 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1564 | |
1565 return TRUE; | |
1566 } | |
1567 | |
1568 return FALSE; | |
1569 } | |
1570 | |
6057 | 1571 static gboolean |
1572 refocus_entry_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1573 { | |
1574 GaimGtkConversation *gtkconv = data; | |
1575 | |
1576 gtk_widget_grab_focus(gtkconv->entry); | |
1577 | |
1578 return FALSE; | |
1579 } | |
1580 | |
4359 | 1581 static void |
4673 | 1582 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1583 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1584 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1585 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1586 GaimConversation *conv; |
4359 | 1587 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1588 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1589 |
4491 | 1590 gaim_conversation_set_account(conv, account); |
4359 | 1591 } |
1592 | |
1593 static void | |
1594 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1595 gchar *new_text, gint new_text_length, gpointer user_data) | |
1596 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1597 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1598 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1599 g_return_if_fail(conv != NULL); |
4359 | 1600 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1601 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1602 return; |
1603 | |
1604 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1605 gtk_text_iter_is_end(position))); | |
1606 } | |
1607 | |
1608 static void | |
1609 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1610 GtkTextIter *end_pos, gpointer user_data) | |
1611 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1612 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1613 GaimConvIm *im; |
4359 | 1614 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1615 g_return_if_fail(conv != NULL); |
4359 | 1616 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1617 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1618 return; |
1619 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1620 im = GAIM_CONV_IM(conv); |
4359 | 1621 |
1622 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1623 | |
1624 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1625 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1626 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1627 |
1628 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1629 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1630 GAIM_NOT_TYPING); |
4359 | 1631 } |
1632 else { | |
1633 /* We're deleting, but not all of it, so it counts as typing. */ | |
1634 got_typing_keypress(conv, FALSE); | |
1635 } | |
1636 } | |
1637 | |
1638 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1639 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1640 { |
1641 static GdkCursor *cursor = NULL; | |
1642 | |
1643 gtkwin->in_drag = TRUE; | |
1644 | |
1645 if (gtkwin->drag_leave_signal) { | |
1646 g_signal_handler_disconnect(G_OBJECT(widget), | |
1647 gtkwin->drag_leave_signal); | |
1648 | |
1649 gtkwin->drag_leave_signal = 0; | |
1650 } | |
1651 | |
1652 if (cursor == NULL) | |
1653 cursor = gdk_cursor_new(GDK_FLEUR); | |
1654 | |
1655 /* Grab the pointer */ | |
1656 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1657 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1658 /* 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
|
1659 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1660 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1661 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1662 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1663 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1664 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1665 } |
1666 | |
1667 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1668 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1669 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1670 GaimGtkWindow *gtkwin; |
4359 | 1671 |
1672 gtkwin = GAIM_GTK_WINDOW(win); | |
1673 | |
1674 /* | |
1675 * Make sure the user moved the mouse far enough for the | |
1676 * drag to be initiated. | |
1677 */ | |
1678 if (gtkwin->in_predrag) { | |
1679 if (e->x_root < gtkwin->drag_min_x || | |
1680 e->x_root >= gtkwin->drag_max_x || | |
1681 e->y_root < gtkwin->drag_min_y || | |
1682 e->y_root >= gtkwin->drag_max_y) { | |
1683 | |
1684 gtkwin->in_predrag = FALSE; | |
1685 notebook_init_grab(gtkwin, widget); | |
1686 } | |
1687 } | |
1688 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1689 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1690 GaimGtkWindow *dest_gtkwin; |
4359 | 1691 GtkNotebook *dest_notebook; |
1692 GtkWidget *tab, *last_vis_tab = NULL; | |
1693 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1694 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1695 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1696 GList *l; | |
1697 | |
1698 /* Get the window that the cursor is over. */ | |
1699 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1700 | |
1701 if (dest_win == NULL) { | |
1702 dnd_hints_hide_all(); | |
1703 | |
1704 return TRUE; | |
1705 } | |
1706 | |
1707 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1708 | |
1709 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1710 | |
1711 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1712 | |
1713 arrow1_x = arrow2_x = nb_x; | |
1714 arrow1_y = arrow2_y = nb_y; | |
1715 | |
1716 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1717 e->x_root, e->y_root); | |
1718 | |
1719 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1720 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1721 | |
1722 horiz_tabs = TRUE; | |
1723 } | |
1724 | |
1725 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1726 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1727 l != NULL; |
1728 l = l->next, i++) { | |
1729 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1730 GaimConversation *conv = l->data; |
4359 | 1731 |
1732 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1733 | |
1734 /* | |
1735 * If this is the correct tab, record the positions | |
1736 * for the arrows. | |
1737 */ | |
1738 if (i == page_num) { | |
1739 if (horiz_tabs) { | |
1740 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1741 arrow1_y = nb_y + tab->allocation.y; | |
1742 arrow2_y = nb_y + tab->allocation.y + | |
1743 tab->allocation.height; | |
1744 } | |
1745 else { | |
1746 arrow1_x = nb_x + tab->allocation.x; | |
1747 arrow2_x = nb_x + tab->allocation.x + | |
1748 tab->allocation.width; | |
1749 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1750 } | |
1751 | |
1752 tab_found = TRUE; | |
1753 break; | |
1754 } | |
1755 else { /* Keep track of the right-most tab that we see. */ | |
1756 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1757 last_vis_tab = tab; | |
1758 last_vis_tab_loc = tab->allocation.x; | |
1759 } | |
1760 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1761 last_vis_tab = tab; | |
1762 last_vis_tab_loc = tab->allocation.y; | |
1763 } | |
1764 } | |
1765 } | |
1766 | |
1767 /* | |
1768 * If we didn't find the tab, then we'll just place the | |
1769 * arrows to the right/bottom of the last visible tab. | |
1770 */ | |
1771 if (!tab_found && last_vis_tab) { | |
1772 if (horiz_tabs) { | |
1773 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1774 last_vis_tab->allocation.width; | |
1775 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1776 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1777 last_vis_tab->allocation.height; | |
1778 } | |
1779 else { | |
1780 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1781 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1782 last_vis_tab->allocation.width; | |
1783 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1784 last_vis_tab->allocation.height; | |
1785 } | |
1786 } | |
1787 | |
1788 if (horiz_tabs) { | |
1789 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1790 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1791 } | |
1792 else { | |
1793 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1794 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1795 } | |
1796 } | |
1797 | |
1798 return TRUE; | |
1799 } | |
1800 | |
1801 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1802 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1803 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1804 GaimGtkWindow *gtkwin; |
4359 | 1805 |
1806 gtkwin = GAIM_GTK_WINDOW(win); | |
1807 | |
1808 if (gtkwin->in_drag) | |
1809 return FALSE; | |
1810 | |
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 gtkwin->in_predrag = FALSE; | |
1817 notebook_init_grab(gtkwin, widget); | |
1818 } | |
1819 | |
1820 return TRUE; | |
1821 } | |
1822 | |
1823 /* | |
1824 * THANK YOU GALEON! | |
1825 */ | |
1826 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1827 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1828 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1829 GaimGtkWindow *gtkwin; |
4359 | 1830 gint nb_x, nb_y, x_rel, y_rel; |
1831 GList *l; | |
1832 int tab_clicked; | |
1833 | |
1834 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1835 return FALSE; | |
1836 | |
1837 gtkwin = GAIM_GTK_WINDOW(win); | |
1838 | |
1839 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1840 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1841 "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
|
1842 return TRUE; |
4359 | 1843 } |
1844 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1845 /* |
4359 | 1846 * Make sure a tab was actually clicked. The arrow buttons |
1847 * mess things up. | |
1848 */ | |
1849 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1850 | |
1851 if (tab_clicked == -1) | |
1852 return FALSE; | |
1853 | |
1854 /* | |
1855 * Get the relative position of the press event, with regards to | |
1856 * the position of the notebook. | |
1857 */ | |
1858 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1859 | |
1860 x_rel = e->x_root - nb_x; | |
1861 y_rel = e->y_root - nb_y; | |
1862 | |
1863 /* Reset the min/max x/y */ | |
1864 gtkwin->drag_min_x = 0; | |
1865 gtkwin->drag_min_y = 0; | |
1866 gtkwin->drag_max_x = 0; | |
1867 gtkwin->drag_max_y = 0; | |
1868 | |
1869 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1870 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
|
1871 GaimConversation *conv = l->data; |
4359 | 1872 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1873 | |
1874 if (!GTK_WIDGET_VISIBLE(tab)) | |
1875 continue; | |
1876 | |
1877 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1878 break; | |
1879 | |
1880 /* Save the borders of the tab. */ | |
1881 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1882 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1883 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1884 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1885 } | |
1886 | |
1887 /* Make sure the click occurred in the tab. */ | |
1888 if (e->x_root < gtkwin->drag_min_x || | |
1889 e->x_root >= gtkwin->drag_max_x || | |
1890 e->y_root < gtkwin->drag_min_y || | |
1891 e->y_root >= gtkwin->drag_max_y) { | |
1892 | |
1893 return FALSE; | |
1894 } | |
1895 | |
1896 gtkwin->in_predrag = TRUE; | |
1897 | |
1898 /* Connect the new motion signals. */ | |
1899 gtkwin->drag_motion_signal = | |
1900 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1901 G_CALLBACK(notebook_motion_cb), win); | |
1902 | |
1903 gtkwin->drag_leave_signal = | |
1904 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1905 G_CALLBACK(notebook_leave_cb), win); | |
1906 | |
1907 return FALSE; | |
1908 } | |
1909 | |
1910 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1911 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1912 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1913 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1914 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1915 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1916 GaimConversation *conv; |
4359 | 1917 GtkNotebook *dest_notebook; |
1918 gint dest_page_num; | |
1919 | |
1920 /* | |
1921 * Don't check to make sure that the event's window matches the | |
1922 * widget's, because we may be getting an event passed on from the | |
1923 * close button. | |
1924 */ | |
1925 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1926 return FALSE; | |
1927 | |
1928 if (gdk_pointer_is_grabbed()) { | |
1929 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1930 gtk_grab_remove(widget); | |
1931 } | |
1932 | |
1933 gtkwin = GAIM_GTK_WINDOW(win); | |
1934 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1935 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1936 return FALSE; |
4359 | 1937 |
1938 /* Disconnect the motion signal. */ | |
1939 if (gtkwin->drag_motion_signal) { | |
1940 g_signal_handler_disconnect(G_OBJECT(widget), | |
1941 gtkwin->drag_motion_signal); | |
1942 | |
1943 gtkwin->drag_motion_signal = 0; | |
1944 } | |
1945 | |
1946 /* | |
1947 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1948 * signal. | |
1949 */ | |
1950 if (gtkwin->in_predrag) { | |
1951 gtkwin->in_predrag = FALSE; | |
1952 | |
1953 if (gtkwin->drag_leave_signal) { | |
1954 g_signal_handler_disconnect(G_OBJECT(widget), | |
1955 gtkwin->drag_leave_signal); | |
1956 | |
1957 gtkwin->drag_leave_signal = 0; | |
1958 } | |
1959 } | |
1960 | |
1961 /* If we're not in drag... */ | |
1962 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1963 if (!gtkwin->in_drag) |
4359 | 1964 return FALSE; |
1965 | |
1966 gtkwin->in_drag = FALSE; | |
1967 | |
1968 dnd_hints_hide_all(); | |
1969 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1970 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1971 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1972 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1973 |
1974 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1975 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1976 return FALSE; |
1977 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1978 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1979 /* Make a new window to stick this to. */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1980 GaimConvWindow *new_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1981 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1982 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1983 gint win_width, win_height; |
5121 | 1984 |
1985 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1986 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1987 new_win = gaim_conv_window_new(); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1988 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1989 gaim_conv_window_add_conversation(new_win, |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1990 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1991 gaim_conversation_get_index(conv))); |
5121 | 1992 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1993 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1994 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1995 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1996 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1997 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1998 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1999 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2000 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2001 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2002 gaim_conv_window_show(new_win); |
4359 | 2003 } |
2004 | |
2005 return TRUE; | |
2006 } | |
2007 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2008 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2009 |
4359 | 2010 /* Get the destination notebook. */ |
2011 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
2012 | |
2013 /* Get the destination page number. */ | |
2014 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
7143 | 2015 e->x_root, e->y_root); |
4359 | 2016 |
2017 if (win == dest_win) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2018 gaim_conv_window_move_conversation(win, |
4359 | 2019 gaim_conversation_get_index(conv), dest_page_num); |
2020 } | |
2021 else { | |
2022 size_t pos; | |
2023 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2024 gaim_conv_window_remove_conversation(win, |
4359 | 2025 gaim_conversation_get_index(conv)); |
2026 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2027 pos = gaim_conv_window_add_conversation(dest_win, conv); |
4359 | 2028 |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
2029 if (pos != dest_page_num) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2030 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2031 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2032 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
4359 | 2033 } |
2034 | |
2035 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
2036 | |
2037 return TRUE; | |
2038 } | |
2039 | |
7143 | 2040 static GdkPixbuf *get_tab_icon(GaimConversation *conv) |
2041 { | |
2042 GaimAccount *account = gaim_conversation_get_account(conv); | |
2043 const char *name = gaim_conversation_get_name(conv); | |
2044 GdkPixbuf *status = NULL; | |
2045 | |
2046 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2047 GaimBuddy *b = gaim_find_buddy(account, name); | |
2048 if (b != NULL) { | |
2049 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
2050 GAIM_STATUS_ICON_SMALL); | |
2051 } | |
2052 } | |
2053 | |
2054 if (!status) { | |
2055 GdkPixbuf *pixbuf; | |
2056 pixbuf = create_prpl_icon(account); | |
2057 | |
2058 if (pixbuf) { | |
2059 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
2060 GDK_INTERP_BILINEAR); | |
2061 g_object_unref(pixbuf); | |
2062 } | |
2063 } | |
2064 return status; | |
2065 } | |
2066 | |
4359 | 2067 static void |
2068 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
2069 gpointer user_data) | |
2070 { | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2071 GaimPluginProtocolInfo *prpl_info = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2072 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2073 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2074 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2075 GaimGtkWindow *gtkwin; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2076 GaimConnection *gc; |
7222 | 2077 GdkPixbuf *window_icon = NULL; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2078 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2079 win = (GaimConvWindow *)user_data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2080 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2081 conv = gaim_conv_window_get_conversation_at(win, page_num); |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
2082 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2083 g_return_if_fail(conv != NULL); |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
2084 |
4359 | 2085 gc = gaim_conversation_get_gc(conv); |
2086 gtkwin = GAIM_GTK_WINDOW(win); | |
2087 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2088 | |
2089 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2090 | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2091 if (gc != NULL) { |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2092 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2093 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2094 } |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2095 |
7619
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2096 |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2097 if (gaim_prpl_has_send_file (gc, gaim_conversation_get_name(conv))) { |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2098 gtk_widget_show(gtkwin->menu.sendfile); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2099 gtk_widget_set_sensitive(gtkwin->menu.sendfile, TRUE); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2100 } else { |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2101 gtk_widget_hide(gtkwin->menu.sendfile); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2102 gtk_widget_set_sensitive(gtkwin->menu.sendfile, FALSE); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2103 } |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2104 |
4359 | 2105 /* Update the menubar */ |
2106 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2107 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2108 |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2109 if (gc && prpl_info->options & OPT_PROTO_IM_IMAGE) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2110 gtk_widget_show(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2111 gtk_widget_set_sensitive(gtkconv->toolbar.image, TRUE); |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2112 |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2113 } |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2114 else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2115 gtk_widget_hide(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2116 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2117 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2118 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2119 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2120 gtk_widget_show(gtkwin->menu.get_info); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2121 gtk_widget_show(gtkwin->menu.warn); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2122 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2123 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2124 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2125 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2127 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2128 gtk_widget_hide(gtkwin->menu.remove); |
5911
865f235ffaf0
[gaim-migrate @ 6343]
Christian Hammond <chipx86@chipx86.com>
parents:
5908
diff
changeset
|
2129 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2130 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2131 else { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2132 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2133 gtk_widget_hide(gtkwin->menu.add); |
5911
865f235ffaf0
[gaim-migrate @ 6343]
Christian Hammond <chipx86@chipx86.com>
parents:
5908
diff
changeset
|
2134 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2135 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2136 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2137 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2138 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2139 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2140 gtk_widget_hide(gtkwin->menu.invite); |
4359 | 2141 |
2142 if (gtkwin->menu.send_as != NULL) | |
4685 | 2143 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2144 |
7143 | 2145 if (gtkconv->u.im->anim) { |
7219 | 2146 window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
2147 g_object_ref(window_icon); | |
7143 | 2148 } else { |
7219 | 2149 window_icon = get_tab_icon(conv); |
7143 | 2150 } |
4359 | 2151 } |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2152 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2153 gtk_widget_show(gtkwin->menu.invite); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2154 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2155 gtk_widget_hide(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2156 gtk_widget_hide(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
2157 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2158 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2159 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2160 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2161 gtk_widget_hide(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2162 gtk_widget_hide(gtkwin->menu.get_info); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2163 gtk_widget_hide(gtkwin->menu.warn); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2164 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2165 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2166 if (gaim_find_chat(gaim_conversation_get_gc(conv), |
7143 | 2167 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2168 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2169 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2170 gtk_widget_hide(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2171 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2172 else { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2173 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2174 gtk_widget_hide(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2175 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2176 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2177 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2178 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2179 |
4359 | 2180 if (gtkwin->menu.send_as != NULL) |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2181 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
7219 | 2182 window_icon = get_tab_icon(conv); |
4359 | 2183 } |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2184 |
4736 | 2185 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2186 |
4359 | 2187 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2188 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2189 |
4359 | 2190 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2191 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2192 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2193 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2194 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2195 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2196 |
4359 | 2197 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2198 |
7219 | 2199 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2200 g_object_unref(G_OBJECT(window_icon)); | |
4965 | 2201 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2202 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2203 } |
2204 | |
2205 /************************************************************************** | |
2206 * Utility functions | |
2207 **************************************************************************/ | |
2208 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2209 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 2210 { |
2211 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bold))) | |
2212 gaim_gtk_surround(gtkconv, "<B>", "</B>"); | |
2213 else | |
2214 gaim_gtk_advance_past(gtkconv, "<B>", "</B>"); | |
2215 | |
2216 gtk_widget_grab_focus(gtkconv->entry); | |
2217 } | |
2218 | |
2219 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2220 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 2221 { |
2222 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(italic))) | |
2223 gaim_gtk_surround(gtkconv, "<I>", "</I>"); | |
2224 else | |
2225 gaim_gtk_advance_past(gtkconv, "<I>", "</I>"); | |
2226 | |
2227 gtk_widget_grab_focus(gtkconv->entry); | |
2228 } | |
2229 | |
2230 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2231 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 2232 { |
2233 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(underline))) | |
2234 gaim_gtk_surround(gtkconv, "<U>", "</U>"); | |
2235 else | |
2236 gaim_gtk_advance_past(gtkconv, "<U>", "</U>"); | |
2237 | |
2238 gtk_widget_grab_focus(gtkconv->entry); | |
2239 } | |
2240 | |
2241 static void | |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
2242 do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv) |
4359 | 2243 { |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
2244 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb))) |
5049 | 2245 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); |
2246 else | |
2247 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
4359 | 2248 |
2249 gtk_widget_grab_focus(gtkconv->entry); | |
2250 } | |
2251 | |
2252 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2253 do_normal(GtkWidget *normal, GaimGtkConversation *gtkconv) |
4359 | 2254 { |
5049 | 2255 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(normal))) |
2256 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
2257 else | |
2258 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
4359 | 2259 |
2260 gtk_widget_grab_focus(gtkconv->entry); | |
2261 } | |
2262 | |
2263 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2264 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 2265 { |
5049 | 2266 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) |
2267 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
2268 else | |
2269 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
4359 | 2270 |
2271 gtk_widget_grab_focus(gtkconv->entry); | |
2272 } | |
2273 | |
2274 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2275 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 2276 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2277 GaimGtkConversation *gtkconv; |
4359 | 2278 |
2279 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2280 | |
2281 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) | |
2282 show_font_dialog(conv, font); | |
5582 | 2283 else if (gtkconv->dialogs.font != NULL) |
4359 | 2284 cancel_font(font, conv); |
2285 else | |
2286 gaim_gtk_advance_past(gtkconv, "<FONT FACE>", "</FONT>"); | |
2287 } | |
2288 | |
2289 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2290 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2291 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2292 GaimGtkConversation *gtkconv; |
4359 | 2293 |
2294 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2295 | |
2296 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2297 show_fgcolor_dialog(conv, color); | |
2298 else if (gtkconv->dialogs.fg_color != NULL) | |
2299 cancel_fgcolor(color, conv); | |
2300 else | |
2301 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
2302 } | |
2303 | |
2304 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2305 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2306 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2307 GaimGtkConversation *gtkconv; |
4359 | 2308 |
2309 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2310 | |
2311 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2312 show_bgcolor_dialog(conv, color); | |
2313 else if (gtkconv->dialogs.bg_color != NULL) | |
2314 cancel_bgcolor(color, conv); | |
2315 else | |
2316 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
2317 } | |
2318 | |
2319 static void | |
2320 check_everything(GtkTextBuffer *buffer) | |
2321 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2322 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2323 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2324 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2325 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 2326 "user_data"); |
2327 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2328 g_return_if_fail(conv != NULL); |
4359 | 2329 |
2330 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2331 | |
2332 /* CONV TODO */ | |
2333 } | |
2334 | |
2335 static void | |
4685 | 2336 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 2337 { |
2338 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
2339 } | |
2340 | |
2341 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2342 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2343 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2344 GaimConvIm *im; |
4685 | 2345 |
4359 | 2346 /* |
2347 * 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
|
2348 * send GAIM_TYPED any time soon. |
4359 | 2349 */ |
2350 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2351 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2352 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2353 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2354 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2355 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2356 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2357 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2358 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2359 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2360 |
2361 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2362 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2363 GAIM_TYPING); |
4359 | 2364 |
2365 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2366 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2367 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2368 gaim_conv_im_set_type_again(im, 0); |
4359 | 2369 } |
2370 } | |
2371 | |
4736 | 2372 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2373 update_typing_icon(GaimConversation *conv) |
4736 | 2374 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2375 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2376 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2377 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2378 |
2379 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2380 | |
2381 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2382 im = GAIM_CONV_IM(conv); |
4736 | 2383 |
2384 if(gtkwin->menu.typing_icon) { | |
2385 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2386 gtkwin->menu.typing_icon = NULL; | |
2387 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2388 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2389 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2390 gtk_image_menu_item_set_image( | |
2391 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2392 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2393 GTK_ICON_SIZE_MENU)); | |
4757 | 2394 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2395 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2396 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2397 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2398 gtk_image_menu_item_set_image( | |
2399 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2400 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2401 GTK_ICON_SIZE_MENU)); | |
4757 | 2402 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2403 _("User has typed something and paused"), NULL); |
2404 } | |
2405 | |
2406 if(gtkwin->menu.typing_icon) { | |
2407 gtk_menu_item_set_right_justified( | |
2408 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2409 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2410 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2411 gtkwin->menu.typing_icon); | |
2412 } | |
2413 } | |
2414 | |
4685 | 2415 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2416 update_send_as_selection(GaimConvWindow *win) |
4359 | 2417 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2418 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2419 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2420 GaimGtkWindow *gtkwin; |
4359 | 2421 GtkWidget *menu; |
2422 GList *child; | |
2423 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2424 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2425 return FALSE; |
4849 | 2426 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2427 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2428 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2429 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2430 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2431 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2432 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2433 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2434 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2435 if (gtkwin->menu.send_as == NULL) |
4685 | 2436 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2437 |
4359 | 2438 gtk_widget_show(gtkwin->menu.send_as); |
2439 | |
2440 menu = gtk_menu_item_get_submenu( | |
2441 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2442 | |
2443 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2444 child != NULL; | |
2445 child = child->next) { | |
2446 | |
2447 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2448 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2449 "gaim_account"); |
2450 | |
2451 if (account == item_account) { | |
4359 | 2452 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2453 break; | |
2454 } | |
2455 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2456 |
4685 | 2457 return FALSE; |
4359 | 2458 } |
2459 | |
2460 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2461 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2462 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2463 GaimGtkWindow *gtkwin; |
4359 | 2464 GtkWidget *menu; |
2465 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2466 GList *gcs; |
4359 | 2467 GList *convs; |
2468 GSList *group = NULL; | |
2469 gboolean first_offline = TRUE; | |
2470 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2471 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2472 |
2473 gtkwin = GAIM_GTK_WINDOW(win); | |
2474 | |
2475 if (gtkwin->menu.send_as != NULL) | |
2476 gtk_widget_destroy(gtkwin->menu.send_as); | |
2477 | |
2478 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2479 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2480 /* Now make sure we don't have any Offline entries. */ |
2481 gboolean found_offline = FALSE; | |
2482 | |
2483 for (convs = gaim_get_conversations(); | |
2484 convs != NULL; | |
2485 convs = convs->next) { | |
2486 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2487 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2488 GaimAccount *account; |
4491 | 2489 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2490 conv = (GaimConversation *)convs->data; |
4491 | 2491 account = gaim_conversation_get_account(conv); |
2492 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2493 if (account != NULL && account->gc == NULL) { |
4359 | 2494 found_offline = TRUE; |
2495 break; | |
2496 } | |
2497 } | |
2498 | |
2499 if (!found_offline) { | |
2500 gtkwin->menu.send_as = NULL; | |
2501 return; | |
2502 } | |
2503 } | |
2504 | |
2505 /* Build the Send As menu */ | |
2506 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2507 gtk_widget_show(gtkwin->menu.send_as); | |
2508 | |
2509 menu = gtk_menu_new(); | |
2510 | |
2511 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2512 gtkwin->menu.send_as); | |
2513 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); | |
2514 | |
2515 gtk_widget_show(menu); | |
2516 | |
2517 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2518 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2519 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2520 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2521 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2522 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2523 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2524 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2525 GdkPixbuf *pixbuf, *scale; |
4359 | 2526 |
2527 found_online = TRUE; | |
2528 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2529 gc = (GaimConnection *)gcs->data; |
4359 | 2530 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2531 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2532 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2533 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
|
2534 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2535 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2536 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2537 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2538 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2539 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2540 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2541 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2542 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2543 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2544 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2545 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2546 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2547 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2548 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2549 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2550 gaim_account_get_username(account)); |
4793 | 2551 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2552 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2553 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2554 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2555 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2556 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2557 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2558 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2559 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2560 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2561 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2562 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2563 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2564 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2565 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2566 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2567 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2568 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2569 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2570 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2571 /* Set our data and callbacks. */ |
4359 | 2572 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2573 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2574 |
4786 | 2575 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2576 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2577 |
2578 gtk_widget_show(menuitem); | |
2579 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2580 } | |
2581 | |
2582 /* | |
2583 * Fill it with any accounts that still has an open (yet disabled) window | |
2584 * (signed off accounts with a window open). | |
2585 */ | |
2586 for (convs = gaim_get_conversations(); | |
2587 convs != NULL; | |
2588 convs = convs->next) { | |
2589 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2590 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2591 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2592 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2593 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2594 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2595 GdkPixbuf *pixbuf, *scale; |
4359 | 2596 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2597 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2598 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2599 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2600 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2601 |
4491 | 2602 account = gaim_conversation_get_account(conv); |
2603 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2604 if (account != NULL && account->gc == NULL) { |
4359 | 2605 if (first_offline && found_online) { |
2606 menuitem = gtk_separator_menu_item_new(); | |
2607 gtk_widget_show(menuitem); | |
2608 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2609 | |
2610 first_offline = FALSE; | |
2611 } | |
2612 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2613 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2614 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2615 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2616 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2617 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2618 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2619 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2620 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2621 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2622 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2623 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2624 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2625 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2626 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2627 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2628 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2629 /* Make our menu item */ |
4359 | 2630 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2631 account->username); |
4793 | 2632 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2633 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2634 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2635 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2636 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2637 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2638 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2639 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2640 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2641 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2642 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2643 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2644 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2645 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2646 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2647 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2648 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2649 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2650 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2651 |
4359 | 2652 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2653 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2654 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2655 |
4786 | 2656 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2657 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2658 |
4359 | 2659 gtk_widget_show(menuitem); |
2660 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2661 } | |
2662 } | |
2663 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2664 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2665 |
4359 | 2666 gtk_widget_show(gtkwin->menu.send_as); |
2667 update_send_as_selection(win); | |
2668 } | |
2669 | |
2670 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2671 generate_invite_user_names(GaimConnection *gc) |
4359 | 2672 { |
6695 | 2673 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2674 static GList *tmp = NULL; |
2675 | |
2676 if (tmp) | |
2677 g_list_free(tmp); | |
2678 | |
2679 tmp = g_list_append(NULL, ""); | |
2680 | |
2681 if (gc != NULL) { | |
4785 | 2682 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2683 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2684 continue; | |
6695 | 2685 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2686 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2687 continue; |
6695 | 2688 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2689 GaimBuddy *buddy; | |
2690 | |
2691 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2692 continue; | |
2693 | |
2694 buddy = (GaimBuddy *)bnode; | |
2695 | |
2696 if (buddy->account == gc->account && | |
2697 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2698 tmp = g_list_append(tmp, buddy->name); | |
2699 } | |
4359 | 2700 } |
2701 } | |
2702 } | |
2703 | |
2704 return tmp; | |
2705 } | |
2706 | |
2707 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2708 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2709 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2710 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2711 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2712 GaimConvChat *chat; |
4359 | 2713 GtkTreeIter iter; |
2714 GtkListStore *ls; | |
2715 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2716 chat = GAIM_CONV_CHAT(conv); |
4359 | 2717 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2718 gtkchat = gtkconv->u.chat; | |
2719 | |
2720 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2721 | |
2722 gtk_list_store_append(ls, &iter); | |
2723 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2724 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2725 1, name, -1); |
2726 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2727 GTK_SORT_ASCENDING); | |
2728 } | |
2729 | |
2730 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2731 tab_complete(GaimConversation *conv) |
4359 | 2732 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2733 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2734 GaimConvChat *chat; |
4359 | 2735 GtkTextIter cursor, word_start, start_buffer; |
2736 int start; | |
2737 int most_matched = -1; | |
2738 char *entered, *partial = NULL; | |
2739 char *text; | |
2740 GList *matches = NULL; | |
2741 GList *nicks = NULL; | |
2742 | |
2743 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2744 chat = GAIM_CONV_CHAT(conv); |
4359 | 2745 |
2746 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2747 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2748 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2749 | |
2750 word_start = cursor; | |
2751 | |
2752 /* if there's nothing there just return */ | |
2753 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2754 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2755 |
4359 | 2756 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2757 &cursor, FALSE); | |
2758 | |
2759 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2760 start = strlen(text) - 1; | |
2761 | |
2762 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2763 gtk_text_iter_backward_chars(&word_start, 2); | |
2764 | |
2765 /* find the start of the word that we're tabbing */ | |
2766 while (start >= 0 && text[start] != ' ') { | |
2767 gtk_text_iter_backward_char(&word_start); | |
2768 start--; | |
2769 } | |
2770 | |
2771 g_free(text); | |
2772 | |
2773 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2774 &cursor, FALSE); | |
2775 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2776 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2777 if (strlen(entered) >= 2 && |
2778 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2779 | |
2780 entered[strlen(entered) - 2] = 0; | |
2781 } | |
2782 } | |
2783 | |
2784 if (!strlen(entered)) { | |
2785 g_free(entered); | |
2786 return; | |
2787 } | |
2788 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2789 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 2790 nicks != NULL; |
2791 nicks = nicks->next) { | |
2792 | |
2793 char *nick = nicks->data; | |
2794 /* this checks to see if the current nick could be a completion */ | |
4793 | 2795 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2796 if (*nick != '+' && *nick != '@' && *nick != '%') |
4359 | 2797 continue; |
2798 | |
4793 | 2799 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { |
4359 | 2800 if (nick[0] != '@' || nick[1] != '+') |
2801 continue; | |
2802 | |
4793 | 2803 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) |
4359 | 2804 continue; |
2805 else | |
2806 nick += 2; | |
2807 } | |
2808 else | |
2809 nick++; | |
2810 } | |
2811 | |
2812 /* if we're here, it's a possible completion */ | |
2813 | |
2814 /* 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
|
2815 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2816 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2817 &word_start, &cursor); | |
2818 | |
2819 if (strlen(nick) == strlen(entered)) { | |
2820 nicks = (nicks->next | |
2821 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2822 : gaim_conv_chat_get_users(chat)); |
4359 | 2823 |
2824 nick = nicks->data; | |
2825 | |
2826 if (*nick == '@') nick++; | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2827 if (*nick == '%') nick++; |
4359 | 2828 if (*nick == '+') nick++; |
2829 } | |
2830 | |
2831 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2832 &start_buffer); | |
2833 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2834 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2835 | |
2836 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2837 char *tmp = g_strdup_printf("%s: ", nick); | |
2838 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2839 tmp, -1); | |
2840 g_free(tmp); | |
2841 } | |
2842 else | |
2843 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2844 nick, -1); | |
2845 | |
2846 g_free(entered); | |
2847 | |
2848 return; | |
2849 } | |
2850 | |
2851 /* we're only here if we're doing new style */ | |
2852 if (most_matched == -1) { | |
2853 /* | |
2854 * this will only get called once, since from now | |
2855 * on most_matched is >= 0 | |
2856 */ | |
2857 most_matched = strlen(nick); | |
2858 partial = g_strdup(nick); | |
2859 } | |
2860 else if (most_matched) { | |
4793 | 2861 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2862 most_matched--; |
2863 | |
2864 partial[most_matched] = 0; | |
2865 } | |
2866 | |
2867 matches = g_list_append(matches, nick); | |
2868 } | |
2869 | |
2870 /* we're only here if we're doing new style */ | |
2871 | |
2872 /* if there weren't any matches, return */ | |
2873 if (!matches) { | |
2874 /* if matches isn't set partials won't be either */ | |
2875 g_free(entered); | |
2876 return; | |
2877 } | |
2878 | |
2879 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2880 | |
2881 if (!matches->next) { | |
2882 /* there was only one match. fill it in. */ | |
2883 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2884 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2885 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2886 | |
2887 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2888 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2889 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2890 g_free(tmp); | |
2891 } | |
2892 else | |
2893 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2894 matches->data, -1); | |
2895 | |
2896 matches = g_list_remove(matches, matches->data); | |
2897 } | |
2898 else { | |
2899 /* | |
2900 * there were lots of matches, fill in as much as possible | |
2901 * and display all of them | |
2902 */ | |
2903 char *addthis = g_malloc0(1); | |
2904 | |
2905 while (matches) { | |
2906 char *tmp = addthis; | |
2907 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2908 g_free(tmp); | |
2909 matches = g_list_remove(matches, matches->data); | |
2910 } | |
2911 | |
6982 | 2912 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 2913 time(NULL)); |
2914 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2915 g_free(addthis); | |
2916 } | |
2917 | |
2918 g_free(entered); | |
2919 g_free(partial); | |
2920 } | |
2921 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2922 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2923 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2924 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2925 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2926 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2927 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2928 window = gtk_file_selection_new(_("Gaim - Save Conversation")); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2929 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2930 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", |
7261 | 2931 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2932 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2933 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
|
2934 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2935 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 2936 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2937 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
|
2938 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2939 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2940 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2941 |
4359 | 2942 static GtkItemFactoryEntry menu_items[] = |
2943 { | |
2944 /* Conversation menu */ | |
4596 | 2945 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2946 |
4596 | 2947 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 2948 "<StockItem>", GTK_STOCK_SAVE_AS }, |
7295 | 2949 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
2950 { N_("/Conversation/Search..."), NULL, menu_search_cb, 0, "<StockItem>", GTK_STOCK_FIND }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2951 |
4359 | 2952 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2953 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2954 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2955 0, NULL }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2956 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2957 "<StockItem>", GAIM_STOCK_EDIT }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2958 { N_("/Conversation/_Get Info..."), NULL, menu_get_info_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2959 "<StockItem>", GAIM_STOCK_INFO }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2960 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2961 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2962 |
7619
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2963 { N_("/Conversation/Send _File..."), NULL, menu_sendfile_cb, 0, |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2964 "<StockItem>", GAIM_STOCK_INVITE }, |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
2965 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2966 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2967 |
4596 | 2968 { N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0, |
4359 | 2969 "<StockItem>", GAIM_STOCK_LINK }, |
4596 | 2970 { N_("/Conversation/Insert _Image..."), NULL, menu_insert_image_cb, 0, |
4359 | 2971 "<StockItem>", GAIM_STOCK_IMAGE }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2972 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2973 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2974 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2975 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2976 "<StockItem>", GAIM_STOCK_WARN }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2977 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2978 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2979 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2980 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2981 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2982 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2983 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2984 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2985 |
4596 | 2986 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 2987 "<StockItem>", GTK_STOCK_CLOSE }, |
2988 | |
2989 /* Options */ | |
4596 | 2990 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
2991 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
2992 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2993 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 2994 }; |
2995 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2996 static const int menu_item_count = |
4359 | 2997 sizeof(menu_items) / sizeof(*menu_items); |
2998 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2999 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3000 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3001 { |
7386 | 3002 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3003 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3004 |
4359 | 3005 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3006 setup_menubar(GaimConvWindow *win) |
4359 | 3007 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3008 GaimGtkWindow *gtkwin; |
5116 | 3009 GtkAccelGroup *accel_group; |
4359 | 3010 gtkwin = GAIM_GTK_WINDOW(win); |
3011 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3012 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3013 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3014 g_object_unref (accel_group); |
5116 | 3015 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3016 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3017 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3018 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3019 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3020 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3021 NULL, NULL); |
4630 | 3022 |
3023 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3024 menu_items, win); |
7420 | 3025 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3026 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3027 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3028 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3029 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3030 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3031 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3032 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3033 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3034 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3035 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3036 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3037 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3038 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3039 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3040 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3041 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3042 gtkwin->menu.alias = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3043 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3044 N_("/Conversation/Alias...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3045 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3046 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3047 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3048 N_("/Conversation/Get Info...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3049 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3050 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3051 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3052 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3053 |
7619
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
3054 gtkwin->menu.sendfile = |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
3055 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
3056 N_("/Conversation/Send File...")); |
994b2d782711
[gaim-migrate @ 8243]
Christian Hammond <chipx86@chipx86.com>
parents:
7589
diff
changeset
|
3057 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3058 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3059 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3060 gtkwin->menu.insert_link = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3061 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3062 N_("/Conversation/Insert URL...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3064 gtkwin->menu.insert_image = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3065 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3066 N_("/Conversation/Insert Image...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3067 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3068 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3069 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3070 gtkwin->menu.warn = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3071 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3072 N_("/Conversation/Warn...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3073 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3074 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3075 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3076 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3077 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3078 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3079 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3080 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3081 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3082 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3083 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3084 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3085 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3086 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3087 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3088 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3089 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3090 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3091 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3092 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3093 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3094 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3095 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3096 N_("/Options/Show Formatting Toolbar")); |
4359 | 3097 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3098 generate_send_as_items(win, NULL); |
4359 | 3099 |
3100 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3101 |
3102 return gtkwin->menu.menubar; | |
4359 | 3103 } |
3104 | |
3105 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3106 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3107 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3108 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3109 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3110 GaimGtkImPane *gtkim; |
4359 | 3111 GaimConversationType type = GAIM_CONV_IM; |
3112 | |
3113 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3114 gtkim = gtkconv->u.im; | |
3115 gc = gaim_conversation_get_gc(conv); | |
3116 | |
3117 /* From right to left... */ | |
3118 | |
3119 /* Send button */ | |
3120 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3121 GAIM_STOCK_SEND, type); | |
3122 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3123 | |
3124 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3125 | |
3126 /* Separator */ | |
3127 if (gtkim->sep2 != NULL) | |
3128 gtk_widget_destroy(gtkim->sep2); | |
3129 | |
3130 gtkim->sep2 = gtk_vseparator_new(); | |
3131 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3132 gtk_widget_show(gtkim->sep2); | |
3133 | |
3134 /* Now, um, just kind of all over the place. Huh? */ | |
3135 | |
3136 /* Add button */ | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3137 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3138 gaim_conversation_get_name(conv)) == NULL) { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3139 |
4359 | 3140 gtkim->add = gaim_gtk_change_text(_("Add"), gtkim->add, |
3141 GTK_STOCK_ADD, type); | |
3142 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3143 _("Add the user to your buddy list"), NULL); |
4359 | 3144 } |
3145 else { | |
3146 gtkim->add = gaim_gtk_change_text(_("Remove"), gtkim->add, | |
3147 GTK_STOCK_REMOVE, type); | |
3148 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3149 _("Remove the user from your buddy list"), NULL); |
4359 | 3150 } |
3151 | |
3152 gtk_box_pack_start(GTK_BOX(parent), gtkim->add, | |
3153 FALSE, FALSE, 0); | |
3154 | |
3155 /* Warn button */ | |
3156 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
3157 GAIM_STOCK_WARN, type); | |
3158 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3159 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3160 _("Warn the user"), NULL); |
4359 | 3161 |
3162 /* Info button */ | |
3163 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
3164 GAIM_STOCK_INFO, type); | |
3165 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); | |
3166 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3167 _("Get the user's information"), NULL); |
4359 | 3168 |
3169 /* Block button */ | |
3170 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
3171 GAIM_STOCK_BLOCK, type); | |
3172 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3173 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3174 _("Block the user"), NULL); |
4359 | 3175 |
3176 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); | |
3177 gtk_button_set_relief(GTK_BUTTON(gtkim->add), GTK_RELIEF_NONE); | |
3178 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3179 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
3180 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3181 | |
3182 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); | |
3183 gtk_size_group_add_widget(gtkconv->sg, gtkim->add); | |
3184 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3185 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
3186 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3187 | |
3188 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3189 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3190 gtk_box_reorder_child(GTK_BOX(parent), gtkim->add, 3); |
4359 | 3191 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 4); |
3192 | |
3193 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3194 | |
3195 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3196 G_CALLBACK(send_cb), conv); | |
3197 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3198 G_CALLBACK(info_cb), conv); | |
3199 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3200 G_CALLBACK(warn_cb), conv); | |
3201 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3202 G_CALLBACK(block_cb), conv); | |
3203 } | |
3204 | |
3205 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3206 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3207 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3208 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3209 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3210 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3211 GaimGtkWindow *gtkwin; |
4359 | 3212 GtkWidget *sep; |
3213 | |
3214 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3215 gtkchat = gtkconv->u.chat; | |
3216 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3217 gc = gaim_conversation_get_gc(conv); | |
3218 | |
3219 /* Send button */ | |
3220 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3221 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3222 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3223 | |
3224 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3225 | |
3226 /* Separator */ | |
3227 sep = gtk_vseparator_new(); | |
3228 gtk_box_pack_end(GTK_BOX(parent), sep, FALSE, TRUE, 0); | |
3229 gtk_widget_show(sep); | |
3230 | |
3231 /* Invite */ | |
3232 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3233 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3234 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3235 _("Invite a user"), NULL); | |
3236 gtk_box_pack_end(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); | |
3237 | |
3238 /* Set the relief on these. */ | |
3239 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
3240 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
3241 | |
3242 /* Callbacks */ | |
3243 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3244 G_CALLBACK(send_cb), conv); | |
3245 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", | |
3246 G_CALLBACK(invite_cb), conv); | |
3247 } | |
3248 | |
3249 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3250 build_conv_toolbar(GaimConversation *conv) |
4359 | 3251 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3252 GaimGtkConversation *gtkconv; |
4359 | 3253 GtkWidget *vbox; |
3254 GtkWidget *hbox; | |
3255 GtkWidget *button; | |
3256 GtkWidget *sep; | |
3257 GtkSizeGroup *sg; | |
3258 | |
3259 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3260 | |
3261 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3262 | |
3263 vbox = gtk_vbox_new(FALSE, 0); | |
3264 sep = gtk_hseparator_new(); | |
3265 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3266 | |
3267 hbox = gtk_hbox_new(FALSE, 5); | |
3268 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3269 | |
3270 /* Bold */ | |
3271 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
3272 gtk_size_group_add_widget(sg, button); | |
3273 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3274 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
3275 | |
3276 g_signal_connect(G_OBJECT(button), "clicked", | |
3277 G_CALLBACK(do_bold), gtkconv); | |
3278 | |
3279 gtkconv->toolbar.bold = button; | |
3280 | |
3281 /* Italic */ | |
3282 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
3283 gtk_size_group_add_widget(sg, button); | |
3284 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3285 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
3286 | |
3287 g_signal_connect(G_OBJECT(button), "clicked", | |
3288 G_CALLBACK(do_italic), gtkconv); | |
3289 | |
3290 gtkconv->toolbar.italic = button; | |
3291 | |
3292 /* Underline */ | |
3293 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
3294 gtk_size_group_add_widget(sg, button); | |
3295 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3296 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
3297 | |
3298 g_signal_connect(G_OBJECT(button), "clicked", | |
3299 G_CALLBACK(do_underline), gtkconv); | |
3300 | |
3301 gtkconv->toolbar.underline = button; | |
3302 | |
3303 /* Sep */ | |
3304 sep = gtk_vseparator_new(); | |
3305 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3306 | |
3307 /* Increase font size */ | |
3308 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
3309 gtk_size_group_add_widget(sg, button); | |
3310 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3311 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3312 _("Larger font size"), NULL); | |
3313 | |
3314 g_signal_connect(G_OBJECT(button), "clicked", | |
3315 G_CALLBACK(do_big), gtkconv); | |
3316 | |
5049 | 3317 gtkconv->toolbar.larger_size = button; |
3318 | |
4359 | 3319 /* Normal font size */ |
3320 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); | |
3321 gtk_size_group_add_widget(sg, button); | |
3322 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3323 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3324 _("Normal font size"), NULL); | |
3325 | |
3326 g_signal_connect(G_OBJECT(button), "clicked", | |
3327 G_CALLBACK(do_normal), gtkconv); | |
3328 | |
3329 gtkconv->toolbar.normal_size = button; | |
3330 | |
3331 /* Decrease font size */ | |
3332 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
3333 gtk_size_group_add_widget(sg, button); | |
3334 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3335 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3336 _("Smaller font size"), NULL); | |
3337 | |
3338 g_signal_connect(G_OBJECT(button), "clicked", | |
3339 G_CALLBACK(do_small), gtkconv); | |
3340 | |
5049 | 3341 gtkconv->toolbar.smaller_size = button; |
3342 | |
4359 | 3343 /* Sep */ |
3344 sep = gtk_vseparator_new(); | |
3345 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3346 | |
4685 | 3347 /* Font Face */ |
3348 | |
3349 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
3350 gtk_size_group_add_widget(sg, button); | |
3351 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3352 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3353 _("Font Face"), NULL); | |
3354 | |
3355 g_signal_connect(G_OBJECT(button), "clicked", | |
3356 G_CALLBACK(toggle_font), conv); | |
3357 | |
3358 gtkconv->toolbar.font = button; | |
3359 | |
4359 | 3360 /* Foreground Color */ |
3361 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
3362 gtk_size_group_add_widget(sg, button); | |
3363 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3364 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3365 _("Foreground font color"), NULL); | |
3366 | |
3367 g_signal_connect(G_OBJECT(button), "clicked", | |
3368 G_CALLBACK(toggle_fg_color), conv); | |
3369 | |
3370 gtkconv->toolbar.fgcolor = button; | |
3371 | |
3372 /* Background Color */ | |
3373 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
3374 gtk_size_group_add_widget(sg, button); | |
3375 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3376 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3377 _("Background color"), NULL); | |
3378 | |
3379 g_signal_connect(G_OBJECT(button), "clicked", | |
3380 G_CALLBACK(toggle_bg_color), conv); | |
3381 | |
3382 gtkconv->toolbar.bgcolor = button; | |
3383 | |
3384 /* Sep */ | |
3385 sep = gtk_vseparator_new(); | |
3386 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3387 | |
3388 /* Insert IM Image */ | |
3389 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
3390 gtk_size_group_add_widget(sg, button); | |
3391 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3392 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
3393 | |
3394 g_signal_connect(G_OBJECT(button), "clicked", | |
3395 G_CALLBACK(insert_image_cb), conv); | |
3396 | |
3397 gtkconv->toolbar.image = button; | |
3398 | |
3399 /* Insert Link */ | |
3400 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
3401 gtk_size_group_add_widget(sg, button); | |
3402 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3403 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
3404 | |
3405 g_signal_connect(G_OBJECT(button), "clicked", | |
3406 G_CALLBACK(insert_link_cb), conv); | |
3407 | |
3408 gtkconv->toolbar.link = button; | |
3409 | |
3410 /* Insert Smiley */ | |
3411 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
3412 gtk_size_group_add_widget(sg, button); | |
3413 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3414 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
3415 | |
3416 g_signal_connect(G_OBJECT(button), "clicked", | |
3417 G_CALLBACK(insert_smiley_cb), conv); | |
3418 | |
3419 gtkconv->toolbar.smiley = button; | |
3420 | |
3421 | |
3422 sep = gtk_hseparator_new(); | |
3423 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3424 | |
3425 gtk_widget_show_all(vbox); | |
3426 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3427 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3428 gtk_widget_hide(vbox); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3429 |
4359 | 3430 return vbox; |
3431 } | |
3432 | |
3433 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3434 setup_chat_pane(GaimConversation *conv) |
4359 | 3435 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3436 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3437 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3438 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3439 GaimConnection *gc; |
4359 | 3440 GtkWidget *vpaned, *hpaned; |
3441 GtkWidget *vbox, *hbox; | |
3442 GtkWidget *lbox, *bbox; | |
3443 GtkWidget *label; | |
3444 GtkWidget *sw2; | |
3445 GtkWidget *list; | |
3446 GtkWidget *button; | |
3447 GtkWidget *frame; | |
3448 GtkListStore *ls; | |
3449 GtkCellRenderer *rend; | |
3450 GtkTreeViewColumn *col; | |
3451 | |
3452 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3453 gtkchat = gtkconv->u.chat; | |
3454 gc = gaim_conversation_get_gc(conv); | |
3455 | |
3456 /* Setup the outer pane. */ | |
3457 vpaned = gtk_vpaned_new(); | |
3458 gtk_widget_show(vpaned); | |
3459 | |
3460 /* Setup the top part of the pane. */ | |
3461 vbox = gtk_vbox_new(FALSE, 5); | |
3462 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
3463 gtk_widget_show(vbox); | |
3464 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3465 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3466 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3467 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3468 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3469 { |
3470 hbox = gtk_hbox_new(FALSE, 0); | |
3471 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
3472 gtk_widget_show(hbox); | |
3473 | |
3474 label = gtk_label_new(_("Topic:")); | |
3475 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
3476 gtk_widget_show(label); | |
3477 | |
3478 gtkchat->topic_text = gtk_entry_new(); | |
4635 | 3479 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); |
4359 | 3480 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
3481 gtk_widget_show(gtkchat->topic_text); | |
3482 } | |
3483 | |
3484 /* Setup the horizontal pane. */ | |
3485 hpaned = gtk_hpaned_new(); | |
3486 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
3487 gtk_widget_show(hpaned); | |
3488 | |
3489 /* Setup the scrolled window to put gtkimhtml in. */ | |
3490 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3491 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3492 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3493 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3494 GTK_SHADOW_IN); | |
3495 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3496 | |
3497 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3498 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3499 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3500 |
4359 | 3501 gtk_widget_show(gtkconv->sw); |
3502 | |
3503 /* Setup gtkihmtml. */ | |
3504 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3505 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3506 | |
3507 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3508 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3509 |
3510 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3511 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3512 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3513 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3514 |
3515 gaim_setup_imhtml(gtkconv->imhtml); | |
3516 | |
3517 gtk_widget_show(gtkconv->imhtml); | |
3518 | |
3519 /* Build the right pane. */ | |
3520 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3521 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3522 gtk_widget_show(lbox); |
3523 | |
3524 /* Setup the label telling how many people are in the room. */ | |
3525 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3526 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3527 gtk_widget_show(gtkchat->count); | |
3528 | |
3529 /* Setup the list of users. */ | |
3530 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
3531 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
3532 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
3533 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
3534 gtk_widget_show(sw2); | |
3535 | |
3536 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3537 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3538 GTK_SORT_ASCENDING); | |
3539 | |
3540 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3541 | |
3542 rend = gtk_cell_renderer_text_new(); | |
3543 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3544 "text", 0, NULL); | |
3545 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3546 | |
3547 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3548 G_CALLBACK(right_click_chat_cb), conv); | |
3549 | |
3550 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3551 | |
3552 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3553 "text", 1, NULL); | |
3554 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3555 | |
3556 #if 0 | |
3557 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3558 G_CALLBACK(right_click_chat), conv); | |
3559 #endif | |
3560 | |
3561 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3562 | |
3563 gtk_widget_set_size_request(list, 150, -1); | |
3564 | |
3565 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3566 gtk_widget_show(list); | |
3567 | |
3568 gtkchat->list = list; | |
3569 | |
3570 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
3571 | |
3572 /* Setup the user list toolbar. */ | |
3573 bbox = gtk_hbox_new(TRUE, 5); | |
3574 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3575 gtk_widget_show(bbox); | |
3576 | |
3577 /* IM */ | |
3578 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3579 GAIM_BUTTON_VERTICAL); | |
3580 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3581 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
|
3582 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3583 g_signal_connect(G_OBJECT(button), "clicked", |
3584 G_CALLBACK(im_cb), conv); | |
3585 | |
3586 gtk_widget_show(button); | |
3587 | |
3588 /* Ignore */ | |
3589 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3590 GAIM_BUTTON_VERTICAL); | |
3591 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3592 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
|
3593 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3594 _("Ignore the user"), NULL); |
4359 | 3595 g_signal_connect(G_OBJECT(button), "clicked", |
3596 G_CALLBACK(ignore_cb), conv); | |
3597 gtk_widget_show(button); | |
3598 | |
3599 /* Info */ | |
3600 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3601 GAIM_BUTTON_VERTICAL); | |
3602 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3603 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3604 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3605 _("Get the user's information"), NULL); |
4359 | 3606 g_signal_connect(G_OBJECT(button), "clicked", |
3607 G_CALLBACK(info_cb), conv); | |
3608 | |
3609 gtk_widget_show(button); | |
3610 | |
3611 gtkconv->info = button; | |
3612 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3613 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3614 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3615 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3616 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3617 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3618 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3619 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3620 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3621 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3622 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3623 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3624 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3625 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3626 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3627 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3628 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3629 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3630 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3631 |
5105 | 3632 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3633 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3634 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3635 25)); |
4359 | 3636 |
3637 /* Connect the signal handlers. */ | |
3638 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | |
3639 G_CALLBACK(entry_key_pressed_cb_1), | |
3640 gtkconv->entry_buffer); | |
3641 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3642 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3643 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3644 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3645 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3646 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3647 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3648 |
3649 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3650 gtk_widget_show(gtkconv->entry); | |
3651 | |
3652 /* Setup the bottom button box. */ | |
3653 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3654 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3655 gtk_widget_show(gtkconv->bbox); | |
3656 | |
3657 setup_chat_buttons(conv, gtkconv->bbox); | |
3658 | |
3659 return vpaned; | |
3660 } | |
3661 | |
3662 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3663 setup_im_pane(GaimConversation *conv) |
4359 | 3664 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3665 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3666 GaimGtkImPane *gtkim; |
4359 | 3667 GtkWidget *paned; |
3668 GtkWidget *vbox; | |
3669 GtkWidget *vbox2; | |
3670 GtkWidget *frame; | |
3671 | |
3672 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3673 gtkim = gtkconv->u.im; | |
3674 | |
3675 /* Setup the outer pane. */ | |
3676 paned = gtk_vpaned_new(); | |
3677 gtk_widget_show(paned); | |
3678 | |
3679 /* Setup the top part of the pane. */ | |
3680 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3681 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3682 gtk_widget_show(vbox); |
3683 | |
3684 /* Setup the gtkimhtml widget. */ | |
3685 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3686 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3687 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3688 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3689 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3690 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3691 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3692 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3693 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3694 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3695 gtk_widget_show(gtkconv->sw); |
3696 | |
3697 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3698 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3699 | |
3700 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3701 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3702 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3703 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3704 |
3705 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3706 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3707 |
3708 gaim_setup_imhtml(gtkconv->imhtml); | |
3709 | |
3710 gtk_widget_show(gtkconv->imhtml); | |
3711 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3712 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3713 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3714 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3715 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3716 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3717 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3718 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3719 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3720 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3721 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3722 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3723 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3724 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3725 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3726 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3727 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3728 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3729 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3730 |
5105 | 3731 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3732 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3733 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3734 25)); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3735 |
4359 | 3736 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3737 G_CALLBACK(entry_key_pressed_cb_1), | |
3738 gtkconv->entry_buffer); | |
3739 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3740 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3741 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3742 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3743 | |
3744 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3745 G_CALLBACK(insert_text_cb), conv); | |
3746 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3747 G_CALLBACK(delete_text_cb), conv); | |
3748 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3749 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3750 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3751 |
3752 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3753 gtk_widget_show(gtkconv->entry); | |
3754 | |
3755 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3756 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3757 gtk_widget_show(gtkconv->bbox); | |
3758 | |
3759 setup_im_buttons(conv, gtkconv->bbox); | |
3760 | |
3761 return paned; | |
3762 } | |
3763 | |
3764 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3765 move_next_tab(GaimConversation *conv) |
4359 | 3766 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3767 GaimConversation *next_conv = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3768 GaimConvWindow *win; |
4359 | 3769 GList *l; |
3770 int index, i; | |
3771 | |
3772 win = gaim_conversation_get_window(conv); | |
3773 index = gaim_conversation_get_index(conv); | |
3774 | |
3775 /* First check the tabs after this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3776 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); |
4359 | 3777 l != NULL; |
3778 l = l->next) { | |
3779 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3780 next_conv = (GaimConversation *)l->data; |
4359 | 3781 |
3782 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3783 break; | |
3784 | |
3785 next_conv = NULL; | |
3786 } | |
3787 | |
3788 if (next_conv == NULL) { | |
3789 | |
3790 /* Now check before this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3791 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 3792 l != NULL && i < index; |
3793 l = l->next) { | |
3794 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3795 next_conv = (GaimConversation *)l->data; |
4359 | 3796 |
3797 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3798 break; | |
3799 | |
3800 next_conv = NULL; | |
3801 } | |
3802 | |
3803 if (next_conv == NULL) { | |
3804 /* Okay, just grab the next conversation tab. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3805 if (index == gaim_conv_window_get_conversation_count(win) - 1) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3806 next_conv = gaim_conv_window_get_conversation_at(win, 0); |
4359 | 3807 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3808 next_conv = gaim_conv_window_get_conversation_at(win, index + 1); |
4359 | 3809 } |
3810 } | |
3811 | |
3812 if (next_conv != NULL && next_conv != conv) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3813 gaim_conv_window_switch_conversation(win, |
4359 | 3814 gaim_conversation_get_index(next_conv)); |
3815 } | |
3816 } | |
3817 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3818 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3819 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
|
3820 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3821 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3822 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3823 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3824 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3825 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3826 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) { |
4781 | 3827 GaimBlistNode *n = NULL; |
6695 | 3828 GaimBuddy *b; |
4781 | 3829 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3830 |
6695 | 3831 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3832 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3833 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3834 b = (GaimBuddy*)n; | |
3835 else | |
4781 | 3836 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3837 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3838 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
|
3839 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3840 gaim_conv_window_add_conversation(win, c); |
4702 | 3841 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3842 } |
4359 | 3843 |
3844 /************************************************************************** | |
3845 * GTK+ window ops | |
3846 **************************************************************************/ | |
3847 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3848 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 3849 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3850 GaimGtkWindow *gtkwin; |
4359 | 3851 GtkPositionType pos; |
3852 GtkWidget *testidea; | |
3853 GtkWidget *menubar; | |
3854 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3855 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3856 |
3857 win->ui_data = gtkwin; | |
3858 | |
3859 /* Create the window. */ | |
3860 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3861 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3862 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3863 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3864 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3865 gtk_widget_realize(gtkwin->window); |
3866 | |
3867 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3868 G_CALLBACK(close_win_cb), win); | |
3869 | |
3870 /* Create the notebook. */ | |
3871 gtkwin->notebook = gtk_notebook_new(); | |
3872 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3873 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3874 |
3875 #if 0 | |
3876 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3877 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3878 #endif | |
3879 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3880 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3881 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3882 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3883 | |
4359 | 3884 gtk_widget_show(gtkwin->notebook); |
3885 | |
3886 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
3887 G_CALLBACK(switch_conv_cb), win); | |
3888 | |
3889 /* Setup the tab drag and drop signals. */ | |
4486 | 3890 gtk_widget_add_events(gtkwin->notebook, |
3891 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3892 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3893 G_CALLBACK(notebook_press_cb), win); |
4486 | 3894 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3895 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3896 |
4359 | 3897 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3898 |
4359 | 3899 /* Setup the menubar. */ |
3900 menubar = setup_menubar(win); | |
3901 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3902 | |
3903 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
3904 | |
3905 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
3906 | |
3907 gtk_widget_show(testidea); | |
3908 } | |
3909 | |
3910 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3911 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 3912 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3913 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3914 |
3915 gtk_widget_destroy(gtkwin->window); | |
3916 | |
4630 | 3917 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
3918 | |
4359 | 3919 g_free(gtkwin); |
3920 win->ui_data = NULL; | |
3921 } | |
3922 | |
3923 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3924 gaim_gtk_show(GaimConvWindow *win) |
4359 | 3925 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3926 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3927 |
3928 gtk_widget_show(gtkwin->window); | |
7413 | 3929 |
3930 #ifdef _WIN32 | |
7415 | 3931 /* This works around a win32 gtk+ bug, where it can't handle |
3932 * creating the button correctly before the window is shown. | |
3933 * That's why we get the appearance of a button, without all | |
3934 * the normal button-like properties, like being able to click | |
7413 | 3935 * it. ;-) --Nathan */ |
7414 | 3936 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
3937 GaimConversation *conv; | |
3938 GaimGtkConversation *gtkconv; | |
3939 | |
3940 conv = gaim_conv_window_get_conversation_at(win, 0); | |
3941 if(conv) { | |
3942 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 3943 gtk_widget_hide(gtkconv->close); |
7414 | 3944 gtk_widget_show_all(gtkconv->close); |
3945 } | |
3946 } | |
7413 | 3947 #endif |
4359 | 3948 } |
3949 | |
3950 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3951 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 3952 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3953 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3954 |
3955 gtk_widget_hide(gtkwin->window); | |
3956 } | |
3957 | |
3958 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3959 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 3960 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3961 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3962 |
5484 | 3963 gtk_widget_show(gtkwin->window); |
5103 | 3964 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 3965 gdk_window_raise(gtkwin->window->window); |
4359 | 3966 } |
3967 | |
3968 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3969 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 3970 { |
3971 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3972 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3973 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3974 wgaim_conv_im_blink(gtkwin->window); |
4359 | 3975 #endif |
3976 } | |
3977 | |
3978 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3979 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 3980 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3981 GaimGtkWindow *gtkwin; |
4359 | 3982 |
3983 gtkwin = GAIM_GTK_WINDOW(win); | |
3984 | |
3985 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
3986 } | |
3987 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3988 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3989 { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3990 {"text/plain", 0, 0}, |
4702 | 3991 {"text/uri-list", 0, 1}, |
4781 | 3992 {"GAIM_BLIST_NODE", 0, 2}, |
4702 | 3993 {"STRING", 0, 3} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3994 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3995 |
4359 | 3996 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3997 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 3998 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3999 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4000 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4001 GaimConversation *focus_conv; |
4359 | 4002 GtkWidget *pane = NULL; |
4003 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4004 GtkWidget *tabby, *menu_tabby; |
4359 | 4005 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4006 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4007 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4008 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4009 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4010 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4011 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4012 |
4013 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4014 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4015 |
4016 tab_cont = gtkconv->tab_cont; | |
4017 | |
4018 new_ui = FALSE; | |
4019 } | |
4020 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4021 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4022 conv->ui_data = gtkconv; |
4023 | |
4024 /* Setup some initial variables. */ | |
4025 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4026 gtkconv->tooltips = gtk_tooltips_new(); | |
4027 | |
4421 | 4028 /* Setup the foreground and background colors */ |
4029 gaim_gtkconv_update_font_colors(conv); | |
4030 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4031 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4032 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4033 |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4034 if (conv_type == GAIM_CONV_CHAT) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4035 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); |
4359 | 4036 |
4037 pane = setup_chat_pane(conv); | |
4038 } | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4039 else if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4040 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4041 gtkconv->u.im->a_virgin = TRUE; |
4042 | |
4043 pane = setup_im_pane(conv); | |
4044 } | |
4045 | |
4046 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4047 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4048 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4049 |
4050 g_free(gtkconv); | |
4051 conv->ui_data = NULL; | |
4052 | |
4053 return; | |
4054 } | |
4055 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4056 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4057 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4058 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4059 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4060 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4061 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4062 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4063 GTK_DEST_DEFAULT_MOTION | |
4702 | 4064 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4065 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4066 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4067 gtk_drag_dest_set(gtkconv->entry, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4068 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4069 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4070 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4071 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4072 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4073 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4074 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4075 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4076 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4077 #if 0 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4078 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4079 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4080 #endif |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4081 |
4359 | 4082 /* Setup the container for the tab. */ |
4083 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
4084 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
4085 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
4086 gtk_widget_show(pane); | |
4087 | |
4088 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4089 |
4359 | 4090 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4091 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4092 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4093 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4094 |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4095 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
7143 | 4096 G_CALLBACK(gtk_widget_grab_focus), |
4097 gtkconv->entry); | |
4359 | 4098 } |
4099 | |
4100 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4101 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 5); |
4359 | 4102 |
4103 /* Close button. */ | |
4104 gtkconv->close = gtk_button_new(); | |
4105 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
|
4106 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4107 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4108 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4109 GTK_ICON_SIZE_MENU)); | |
4359 | 4110 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4111 _("Close conversation"), NULL); |
4359 | 4112 |
4113 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4114 G_CALLBACK(close_conv_cb), conv); |
4359 | 4115 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4116 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4117 * 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
|
4118 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4119 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4120 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4121 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4122 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4123 /* Status icon. */ |
6440 | 4124 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4125 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4126 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4127 |
4359 | 4128 /* Tab label. */ |
4129 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
|
4130 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4131 #if 0 |
4132 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4133 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4134 #endif | |
4135 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4136 |
4359 | 4137 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4138 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4139 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4140 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4141 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4142 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4143 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4144 |
4359 | 4145 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
|
4146 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4147 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4148 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4149 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
|
4150 |
4445 | 4151 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
|
4152 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4153 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4154 |
4445 | 4155 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4156 gtk_widget_show(menu_tabby); |
4359 | 4157 |
7143 | 4158 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4159 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4160 |
4359 | 4161 /* Add this pane to the conversations notebook. */ |
4162 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4163 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, menu_tabby); |
4359 | 4164 |
4165 gtk_widget_show(tab_cont); | |
4166 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4167 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4168 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4169 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4170 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4171 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4172 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4173 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4174 else |
4818 | 4175 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4176 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4177 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4178 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4179 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4180 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4181 |
4182 if (!new_ui) | |
4183 g_object_unref(gtkconv->tab_cont); | |
4184 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4185 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4186 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4187 } |
4188 | |
4189 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4190 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4191 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4192 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4193 GaimGtkConversation *gtkconv; |
4359 | 4194 unsigned int index; |
4818 | 4195 GaimConversationType conv_type; |
4196 | |
4197 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4198 index = gaim_conversation_get_index(conv); |
4199 | |
4200 gtkwin = GAIM_GTK_WINDOW(win); | |
4201 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4202 | |
4203 g_object_ref(gtkconv->tab_cont); | |
4204 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4205 | |
4206 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4207 | |
4818 | 4208 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4209 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4210 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4211 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4212 } |
4213 | |
4214 | |
4359 | 4215 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4216 if (conv_type == GAIM_CONV_IM && |
4359 | 4217 gaim_conversation_get_gc(conv) == NULL) { |
4218 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4219 generate_send_as_items(win, conv); |
4359 | 4220 } |
4221 } | |
4222 | |
4223 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4224 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4225 unsigned int new_index) |
4226 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4227 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4228 GaimGtkConversation *gtkconv; |
4359 | 4229 |
4230 gtkwin = GAIM_GTK_WINDOW(win); | |
4231 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4232 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4233 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4234 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4235 |
4359 | 4236 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4237 gtkconv->tab_cont, new_index); | |
4238 } | |
4239 | |
4240 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4241 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4242 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4243 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4244 int index; |
4359 | 4245 |
4246 gtkwin = GAIM_GTK_WINDOW(win); | |
4247 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4248 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4249 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4250 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4251 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4252 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4253 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4254 return (index == -1 ? 0 : index); |
4359 | 4255 } |
4256 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4257 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4258 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4259 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4260 gaim_gtk_new_window, |
4261 gaim_gtk_destroy_window, | |
4262 gaim_gtk_show, | |
4263 gaim_gtk_hide, | |
4264 gaim_gtk_raise, | |
4265 gaim_gtk_flash, | |
4266 gaim_gtk_switch_conversation, | |
4267 gaim_gtk_add_conversation, | |
4268 gaim_gtk_remove_conversation, | |
4269 gaim_gtk_move_conversation, | |
4270 gaim_gtk_get_active_index | |
4271 }; | |
4272 | |
4273 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4274 update_convo_add_button(GaimConversation *conv) |
4359 | 4275 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4276 GaimPluginProtocolInfo *prpl_info = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4277 GaimConvWindow *win; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4278 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4279 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4280 GaimConnection *gc; |
4359 | 4281 GaimConversationType type; |
4282 GtkWidget *parent; | |
4283 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4284 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4285 win = gaim_conversation_get_window(conv); |
4359 | 4286 type = gaim_conversation_get_type(conv); |
4287 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4288 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4289 parent = gtk_widget_get_parent(gtkconv->u.im->add); |
4290 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4291 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4292 |
4687 | 4293 if (gaim_find_buddy(gc->account, gaim_conversation_get_name(conv))) { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4294 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4295 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4296 GTK_STOCK_REMOVE, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4297 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4298 _("Remove the user from your buddy list"), NULL); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4299 |
4359 | 4300 gtk_widget_set_sensitive(gtkconv->u.im->add, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4301 (gc != NULL && prpl_info->remove_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4302 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4303 if (gaim_conv_window_get_active_conversation(win) == conv) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4304 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4305 gtk_widget_hide(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4306 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4307 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4308 else { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4309 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4310 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4311 GTK_STOCK_ADD, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4312 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4313 _("Add the user to your buddy list"), NULL); |
4359 | 4314 |
4315 gtk_widget_set_sensitive(gtkconv->u.im->add, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4316 (gc != NULL && prpl_info->add_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4317 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4318 if (gaim_conv_window_get_active_conversation(win) == conv) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4319 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4320 gtk_widget_hide(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4321 } |
4359 | 4322 } |
4323 | |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4324 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4325 G_CALLBACK(add_cb), conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4326 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4327 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4328 FALSE, FALSE, 0); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4329 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4330 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4331 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); |
4359 | 4332 } |
4333 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4334 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4335 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4336 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4337 return &window_ui_ops; |
4359 | 4338 } |
4339 | |
4340 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4341 * Conversation UI operations |
4359 | 4342 **************************************************************************/ |
4343 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4344 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4345 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4346 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4347 |
4348 if (gtkconv->dialogs.fg_color != NULL) | |
4349 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4350 | |
4351 if (gtkconv->dialogs.bg_color != NULL) | |
4352 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4353 | |
4354 if (gtkconv->dialogs.font != NULL) | |
4355 gtk_widget_destroy(gtkconv->dialogs.font); | |
4356 | |
5959 | 4357 if (gtkconv->dialogs.image != NULL) |
4358 gtk_widget_destroy(gtkconv->dialogs.image); | |
4359 | |
4359 | 4360 if (gtkconv->dialogs.smiley != NULL) |
4361 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4362 | |
4363 if (gtkconv->dialogs.link != NULL) | |
4364 gtk_widget_destroy(gtkconv->dialogs.link); | |
4365 | |
4366 if (gtkconv->dialogs.log != NULL) | |
4367 gtk_widget_destroy(gtkconv->dialogs.log); | |
4368 | |
7295 | 4369 if (gtkconv->dialogs.search != NULL) |
4370 gtk_widget_destroy(gtkconv->dialogs.search); | |
4371 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4372 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4373 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4374 |
4359 | 4375 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4376 if (gtkconv->u.im->icon_timer != 0) |
4377 g_source_remove(gtkconv->u.im->icon_timer); | |
4378 | |
4359 | 4379 if (gtkconv->u.im->save_icon != NULL) |
4380 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4381 | |
4382 if (gtkconv->u.im->anim != NULL) | |
4793 | 4383 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4384 |
4385 g_free(gtkconv->u.im); | |
4386 } | |
4387 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4388 g_free(gtkconv->u.chat); | |
4389 } | |
4390 | |
4633 | 4391 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4392 | |
4359 | 4393 g_free(gtkconv); |
4394 } | |
4395 | |
4396 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4397 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4398 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4399 time_t mtime) |
4359 | 4400 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4401 GaimGtkConversation *gtkconv; |
4359 | 4402 |
4403 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4404 | |
6621 | 4405 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4406 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4407 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4408 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4409 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4410 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4411 /* Play a sound, if specified in prefs. */ |
4359 | 4412 if (gtkconv->make_sound) { |
6621 | 4413 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4414 if (gtkconv->u.im->a_virgin && |
5820 | 4415 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4416 |
4561 | 4417 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4418 } |
4419 else | |
4561 | 4420 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4421 } |
4422 else { | |
4561 | 4423 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4424 } |
4425 } | |
4426 | |
4427 gtkconv->u.im->a_virgin = FALSE; | |
4428 | |
6982 | 4429 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4430 } |
4431 | |
4432 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4433 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4434 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4435 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4436 GaimGtkConversation *gtkconv; |
4359 | 4437 |
4438 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4439 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4440 /* Play a sound, if specified in prefs. */ |
4359 | 4441 if (gtkconv->make_sound) { |
6621 | 4442 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4443 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4444 else if (flags & GAIM_MESSAGE_RECV) { |
4445 if ((flags & GAIM_MESSAGE_NICK) && | |
6102 | 4446 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4447 |
4561 | 4448 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4449 } |
4359 | 4450 else |
4561 | 4451 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4452 } |
4453 } | |
4454 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4455 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4456 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4457 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4458 /* Raise the window, if specified in prefs. */ |
6621 | 4459 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4460 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4461 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4462 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4463 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4464 |
6982 | 4465 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4466 } |
4467 | |
4468 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4469 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4470 const char *message, GaimMessageFlags flags, |
4359 | 4471 time_t mtime) |
4472 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4473 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4474 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4475 GaimConnection *gc; |
4359 | 4476 int gtk_font_options = 0; |
6982 | 4477 GSList *images = NULL; |
7440 | 4478 char buf[BUF_LONG]; |
4359 | 4479 char buf2[BUF_LONG]; |
4480 char mdate[64]; | |
4481 char color[10]; | |
4482 char *str; | |
4483 char *with_font_tag; | |
4896 | 4484 char *sml_attrib = NULL; |
6982 | 4485 size_t length = strlen(message) + 1; |
4895 | 4486 |
4359 | 4487 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4488 gc = gaim_conversation_get_gc(conv); | |
4489 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4490 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4491 |
6621 | 4492 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4493 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4494 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4495 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4496 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || | |
4497 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
|
4498 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4499 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4500 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4501 |
7078 | 4502 if (flags & GAIM_MESSAGE_IMAGES) |
4503 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4504 |
5133 | 4505 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4506 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4507 else | |
4508 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4509 |
4896 | 4510 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4511 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4512 |
4359 | 4513 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4514 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4515 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4516 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4517 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4518 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4519 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4520 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4521 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4522 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4523 | |
6185 | 4524 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol(conv->account)))->options & |
7431 | 4525 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4526 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4527 } |
4359 | 4528 |
6621 | 4529 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4530 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4531 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
7431 | 4532 mdate, message); |
4359 | 4533 else |
4534 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4535 |
4359 | 4536 g_snprintf(buf2, sizeof(buf2), |
7431 | 4537 "<!--(%s) --><B>%s</B><BR>", |
4538 mdate, message); | |
7440 | 4539 |
6982 | 4540 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
7440 | 4541 |
7583 | 4542 /* Add the message to a conversations scrollback buffer */ |
4543 conv->history = g_string_append(conv->history, buf); | |
4544 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4545 |
7431 | 4546 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4547 g_snprintf(buf, BUF_LONG, |
7431 | 4548 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", |
4549 message); | |
7440 | 4550 |
6982 | 4551 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf, 0, images); |
4359 | 4552 } |
4553 else { | |
4895 | 4554 char *new_message = g_memdup(message, length); |
7440 | 4555 |
6621 | 4556 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4557 str = g_malloc(1024); |
7440 | 4558 |
4359 | 4559 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4560 if (gaim_message_meify(new_message, length)) { |
4359 | 4561 g_snprintf(str, 1024, "***%s", who); |
4562 strcpy(color, "#6C2585"); | |
4563 } | |
4564 else { | |
4565 g_snprintf(str, 1024, "*%s*:", who); | |
4566 strcpy(color, "#00FF00"); | |
4567 } | |
7440 | 4568 } |
4359 | 4569 else { |
7564 | 4570 if (gaim_message_meify(new_message, length)) { |
4359 | 4571 str = g_malloc(1024); |
7440 | 4572 |
6621 | 4573 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4574 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
4575 else | |
4576 g_snprintf(str, 1024, "***%s", who); | |
7440 | 4577 |
6621 | 4578 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4579 strcpy(color, "#AF7F00"); |
4580 else | |
4581 strcpy(color, "#062585"); | |
4582 } | |
4583 else { | |
4584 str = g_malloc(1024); | |
6621 | 4585 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4586 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
4587 else | |
4588 g_snprintf(str, 1024, "%s:", who); | |
6621 | 4589 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4590 strcpy(color, "#AF7F00"); |
6621 | 4591 else if (flags & GAIM_MESSAGE_RECV) { |
4592 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4593 const char *u; |
4594 int m = 0; | |
7440 | 4595 |
4359 | 4596 for (u = who; *u != '\0'; u++) |
4597 m += *u; | |
7440 | 4598 |
4359 | 4599 m = m % NUM_NICK_COLORS; |
7440 | 4600 |
4359 | 4601 strcpy(color, nick_colors[m]); |
4602 } | |
4603 else | |
4604 strcpy(color, "#A82F2F"); | |
4605 } | |
6621 | 4606 else if (flags & GAIM_MESSAGE_SEND) |
4359 | 4607 strcpy(color, "#16569E"); |
4608 } | |
4609 } | |
7440 | 4610 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4611 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4612 g_snprintf(buf, BUF_LONG, |
7431 | 4613 "<FONT COLOR=\"%s\" %s>(%s) " |
4614 "<B>%s</B></FONT> ", color, | |
4615 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4616 else |
4617 g_snprintf(buf, BUF_LONG, | |
7431 | 4618 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4619 sml_attrib ? sml_attrib : "", str); | |
7440 | 4620 |
4359 | 4621 g_snprintf(buf2, BUF_LONG, |
7431 | 4622 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4623 "<B>%s</B></FONT> ", | |
4624 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4625 |
4359 | 4626 g_free(str); |
4627 | |
6982 | 4628 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
4359 | 4629 |
4895 | 4630 if(gc){ |
4896 | 4631 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4632 char *post = "</font>"; |
4633 int pre_len = strlen(pre); | |
4634 int post_len = strlen(post); | |
7440 | 4635 |
4895 | 4636 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4637 |
4895 | 4638 strcpy(with_font_tag, pre); |
4639 memcpy(with_font_tag + pre_len, new_message, length); | |
4640 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4641 |
4895 | 4642 length += pre_len + post_len; |
4643 g_free(pre); | |
4644 } | |
4608 | 4645 else |
4895 | 4646 with_font_tag = g_memdup(new_message, length); |
7440 | 4647 |
7589 | 4648 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4649 with_font_tag, gtk_font_options, images); |
7440 | 4650 |
6982 | 4651 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
7440 | 4652 |
7431 | 4653 /*conv->history = g_string_append(conv->history, t1); |
4654 conv->history = g_string_append(conv->history, t2); | |
4655 conv->history = g_string_append(conv->history, "\n"); | |
7440 | 4656 |
7431 | 4657 g_free(t1); |
4658 g_free(t2); */ | |
7440 | 4659 |
4660 g_free(with_font_tag); | |
7447 | 4661 g_free(new_message); |
7440 | 4662 } |
4663 | |
6062 | 4664 |
5012 | 4665 if(sml_attrib) |
4666 g_free(sml_attrib); | |
6982 | 4667 |
4668 if (images) { | |
7078 | 4669 GSList *tmp; |
4670 | |
4671 for (tmp = images; tmp; tmp = tmp->next) { | |
4672 GdkPixbuf *pixbuf = tmp->data; | |
4673 if(pixbuf) | |
4674 g_object_unref(pixbuf); | |
6982 | 4675 } |
7078 | 4676 |
6982 | 4677 g_slist_free(images); |
4678 } | |
4359 | 4679 } |
4680 | |
4681 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4682 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4683 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4684 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4685 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4686 GaimGtkChatPane *gtkchat; |
4359 | 4687 char tmp[BUF_LONG]; |
4688 int num_users; | |
4689 int pos; | |
4690 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4691 chat = GAIM_CONV_CHAT(conv); |
4359 | 4692 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4693 gtkchat = gtkconv->u.chat; | |
4694 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4695 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4696 |
4697 g_snprintf(tmp, sizeof(tmp), | |
4698 ngettext("%d person in room", "%d people in room", | |
4699 num_users), | |
4700 num_users); | |
4701 | |
4702 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4703 | |
4704 if (gtkconv->make_sound) | |
4561 | 4705 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4706 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4707 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4708 |
4709 add_chat_buddy_common(conv, user, pos); | |
4710 } | |
4711 | |
4712 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4713 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4714 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4715 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4716 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4717 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4718 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4719 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4720 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4721 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4722 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4723 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4724 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4725 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4726 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4727 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
|
4728 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4729 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4730 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4731 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4732 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4733 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4734 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4735 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4736 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4737 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
|
4738 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4739 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4740 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4741 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4742 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4743 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4744 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4745 const char *new_name) |
4359 | 4746 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4747 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4748 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4749 GaimGtkChatPane *gtkchat; |
4359 | 4750 GtkTreeIter iter; |
4751 GtkTreeModel *model; | |
4752 GList *names; | |
4753 int pos; | |
4754 int f = 1; | |
4755 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4756 chat = GAIM_CONV_CHAT(conv); |
4359 | 4757 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4758 gtkchat = gtkconv->u.chat; | |
4759 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4760 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4761 names != NULL; |
4762 names = names->next) { | |
4763 | |
4764 char *u = (char *)names->data; | |
4765 | |
4793 | 4766 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4767 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4768 | |
4769 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4770 break; | |
4771 | |
4772 while (f != 0) { | |
4773 char *val; | |
4774 | |
4775 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4776 | |
4793 | 4777 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4778 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4779 break; |
4780 } | |
4359 | 4781 |
4782 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4783 | |
4784 g_free(val); | |
4785 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4786 |
4359 | 4787 break; |
4788 } | |
4789 } | |
4790 | |
4791 if (!names) | |
4792 return; | |
4793 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4794 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4795 |
4796 add_chat_buddy_common(conv, new_name, pos); | |
4797 } | |
4798 | |
4799 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4800 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4801 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4802 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4803 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4804 GaimGtkChatPane *gtkchat; |
4359 | 4805 GtkTreeIter iter; |
4806 GtkTreeModel *model; | |
4807 GList *names; | |
4808 char tmp[BUF_LONG]; | |
4809 int num_users; | |
4810 int f = 1; | |
4811 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4812 chat = GAIM_CONV_CHAT(conv); |
4359 | 4813 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4814 gtkchat = gtkconv->u.chat; | |
4815 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4816 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
|
4817 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4818 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4819 names != NULL; |
4820 names = names->next) { | |
4821 | |
4822 char *u = (char *)names->data; | |
4823 | |
4793 | 4824 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4825 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4826 | |
4827 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4828 break; | |
4829 | |
4830 while (f != 0) { | |
4831 char *val; | |
4832 | |
4833 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4834 | |
4793 | 4835 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4836 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4837 | |
4838 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4839 | |
4840 g_free(val); | |
4841 } | |
4842 | |
4843 break; | |
4844 } | |
4845 } | |
4846 | |
4847 if (names == NULL) | |
4848 return; | |
4849 | |
4850 g_snprintf(tmp, sizeof(tmp), | |
4851 ngettext("%d person in room", "%d people in room", | |
4852 num_users), num_users); | |
4853 | |
4854 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4855 | |
4856 if (gtkconv->make_sound) | |
4561 | 4857 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4858 } |
4859 | |
4860 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4861 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4862 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4863 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4864 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4865 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4866 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4867 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4868 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4869 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4870 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4871 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4872 int f = 1; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4873 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4874 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4875 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4876 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4877 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4878 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
|
4879 g_list_length(users); |
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 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4882 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4883 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4884 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4885 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4886 char *u = (char *)names->data; |
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 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4889 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4890 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4891 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4892 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4893 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4894 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4895 while (f != 0) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4896 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4897 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4898 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4899 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4900 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4901 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4902 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4903 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4904 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4905 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4906 g_free(val); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4907 } |
7431 | 4908 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4909 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4910 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4911 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4912 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4913 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4914 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4915 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4916 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4917 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4918 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4919 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4920 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4921 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4922 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4923 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4924 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4925 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4926 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4927 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4928 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4929 GaimGtkWindow *gtkwin; |
4681 | 4930 |
4931 win = gaim_conversation_get_window(conv); | |
4932 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4933 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4934 | |
4935 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4936 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4937 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4938 if(conv == gaim_conv_window_get_active_conversation(win)) |
4681 | 4939 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
4359 | 4940 } |
4941 | |
4942 static void | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4943 update_tab_icon(GaimConversation *conv) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4944 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4945 GaimGtkConversation *gtkconv; |
7146 | 4946 GaimConvWindow *win = gaim_conversation_get_window(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4947 GaimAccount *account; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4948 const char *name; |
7008 | 4949 GdkPixbuf *status = NULL; |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4950 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4951 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4952 name = gaim_conversation_get_name(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4953 account = gaim_conversation_get_account(conv); |
6440 | 4954 |
7143 | 4955 status = get_tab_icon(conv); |
7008 | 4956 |
4957 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
4958 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
4959 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4960 if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) |
7146 | 4961 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
4962 | |
7008 | 4963 if(status) |
4964 g_object_unref(status); | |
7146 | 4965 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4966 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4967 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4968 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4969 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4970 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4971 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4972 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4973 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4974 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4975 GaimConvChat *chat; |
4359 | 4976 |
4977 win = gaim_conversation_get_window(conv); | |
4736 | 4978 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4979 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4980 | |
4491 | 4981 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 4982 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4983 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4984 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4985 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4986 |
4359 | 4987 gaim_gtkconv_update_buttons_by_protocol(conv); |
4988 | |
4685 | 4989 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4990 |
4991 smiley_themeize(gtkconv->imhtml); | |
6394 | 4992 |
6395 | 4993 update_tab_icon(conv); |
4359 | 4994 } |
4995 else if (type == GAIM_CONV_UPDATE_TYPING || | |
4996 type == GAIM_CONV_UPDATE_UNSEEN) { | |
4997 GtkStyle *style; | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4998 GaimConvIm *im = NULL; |
4359 | 4999 |
4736 | 5000 |
4359 | 5001 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5002 im = GAIM_CONV_IM(conv); |
4359 | 5003 |
5004 style = gtk_style_new(); | |
5005 | |
5006 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5007 gtk_widget_realize(gtkconv->tab_label); | |
5008 | |
4757 | 5009 pango_font_description_free(style->font_desc); |
4635 | 5010 style->font_desc = pango_font_description_copy( |
5011 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 5012 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5013 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4577 | 5014 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
5015 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
5016 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
5017 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5018 } |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5019 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4577 | 5020 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
5021 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
5022 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
5023 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5024 } |
5025 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 5026 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
5027 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
5028 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 5029 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5030 } |
6405
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5031 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) { |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5032 style->fg[GTK_STATE_ACTIVE].red = 0x8686;; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5033 style->fg[GTK_STATE_ACTIVE].green = 0x8282; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5034 style->fg[GTK_STATE_ACTIVE].blue = 0x7272; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5035 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5036 } |
4359 | 5037 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { |
4577 | 5038 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
5039 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
5040 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 5041 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5042 } |
5043 | |
5044 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 5045 g_object_unref(G_OBJECT(style)); |
4736 | 5046 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5047 if(conv == gaim_conv_window_get_active_conversation(win)) { |
4736 | 5048 update_typing_icon(conv); |
5049 } | |
5050 | |
4359 | 5051 } |
5052 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
7154 | 5053 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5054 chat = GAIM_CONV_CHAT(conv); |
4359 | 5055 gtkchat = gtkconv->u.chat; |
5056 | |
7154 | 5057 topic = gaim_conv_chat_get_topic(chat); |
5058 | |
5059 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5060 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
5061 topic, NULL); | |
4359 | 5062 } |
5063 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
5064 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
5065 | |
7476 | 5066 gaim_gtkconv_update_buttons_by_protocol(conv); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5067 generate_send_as_items(win, NULL); |
6440 | 5068 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5069 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5070 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5071 else if (type == GAIM_CONV_UPDATE_AWAY) { |
6440 | 5072 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5073 update_tab_icon(conv); | |
4359 | 5074 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5075 else if (type == GAIM_CONV_UPDATE_ADD || |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5076 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 5077 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5078 update_convo_add_button(conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5079 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5080 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5081 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5082 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5083 } |
4359 | 5084 } |
5085 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5086 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5087 { |
5088 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5089 gaim_gtkconv_write_chat, /* write_chat */ | |
5090 gaim_gtkconv_write_im, /* write_im */ | |
5091 gaim_gtkconv_write_conv, /* write_conv */ | |
5092 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5093 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5094 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5095 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5096 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5097 gaim_gtkconv_set_title, /* set_title */ |
5098 NULL, /* update_progress */ | |
5099 gaim_gtkconv_updated /* updated */ | |
5100 }; | |
5101 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5102 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5103 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5104 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5105 return &conversation_ui_ops; |
4359 | 5106 } |
5107 | |
5108 /************************************************************************** | |
5109 * Public conversation utility functions | |
5110 **************************************************************************/ | |
5111 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5112 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 5113 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5114 g_return_if_fail(gtkconv != NULL); |
4359 | 5115 |
5116 if (gtkconv->u.im->icon != NULL) | |
5117 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
5118 gtkconv->u.im->icon->parent->parent); | |
5119 | |
5120 if (gtkconv->u.im->anim != NULL) | |
4793 | 5121 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 5122 |
5123 if (gtkconv->u.im->icon_timer != 0) | |
5124 g_source_remove(gtkconv->u.im->icon_timer); | |
5125 | |
5126 if (gtkconv->u.im->iter != NULL) | |
5127 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5128 | |
5129 gtkconv->u.im->icon_timer = 0; | |
5130 gtkconv->u.im->icon = NULL; | |
5131 gtkconv->u.im->anim = NULL; | |
5132 gtkconv->u.im->iter = NULL; | |
5133 } | |
5134 | |
5135 static gboolean | |
5136 redraw_icon(gpointer data) | |
5137 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5138 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5139 GaimGtkConversation *gtkconv; |
4359 | 5140 |
5141 GdkPixbuf *buf; | |
5142 GdkPixbuf *scale; | |
5143 GdkPixmap *pm; | |
5144 GdkBitmap *bm; | |
5145 gint delay; | |
5146 | |
5147 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5148 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5149 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5150 "is a bug.\n"); |
4359 | 5151 return FALSE; |
5152 } | |
5153 | |
5154 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5155 | |
5156 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
5157 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5158 | |
5159 scale = gdk_pixbuf_scale_simple(buf, | |
5160 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
5161 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5162 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
5163 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5164 GDK_INTERP_NEAREST); | |
5165 | |
5166 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5167 g_object_unref(G_OBJECT(scale)); |
4635 | 5168 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 5169 g_object_unref(G_OBJECT(pm)); |
4359 | 5170 gtk_widget_queue_draw(gtkconv->u.im->icon); |
5171 | |
5172 if (bm) | |
4793 | 5173 g_object_unref(G_OBJECT(bm)); |
4359 | 5174 |
5175 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
5176 | |
5177 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
5178 | |
5179 return FALSE; | |
5180 } | |
5181 | |
5182 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5183 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5184 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5185 GaimGtkConversation *gtkconv; |
4359 | 5186 int delay; |
5187 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5188 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5189 return; |
5190 | |
5191 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5192 | |
6016 | 5193 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
5194 return; | |
5195 | |
4359 | 5196 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
5197 | |
5198 if (gtkconv->u.im->anim) | |
5199 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5200 conv); | |
5201 } | |
5202 | |
5203 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5204 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5205 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5206 GaimGtkConversation *gtkconv; |
4359 | 5207 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5208 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5209 return; |
5210 | |
5211 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5212 | |
5213 if (gtkconv->u.im->icon_timer != 0) | |
5214 g_source_remove(gtkconv->u.im->icon_timer); | |
5215 | |
5216 gtkconv->u.im->icon_timer = 0; | |
5217 } | |
5218 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5219 static void |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5220 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5221 { |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5222 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5223 start_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5224 else |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5225 stop_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5226 } |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5227 |
4359 | 5228 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5229 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 5230 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5231 GaimGtkConversation *gtkconv; |
4359 | 5232 static GtkWidget *menu = NULL; |
5233 GtkWidget *button; | |
5234 | |
5235 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
5236 return FALSE; | |
5237 | |
5238 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5239 | |
5240 /* | |
5241 * If a menu already exists, destroy it before creating a new one, | |
5242 * thus freeing-up the memory it occupied. | |
5243 */ | |
5244 if (menu != NULL) | |
5245 gtk_widget_destroy(menu); | |
5246 | |
5247 menu = gtk_menu_new(); | |
5248 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5249 if (gtkconv->u.im->anim && |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5250 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) |
4359 | 5251 { |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5252 gaim_new_check_item(menu, _("Animate"), |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5253 G_CALLBACK(toggle_icon_animate_cb), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5254 gtkconv->u.im->icon_timer); |
4359 | 5255 } |
5256 | |
5257 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5258 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5259 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5260 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5261 gtk_widget_show(button); | |
5262 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5263 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5264 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5265 0, 0, NULL); |
4359 | 5266 |
5267 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5268 | |
5269 return TRUE; | |
5270 } | |
5271 | |
5272 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5273 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5274 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5275 GaimGtkConversation *gtkconv; |
7143 | 5276 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5277 |
5278 char filename[256]; | |
5279 FILE *file; | |
5280 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5281 gboolean animate = TRUE; |
4359 | 5282 |
6695 | 5283 GaimBuddy *buddy; |
4757 | 5284 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5285 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5286 size_t len; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5287 int delay; |
4359 | 5288 |
5289 GdkPixbuf *buf; | |
5290 | |
5291 GtkWidget *event; | |
5292 GtkWidget *frame; | |
5293 GdkPixbuf *scale; | |
5294 GdkPixmap *pm; | |
5295 GdkBitmap *bm; | |
5296 int sf = 0; | |
5297 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5298 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5299 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5300 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5301 |
5302 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5303 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5304 if (gtkconv->u.im->icon_timer == 0 && gtkconv->u.im->icon != NULL) |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5305 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5306 |
4359 | 5307 remove_icon(gtkconv); |
5308 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5309 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5310 return; |
5311 | |
5312 if (gaim_conversation_get_gc(conv) == NULL) | |
5313 return; | |
5314 | |
4793 | 5315 if(gtkconv->u.im->anim) |
5316 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5317 | |
4757 | 5318 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5319 gaim_conversation_get_name(conv))) != NULL) { | |
7125 | 5320 const char *file; |
5321 if((file = gaim_buddy_get_setting(buddy, "buddy_icon"))) | |
4757 | 5322 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5323 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5324 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5325 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5326 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
|
5327 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5328 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5329 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5330 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5331 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5332 |
5333 /* this is such an evil hack, i don't know why i'm even considering it. | |
5334 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5335 g_snprintf(filename, sizeof(filename), | |
5336 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5337 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5338 | |
5339 if (!(file = fopen(filename, "wb"))) | |
5340 return; | |
5341 | |
5342 fwrite(data, 1, len, file); | |
5343 fclose(file); | |
5344 | |
5345 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5346 /* make sure we remove the file as soon as possible */ | |
5347 unlink(filename); | |
5348 } | |
4359 | 5349 |
5350 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5351 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5352 "Buddy icon error: %s\n", err->message); |
4359 | 5353 g_error_free(err); |
5354 } | |
5355 | |
5356 | |
5357 if (!gtkconv->u.im->anim) | |
5358 return; | |
5359 | |
4793 | 5360 if(gtkconv->u.im->iter) |
5361 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5362 | |
4359 | 5363 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5364 gtkconv->u.im->iter = NULL; | |
5365 delay = 0; | |
5366 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5367 } else { | |
5368 gtkconv->u.im->iter = | |
5369 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5370 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5371 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5372 delay = delay / 10; | |
5373 } | |
5374 | |
5375 sf = SCALE(gtkconv->u.im->anim); | |
5376 scale = gdk_pixbuf_scale_simple(buf, | |
5377 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5378 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5379 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5380 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5381 GDK_INTERP_NEAREST); | |
5382 | |
5383 if (delay) | |
5384 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5385 conv); | |
5386 | |
5387 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5388 g_object_unref(G_OBJECT(scale)); |
4359 | 5389 |
5390 frame = gtk_frame_new(NULL); | |
5391 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5392 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5393 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5394 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5395 gtk_widget_show(frame); | |
5396 | |
5397 event = gtk_event_box_new(); | |
5398 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5399 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5400 G_CALLBACK(icon_menu), conv); |
5401 gtk_widget_show(event); | |
5402 | |
4635 | 5403 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5404 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5405 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5406 gtk_widget_show(gtkconv->u.im->icon); | |
5407 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5408 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5409 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5410 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5411 } |
4359 | 5412 |
4793 | 5413 g_object_unref(G_OBJECT(pm)); |
4359 | 5414 |
5415 if (bm) | |
4793 | 5416 g_object_unref(G_OBJECT(bm)); |
7143 | 5417 |
5418 /* The buddy icon code needs badly to be fixed. */ | |
5419 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5420 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5421 } |
5422 | |
5423 void | |
5424 gaim_gtkconv_update_font_buttons(void) | |
5425 { | |
5426 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5427 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5428 GaimGtkConversation *gtkconv; |
4359 | 5429 |
5430 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5431 conv = (GaimConversation *)l->data; |
4359 | 5432 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5433 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5434 continue; |
5435 | |
5436 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5437 | |
5438 if (gtkconv->toolbar.bold != NULL) | |
5439 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5440 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5441 |
5442 if (gtkconv->toolbar.italic != NULL) | |
5443 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5444 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5445 |
5446 if (gtkconv->toolbar.underline != NULL) | |
5447 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5448 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5449 } |
5450 } | |
5451 | |
5452 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5453 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5454 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5455 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5456 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5457 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5458 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5459 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5460 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5461 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5462 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5463 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5464 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5465 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5466 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5467 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5468 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5469 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5470 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5471 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5472 GaimGtkConversation *gtkconv; |
6141 | 5473 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5474 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5475 return; |
6141 | 5476 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5477 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5478 |
6141 | 5479 strncpy(gtkconv->fontface, |
5480 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5481 sizeof(gtkconv->fontface)); | |
4421 | 5482 } |
5483 | |
5484 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5485 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5486 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5487 GaimPluginProtocolInfo *prpl_info = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5488 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5489 GaimGtkWindow *gtkwin = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5490 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
5491 GaimConnection *gc; |
4359 | 5492 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5493 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5494 return; |
5495 | |
5496 gc = gaim_conversation_get_gc(conv); | |
5497 win = gaim_conversation_get_window(conv); | |
5498 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5499 | |
5500 if (win != NULL) | |
5501 gtkwin = GAIM_GTK_WINDOW(win); | |
5502 | |
5503 if (gc == NULL) { | |
5504 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
5505 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5506 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) { |
4359 | 5507 gtk_widget_set_sensitive(gtkwin->menu.insert_link, FALSE); |
5508 } | |
5509 } | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
5510 else { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5511 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5512 |
4674 | 5513 gtk_widget_set_sensitive(gtkconv->send, TRUE); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5514 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5515 if (win != NULL) |
4365
6e96ced6fb78
[gaim-migrate @ 4631]
Christian Hammond <chipx86@chipx86.com>
parents:
4364
diff
changeset
|
5516 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
6629 | 5517 |
5518 gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor, | |
5519 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR)); | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
5520 } |
4359 | 5521 |
5522 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
5523 if (gc == NULL) { | |
5524 gtk_widget_set_sensitive(gtkconv->info, FALSE); | |
5525 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
5526 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
5527 gtk_widget_set_sensitive(gtkconv->u.im->add, FALSE); | |
5528 | |
5529 if (win != NULL && | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5530 gaim_conv_window_get_active_conversation(win) == conv) { |
4359 | 5531 |
5532 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); | |
5533 } | |
5534 | |
5535 return; | |
5536 } | |
5537 | |
5538 gtk_widget_set_sensitive(gtkconv->info, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5539 (prpl_info->get_info != NULL)); |
4359 | 5540 |
5541 gtk_widget_set_sensitive(gtkconv->toolbar.image, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5542 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 5543 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5544 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) { |
4359 | 5545 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5546 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 5547 } |
5548 | |
5549 gtk_widget_set_sensitive(gtkconv->u.im->warn, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5550 (prpl_info->warn != NULL)); |
4359 | 5551 |
5552 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
6760 | 5553 (prpl_info->add_deny != NULL)); |
4359 | 5554 |
5555 update_convo_add_button(conv); | |
5556 } | |
5557 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
5558 if (gc == NULL) { | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5559 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5560 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, FALSE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5561 |
4359 | 5562 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); |
5563 | |
5564 return; | |
5565 } | |
5566 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5567 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); |
4359 | 5568 |
5569 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); | |
5570 /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ | |
5571 | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5572 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5573 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5574 (prpl_info->chat_whisper != NULL)); |
4359 | 5575 |
5576 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5577 (prpl_info->chat_invite != NULL)); |
4359 | 5578 } |
5579 } | |
5580 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5581 GaimConvWindow * |
4359 | 5582 gaim_gtkwin_get_at_xy(int x, int y) |
5583 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5584 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5585 GaimGtkWindow *gtkwin; |
4359 | 5586 GdkWindow *gdkwin; |
5587 GList *l; | |
5588 | |
5589 gdkwin = gdk_window_at_pointer(&x, &y); | |
5590 | |
5591 if (gdkwin) | |
5592 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5593 | |
5594 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5595 win = (GaimConvWindow *)l->data; |
4359 | 5596 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5597 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5598 continue; |
5599 | |
5600 gtkwin = GAIM_GTK_WINDOW(win); | |
5601 | |
5602 if (gdkwin == gtkwin->window->window) | |
5603 return win; | |
5604 } | |
5605 | |
5606 return NULL; | |
5607 } | |
5608 | |
5609 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5610 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5611 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5612 GaimGtkWindow *gtkwin; |
4359 | 5613 GList *l; |
5614 gint nb_x, nb_y, x_rel, y_rel; | |
5615 GtkNotebook *notebook; | |
5616 GtkWidget *tab; | |
5617 gint i, page_num = 0; | |
5618 gboolean first_visible = TRUE; | |
5619 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5620 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5621 return -1; |
5622 | |
5623 gtkwin = GAIM_GTK_WINDOW(win); | |
5624 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5625 | |
5626 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5627 x_rel = x - nb_x; | |
5628 y_rel = y - nb_y; | |
5629 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5630 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5631 l != NULL; |
5632 l = l->next, i++) { | |
5633 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5634 GaimConversation *conv = l->data; |
4359 | 5635 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5636 | |
5637 if (!GTK_WIDGET_MAPPED(tab)) | |
5638 continue; | |
5639 | |
5640 if (first_visible) { | |
5641 first_visible = FALSE; | |
5642 | |
5643 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5644 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5645 } | |
5646 | |
5647 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5648 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5649 | |
5650 if (tab->allocation.x <= x_rel) { | |
5651 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5652 page_num = i + 1; | |
5653 else | |
5654 page_num = i; | |
5655 } | |
5656 else | |
5657 break; | |
5658 } | |
5659 else { | |
5660 if (tab->allocation.y <= y_rel) { | |
5661 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5662 page_num = i + 1; | |
5663 else | |
5664 page_num = i; | |
5665 } | |
5666 else | |
5667 break; | |
5668 } | |
5669 } | |
5670 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5671 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5672 return -1; |
5673 | |
5674 return page_num; | |
5675 } | |
5676 | |
5677 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5678 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5679 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5680 GaimGtkWindow *gtkwin; |
4359 | 5681 GList *l; |
5682 gint nb_x, nb_y, x_rel, y_rel; | |
5683 GtkNotebook *notebook; | |
5684 GtkWidget *tab; | |
5685 gint i, page_num = 0; | |
5686 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5687 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5688 return -1; |
5689 | |
5690 gtkwin = GAIM_GTK_WINDOW(win); | |
5691 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5692 | |
5693 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5694 x_rel = x - nb_x; | |
5695 y_rel = y - nb_y; | |
5696 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5697 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5698 l != NULL; |
5699 l = l->next, i++) { | |
5700 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5701 GaimConversation *conv = l->data; |
4359 | 5702 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5703 | |
5704 if (!GTK_WIDGET_MAPPED(tab)) | |
5705 continue; | |
5706 | |
5707 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5708 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5709 | |
5710 if (tab->allocation.x <= x_rel) { | |
5711 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5712 page_num = i + 1; | |
5713 else | |
5714 page_num = i; | |
5715 } | |
5716 else | |
5717 break; | |
5718 } | |
5719 else { | |
5720 if (tab->allocation.y <= y_rel) { | |
5721 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5722 page_num = i + 1; | |
5723 else | |
5724 page_num = i; | |
5725 } | |
5726 else | |
5727 break; | |
5728 } | |
5729 } | |
5730 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5731 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5732 return -1; |
5733 | |
5734 return page_num; | |
5735 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5736 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5737 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5738 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5739 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5740 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5741 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5742 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5743 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5744 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5745 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5746 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5747 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5748 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5749 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5750 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
|
5751 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5752 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5753 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5754 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5755 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5756 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5757 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5758 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5759 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5760 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5761 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5762 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5763 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5764 |
6440 | 5765 if (value) { |
5766 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5767 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5768 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5769 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5770 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5771 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5772 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5773 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5774 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5775 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5776 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5777 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5778 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
|
5779 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5780 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5781 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5782 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5783 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5784 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5785 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5786 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5787 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5788 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5789 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5790 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5791 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5792 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5793 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5794 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5795 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5796 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5797 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5798 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5799 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5800 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5801 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5802 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5803 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5804 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5805 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5806 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5807 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5808 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5809 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5810 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5811 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5812 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5813 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5814 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5815 |
7386 | 5816 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
|
5817 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5818 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5819 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5820 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5821 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5822 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5823 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5824 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5825 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5826 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5827 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5828 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5829 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5830 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5831 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5832 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5833 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5834 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5835 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5836 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5837 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5838 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5839 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5840 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5841 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5842 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5843 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5844 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5845 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5846 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5847 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5848 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5849 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5850 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5851 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5852 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5853 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5854 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5855 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5856 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5857 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5858 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5859 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5860 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5861 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5862 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5863 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5864 |
7386 | 5865 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
|
5866 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5867 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5868 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5869 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5870 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5871 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5872 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5873 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5874 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5875 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5876 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5877 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5878 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5879 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5880 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5881 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5882 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5883 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5884 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5885 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5886 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5887 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5888 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5889 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5890 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5891 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5892 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5893 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5894 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5895 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5896 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5897 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5898 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5899 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5900 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5901 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5902 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5903 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5904 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5905 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5906 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5907 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5908 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5909 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5910 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5911 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5912 |
7386 | 5913 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5914 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5915 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5916 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5917 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5918 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5919 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5920 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5921 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5922 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5923 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5924 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5925 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5926 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5927 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5928 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5929 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5930 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5931 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5932 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5933 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5934 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5935 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5936 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5937 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5938 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5939 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5940 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5941 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5942 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5943 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5944 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5945 GList *l; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5946 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5947 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
|
5948 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5949 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5950 if (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5951 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5952 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5953 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5954 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5955 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5956 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5957 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5958 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5959 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5960 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 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
|
5962 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5963 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5964 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5965 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5966 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5967 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5968 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5969 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5970 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5971 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5972 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5973 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5974 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5975 chat_button_type_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5976 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5977 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5978 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5979 GaimConnection *g; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5980 GtkWidget *parent; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5981 GaimConversationType conv_type = GAIM_CONV_CHAT; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5982 GSList *bcs; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5983 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5984 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5985 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5986 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5987 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5988 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5989 g = (GaimConnection *)l->data; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5990 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5991 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5992 conv = (GaimConversation *)bcs->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5993 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5994 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5995 continue; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5996 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5997 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5998 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5999 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6000 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6001 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6002 parent = gtk_widget_get_parent(gtkconv->send); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6003 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6004 gtkconv->send = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6005 gaim_gtk_change_text(_("Send"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6006 gtkconv->send, GAIM_STOCK_SEND, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6007 gtkconv->u.chat->invite = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6008 gaim_gtk_change_text(_("Invite"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6009 gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6010 GAIM_STOCK_INVITE, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6011 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6012 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6013 conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6014 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6015 FALSE, FALSE, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6016 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6017 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6018 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6019 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6020 G_CALLBACK(send_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6021 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6022 G_CALLBACK(invite_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6023 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6024 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6025 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6026 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6027 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6028 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6029 gaim_gtkconv_update_buttons_by_protocol(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6030 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6031 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6032 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6033 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6034 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6035 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6036 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6037 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6038 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6039 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6040 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6041 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6042 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6043 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6044 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6045 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6046 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6047 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6048 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6049 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6050 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6052 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6053 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6055 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6056 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
|
6057 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6058 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6059 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6060 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6061 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6062 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6063 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6064 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6065 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6066 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6067 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
|
6068 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6069 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6070 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6071 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6072 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6073 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6074 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6075 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6076 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6077 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
6078 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
|
6079 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
|
6080 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6081 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6082 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6083 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6084 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6085 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6086 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
|
6087 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6088 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6089 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6090 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6091 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6092 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6093 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
|
6094 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
|
6095 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6096 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6097 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6098 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6099 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6100 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6101 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6102 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6103 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6104 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
|
6105 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
|
6106 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
|
6107 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
|
6108 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6109 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6110 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6111 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6112 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6113 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6114 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6115 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6116 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6117 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6118 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6119 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6121 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6122 show_timestamps_pref_cb, NULL); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6123 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6124 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6125 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6126 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6127 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6128 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6129 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6130 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6131 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6132 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6133 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6134 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6135 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6136 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6137 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6138 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6139 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6140 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6141 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6142 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6143 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6144 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6145 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6146 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6147 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6148 } |