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