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