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